blob: 3e17fc08a355de8dd210260b02ea43b3e0c2976d [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"
George Keishing34d4b8d2016-12-07 08:35:29 -060010... Power cycle system via PDU if specified
George Keishing78ea2dc2016-11-18 04:33:45 -060011
12Resource ../lib/boot/boot_resource_master.robot
13Resource ../lib/utils.robot
George Keishing34d4b8d2016-12-07 08:35:29 -060014Resource ../lib/pdu/pdu.robot
George Keishing78ea2dc2016-11-18 04:33:45 -060015
16*** Variables ***
17${HOST_SETTING} /org/openbmc/settings/host0
18
19*** Test cases ***
20
21Get to Stable State
22 [Documentation] BMC cleanup drive to stable state
George Keishing34d4b8d2016-12-07 08:35:29 -060023 ... 1. PDU powercycle if specified
George Keishing78ea2dc2016-11-18 04:33:45 -060024 ... 1. Ping Test
25 ... 2. SSH Connection session Test
26 ... 3. REST Connection session Test
27 ... 4. Reboot BMC if REST Test failed
28 ... 5. Check BMC state for standby
29 ... 6. Issue poweroff if not already in
30 ... standby state
31 ... 7. Update restore policy
32 [Tags] Get to Stable State
33
George Keishing34d4b8d2016-12-07 08:35:29 -060034 Run Keyword And Ignore Error Powercycle System Via PDU
35
George Keishing78ea2dc2016-11-18 04:33:45 -060036 Wait For Host To Ping ${OPENBMC_HOST} 1 mins
37 Open Connection And Log In host=${OPENBMC_HOST}
38
Gunnar Mills597ffa02016-12-06 11:26:53 -060039 ${l_rest}= Run Keyword And Return Status
George Keishing78ea2dc2016-11-18 04:33:45 -060040 ... Initialize OpenBMC
41 Run Keyword If '${l_rest}' == '${False}'
42 ... Reboot and Wait for BMC Online
43
Gunnar Mills597ffa02016-12-06 11:26:53 -060044 ${l_ready}= Run Keyword And Return Status
George Keishing78ea2dc2016-11-18 04:33:45 -060045 ... Get BMC State and Expect Standby
46
47 Run Keyword If '${l_ready}' == '${False}'
48 ... Initiate Power Off
49
50 Update Policy Setting RESTORE_LAST_STATE
51
52
53*** Keywords ***
54
55Reboot and Wait for BMC Online
56 [Documentation] Reboot BMC and wait for it to come online
57 ... and boot to standby
58
59 Trigger Warm Reset via Reboot
60 Wait Until Keyword Succeeds
61 ... 5 min 10 sec BMC Online Test
62
63 Wait For BMC Standby
64
65
66BMC Online Test
67 [Documentation] BMC ping, SSH, REST connection Test
68
Gunnar Mills597ffa02016-12-06 11:26:53 -060069 ${l_status}= Run Keyword and Return Status
George Keishing78ea2dc2016-11-18 04:33:45 -060070 ... Verify Ping and REST Authentication
71 Run Keyword If '${l_status}' == '${False}'
72 ... Fail msg=System not in ideal state to continue [ERROR]
73
74
75Wait For BMC Standby
76 [Documentation] Wait Until BMC standby post BMC reboot
77
78 @{states}= Create List BMC_READY HOST_POWERED_OFF
79 Wait Until Keyword Succeeds
80 ... 10 min 10 sec Verify BMC State ${states}
81
82
83Get BMC State and Expect Standby
84 [Documentation] Get BMC state and should be at standby
85
86 @{states}= Create List BMC_READY HOST_POWERED_OFF
87 ${bmc_state}= Get BMC State
88 Should Contain ${states} ${bmc_state}
89
90
91Update Policy Setting
92 [Documentation] Update the given restore policy
93 [arguments] ${policy}
94
Gunnar Mills597ffa02016-12-06 11:26:53 -060095 ${valueDict}= create dictionary data=${policy}
George Keishing78ea2dc2016-11-18 04:33:45 -060096 Write Attribute ${HOST_SETTING} power_policy data=${valueDict}
97 ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy
98 Should Be Equal ${currentPolicy} ${policy}
99
George Keishingd5123f72016-12-07 09:54:51 -0600100
101Trigger Warm Reset via Reboot
102 [Documentation] Execute reboot command on the remote BMC and
103 ... returns immediately. This keyword "Start Command"
104 ... returns nothing and does not wait for the command
105 ... execution to be finished.
106 Open Connection And Log In
107
108 Start Command /sbin/reboot
George Keishing34d4b8d2016-12-07 08:35:29 -0600109
110
111Powercycle System Via PDU
112 [Documentation] AC cycle the system via PDU
113
114 Validate Parameters
115 PDU Power Cycle
116 Check If BMC is Up 5 min 10 sec
117
118
119Validate Parameters
120 Should Not Be Empty ${PDU_IP}
121 Should Not Be Empty ${PDU_TYPE}
122 Should Not Be Empty ${PDU_SLOT_NO}
123 Should Not Be Empty ${PDU_USERNAME}
124 Should Not Be Empty ${PDU_PASSWORD}