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 |
| 11 | |
| 12 | |
| 13 | Library SSHLibrary |
| 14 | |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 15 | Test Teardown Post Test Case Execution |
| 16 | Suite Teardown Post Test Suite Execution |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 17 | |
| 18 | Force Tags power_restore |
| 19 | |
| 20 | *** Variables *** |
| 21 | |
| 22 | *** Test Cases *** |
| 23 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 24 | Test Restore Policy ALWAYS_POWER_OFF With Host Off |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 25 | # Policy Initial Host State Expected Host State |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 26 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 27 | ${ALWAYS_POWER_OFF} Off Off |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 28 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 29 | [Documentation] Validate ALWAYS_POWER_OFF restore policy functionality. |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 30 | ... Policy: |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 31 | ... System policy set to ALWAYS_POWER_OFF. |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 32 | ... Initial Host State: |
| 33 | ... State where system should be before running the |
| 34 | ... test case. |
| 35 | ... Expected Host State: |
| 36 | ... After BMC reset, system should reach this |
| 37 | ... specific state. |
| 38 | |
| 39 | [Template] Verify Restore Policy |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 40 | [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_Off |
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 |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 44 | # Policy Initial Host State Expected Host State |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 45 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 46 | ${ALWAYS_POWER_OFF} Running Off |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 47 | |
| 48 | [Template] Verify Restore Policy |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 49 | [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_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 |
| 53 | # Policy Initial Host State Expected Host State |
| 54 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 55 | ${ALWAYS_POWER_ON} Off Running |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 56 | |
| 57 | [Documentation] Validate ALWAYS_POWER_ON restore policy functionality. |
| 58 | ... Policy: |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 59 | ... System policy set to ALWAYS_POWER_OFF. |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 60 | ... Initial Host State: |
| 61 | ... State where system should be before running the |
| 62 | ... test case. |
| 63 | ... Expected Host State: |
| 64 | ... After BMC reset, system should reach this |
| 65 | ... specific state. |
| 66 | |
| 67 | [Template] Verify Restore Policy |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 68 | [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Off |
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 |
| 72 | # Policy Initial Host State Expected Host State |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 73 | |
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 | |
| 76 | [Template] Verify Restore Policy |
| 77 | [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Running |
| 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 | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 81 | # Policy Initial Host State Expected Host State |
| 82 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 83 | ${RESTORE_LAST_STATE} Running Running |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 84 | |
| 85 | [Documentation] Validate RESTORE_LAST_STATE restore policy functionality. |
| 86 | ... Policy: |
| 87 | ... System policy set to RESTORE_LAST_STATE. |
| 88 | ... Initial Host State: |
| 89 | ... State where system should be before running the |
| 90 | ... test case. |
| 91 | ... Expected Host State: |
| 92 | ... After BMC reset, system should reach this |
| 93 | ... specific state. |
| 94 | |
| 95 | [Template] Verify Restore Policy |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 96 | [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Running |
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 |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 100 | # Policy Initial Host State Expected Host State |
| 101 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 102 | ${RESTORE_LAST_STATE} Off Off |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 103 | |
| 104 | |
| 105 | [Template] Verify Restore Policy |
Rahul Maheshwari | f049959 | 2017-05-10 01:55:59 -0500 | [diff] [blame] | 106 | [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Off |
George Keishing | 450a528 | 2017-05-05 03:13:37 -0500 | [diff] [blame] | 107 | |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 108 | |
| 109 | *** Keywords *** |
| 110 | |
| 111 | Verify Restore Policy |
| 112 | [Documentation] Set given policy, reset BMC and expect specified end |
| 113 | ... state. |
| 114 | [Arguments] ${policy} ${expectedState} ${nextState} |
| 115 | |
| 116 | # Description of argument(s): |
| 117 | # policy System policy state string. |
| 118 | # expectedState Test initial host state. |
| 119 | # nextState Test end host state. |
| 120 | |
| 121 | Set BMC Power Policy ${policy} |
| 122 | |
| 123 | ${currentState}= Get Host State |
| 124 | |
| 125 | Log Current System State= ${currentState} |
| 126 | Log Initial Host State= ${expectedState} |
| 127 | Log Expected Host State= ${nextState} |
| 128 | |
| 129 | Run Keyword If |
| 130 | ... '${currentState}' != '${expectedState}' |
| 131 | ... Set Initial Test State ${expectedState} |
| 132 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 133 | Initiate BMC Reboot |
George Keishing | 880f4e6 | 2017-04-20 01:10:17 -0500 | [diff] [blame] | 134 | |
| 135 | Wait Until Keyword Succeeds |
| 136 | ... 10 min 10 sec Verify Host State ${nextState} |
| 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' |
| 148 | ... Initiate Host Boot |
| 149 | |
| 150 | Run Keyword If '${expectedState}' == 'Off' |
| 151 | ... Initiate Host PowerOff |
| 152 | |
| 153 | |
| 154 | ${currentState}= Get Host State |
| 155 | |
| 156 | |
| 157 | Verify Host State |
| 158 | [Documentation] Verify expected host state. |
| 159 | [Arguments] ${expectedState} |
| 160 | |
| 161 | # Description of argument(s): |
| 162 | # expectedState Expected host state. |
| 163 | ${currentState}= Get Host State |
| 164 | Should Be Equal ${currentState} ${expectedState} |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 165 | |
| 166 | |
| 167 | Post Test Case Execution |
| 168 | [Documentation] Do the post test teardown. |
| 169 | # 1. Capture FFDC on test failure. |
| 170 | # 2. Close all open SSH connections. |
| 171 | |
| 172 | FFDC On Test Case Fail |
| 173 | Close All Connections |
| 174 | |
| 175 | |
| 176 | Post Test Suite Execution |
| 177 | [Documentation] Do the post suite teardown. |
| 178 | # 1. Set policy to default. |
| 179 | |
George Keishing | 1c3a966 | 2017-08-11 10:16:36 -0500 | [diff] [blame] | 180 | Run Keyword And Ignore Error Set BMC Power Policy ${RESTORE_LAST_STATE} |
George Keishing | 0ef6ece | 2017-05-05 02:57:16 -0500 | [diff] [blame] | 181 | |