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 |
| 12 | Library ../../lib/state_map.py |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 13 | |
George Keishing | 62c8267 | 2017-12-06 04:39:46 -0600 | [diff] [blame] | 14 | Test Teardown Test Teardown Execution |
| 15 | Suite Teardown Suite Teardown Execution |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 16 | |
| 17 | Force Tags power_restore |
| 18 | |
| 19 | *** Variables *** |
| 20 | |
| 21 | *** Test Cases *** |
| 22 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 23 | Test Restore Policy ALWAYS_POWER_OFF With Host Off |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 24 | [Documentation] Validate ALWAYS_POWER_OFF restore policy functionality. |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 25 | ... Policy: |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 26 | ... System policy set to ALWAYS_POWER_OFF. |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 27 | ... Initial Host State: |
| 28 | ... State where system should be before running the |
| 29 | ... test case. |
| 30 | ... Expected Host State: |
| 31 | ... After BMC reset, system should reach this |
| 32 | ... specific state. |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 33 | [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_Off |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 34 | [Template] Verify Restore Policy |
| 35 | |
| 36 | # Policy Initial Host State Expected Host State |
| 37 | ${ALWAYS_POWER_OFF} Off Off |
| 38 | |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 39 | |
| 40 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 41 | Test Restore Policy ALWAYS_POWER_OFF With Host Running |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 42 | [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] | 43 | [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_Running |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 44 | [Template] Verify Restore Policy |
| 45 | |
| 46 | # Policy Initial Host State Expected Host State |
| 47 | ${ALWAYS_POWER_OFF} Running Running |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 48 | |
| 49 | |
| 50 | Test Restore Policy ALWAYS_POWER_ON With Host Off |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 51 | [Documentation] Validate ALWAYS_POWER_ON restore policy functionality. |
| 52 | ... Policy: |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 53 | ... System policy set to ALWAYS_POWER_OFF. |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 54 | ... Initial Host State: |
| 55 | ... State where system should be before running the |
| 56 | ... test case. |
| 57 | ... Expected Host State: |
| 58 | ... After BMC reset, system should reach this |
| 59 | ... specific state. |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 60 | [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Off |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 61 | [Template] Verify Restore Policy |
| 62 | |
| 63 | # Policy Initial Host State Expected Host State |
| 64 | ${ALWAYS_POWER_ON} Off Running |
| 65 | |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 66 | |
| 67 | |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 68 | Test Restore Policy ALWAYS_POWER_ON With Host Running |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 69 | [Documentation] Verify the BMC restore policy is ALWAYS_POWER_ON while the Host is running. |
| 70 | [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Running |
| 71 | [Template] Verify Restore Policy |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 72 | |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 73 | # Policy Initial Host State Expected Host State |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 74 | ${ALWAYS_POWER_ON} Running Running |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 75 | |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 76 | |
| 77 | |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 78 | Test Restore Policy Restore Last State With Host Running |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 79 | [Documentation] Validate RESTORE_LAST_STATE restore policy functionality. |
| 80 | ... Policy: |
| 81 | ... System policy set to RESTORE_LAST_STATE. |
| 82 | ... Initial Host State: |
| 83 | ... State where system should be before running the |
| 84 | ... test case. |
| 85 | ... Expected Host State: |
| 86 | ... After BMC reset, system should reach this |
| 87 | ... specific state. |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 88 | [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Running |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 89 | [Template] Verify Restore Policy |
| 90 | |
| 91 | # Policy Initial Host State Expected Host State |
| 92 | ${RESTORE_LAST_STATE} Running Running |
| 93 | |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 94 | |
| 95 | |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 96 | Test Restore Policy Restore Last State With Host Off |
Joy Onyerikwu | f4a807b | 2018-06-20 08:43:54 -0500 | [diff] [blame] | 97 | [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] | 98 | [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Off |
George Keishing | 5abfe60 | 2018-07-05 11:54:37 -0500 | [diff] [blame] | 99 | [Template] Verify Restore Policy |
| 100 | |
| 101 | # Policy Initial Host State Expected Host State |
| 102 | ${RESTORE_LAST_STATE} Off Off |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 103 | |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 104 | |
| 105 | *** Keywords *** |
| 106 | |
| 107 | Verify Restore Policy |
| 108 | [Documentation] Set given policy, reset BMC and expect specified end |
| 109 | ... state. |
| 110 | [Arguments] ${policy} ${expectedState} ${nextState} |
| 111 | |
| 112 | # Description of argument(s): |
| 113 | # policy System policy state string. |
| 114 | # expectedState Test initial host state. |
| 115 | # nextState Test end host state. |
| 116 | |
| 117 | Set BMC Power Policy ${policy} |
| 118 | |
George Keishing | d45aae5 | 2017-12-11 09:38:37 -0600 | [diff] [blame] | 119 | Set Initial Test State ${expectedState} |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 120 | |
George Keishing | 5611421 | 2019-07-22 02:27:42 -0500 | [diff] [blame] | 121 | Redfish Power Operation reset_type=GracefulRestart |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 122 | |
| 123 | Wait Until Keyword Succeeds |
George Keishing | b95aba2 | 2017-12-13 07:59:23 -0600 | [diff] [blame] | 124 | ... 10 min 10 sec Valid Boot States ${nextState} |
George Keishing | d45aae5 | 2017-12-11 09:38:37 -0600 | [diff] [blame] | 125 | |
| 126 | |
| 127 | Valid Boot States |
| 128 | [Documentation] Verify boot states for a given system state. |
| 129 | [Arguments] ${sys_state} |
| 130 | |
| 131 | # Description of argument(s): |
| 132 | # sys_state system state list |
George Keishing | b95aba2 | 2017-12-13 07:59:23 -0600 | [diff] [blame] | 133 | # (e.g. "Off", "On", "Reboot", etc.). |
George Keishing | d45aae5 | 2017-12-11 09:38:37 -0600 | [diff] [blame] | 134 | |
| 135 | ${current_state}= Get Boot State |
George Keishing | b95aba2 | 2017-12-13 07:59:23 -0600 | [diff] [blame] | 136 | Valid Boot State ${sys_state} ${current_state} |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 137 | |
| 138 | |
| 139 | Set Initial Test State |
| 140 | [Documentation] Poweron if ON expected, Poweroff if OFF expected |
| 141 | ... to initial state of the test. |
| 142 | |
| 143 | [Arguments] ${expectedState} |
| 144 | # Description of argument(s): |
| 145 | # expectedState Test initial host state. |
| 146 | |
| 147 | Run Keyword If '${expectedState}' == 'Running' |
George Keishing | 5611421 | 2019-07-22 02:27:42 -0500 | [diff] [blame] | 148 | ... Redfish Power On |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 149 | |
| 150 | Run Keyword If '${expectedState}' == 'Off' |
George Keishing | 5611421 | 2019-07-22 02:27:42 -0500 | [diff] [blame] | 151 | ... Redfish Power Off |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 152 | |
| 153 | |
George Keishing | 62c8267 | 2017-12-06 04:39:46 -0600 | [diff] [blame] | 154 | Test Teardown Execution |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 155 | [Documentation] Do the post test teardown. |
| 156 | # 1. Capture FFDC on test failure. |
| 157 | # 2. Close all open SSH connections. |
| 158 | |
| 159 | FFDC On Test Case Fail |
| 160 | Close All Connections |
| 161 | |
| 162 | |
George Keishing | 62c8267 | 2017-12-06 04:39:46 -0600 | [diff] [blame] | 163 | Suite Teardown Execution |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 164 | [Documentation] Do the post suite teardown. |
| 165 | # 1. Set policy to default. |
| 166 | |
George Keishing | efc3ff2 | 2017-12-12 11:49:25 -0600 | [diff] [blame] | 167 | Run Keyword And Ignore Error Set BMC Power Policy ${ALWAYS_POWER_OFF} |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 168 | |