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