blob: 57a9f322ac375b4f26a0d9172d0fdc6d164cb86a [file] [log] [blame]
George Keishing78ea2dc2016-11-18 04:33:45 -06001*** Settings ***
2Documentation This module will take whatever action is necessary
3... to bring the BMC to a stable, standby state. For our
4... purposes, a stable state is defined as:
5... - BMC is communicating
6... (pinging, sshing and REST commands working)
7... - Power state is 0 (off)
8... - BMC state is "BMC_READY" or "HOST_POWERED_OFF"
9... - Boot policy is "RESTORE_LAST_STATE"
10
11Resource ../lib/boot/boot_resource_master.robot
12Resource ../lib/utils.robot
13
14*** Variables ***
15${HOST_SETTING} /org/openbmc/settings/host0
16
17*** Test cases ***
18
19Get to Stable State
20 [Documentation] BMC cleanup drive to stable state
21 ... 1. Ping Test
22 ... 2. SSH Connection session Test
23 ... 3. REST Connection session Test
24 ... 4. Reboot BMC if REST Test failed
25 ... 5. Check BMC state for standby
26 ... 6. Issue poweroff if not already in
27 ... standby state
28 ... 7. Update restore policy
29 [Tags] Get to Stable State
30
31 Wait For Host To Ping ${OPENBMC_HOST} 1 mins
32 Open Connection And Log In host=${OPENBMC_HOST}
33
Gunnar Mills597ffa02016-12-06 11:26:53 -060034 ${l_rest}= Run Keyword And Return Status
George Keishing78ea2dc2016-11-18 04:33:45 -060035 ... Initialize OpenBMC
36 Run Keyword If '${l_rest}' == '${False}'
37 ... Reboot and Wait for BMC Online
38
Gunnar Mills597ffa02016-12-06 11:26:53 -060039 ${l_ready}= Run Keyword And Return Status
George Keishing78ea2dc2016-11-18 04:33:45 -060040 ... Get BMC State and Expect Standby
41
42 Run Keyword If '${l_ready}' == '${False}'
43 ... Initiate Power Off
44
45 Update Policy Setting RESTORE_LAST_STATE
46
47
48*** Keywords ***
49
50Reboot and Wait for BMC Online
51 [Documentation] Reboot BMC and wait for it to come online
52 ... and boot to standby
53
54 Trigger Warm Reset via Reboot
55 Wait Until Keyword Succeeds
56 ... 5 min 10 sec BMC Online Test
57
58 Wait For BMC Standby
59
60
61BMC Online Test
62 [Documentation] BMC ping, SSH, REST connection Test
63
Gunnar Mills597ffa02016-12-06 11:26:53 -060064 ${l_status}= Run Keyword and Return Status
George Keishing78ea2dc2016-11-18 04:33:45 -060065 ... Verify Ping and REST Authentication
66 Run Keyword If '${l_status}' == '${False}'
67 ... Fail msg=System not in ideal state to continue [ERROR]
68
69
70Wait For BMC Standby
71 [Documentation] Wait Until BMC standby post BMC reboot
72
73 @{states}= Create List BMC_READY HOST_POWERED_OFF
74 Wait Until Keyword Succeeds
75 ... 10 min 10 sec Verify BMC State ${states}
76
77
78Get BMC State and Expect Standby
79 [Documentation] Get BMC state and should be at standby
80
81 @{states}= Create List BMC_READY HOST_POWERED_OFF
82 ${bmc_state}= Get BMC State
83 Should Contain ${states} ${bmc_state}
84
85
86Update Policy Setting
87 [Documentation] Update the given restore policy
88 [arguments] ${policy}
89
Gunnar Mills597ffa02016-12-06 11:26:53 -060090 ${valueDict}= create dictionary data=${policy}
George Keishing78ea2dc2016-11-18 04:33:45 -060091 Write Attribute ${HOST_SETTING} power_policy data=${valueDict}
92 ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy
93 Should Be Equal ${currentPolicy} ${policy}
94
George Keishingd5123f72016-12-07 09:54:51 -060095
96Trigger Warm Reset via Reboot
97 [Documentation] Execute reboot command on the remote BMC and
98 ... returns immediately. This keyword "Start Command"
99 ... returns nothing and does not wait for the command
100 ... execution to be finished.
101 Open Connection And Log In
102
103 Start Command /sbin/reboot