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 | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 5 | Library OperatingSystem |
| 6 | Library ../../lib/state.py |
| 7 | Resource ../../lib/dmtf_tools_utils.robot |
| 8 | Resource ../../lib/openbmc_ffdc.robot |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 9 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 10 | Test Setup Test Setup Execution |
| 11 | Test Teardown Test Teardown Execution |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 12 | |
| 13 | *** Variables *** |
| 14 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 15 | ${DEFAULT_PYTHON} python3 |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 16 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 17 | ${rsv_github_url} https://github.com/DMTF/Redfish-Usecase-Checkers.git |
| 18 | ${rsv_dir_path} Redfish-Usecase-Checkers |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 19 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 20 | ${command_account} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}account_management/account_management.py |
| 21 | ... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME} |
manashsarma | a053fb3 | 2020-06-08 08:43:32 -0500 | [diff] [blame] | 22 | ... -p ${OPENBMC_PASSWORD} -S Always -d ${EXECDIR}${/}logs${/} |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 23 | |
| 24 | ${command_power_control} ${DEFAULT_PYTHON} ${rsv_dir_path}${/}power_control/power_control.py |
| 25 | ... -r ${OPENBMC_HOST} -u ${OPENBMC_USERNAME} |
manashsarma | a053fb3 | 2020-06-08 08:43:32 -0500 | [diff] [blame] | 26 | ... -p ${OPENBMC_PASSWORD} -S Always |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 27 | |
| 28 | ${power_on_timeout} 15 mins |
| 29 | ${power_off_timeout} 15 mins |
| 30 | ${state_change_timeout} 3 mins |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 31 | |
| 32 | *** Test Case *** |
| 33 | |
| 34 | Test BMC Redfish Account Management |
| 35 | [Documentation] Check Account Management with a Redfish interface. |
| 36 | [Tags] Test_BMC_Redfish_Account_Management |
| 37 | |
manashsarma | a053fb3 | 2020-06-08 08:43:32 -0500 | [diff] [blame] | 38 | ${output}= Run DMTF Tool ${rsv_dir_path} ${command_account} check_error=1 |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 39 | |
| 40 | ${output}= Shell Cmd cat ${EXECDIR}${/}logs${/}results.json |
| 41 | Log ${output} |
| 42 | |
manashsarma | a053fb3 | 2020-06-08 08:43:32 -0500 | [diff] [blame] | 43 | ${json}= OperatingSystem.Get File ${EXECDIR}${/}logs${/}results.json |
| 44 | |
| 45 | ${object}= Evaluate json.loads('''${json}''') json |
| 46 | |
| 47 | ${result_list}= Set Variable ${object["TestResults"]} |
| 48 | |
| 49 | @{failed_tc_list}= Create List |
| 50 | |
| 51 | FOR ${result} IN @{result_list} |
| 52 | ${rc}= evaluate 'ErrorMessages'=='${result}' |
| 53 | ${num}= Run Keyword If ${rc} == False Set Variable ${result_list["${result}"]["fail"]} |
| 54 | Run Keyword If ${num} != None and ${num} > 0 Append To List ${failed_tc_list} ${result} |
| 55 | END |
| 56 | |
| 57 | Should Be Empty ${failed_tc_list} Failed test cases are ${failed_tc_list} |
| 58 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 59 | |
| 60 | Test BMC Redfish Boot Host And ForceOff |
| 61 | [Documentation] Boot host and ForceOff. |
| 62 | [Tags] Test_BMC_Redfish_Boot_Host_And_ForceOff |
| 63 | |
| 64 | DMTF Power On |
| 65 | DMTF Hard Power Off |
| 66 | |
| 67 | |
| 68 | Test BMC Redfish Boot Host And GracefulShutdown |
| 69 | [Documentation] Boot host and issue GracefulShutdown. |
| 70 | [Tags] Test_BMC_Redfish_Boot_Host_And_GracefulShutdown |
| 71 | |
| 72 | DMTF Power On |
| 73 | DMTF Power Off |
| 74 | |
| 75 | |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 76 | *** Keywords *** |
| 77 | |
| 78 | Test Setup Execution |
| 79 | [Documentation] Do test case setup tasks. |
| 80 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 81 | Printn |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 82 | Download DMTF Tool ${rsv_dir_path} ${rsv_github_url} |
| 83 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 84 | ${status} ${state}= Run Keyword And Ignore Error |
| 85 | ... Check State standby_match_state |
| 86 | Return From Keyword If '${status}' == 'PASS' |
| 87 | DMTF Power Off |
| 88 | |
| 89 | |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 90 | Test Teardown Execution |
| 91 | [Documentation] Do the post-test teardown. |
| 92 | |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 93 | Printn |
George Keishing | 4d9b7e1 | 2019-03-26 02:03:47 -0500 | [diff] [blame] | 94 | FFDC On Test Case Fail |
George Keishing | 6a69d26 | 2019-04-03 03:45:27 -0500 | [diff] [blame] | 95 | |
| 96 | |
| 97 | DMTF Power On |
| 98 | [Documentation] Power the BMC machine on via DMTF tools. |
| 99 | |
| 100 | Print Timen Doing "DMTF Power On". |
| 101 | |
| 102 | ${state}= Get State |
| 103 | ${match_state}= Anchor State ${state} |
| 104 | Run DMTF Tool ${rsv_dir_path} ${command_power_control} On |
| 105 | ${state}= Wait State ${match_state} wait_time=${state_change_timeout} interval=10 seconds invert=1 |
| 106 | ${state}= Wait State os_running_match_state wait_time=${power_on_timeout} interval=10 seconds |
| 107 | |
| 108 | [Return] ${state} |
| 109 | |
| 110 | |
| 111 | DMTF Power Off |
| 112 | [Documentation] Power the BMC machine off via DMTF tools. |
| 113 | |
| 114 | Print Timen Doing "DMTF Hard Power Off". |
| 115 | |
| 116 | ${state}= Get State |
| 117 | ${match_state}= Anchor State ${state} |
| 118 | Run DMTF Tool ${rsv_dir_path} ${command_power_control} GracefulShutdown |
| 119 | ${state}= Wait State ${match_state} wait_time=${state_change_timeout} interval=10 seconds invert=1 |
| 120 | ${state}= Wait State standby_match_state wait_time=${power_off_timeout} interval=10 seconds |
| 121 | |
| 122 | [Return] ${state} |
| 123 | |
| 124 | |
| 125 | DMTF Hard Power Off |
| 126 | [Documentation] Power the BMC machine off via DMTF tools. |
| 127 | |
| 128 | Print Timen Doing "DMTF Hard Power Off". |
| 129 | |
| 130 | ${state}= Get State |
| 131 | ${match_state}= Anchor State ${state} |
| 132 | Run DMTF Tool ${rsv_dir_path} ${command_power_control} ForceOff |
| 133 | ${state}= Wait State ${match_state} wait_time=${state_change_timeout} interval=10 seconds invert=1 |
| 134 | ${state}= Wait State standby_match_state wait_time=${power_off_timeout} interval=10 seconds |
| 135 | |
| 136 | [Return] ${state} |