George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation This suite verifies the power restore policy supported by |
| 3 | ... REST Interfaces. |
| 4 | ... Refer here for documentation on the REST interfaces |
| 5 | ... https://github.com/openbmc/docs/blob/master/rest-api.md |
| 6 | |
George Keishing | 5611421 | 2019-07-22 02:27:42 -0500 | [diff] [blame] | 7 | Resource ../../lib/rest_client.robot |
| 8 | Resource ../../lib/utils.robot |
| 9 | Resource ../../lib/openbmc_ffdc.robot |
| 10 | Resource ../../lib/state_manager.robot |
| 11 | Resource ../../lib/boot_utils.robot |
George Keishing | 69436a3 | 2019-08-09 01:53:08 -0500 | [diff] [blame] | 12 | Resource ../../lib/bmc_redfish_resource.robot |
| 13 | Resource ../../lib/bmc_redfish_utils.robot |
aravinth0510 | 67b409b | 2022-07-13 10:41:26 +0000 | [diff] [blame] | 14 | Resource ../../lib/pdu/pdu.robot |
George Keishing | 5611421 | 2019-07-22 02:27:42 -0500 | [diff] [blame] | 15 | Library ../../lib/state_map.py |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 16 | |
George Keishing | 62c8267 | 2017-12-06 04:39:46 -0600 | [diff] [blame] | 17 | Test Teardown Test Teardown Execution |
| 18 | Suite Teardown Suite Teardown Execution |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 19 | |
| 20 | Force Tags power_restore |
| 21 | |
| 22 | *** Variables *** |
| 23 | |
| 24 | *** Test Cases *** |
| 25 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 26 | Test Restore Policy ALWAYS_POWER_OFF With Host Off |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 27 | [Documentation] Validate ALWAYS_POWER_OFF restore policy functionality. |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 28 | ... Policy: |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 29 | ... System policy set to ALWAYS_POWER_OFF. |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 30 | ... Initial Host State: |
| 31 | ... State where system should be before running the |
| 32 | ... test case. |
| 33 | ... Expected Host State: |
| 34 | ... After BMC reset, system should reach this |
| 35 | ... specific state. |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 36 | [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_Off |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 37 | [Template] Verify Restore Policy |
| 38 | |
| 39 | # Policy Initial Host State Expected Host State |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 40 | AlwaysOff Off Off |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 41 | |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 42 | |
| 43 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 44 | Test Restore Policy ALWAYS_POWER_OFF With Host Running |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 45 | [Documentation] Verify that the BMC restore policy is ALWAYS_POWER_OFF while the Host is running. |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 46 | [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_Running |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 47 | [Template] Verify Restore Policy |
| 48 | |
| 49 | # Policy Initial Host State Expected Host State |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 50 | AlwaysOff Running Running |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 51 | |
| 52 | |
| 53 | Test Restore Policy ALWAYS_POWER_ON With Host Off |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 54 | [Documentation] Validate ALWAYS_POWER_ON restore policy functionality. |
| 55 | ... Policy: |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 56 | ... System policy set to ALWAYS_POWER_OFF. |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 57 | ... Initial Host State: |
| 58 | ... State where system should be before running the |
| 59 | ... test case. |
| 60 | ... Expected Host State: |
| 61 | ... After BMC reset, system should reach this |
| 62 | ... specific state. |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 63 | [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Off |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 64 | [Template] Verify Restore Policy |
| 65 | |
| 66 | # Policy Initial Host State Expected Host State |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 67 | AlwaysOn Off Running |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 68 | |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 69 | |
| 70 | |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 71 | Test Restore Policy ALWAYS_POWER_ON With Host Running |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 72 | [Documentation] Verify the BMC restore policy is ALWAYS_POWER_ON while the Host is running. |
| 73 | [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Running |
| 74 | [Template] Verify Restore Policy |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 75 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 76 | # Policy Initial Host State Expected Host State |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 77 | AlwaysOn Running Running |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 78 | |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 79 | |
| 80 | |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 81 | Test Restore Policy Restore Last State With Host Running |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 82 | [Documentation] Validate RESTORE_LAST_STATE restore policy functionality. |
| 83 | ... Policy: |
| 84 | ... System policy set to RESTORE_LAST_STATE. |
| 85 | ... Initial Host State: |
| 86 | ... State where system should be before running the |
| 87 | ... test case. |
| 88 | ... Expected Host State: |
| 89 | ... After BMC reset, system should reach this |
| 90 | ... specific state. |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 91 | [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Running |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 92 | [Template] Verify Restore Policy |
| 93 | |
| 94 | # Policy Initial Host State Expected Host State |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 95 | LastState Running Running |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 96 | |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 97 | |
| 98 | |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 99 | Test Restore Policy Restore Last State With Host Off |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 100 | [Documentation] Verify the RESTORE_LAST_STATE restore policy functionality while the Host is off. |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 101 | [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Off |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 102 | [Template] Verify Restore Policy |
| 103 | |
| 104 | # Policy Initial Host State Expected Host State |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 105 | LastState Off Off |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 106 | |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 107 | |
| 108 | *** Keywords *** |
| 109 | |
| 110 | Verify Restore Policy |
| 111 | [Documentation] Set given policy, reset BMC and expect specified end |
| 112 | ... state. |
| 113 | [Arguments] ${policy} ${expectedState} ${nextState} |
| 114 | |
| 115 | # Description of argument(s): |
| 116 | # policy System policy state string. |
| 117 | # expectedState Test initial host state. |
| 118 | # nextState Test end host state. |
| 119 | |
George Keishing | d45aae5 | 2017-12-11 09:38:37 -0600 | [diff] [blame] | 120 | Set Initial Test State ${expectedState} |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 121 | |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 122 | Redfish Set Power Restore Policy ${policy} |
George Keishing | 69436a3 | 2019-08-09 01:53:08 -0500 | [diff] [blame] | 123 | |
aravinth0510 | 67b409b | 2022-07-13 10:41:26 +0000 | [diff] [blame] | 124 | PDU Power Cycle |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 125 | Sleep 20s |
| 126 | Wait For BMC Online |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 127 | |
| 128 | Wait Until Keyword Succeeds |
George Keishing | 69436a3 | 2019-08-09 01:53:08 -0500 | [diff] [blame] | 129 | ... 10 min 20 sec Valid Boot States ${nextState} |
George Keishing | d45aae5 | 2017-12-11 09:38:37 -0600 | [diff] [blame] | 130 | |
| 131 | |
| 132 | Valid Boot States |
| 133 | [Documentation] Verify boot states for a given system state. |
| 134 | [Arguments] ${sys_state} |
| 135 | |
| 136 | # Description of argument(s): |
| 137 | # sys_state system state list |
George Keishing | b95aba2 | 2017-12-13 07:59:23 -0600 | [diff] [blame] | 138 | # (e.g. "Off", "On", "Reboot", etc.). |
George Keishing | d45aae5 | 2017-12-11 09:38:37 -0600 | [diff] [blame] | 139 | |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 140 | ${current_state}= Redfish Get States |
| 141 | Redfish Valid Boot State ${sys_state} ${current_state} |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 142 | |
| 143 | |
| 144 | Set Initial Test State |
| 145 | [Documentation] Poweron if ON expected, Poweroff if OFF expected |
| 146 | ... to initial state of the test. |
| 147 | |
| 148 | [Arguments] ${expectedState} |
| 149 | # Description of argument(s): |
| 150 | # expectedState Test initial host state. |
| 151 | |
George Keishing | 9e1a30e | 2021-05-25 23:15:41 -0500 | [diff] [blame] | 152 | Redfish.Login |
| 153 | |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 154 | Run Keyword If '${expectedState}' == 'Running' |
George Keishing | 69436a3 | 2019-08-09 01:53:08 -0500 | [diff] [blame] | 155 | ... Redfish Power On stack_mode=skip |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 156 | |
| 157 | Run Keyword If '${expectedState}' == 'Off' |
George Keishing | 69436a3 | 2019-08-09 01:53:08 -0500 | [diff] [blame] | 158 | ... Redfish Power Off stack_mode=skip |
| 159 | |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 160 | |
George Keishing | 62c8267 | 2017-12-06 04:39:46 -0600 | [diff] [blame] | 161 | Test Teardown Execution |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 162 | [Documentation] Do the post test teardown. |
| 163 | # 1. Capture FFDC on test failure. |
| 164 | # 2. Close all open SSH connections. |
| 165 | |
| 166 | FFDC On Test Case Fail |
| 167 | Close All Connections |
| 168 | |
| 169 | |
George Keishing | 62c8267 | 2017-12-06 04:39:46 -0600 | [diff] [blame] | 170 | Suite Teardown Execution |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 171 | [Documentation] Do the post suite teardown. |
| 172 | # 1. Set policy to default. |
| 173 | |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 174 | Run Keyword And Ignore Error Redfish Set Power Restore Policy AlwaysOff |
George Keishing | 69436a3 | 2019-08-09 01:53:08 -0500 | [diff] [blame] | 175 | Redfish.Logout |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 176 | |
George Keishing | 90b555a | 2021-05-20 11:54:16 -0500 | [diff] [blame] | 177 | |
| 178 | Wait For BMC Online |
| 179 | [Documentation] Wait for Host to be online. Checks every X seconds |
| 180 | ... interval for Y minutes and fails if timed out. |
| 181 | ... Default MAX timedout is 10 min, interval 10 seconds. |
| 182 | [Arguments] ${max_timeout}=${OPENBMC_REBOOT_TIMEOUT} min |
| 183 | ... ${interval}=10 sec |
| 184 | |
| 185 | # Description of argument(s): |
| 186 | # max_timeout Maximum time to wait. |
| 187 | # This should be expressed in Robot Framework's time format |
| 188 | # (e.g. "10 minutes"). |
| 189 | # interval Interval to wait between status checks. |
| 190 | # This should be expressed in Robot Framework's time format |
| 191 | # (e.g. "5 seconds"). |
| 192 | |
| 193 | Wait Until Keyword Succeeds |
| 194 | ... ${max_timeout} ${interval} Verify Ping SSH And Redfish Authentication |