1*** Settings *** 2Documentation Module to test npcm750 JTAG Master. 3 4Resource ../../lib/openbmc_ffdc.robot 5Resource ../../lib/connection_client.robot 6 7Test Tags JTAG_Master 8 9Suite Setup Suite Setup Execution 10 11*** Variables *** 12${wrong_cpld} 0 13${program_cpld} 0 14 15*** Test Cases *** 16 17Test Read CPLD ID 18 [Documentation] Test Read CPLD ID. 19 [Tags] Test_Read_CPLD_ID 20 21 ${cmd}= Catenate loadsvf -d ${jtag_dev} -s /var/${readid_svf} 22 ${output} ${stderr} ${rc}= BMC Execute Command ${cmd} 23 Set Global Variable ${wrong_cpld} 1 24 Should Not Contain ${stderr} tdo check error 25 Set Global Variable ${wrong_cpld} 0 26 27 28Test Program CPLD 29 [Documentation] Test Program CPLD. 30 [Tags] Test_Program_CPLD 31 32 Pass Execution If ${wrong_cpld}==1 Wrong CPLD chip 33 Pass Execution If ${program_cpld}==0 skip programming cpld 34 35 Program CPLD ${cpld_firmware2} ${firmware_version2} 36 Program CPLD ${cpld_firmware1} ${firmware_version1} 37 38*** Keywords *** 39 40Get File From SFTP Server 41 [Documentation] SCP Get File. 42 [Arguments] ${filename} 43 44 # Description of argument(s): 45 # filename The file to be downloaded. 46 47 Shell Cmd 48 ... scp ${SFTP_USER}@${SFTP_SERVER}:${SFTP_PATH}/${filename} ${filename} 49 50 51Put File To BMC 52 [Documentation] SCP Put File. 53 [Arguments] ${filename} 54 55 # Description of argument(s): 56 # filename The file to be uploaded. 57 58 scp.Put File ${filename} /var/${filename} 59 60Suite Setup Execution 61 [Documentation] Suite Setup Execution. 62 63 ${status}= Run Keyword And Return Status Variable Should Exist 64 ... ${TEST_PROGRAM_CPLD} 65 ${value}= Set Variable if ${status} == ${TRUE} ${TEST_PROGRAM_CPLD} 0 66 Set Global Variable ${program_cpld} ${value} 67 68 ${code_base_dir_path}= Get Code Base Dir Path 69 ${olympus_json}= Evaluate 70 ... json.load(open('${code_base_dir_path}data/oem/nuvoton/olympus.json')) modules=json 71 72 ${cpld_firmware1}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["fw1"]} 73 ${cpld_firmware2}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["fw2"]} 74 ${firmware_version1}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["fw1ver"]} 75 ${firmware_version2}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["fw2ver"]} 76 ${readusercode_svf}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["readusercode"]} 77 ${readid_svf}= Set Variable ${olympus_json["npcm7xx"]["cpld"]["readid"]} 78 ${jtag_dev}= Set Variable ${olympus_json["npcm7xx"]["jtag_dev"]} 79 ${power_cycle_cmd}= Set Variable ${olympus_json["npcm7xx"]["power_cycle_cmd"]} 80 81 Set Suite Variable ${cpld_firmware1} 82 Set Suite Variable ${cpld_firmware2} 83 Set Suite Variable ${firmware_version1} 84 Set Suite Variable ${firmware_version2} 85 Set Suite Variable ${readusercode_svf} 86 Set Suite Variable ${readid_svf} 87 Set Suite Variable ${jtag_dev} 88 Set Suite Variable ${power_cycle_cmd} 89 90 Get File From SFTP Server ${readid_svf} 91 Run KeyWord If ${program_cpld} == 1 Get File From SFTP Server ${readusercode_svf} 92 Run KeyWord If ${program_cpld} == 1 Get File From SFTP Server ${cpld_firmware1} 93 Run KeyWord If ${program_cpld} == 1 Get File From SFTP Server ${cpld_firmware2} 94 95 scp.Open connection ${OPENBMC_HOST} username=${OPENBMC_USERNAME} 96 ... password=${OPENBMC_PASSWORD} 97 Put File To BMC ${readid_svf} 98 Run KeyWord If ${program_cpld} == 1 Put File To BMC ${readusercode_svf} 99 Run KeyWord If ${program_cpld} == 1 Put File To BMC ${cpld_firmware1} 100 Run KeyWord If ${program_cpld} == 1 Put File To BMC ${cpld_firmware2} 101 Sleep 5s 102 scp.Close Connection 103 104Program CPLD 105 [Documentation] Program CPLD. 106 [Arguments] ${svf_file} ${version} 107 108 # Description of argument(s): 109 # svf_file The firmware file. 110 # version The firmware version. 111 112 ${cmd}= Catenate loadsvf -d ${jtag_dev} -s /var/${svf_file} 113 ${output} ${stderr} ${rc}= BMC Execute Command ${cmd} 114 Should Not Contain ${stderr} tdo check error 115 116 # control hot swap controller to power cycle whole system 117 BMC Execute Command ${power_cycle_cmd} ignore_err=1 fork=1 118 119 Sleep 10s 120 Run Keyword Wait For Host To Ping ${OPENBMC_HOST} 5 mins 121 ${cmd}= Catenate loadsvf -d ${jtag_dev} -s /var/${readusercode_svf} 122 ${output} ${stderr} ${rc}= BMC Execute Command ${cmd} 123 Should Contain ${output} ${version} 124