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