1*** Settings *** 2Documentation Test BMC using https://github.com/DMTF/Redfish-Usecase-Checkers 3... DMTF tool. 4 5Resource ../../lib/resource.robot 6Resource ../../lib/dmtf_tools_utils.robot 7Resource ../../lib/openbmc_ffdc.robot 8Library OperatingSystem 9Library ../../lib/state.py 10 11Test Setup Test Setup Execution 12Test Teardown Test Teardown Execution 13 14*** Variables *** 15 16${DEFAULT_PYTHON} python3 17 18${rsv_github_url} https://github.com/DMTF/Redfish-Usecase-Checkers.git 19${rsv_dir_path} Redfish-Usecase-Checkers 20 21${command_account} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}account_management/account_management.py 22... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME} 23... -p ${OPENBMC_PASSWORD} -S Always -d ${EXECDIR}${/}account-logs${/} 24 25${command_power_control} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}power_control/power_control.py 26... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME} 27... -p ${OPENBMC_PASSWORD} -S Always -d ${EXECDIR}${/}power-logs${/} 28 29${power_on_timeout} 15 mins 30${power_off_timeout} 15 mins 31${state_change_timeout} 3 mins 32${branch_name} main 33 34*** Test Cases *** 35 36Test BMC Redfish Account Management 37 [Documentation] Check Account Management with a Redfish interface. 38 [Tags] Test_BMC_Redfish_Account_Management 39 40 ${output}= Run DMTF Tool ${rsv_dir_path} ${command_account} check_error=1 41 42 ${output}= Shell Cmd cat ${EXECDIR}${/}account-logs${/}results.json 43 Log ${output} 44 45 ${json}= OperatingSystem.Get File ${EXECDIR}${/}account-logs${/}results.json 46 47 ${object}= Evaluate json.loads('''${json}''') json 48 49 ${result_list}= Set Variable ${object["TestResults"]} 50 51 @{failed_tc_list}= Create List 52 53 FOR ${result} IN @{result_list} 54 ${rc}= Evaluate 'ErrorMessages'=='${result}' 55 ${num}= Set Variable If ${rc} == False ${result_list["${result}"]["fail"]} 56 IF ${num} != None and ${num} > 0 57 Append To List ${failed_tc_list} ${result} 58 END 59 END 60 61 Should Be Empty ${failed_tc_list} Failed test cases are ${failed_tc_list} 62 63 64Test BMC Redfish Power Control Usecase 65 [Documentation] Power Control Usecase Test. 66 [Tags] Test_BMC_Redfish_Power_Control_Usecase 67 68 DMTF Power 69 70 71*** Keywords *** 72 73Test Setup Execution 74 [Documentation] Do test case setup tasks. 75 76 Printn 77 Download DMTF Tool ${rsv_dir_path} ${rsv_github_url} ${branch_name} 78 79 80Test Teardown Execution 81 [Documentation] Do the post-test teardown. 82 83 Printn 84 FFDC On Test Case Fail 85 86 87DMTF Power 88 [Documentation] Power the BMC machine on via DMTF tools. 89 90 ${output}= Run DMTF Tool ${rsv_dir_path} ${command_power_control} check_error=1 91 Log ${output} 92 93 ${json}= OperatingSystem.Get File ${EXECDIR}${/}power-logs${/}results.json 94 95 ${object}= Evaluate json.loads('''${json}''') json 96 97 ${result_list}= Set Variable ${object["TestResults"]} 98 Log To Console result: ${result_list} 99 100 @{failed_tc_list}= Create List 101 @{error_messages}= Create List 102 103 FOR ${result} IN @{result_list} 104 ${rc}= Evaluate 'ErrorMessages'=='${result}' 105 106 ${num}= Set Variable If ${rc} == False 107 ... ${result_list["${result}"]["fail"]} 108 109 IF ${num} != None and ${num} > 0 110 Append To List ${failed_tc_list} ${result} 111 END 112 113 IF ${rc} == True 114 Append To List ${error_messages} ${result_list["ErrorMessages"]} 115 END 116 END 117 118 Log Many ErrorMessages: @{error_messages} 119 Log To Console ErrorMessages: 120 FOR ${msg} IN @{error_messages} 121 Log To Console ${msg} 122 END 123 124 Should Be Empty ${error_messages} DMTF Power keyword failed. 125