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