George Keishing | 78ea2dc | 2016-11-18 04:33:45 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation 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 | |
| 11 | Resource ../lib/boot/boot_resource_master.robot |
| 12 | Resource ../lib/utils.robot |
| 13 | |
| 14 | *** Variables *** |
| 15 | ${HOST_SETTING} /org/openbmc/settings/host0 |
| 16 | |
| 17 | *** Test cases *** |
| 18 | |
| 19 | Get 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 Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 34 | ${l_rest}= Run Keyword And Return Status |
George Keishing | 78ea2dc | 2016-11-18 04:33:45 -0600 | [diff] [blame] | 35 | ... Initialize OpenBMC |
| 36 | Run Keyword If '${l_rest}' == '${False}' |
| 37 | ... Reboot and Wait for BMC Online |
| 38 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 39 | ${l_ready}= Run Keyword And Return Status |
George Keishing | 78ea2dc | 2016-11-18 04:33:45 -0600 | [diff] [blame] | 40 | ... 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 | |
| 50 | Reboot 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 | |
| 61 | BMC Online Test |
| 62 | [Documentation] BMC ping, SSH, REST connection Test |
| 63 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 64 | ${l_status}= Run Keyword and Return Status |
George Keishing | 78ea2dc | 2016-11-18 04:33:45 -0600 | [diff] [blame] | 65 | ... 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 | |
| 70 | Wait 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 | |
| 78 | Get 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 | |
| 86 | Update Policy Setting |
| 87 | [Documentation] Update the given restore policy |
| 88 | [arguments] ${policy} |
| 89 | |
Gunnar Mills | 597ffa0 | 2016-12-06 11:26:53 -0600 | [diff] [blame] | 90 | ${valueDict}= create dictionary data=${policy} |
George Keishing | 78ea2dc | 2016-11-18 04:33:45 -0600 | [diff] [blame] | 91 | Write Attribute ${HOST_SETTING} power_policy data=${valueDict} |
| 92 | ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy |
| 93 | Should Be Equal ${currentPolicy} ${policy} |
| 94 | |
George Keishing | d5123f7 | 2016-12-07 09:54:51 -0600 | [diff] [blame] | 95 | |
| 96 | Trigger 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 |