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