blob: 54efb51732d520e72b06a67d2db40b8943c522e3 [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
49 [Template] Verify Restore Policy
George Keishing1c3a9662017-08-11 10:16:36 -050050 [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_Running
George Keishing450a5282017-05-05 03:13:37 -050051
52
53Test Restore Policy ALWAYS_POWER_ON With Host Off
54 # Policy Initial Host State Expected Host State
55
George Keishing1c3a9662017-08-11 10:16:36 -050056 ${ALWAYS_POWER_ON} Off Running
George Keishing880f4e62017-04-20 01:10:17 -050057
58 [Documentation] Validate ALWAYS_POWER_ON restore policy functionality.
59 ... Policy:
George Keishing1c3a9662017-08-11 10:16:36 -050060 ... System policy set to ALWAYS_POWER_OFF.
George Keishing880f4e62017-04-20 01:10:17 -050061 ... 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 Keishing450a5282017-05-05 03:13:37 -050069 [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Off
George Keishing880f4e62017-04-20 01:10:17 -050070
71
George Keishing450a5282017-05-05 03:13:37 -050072Test Restore Policy ALWAYS_POWER_ON With Host Running
73 # Policy Initial Host State Expected Host State
George Keishing880f4e62017-04-20 01:10:17 -050074
George Keishing1c3a9662017-08-11 10:16:36 -050075 ${ALWAYS_POWER_ON} Running Running
George Keishing450a5282017-05-05 03:13:37 -050076
77 [Template] Verify Restore Policy
78 [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Running
79
80
Rahul Maheshwarif0499592017-05-10 01:55:59 -050081Test Restore Policy Restore Last State With Host Running
George Keishing450a5282017-05-05 03:13:37 -050082 # Policy Initial Host State Expected Host State
83
George Keishing1c3a9662017-08-11 10:16:36 -050084 ${RESTORE_LAST_STATE} Running Running
George Keishing880f4e62017-04-20 01:10:17 -050085
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 Maheshwarif0499592017-05-10 01:55:59 -050097 [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Running
George Keishing450a5282017-05-05 03:13:37 -050098
99
Rahul Maheshwarif0499592017-05-10 01:55:59 -0500100Test Restore Policy Restore Last State With Host Off
George Keishing450a5282017-05-05 03:13:37 -0500101 # Policy Initial Host State Expected Host State
102
George Keishing1c3a9662017-08-11 10:16:36 -0500103 ${RESTORE_LAST_STATE} Off Off
George Keishing450a5282017-05-05 03:13:37 -0500104
105
106 [Template] Verify Restore Policy
Rahul Maheshwarif0499592017-05-10 01:55:59 -0500107 [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Off
George Keishing450a5282017-05-05 03:13:37 -0500108
George Keishing880f4e62017-04-20 01:10:17 -0500109
110*** Keywords ***
111
112Verify 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 Keishingd45aae52017-12-11 09:38:37 -0600124 Set Initial Test State ${expectedState}
George Keishing880f4e62017-04-20 01:10:17 -0500125
George Keishingd45aae52017-12-11 09:38:37 -0600126 ${initial_states}= Get Boot State
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 Keishingd45aae52017-12-11 09:38:37 -0600131 ... 10 min 10 sec Valid Boot States ${initial_states}
132
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
140 # (e.g.bmc,chassis,host,BootProgress,OperatingSystemState).
141
142 ${current_state}= Get Boot State
143 Lists Should Be Equal ${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 Keishing1c3a9662017-08-11 10:16:36 -0500174 Run Keyword And Ignore Error Set BMC Power Policy ${RESTORE_LAST_STATE}
George Keishing0ef6ece2017-05-05 02:57:16 -0500175