1*** 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... Power cycle system via PDU if specified 11... Prune archived journal logs 12 13Resource ../lib/boot/boot_resource_master.robot 14Resource ../lib/utils.robot 15Resource ../lib/pdu/pdu.robot 16 17*** Variables *** 18${HOST_SETTING} /org/openbmc/settings/host0 19 20*** Test Cases *** 21 22Get to Stable State 23 [Documentation] BMC cleanup drive to stable state 24 ... 1. PDU powercycle if specified 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 35 Run Keyword And Ignore Error Powercycle System Via PDU 36 37 Wait For Host To Ping ${OPENBMC_HOST} 1 mins 38 Open Connection And Log In host=${OPENBMC_HOST} 39 40 ${l_rest}= Run Keyword And Return Status 41 ... Initialize OpenBMC 42 Run Keyword If '${l_rest}' == '${False}' 43 ... Reboot and Wait for BMC Online 44 45 ${l_ready}= Run Keyword And Return Status 46 ... Get BMC State and Expect Standby 47 48 Run Keyword If '${l_ready}' == '${False}' 49 ... Initiate Power Off 50 51 Prune Journal Log 52 53 Run Keyword And Ignore Error 54 ... Update Policy Setting RESTORE_LAST_STATE 55 56 57*** Keywords *** 58 59Reboot 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 70BMC Online Test 71 [Documentation] BMC ping, SSH, REST connection Test 72 73 ${l_status}= Run Keyword and Return Status 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 79Wait 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 87Get 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 95Update Policy Setting 96 [Documentation] Update the given restore policy 97 [Arguments] ${policy} 98 99 ${valueDict}= create dictionary data=${policy} 100 Write Attribute ${HOST_SETTING} power_policy data=${valueDict} 101 ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy 102 Should Be Equal ${currentPolicy} ${policy} 103 104 105Trigger 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 113 114 115Powercycle 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 123Validate 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} 129