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 | |
| 49 | [Template] Verify Restore Policy |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 50 | [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_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 |
| 54 | # Policy Initial Host State Expected Host State |
| 55 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 56 | ${ALWAYS_POWER_ON} Off Running |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 57 | |
| 58 | [Documentation] Validate ALWAYS_POWER_ON restore policy functionality. |
| 59 | ... Policy: |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 60 | ... System policy set to ALWAYS_POWER_OFF. |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 61 | ... Initial Host State: |
| 62 | ... State where system should be before running the |
| 63 | ... test case. |
| 64 | ... Expected Host State: |
| 65 | ... After BMC reset, system should reach this |
| 66 | ... specific state. |
| 67 | |
| 68 | [Template] Verify Restore Policy |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 69 | [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Off |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 70 | |
| 71 | |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 72 | Test Restore Policy ALWAYS_POWER_ON With Host Running |
| 73 | # Policy Initial Host State Expected Host State |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 74 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 75 | ${ALWAYS_POWER_ON} Running Running |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 76 | |
| 77 | [Template] Verify Restore Policy |
| 78 | [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Running |
| 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 | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 82 | # Policy Initial Host State Expected Host State |
| 83 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 84 | ${RESTORE_LAST_STATE} Running Running |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 85 | |
| 86 | [Documentation] Validate RESTORE_LAST_STATE restore policy functionality. |
| 87 | ... Policy: |
| 88 | ... System policy set to RESTORE_LAST_STATE. |
| 89 | ... Initial Host State: |
| 90 | ... State where system should be before running the |
| 91 | ... test case. |
| 92 | ... Expected Host State: |
| 93 | ... After BMC reset, system should reach this |
| 94 | ... specific state. |
| 95 | |
| 96 | [Template] Verify Restore Policy |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 97 | [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Running |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 98 | |
| 99 | |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 100 | Test Restore Policy Restore Last State With Host Off |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 101 | # Policy Initial Host State Expected Host State |
| 102 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 103 | ${RESTORE_LAST_STATE} Off Off |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 104 | |
| 105 | |
| 106 | [Template] Verify Restore Policy |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 107 | [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Off |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 108 | |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 109 | |
| 110 | *** Keywords *** |
| 111 | |
| 112 | Verify Restore Policy |
| 113 | [Documentation] Set given policy, reset BMC and expect specified end |
| 114 | ... state. |
| 115 | [Arguments] ${policy} ${expectedState} ${nextState} |
| 116 | |
| 117 | # Description of argument(s): |
| 118 | # policy System policy state string. |
| 119 | # expectedState Test initial host state. |
| 120 | # nextState Test end host state. |
| 121 | |
| 122 | Set BMC Power Policy ${policy} |
| 123 | |
George Keishing | d45aae5 | 2017-12-11 09:38:37 -0600 | [diff] [blame] | 124 | Set Initial Test State ${expectedState} |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 125 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 126 | Initiate BMC Reboot |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 127 | |
| 128 | Wait Until Keyword Succeeds |
George Keishing | b95aba2 | 2017-12-13 07:59:23 -0600 | [diff] [blame] | 129 | ... 10 min 10 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 | |
| 140 | ${current_state}= Get Boot State |
George Keishing | b95aba2 | 2017-12-13 07:59:23 -0600 | [diff] [blame] | 141 | 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 | |
| 152 | Run Keyword If '${expectedState}' == 'Running' |
| 153 | ... Initiate Host Boot |
| 154 | |
| 155 | Run Keyword If '${expectedState}' == 'Off' |
| 156 | ... Initiate Host PowerOff |
| 157 | |
| 158 | |
George Keishing | 62c8267 | 2017-12-06 04:39:46 -0600 | [diff] [blame] | 159 | Test Teardown Execution |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 160 | [Documentation] Do the post test teardown. |
| 161 | # 1. Capture FFDC on test failure. |
| 162 | # 2. Close all open SSH connections. |
| 163 | |
| 164 | FFDC On Test Case Fail |
| 165 | Close All Connections |
| 166 | |
| 167 | |
George Keishing | 62c8267 | 2017-12-06 04:39:46 -0600 | [diff] [blame] | 168 | Suite Teardown Execution |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 169 | [Documentation] Do the post suite teardown. |
| 170 | # 1. Set policy to default. |
| 171 | |
George Keishing | efc3ff2 | 2017-12-12 11:49:25 -0600 | [diff] [blame] | 172 | Run Keyword And Ignore Error Set BMC Power Policy ${ALWAYS_POWER_OFF} |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 173 | |