blob: ada66dd66e895cd589e233bf5cfeb094e2ea4ca7 [file] [log] [blame]
George Keishingb88df3d2017-01-10 07:28:08 -06001*** Settings ***
2Resource ../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
28Initiate 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
38Initiate 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
48Is Host Running
49 [Documentation] Check if Chassis and Host state is ON.
50 ${power_state}= Get Chassis Power State
George Keishing59d6cb42017-01-19 08:26:03 -060051 Should Be Equal On ${power_state}
George Keishingb88df3d2017-01-10 07:28:08 -060052 ${host_state}= Get Host State
George Keishing59d6cb42017-01-19 08:26:03 -060053 Should Be Equal Running ${host_state}
George Keishingb88df3d2017-01-10 07:28:08 -060054
55
56Is Host Off
57 [Documentation] Check if Chassis and Host state is OFF.
58 ${power_state}= Get Chassis Power State
George Keishing59d6cb42017-01-19 08:26:03 -060059 Should Be Equal Off ${power_state}
George Keishingb88df3d2017-01-10 07:28:08 -060060 ${host_state}= Get Host State
George Keishing59d6cb42017-01-19 08:26:03 -060061 Should Be Equal Off ${host_state}
George Keishingb88df3d2017-01-10 07:28:08 -060062
63
64Get 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}
George Keishing59d6cb42017-01-19 08:26:03 -060071 [Return] ${state.rsplit('.', 1)[1]}
George Keishingb88df3d2017-01-10 07:28:08 -060072
73
74Get 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}
George Keishing59d6cb42017-01-19 08:26:03 -060082 [Return] ${state.rsplit('.', 1)[1]}