blob: 0ff1456d1ede938479381d6dce428179ac0f45df [file] [log] [blame]
George Keishingb88df3d2017-01-10 07:28:08 -06001*** Settings ***
George Keishingbec365b2017-01-19 01:28:41 -06002Resource ../lib/utils.robot
3Variables ../data/variables.py
George Keishingb88df3d2017-01-10 07:28:08 -06004
5*** Variables ***
6
George Keishingb88df3d2017-01-10 07:28:08 -06007${QUIET} ${0}
8
9*** Keywords ***
10
11Initiate 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
21Initiate 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
31Is Host Running
32 [Documentation] Check if Chassis and Host state is ON.
33 ${power_state}= Get Chassis Power State
George Keishing59d6cb42017-01-19 08:26:03 -060034 Should Be Equal On ${power_state}
George Keishingb88df3d2017-01-10 07:28:08 -060035 ${host_state}= Get Host State
George Keishing59d6cb42017-01-19 08:26:03 -060036 Should Be Equal Running ${host_state}
George Keishingb88df3d2017-01-10 07:28:08 -060037
38
39Is Host Off
40 [Documentation] Check if Chassis and Host state is OFF.
41 ${power_state}= Get Chassis Power State
George Keishing59d6cb42017-01-19 08:26:03 -060042 Should Be Equal Off ${power_state}
George Keishingb88df3d2017-01-10 07:28:08 -060043 ${host_state}= Get Host State
George Keishing59d6cb42017-01-19 08:26:03 -060044 Should Be Equal Off ${host_state}
George Keishingb88df3d2017-01-10 07:28:08 -060045
46
47Get 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 Keishing59d6cb42017-01-19 08:26:03 -060054 [Return] ${state.rsplit('.', 1)[1]}
George Keishingb88df3d2017-01-10 07:28:08 -060055
56
57Get 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 Keishing59d6cb42017-01-19 08:26:03 -060065 [Return] ${state.rsplit('.', 1)[1]}