blob: b631beec023c70e8e45e12ba59661204241c9be8 [file] [log] [blame]
Chris Austenb29d2e82016-06-07 12:25:35 -05001*** Settings ***
George Keishing6b59f1d2016-10-12 04:14:53 -05002Documentation 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
Chris Austenb29d2e82016-06-07 12:25:35 -05006
7Resource ../lib/rest_client.robot
8Resource ../lib/pdu/pdu.robot
9Resource ../lib/utils.robot
George Keishingd55a4be2016-08-26 03:28:17 -050010Resource ../lib/openbmc_ffdc.robot
George Keishing6b59f1d2016-10-12 04:14:53 -050011Resource ../lib/boot/boot_resource_master.robot
George Keishing129f38a2017-01-06 01:43:40 -060012Resource ../lib/state_manager.robot
Chris Austenb29d2e82016-06-07 12:25:35 -050013
14
15Library SSHLibrary
16
Gunnar Millseac1af22016-11-14 15:30:09 -060017Test Teardown FFDC On Test Case Fail
causten147f5752016-08-11 16:24:45 -050018Force Tags chassisboot bmcreboot
Chris Austenb29d2e82016-06-07 12:25:35 -050019
George Keishing6b59f1d2016-10-12 04:14:53 -050020*** Variables ***
Chris Austenb29d2e82016-06-07 12:25:35 -050021
George Keishing6b59f1d2016-10-12 04:14:53 -050022*** Test Cases ***
George Keishingd277f832016-10-07 12:04:50 -050023
George Keishing6b59f1d2016-10-12 04:14:53 -050024Set the power restore policy
25 #Policy Expected System State Next System State
George Keishingd277f832016-10-07 12:04:50 -050026
George Keishing129f38a2017-01-06 01:43:40 -060027 LEAVE_OFF Off Off
28 LEAVE_OFF Running Off
29 ALWAYS_POWER_ON Off Running
30 ALWAYS_POWER_ON Running Running
31 RESTORE_LAST_STATE Running Running
32 RESTORE_LAST_STATE Off Off
Chris Austenb29d2e82016-06-07 12:25:35 -050033
George Keishing6b59f1d2016-10-12 04:14:53 -050034 [Documentation] Test to validate restore policy attribute functionality.
35 ... Policy:
36 ... System policy to restore on power cycle
37 ... Expected System State:
38 ... State where system should be before running the
39 ... test case
40 ... Next System State:
41 ... After power cycle, system should reach this
42 ... specific state
43
44 [Template] Set Restore Policy
Chris Austenb29d2e82016-06-07 12:25:35 -050045
Gunnar Mills7c8923f2016-12-12 21:19:52 -060046*** Keywords ***
George Keishing6b59f1d2016-10-12 04:14:53 -050047
48Set Restore Policy
Gunnar Mills38032802016-12-12 13:43:40 -060049 [Arguments] ${policy} ${expectedState} ${nextState}
George Keishing6b59f1d2016-10-12 04:14:53 -050050
Sridevi Ramesh1699d372016-12-06 00:20:22 -060051 Set BMC Power Policy ${policy}
George Keishing6b59f1d2016-10-12 04:14:53 -050052
George Keishing129f38a2017-01-06 01:43:40 -060053 ${currentState}= Get Host State
George Keishing6b59f1d2016-10-12 04:14:53 -050054
55 Log Current System State= ${currentState}
56 Log Expected System State= ${expectedState}
57 Log Next System State= ${nextState}
58
59 Run Keyword If
60 ... '${currentState}' != '${expectedState}'
61 ... Set Initial Test State ${expectedState}
62
63 Log "Doing power cycle"
Chris Austenb29d2e82016-06-07 12:25:35 -050064 PDU Power Cycle
George Keishing129f38a2017-01-06 01:43:40 -060065 Check If BMC is Up 5 min 10 sec
George Keishing6b59f1d2016-10-12 04:14:53 -050066 Log "BMC is Online now"
Chris Austenb29d2e82016-06-07 12:25:35 -050067
George Keishing6b59f1d2016-10-12 04:14:53 -050068 Wait Until Keyword Succeeds
George Keishing129f38a2017-01-06 01:43:40 -060069 ... 5 min 10 sec Is BMC Ready
Chris Austenb29d2e82016-06-07 12:25:35 -050070
71
George Keishing6b59f1d2016-10-12 04:14:53 -050072Set Initial Test State
73 [Documentation] Poweron if ON expected, Poweroff if OFF expected
74 ... to initial state of the test.
Gunnar Mills38032802016-12-12 13:43:40 -060075 [Arguments] ${expectedState}
George Keishing6b59f1d2016-10-12 04:14:53 -050076
77 Run Keyword If
George Keishing129f38a2017-01-06 01:43:40 -060078 ... '${expectedState}' == 'Running'
79 ... Initiate Host Boot
George Keishing6b59f1d2016-10-12 04:14:53 -050080
81 Run Keyword If
George Keishing129f38a2017-01-06 01:43:40 -060082 ... '${expectedState}' == 'Off'
83 ... Initiate Host PowerOff