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 Case *** 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}= Run Keyword If ${rc} == False Set Variable ${result_list["${result}"]["fail"]} 56 Run Keyword If ${num} != None and ${num} > 0 Append To List ${failed_tc_list} ${result} 57 END 58 59 Should Be Empty ${failed_tc_list} Failed test cases are ${failed_tc_list} 60 61 62Test BMC Redfish Power Control Usecase 63 [Documentation] Power Control Usecase Test. 64 [Tags] Test_BMC_Redfish_Power_Control_Usecase 65 66 DMTF Power 67 68 69*** Keywords *** 70 71Test Setup Execution 72 [Documentation] Do test case setup tasks. 73 74 Printn 75 Download DMTF Tool ${rsv_dir_path} ${rsv_github_url} ${branch_name} 76 77 78Test Teardown Execution 79 [Documentation] Do the post-test teardown. 80 81 Printn 82 FFDC On Test Case Fail 83 84 85DMTF Power 86 [Documentation] Power the BMC machine on via DMTF tools. 87 88 ${output}= Run DMTF Tool ${rsv_dir_path} ${command_power_control} check_error=1 89 Log ${output} 90 91 ${json}= OperatingSystem.Get File ${EXECDIR}${/}power-logs${/}results.json 92 93 ${object}= Evaluate json.loads('''${json}''') json 94 95 ${result_list}= Set Variable ${object["TestResults"]} 96 Log To Console result: ${result_list} 97 98 @{failed_tc_list}= Create List 99 @{error_messages}= Create List 100 101 FOR ${result} IN @{result_list} 102 ${rc}= evaluate 'ErrorMessages'=='${result}' 103 ${num}= Run Keyword If ${rc} == False Set Variable ${result_list["${result}"]["fail"]} 104 Run Keyword If ${num} != None and ${num} > 0 Append To List ${failed_tc_list} ${result} 105 Run Keyword If ${rc} == True Set Variable 106 ... Append To List ${error_messages} ${result_list["ErrorMessages"]} 107 END 108 109 Log Many ErrorMessages: @{error_messages} 110 Log To Console ErrorMessages: 111 FOR ${msg} IN @{error_messages} 112 Log To Console ${msg} 113 END 114 115 Should Be Empty ${error_messages} DMTF Power keyword failed. 116