George Keishing | b88df3d | 2017-01-10 07:28:08 -0600 | [diff] [blame] | 1 | *** Settings *** |
George Keishing | bec365b | 2017-01-19 01:28:41 -0600 | [diff] [blame] | 2 | Resource ../lib/utils.robot |
| 3 | Variables ../data/variables.py |
George Keishing | b88df3d | 2017-01-10 07:28:08 -0600 | [diff] [blame] | 4 | |
| 5 | *** Variables *** |
| 6 | |
George Keishing | b88df3d | 2017-01-10 07:28:08 -0600 | [diff] [blame] | 7 | ${QUIET} ${0} |
| 8 | |
| 9 | *** Keywords *** |
| 10 | |
| 11 | Initiate Host Boot |
| 12 | [Documentation] Initiate host power on. |
| 13 | ${args}= Create Dictionary data=${HOST_POWERON_TRANS} |
| 14 | Write Attribute |
| 15 | ... ${HOST_STATE_URI} RequestedHostTransition data=${args} |
| 16 | |
| 17 | Wait Until Keyword Succeeds |
| 18 | ... 10 min 10 sec Is Host Running |
| 19 | |
| 20 | |
| 21 | Initiate Host PowerOff |
| 22 | [Documentation] Initiate host power off. |
| 23 | ${args}= Create Dictionary data=${HOST_POWEROFF_TRANS} |
| 24 | Write Attribute |
| 25 | ... ${HOST_STATE_URI} RequestedHostTransition data=${args} |
| 26 | |
| 27 | Wait Until Keyword Succeeds |
| 28 | ... 3 min 10 sec Is Host Off |
| 29 | |
| 30 | |
| 31 | Is Host Running |
| 32 | [Documentation] Check if Chassis and Host state is ON. |
| 33 | ${power_state}= Get Chassis Power State |
George Keishing | 59d6cb4 | 2017-01-19 08:26:03 -0600 | [diff] [blame] | 34 | Should Be Equal On ${power_state} |
George Keishing | b88df3d | 2017-01-10 07:28:08 -0600 | [diff] [blame] | 35 | ${host_state}= Get Host State |
George Keishing | 59d6cb4 | 2017-01-19 08:26:03 -0600 | [diff] [blame] | 36 | Should Be Equal Running ${host_state} |
George Keishing | b88df3d | 2017-01-10 07:28:08 -0600 | [diff] [blame] | 37 | |
| 38 | |
| 39 | Is Host Off |
| 40 | [Documentation] Check if Chassis and Host state is OFF. |
| 41 | ${power_state}= Get Chassis Power State |
George Keishing | 59d6cb4 | 2017-01-19 08:26:03 -0600 | [diff] [blame] | 42 | Should Be Equal Off ${power_state} |
George Keishing | b88df3d | 2017-01-10 07:28:08 -0600 | [diff] [blame] | 43 | ${host_state}= Get Host State |
George Keishing | 59d6cb4 | 2017-01-19 08:26:03 -0600 | [diff] [blame] | 44 | Should Be Equal Off ${host_state} |
George Keishing | b88df3d | 2017-01-10 07:28:08 -0600 | [diff] [blame] | 45 | |
| 46 | |
| 47 | Get Host State |
| 48 | [Documentation] Return the state of the host as a string. |
| 49 | [Arguments] ${quiet}=${QUIET} |
| 50 | # quiet - Suppress REST output logging to console. |
| 51 | ${state}= |
| 52 | ... Read Attribute ${HOST_STATE_URI} CurrentHostState |
| 53 | ... quiet=${quiet} |
George Keishing | 59d6cb4 | 2017-01-19 08:26:03 -0600 | [diff] [blame] | 54 | [Return] ${state.rsplit('.', 1)[1]} |
George Keishing | b88df3d | 2017-01-10 07:28:08 -0600 | [diff] [blame] | 55 | |
| 56 | |
| 57 | Get Chassis Power State |
| 58 | [Documentation] Return the power state of the Chassis |
| 59 | ... as a string. |
| 60 | [Arguments] ${quiet}=${QUIET} |
| 61 | # quiet - Suppress REST output logging to console. |
| 62 | ${state}= |
| 63 | ... Read Attribute ${CHASSIS_STATE_URI} CurrentPowerState |
| 64 | ... quiet=${quiet} |
George Keishing | 59d6cb4 | 2017-01-19 08:26:03 -0600 | [diff] [blame] | 65 | [Return] ${state.rsplit('.', 1)[1]} |