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