blob: 913002e661ab3e71bc4e2d32d5d33bd2ca5e22ef [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
George Keishing56114212019-07-22 02:27:42 -05007Resource ../../lib/rest_client.robot
8Resource ../../lib/utils.robot
9Resource ../../lib/openbmc_ffdc.robot
10Resource ../../lib/state_manager.robot
11Resource ../../lib/boot_utils.robot
12Library ../../lib/state_map.py
George Keishing880f4e62017-04-20 01:10:17 -050013
George Keishing62c82672017-12-06 04:39:46 -060014Test Teardown Test Teardown Execution
15Suite Teardown Suite Teardown Execution
George Keishing880f4e62017-04-20 01:10:17 -050016
17Force Tags power_restore
18
19*** Variables ***
20
21*** Test Cases ***
22
George Keishing1c3a9662017-08-11 10:16:36 -050023Test Restore Policy ALWAYS_POWER_OFF With Host Off
George Keishing1c3a9662017-08-11 10:16:36 -050024 [Documentation] Validate ALWAYS_POWER_OFF restore policy functionality.
George Keishing880f4e62017-04-20 01:10:17 -050025 ... Policy:
George Keishing1c3a9662017-08-11 10:16:36 -050026 ... System policy set to ALWAYS_POWER_OFF.
George Keishing880f4e62017-04-20 01:10:17 -050027 ... Initial Host State:
28 ... State where system should be before running the
29 ... test case.
30 ... Expected Host State:
31 ... After BMC reset, system should reach this
32 ... specific state.
George Keishing1c3a9662017-08-11 10:16:36 -050033 [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_Off
George Keishing5abfe602018-07-05 11:54:37 -050034 [Template] Verify Restore Policy
35
36 # Policy Initial Host State Expected Host State
37 ${ALWAYS_POWER_OFF} Off Off
38
George Keishing880f4e62017-04-20 01:10:17 -050039
40
George Keishing1c3a9662017-08-11 10:16:36 -050041Test Restore Policy ALWAYS_POWER_OFF With Host Running
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -050042 [Documentation] Verify that the BMC restore policy is ALWAYS_POWER_OFF while the Host is running.
George Keishing1c3a9662017-08-11 10:16:36 -050043 [Tags] Test_Restore_Policy_ALWAYS_POWER_OFF_With_Host_Running
George Keishing5abfe602018-07-05 11:54:37 -050044 [Template] Verify Restore Policy
45
46 # Policy Initial Host State Expected Host State
47 ${ALWAYS_POWER_OFF} Running Running
George Keishing450a5282017-05-05 03:13:37 -050048
49
50Test Restore Policy ALWAYS_POWER_ON With Host Off
George Keishing880f4e62017-04-20 01:10:17 -050051 [Documentation] Validate ALWAYS_POWER_ON restore policy functionality.
52 ... Policy:
George Keishing1c3a9662017-08-11 10:16:36 -050053 ... System policy set to ALWAYS_POWER_OFF.
George Keishing880f4e62017-04-20 01:10:17 -050054 ... Initial Host State:
55 ... State where system should be before running the
56 ... test case.
57 ... Expected Host State:
58 ... After BMC reset, system should reach this
59 ... specific state.
George Keishing450a5282017-05-05 03:13:37 -050060 [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Off
George Keishing5abfe602018-07-05 11:54:37 -050061 [Template] Verify Restore Policy
62
63 # Policy Initial Host State Expected Host State
64 ${ALWAYS_POWER_ON} Off Running
65
George Keishing880f4e62017-04-20 01:10:17 -050066
67
George Keishing450a5282017-05-05 03:13:37 -050068Test Restore Policy ALWAYS_POWER_ON With Host Running
George Keishing5abfe602018-07-05 11:54:37 -050069 [Documentation] Verify the BMC restore policy is ALWAYS_POWER_ON while the Host is running.
70 [Tags] Test_Restore_Policy_ALWAYS_POWER_ON_With_Host_Running
71 [Template] Verify Restore Policy
George Keishing880f4e62017-04-20 01:10:17 -050072
George Keishing5abfe602018-07-05 11:54:37 -050073 # Policy Initial Host State Expected Host State
George Keishing1c3a9662017-08-11 10:16:36 -050074 ${ALWAYS_POWER_ON} Running Running
George Keishing450a5282017-05-05 03:13:37 -050075
George Keishing450a5282017-05-05 03:13:37 -050076
77
Rahul Maheshwarif0499592017-05-10 01:55:59 -050078Test Restore Policy Restore Last State With Host Running
George Keishing880f4e62017-04-20 01:10:17 -050079 [Documentation] Validate RESTORE_LAST_STATE restore policy functionality.
80 ... Policy:
81 ... System policy set to RESTORE_LAST_STATE.
82 ... Initial Host State:
83 ... State where system should be before running the
84 ... test case.
85 ... Expected Host State:
86 ... After BMC reset, system should reach this
87 ... specific state.
Rahul Maheshwarif0499592017-05-10 01:55:59 -050088 [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Running
George Keishing5abfe602018-07-05 11:54:37 -050089 [Template] Verify Restore Policy
90
91 # Policy Initial Host State Expected Host State
92 ${RESTORE_LAST_STATE} Running Running
93
George Keishing450a5282017-05-05 03:13:37 -050094
95
Rahul Maheshwarif0499592017-05-10 01:55:59 -050096Test Restore Policy Restore Last State With Host Off
Joy Onyerikwuf4a807b2018-06-20 08:43:54 -050097 [Documentation] Verify the RESTORE_LAST_STATE restore policy functionality while the Host is off.
Rahul Maheshwarif0499592017-05-10 01:55:59 -050098 [Tags] Test_Restore_Policy_Restore_Last_State_With_Host_Off
George Keishing5abfe602018-07-05 11:54:37 -050099 [Template] Verify Restore Policy
100
101 # Policy Initial Host State Expected Host State
102 ${RESTORE_LAST_STATE} Off Off
George Keishing450a5282017-05-05 03:13:37 -0500103
George Keishing880f4e62017-04-20 01:10:17 -0500104
105*** Keywords ***
106
107Verify Restore Policy
108 [Documentation] Set given policy, reset BMC and expect specified end
109 ... state.
110 [Arguments] ${policy} ${expectedState} ${nextState}
111
112 # Description of argument(s):
113 # policy System policy state string.
114 # expectedState Test initial host state.
115 # nextState Test end host state.
116
117 Set BMC Power Policy ${policy}
118
George Keishingd45aae52017-12-11 09:38:37 -0600119 Set Initial Test State ${expectedState}
George Keishing880f4e62017-04-20 01:10:17 -0500120
George Keishing56114212019-07-22 02:27:42 -0500121 Redfish Power Operation reset_type=GracefulRestart
George Keishing880f4e62017-04-20 01:10:17 -0500122
123 Wait Until Keyword Succeeds
George Keishingb95aba22017-12-13 07:59:23 -0600124 ... 10 min 10 sec Valid Boot States ${nextState}
George Keishingd45aae52017-12-11 09:38:37 -0600125
126
127Valid Boot States
128 [Documentation] Verify boot states for a given system state.
129 [Arguments] ${sys_state}
130
131 # Description of argument(s):
132 # sys_state system state list
George Keishingb95aba22017-12-13 07:59:23 -0600133 # (e.g. "Off", "On", "Reboot", etc.).
George Keishingd45aae52017-12-11 09:38:37 -0600134
135 ${current_state}= Get Boot State
George Keishingb95aba22017-12-13 07:59:23 -0600136 Valid Boot State ${sys_state} ${current_state}
George Keishing880f4e62017-04-20 01:10:17 -0500137
138
139Set 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'
George Keishing56114212019-07-22 02:27:42 -0500148 ... Redfish Power On
George Keishing880f4e62017-04-20 01:10:17 -0500149
150 Run Keyword If '${expectedState}' == 'Off'
George Keishing56114212019-07-22 02:27:42 -0500151 ... Redfish Power Off
George Keishing880f4e62017-04-20 01:10:17 -0500152
153
George Keishing62c82672017-12-06 04:39:46 -0600154Test Teardown Execution
George Keishing0ef6ece2017-05-05 02:57:16 -0500155 [Documentation] Do the post test teardown.
156 # 1. Capture FFDC on test failure.
157 # 2. Close all open SSH connections.
158
159 FFDC On Test Case Fail
160 Close All Connections
161
162
George Keishing62c82672017-12-06 04:39:46 -0600163Suite Teardown Execution
George Keishing0ef6ece2017-05-05 02:57:16 -0500164 [Documentation] Do the post suite teardown.
165 # 1. Set policy to default.
166
George Keishingefc3ff22017-12-12 11:49:25 -0600167 Run Keyword And Ignore Error Set BMC Power Policy ${ALWAYS_POWER_OFF}
George Keishing0ef6ece2017-05-05 02:57:16 -0500168