George Keishing | b88df3d | 2017-01-10 07:28:08 -0600 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Resource ../lib/utils.robot |
| 3 | |
| 4 | *** Variables *** |
| 5 | |
| 6 | # Once the State Manager support is ready remove this variables block |
| 7 | # and use appropriate resource or variable file imports |
| 8 | |
| 9 | # State Manager States |
| 10 | ${HOST_POWEROFF_TRANS} xyz.openbmc_project.State.Host.Transition.Off |
| 11 | ${HOST_POWERON_TRANS} xyz.openbmc_project.State.Host.Transition.On |
| 12 | ${HOST_POWEROFF_STATE} xyz.openbmc_project.State.Host.HostState.Off |
| 13 | ${HOST_POWERON_STATE} xyz.openbmc_project.State.Host.HostState.Running |
| 14 | |
| 15 | ${CHASSIS_POWEROFF_TRANS} xyz.openbmc_project.State.Chassis.Transition.Off |
| 16 | ${CHASSIS_POWERON_TRANS} xyz.openbmc_project.State.Chassis.Transition.On |
| 17 | ${CHASSIS_POWEROFF_STATE} xyz.openbmc_project.State.Chassis.PowerState.Off |
| 18 | ${CHASSIS_POWERON_STATE} xyz.openbmc_project.State.Chassis.PowerState.On |
| 19 | |
| 20 | # State Manager URI's |
| 21 | ${HOST_STATE_URI} /xyz/openbmc_project/state/host0/ |
| 22 | ${CHASSIS_STATE_URI} /xyz/openbmc_project/state/chassis0/ |
| 23 | |
| 24 | ${QUIET} ${0} |
| 25 | |
| 26 | *** Keywords *** |
| 27 | |
| 28 | Initiate Host Boot |
| 29 | [Documentation] Initiate host power on. |
| 30 | ${args}= Create Dictionary data=${HOST_POWERON_TRANS} |
| 31 | Write Attribute |
| 32 | ... ${HOST_STATE_URI} RequestedHostTransition data=${args} |
| 33 | |
| 34 | Wait Until Keyword Succeeds |
| 35 | ... 10 min 10 sec Is Host Running |
| 36 | |
| 37 | |
| 38 | Initiate Host PowerOff |
| 39 | [Documentation] Initiate host power off. |
| 40 | ${args}= Create Dictionary data=${HOST_POWEROFF_TRANS} |
| 41 | Write Attribute |
| 42 | ... ${HOST_STATE_URI} RequestedHostTransition data=${args} |
| 43 | |
| 44 | Wait Until Keyword Succeeds |
| 45 | ... 3 min 10 sec Is Host Off |
| 46 | |
| 47 | |
| 48 | Is Host Running |
| 49 | [Documentation] Check if Chassis and Host state is ON. |
| 50 | ${power_state}= Get Chassis Power State |
| 51 | Should Be Equal ${CHASSIS_POWERON_STATE} ${power_state} |
| 52 | ${host_state}= Get Host State |
| 53 | Should Be Equal ${HOST_POWERON_STATE} ${host_state} |
| 54 | |
| 55 | |
| 56 | Is Host Off |
| 57 | [Documentation] Check if Chassis and Host state is OFF. |
| 58 | ${power_state}= Get Chassis Power State |
| 59 | Should Be Equal ${CHASSIS_POWEROFF_STATE} ${power_state} |
| 60 | ${host_state}= Get Host State |
| 61 | Should Be Equal ${HOST_POWEROFF_STATE} ${host_state} |
| 62 | |
| 63 | |
| 64 | Get Host State |
| 65 | [Documentation] Return the state of the host as a string. |
| 66 | [Arguments] ${quiet}=${QUIET} |
| 67 | # quiet - Suppress REST output logging to console. |
| 68 | ${state}= |
| 69 | ... Read Attribute ${HOST_STATE_URI} CurrentHostState |
| 70 | ... quiet=${quiet} |
| 71 | [Return] ${state} |
| 72 | |
| 73 | |
| 74 | Get Chassis Power State |
| 75 | [Documentation] Return the power state of the Chassis |
| 76 | ... as a string. |
| 77 | [Arguments] ${quiet}=${QUIET} |
| 78 | # quiet - Suppress REST output logging to console. |
| 79 | ${state}= |
| 80 | ... Read Attribute ${CHASSIS_STATE_URI} CurrentPowerState |
| 81 | ... quiet=${quiet} |
| 82 | [Return] ${state} |