blob: 798e0dec71cbf06bf040e0fb77d75272c04d3629 [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
Gunnar Mills7c8923f2016-12-12 21:19:52 -060019*** Test Cases ***
George Keishing78ea2dc2016-11-18 04:33:45 -060020
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
George Keishing75400562016-12-13 06:11:19 -060050 Run Keyword And Ignore Error
51 ... Update Policy Setting RESTORE_LAST_STATE
George Keishing78ea2dc2016-11-18 04:33:45 -060052
53
54*** Keywords ***
55
56Reboot and Wait for BMC Online
57 [Documentation] Reboot BMC and wait for it to come online
58 ... and boot to standby
59
60 Trigger Warm Reset via Reboot
61 Wait Until Keyword Succeeds
62 ... 5 min 10 sec BMC Online Test
63
64 Wait For BMC Standby
65
66
67BMC Online Test
68 [Documentation] BMC ping, SSH, REST connection Test
69
Gunnar Mills597ffa02016-12-06 11:26:53 -060070 ${l_status}= Run Keyword and Return Status
George Keishing78ea2dc2016-11-18 04:33:45 -060071 ... Verify Ping and REST Authentication
72 Run Keyword If '${l_status}' == '${False}'
73 ... Fail msg=System not in ideal state to continue [ERROR]
74
75
76Wait For BMC Standby
77 [Documentation] Wait Until BMC standby post BMC reboot
78
79 @{states}= Create List BMC_READY HOST_POWERED_OFF
80 Wait Until Keyword Succeeds
81 ... 10 min 10 sec Verify BMC State ${states}
82
83
84Get BMC State and Expect Standby
85 [Documentation] Get BMC state and should be at standby
86
87 @{states}= Create List BMC_READY HOST_POWERED_OFF
88 ${bmc_state}= Get BMC State
89 Should Contain ${states} ${bmc_state}
90
91
92Update Policy Setting
93 [Documentation] Update the given restore policy
Gunnar Mills38032802016-12-12 13:43:40 -060094 [Arguments] ${policy}
George Keishing78ea2dc2016-11-18 04:33:45 -060095
Gunnar Mills597ffa02016-12-06 11:26:53 -060096 ${valueDict}= create dictionary data=${policy}
George Keishing78ea2dc2016-11-18 04:33:45 -060097 Write Attribute ${HOST_SETTING} power_policy data=${valueDict}
98 ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy
99 Should Be Equal ${currentPolicy} ${policy}
100
George Keishingd5123f72016-12-07 09:54:51 -0600101
102Trigger Warm Reset via Reboot
103 [Documentation] Execute reboot command on the remote BMC and
104 ... returns immediately. This keyword "Start Command"
105 ... returns nothing and does not wait for the command
106 ... execution to be finished.
107 Open Connection And Log In
108
109 Start Command /sbin/reboot
George Keishing34d4b8d2016-12-07 08:35:29 -0600110
111
112Powercycle System Via PDU
113 [Documentation] AC cycle the system via PDU
114
115 Validate Parameters
116 PDU Power Cycle
117 Check If BMC is Up 5 min 10 sec
118
119
120Validate Parameters
121 Should Not Be Empty ${PDU_IP}
122 Should Not Be Empty ${PDU_TYPE}
123 Should Not Be Empty ${PDU_SLOT_NO}
124 Should Not Be Empty ${PDU_USERNAME}
125 Should Not Be Empty ${PDU_PASSWORD}