blob: f9479f6b056af49543338d7dcc1d252a058d360d [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 Keishing1c3a9662017-08-11 10:16:36 -0500126 Initiate BMC Reboot
George Keishing880f4e62017-04-20 01:10:17 -0500127
128 Wait Until Keyword Succeeds
George Keishingb95aba22017-12-13 07:59:23 -0600129 ... 10 min 10 sec Valid Boot States ${nextState}
George Keishingd45aae52017-12-11 09:38:37 -0600130
131
132Valid 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 Keishingb95aba22017-12-13 07:59:23 -0600138 # (e.g. "Off", "On", "Reboot", etc.).
George Keishingd45aae52017-12-11 09:38:37 -0600139
140 ${current_state}= Get Boot State
George Keishingb95aba22017-12-13 07:59:23 -0600141 Valid Boot State ${sys_state} ${current_state}
George Keishing880f4e62017-04-20 01:10:17 -0500142
143
144Set 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 Keishing62c82672017-12-06 04:39:46 -0600159Test Teardown Execution
George Keishing0ef6ece2017-05-05 02:57:16 -0500160 [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 Keishing62c82672017-12-06 04:39:46 -0600168Suite Teardown Execution
George Keishing0ef6ece2017-05-05 02:57:16 -0500169 [Documentation] Do the post suite teardown.
170 # 1. Set policy to default.
171
George Keishingefc3ff22017-12-12 11:49:25 -0600172 Run Keyword And Ignore Error Set BMC Power Policy ${ALWAYS_POWER_OFF}
George Keishing0ef6ece2017-05-05 02:57:16 -0500173