blob: c4dca6b4b9a19610ea9c27b58b2ff6be71c0fc8f [file] [log] [blame]
George Keishing880f4e62017-04-20 01:10:17 -05001*** Settings ***
2Documentation 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
7Resource ../lib/rest_client.robot
8Resource ../lib/utils.robot
9Resource ../lib/openbmc_ffdc.robot
10Resource ../lib/state_manager.robot
George Keishingd45aae52017-12-11 09:38:37 -060011Library ../lib/state_map.py
George Keishing880f4e62017-04-20 01:10:17 -050012
13
14Library SSHLibrary
15
George Keishing62c82672017-12-06 04:39:46 -060016Test Teardown Test Teardown Execution
17Suite Teardown Suite Teardown Execution
George Keishing880f4e62017-04-20 01:10:17 -050018
19Force Tags power_restore
20
21*** Variables ***
22
23*** Test Cases ***
24
George Keishing1c3a9662017-08-11 10:16:36 -050025Test Restore Policy ALWAYS_POWER_OFF With Host Off
George Keishing450a5282017-05-05 03:13:37 -050026 # Policy Initial Host State Expected Host State
George Keishing880f4e62017-04-20 01:10:17 -050027
George Keishing1c3a9662017-08-11 10:16:36 -050028 ${ALWAYS_POWER_OFF} Off Off
George Keishing880f4e62017-04-20 01:10:17 -050029
George Keishing1c3a9662017-08-11 10:16:36 -050030 [Documentation] Validate ALWAYS_POWER_OFF restore policy functionality.
George Keishing880f4e62017-04-20 01:10:17 -050031 ... Policy:
George Keishing1c3a9662017-08-11 10:16:36 -050032 ... System policy set to ALWAYS_POWER_OFF.
George Keishing880f4e62017-04-20 01:10:17 -050033 ... 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 Keishing1c3a9662017-08-11 10:16:36 -050041 [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_Off
George Keishing880f4e62017-04-20 01:10:17 -050042
43
George Keishing1c3a9662017-08-11 10:16:36 -050044Test Restore Policy ALWAYS_POWER_OFF With Host Running
George Keishing450a5282017-05-05 03:13:37 -050045 # Policy Initial Host State Expected Host State
George Keishing880f4e62017-04-20 01:10:17 -050046
George Keishingd45aae52017-12-11 09:38:37 -060047 ${ALWAYS_POWER_OFF} Running Running
George Keishing450a5282017-05-05 03:13:37 -050048
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -050049 [Documentation] Verify that the BMC restore policy is ALWAYS_POWER_OFF while the Host is running.
George Keishing450a5282017-05-05 03:13:37 -050050 [Template] Verify Restore Policy
George Keishing1c3a9662017-08-11 10:16:36 -050051 [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_Running
George Keishing450a5282017-05-05 03:13:37 -050052
53
54Test Restore Policy ALWAYS_POWER_ON With Host Off
55 # Policy Initial Host State Expected Host State
56
George Keishing1c3a9662017-08-11 10:16:36 -050057 ${ALWAYS_POWER_ON} Off Running
George Keishing880f4e62017-04-20 01:10:17 -050058
59 [Documentation] Validate ALWAYS_POWER_ON restore policy functionality.
60 ... Policy:
George Keishing1c3a9662017-08-11 10:16:36 -050061 ... System policy set to ALWAYS_POWER_OFF.
George Keishing880f4e62017-04-20 01:10:17 -050062 ... 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 Keishing450a5282017-05-05 03:13:37 -050070 [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Off
George Keishing880f4e62017-04-20 01:10:17 -050071
72
George Keishing450a5282017-05-05 03:13:37 -050073Test Restore Policy ALWAYS_POWER_ON With Host Running
74 # Policy Initial Host State Expected Host State
George Keishing880f4e62017-04-20 01:10:17 -050075
George Keishing1c3a9662017-08-11 10:16:36 -050076 ${ALWAYS_POWER_ON} Running Running
George Keishing450a5282017-05-05 03:13:37 -050077
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -050078 [Documentation] Verify the BMC restore policy is ALWAYS_POWER_ON while the Host is running.
George Keishing450a5282017-05-05 03:13:37 -050079 [Template] Verify Restore Policy
80 [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Running
81
82
Rahul Maheshwarif0499592017-05-10 01:55:59 -050083Test Restore Policy Restore Last State With Host Running
George Keishing450a5282017-05-05 03:13:37 -050084 # Policy Initial Host State Expected Host State
85
George Keishing1c3a9662017-08-11 10:16:36 -050086 ${RESTORE_LAST_STATE} Running Running
George Keishing880f4e62017-04-20 01:10:17 -050087
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 Maheshwarif0499592017-05-10 01:55:59 -050099 [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Running
George Keishing450a5282017-05-05 03:13:37 -0500100
101
Rahul Maheshwarif0499592017-05-10 01:55:59 -0500102Test Restore Policy Restore Last State With Host Off
George Keishing450a5282017-05-05 03:13:37 -0500103 # Policy Initial Host State Expected Host State
104
George Keishing1c3a9662017-08-11 10:16:36 -0500105 ${RESTORE_LAST_STATE} Off Off
George Keishing450a5282017-05-05 03:13:37 -0500106
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -0500107 [Documentation] Verify the RESTORE_LAST_STATE restore policy functionality while the Host is off.
George Keishing450a5282017-05-05 03:13:37 -0500108 [Template] Verify Restore Policy
Rahul Maheshwarif0499592017-05-10 01:55:59 -0500109 [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Off
George Keishing450a5282017-05-05 03:13:37 -0500110
George Keishing880f4e62017-04-20 01:10:17 -0500111
112*** Keywords ***
113
114Verify 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 Keishingd45aae52017-12-11 09:38:37 -0600126 Set Initial Test State ${expectedState}
George Keishing880f4e62017-04-20 01:10:17 -0500127
George Keishing1c3a9662017-08-11 10:16:36 -0500128 Initiate BMC Reboot
George Keishing880f4e62017-04-20 01:10:17 -0500129
130 Wait Until Keyword Succeeds
George Keishingb95aba22017-12-13 07:59:23 -0600131 ... 10 min 10 sec Valid Boot States ${nextState}
George Keishingd45aae52017-12-11 09:38:37 -0600132
133
134Valid 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 Keishingb95aba22017-12-13 07:59:23 -0600140 # (e.g. "Off", "On", "Reboot", etc.).
George Keishingd45aae52017-12-11 09:38:37 -0600141
142 ${current_state}= Get Boot State
George Keishingb95aba22017-12-13 07:59:23 -0600143 Valid Boot State ${sys_state} ${current_state}
George Keishing880f4e62017-04-20 01:10:17 -0500144
145
146Set 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 Keishing62c82672017-12-06 04:39:46 -0600161Test Teardown Execution
George Keishing0ef6ece2017-05-05 02:57:16 -0500162 [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 Keishing62c82672017-12-06 04:39:46 -0600170Suite Teardown Execution
George Keishing0ef6ece2017-05-05 02:57:16 -0500171 [Documentation] Do the post suite teardown.
172 # 1. Set policy to default.
173
George Keishingefc3ff22017-12-12 11:49:25 -0600174 Run Keyword And Ignore Error Set BMC Power Policy ${ALWAYS_POWER_OFF}
George Keishing0ef6ece2017-05-05 02:57:16 -0500175