Added keyword to initiate and check host reboot.
This change includes:
- Added keyword to initiate and check host reboot
using new xyz interface.
- Seperated keyword for host and chassis state check.
This is required as host and chassis state does not
always match e.g. host reboot.
- Added a keyword to check host's transition state.
Resolves openbmc/openbmc-test-automation#350
Change-Id: I8f7b0a037122eba6209c7d23032d8155939d9cdf
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/data/variables.py b/data/variables.py
index a597165..14c2a46 100644
--- a/data/variables.py
+++ b/data/variables.py
@@ -22,6 +22,7 @@
HOST_POWEROFF_TRANS = 'xyz.openbmc_project.State.Host.Transition.Off'
HOST_POWERON_TRANS = 'xyz.openbmc_project.State.Host.Transition.On'
+HOST_REBOOT_TRANS = 'xyz.openbmc_project.State.Host.Transition.Reboot'
HOST_POWEROFF_STATE = 'xyz.openbmc_project.State.Host.HostState.Off'
HOST_POWERON_STATE = 'xyz.openbmc_project.State.Host.HostState.Running'
diff --git a/lib/state_manager.robot b/lib/state_manager.robot
index d5bf4ee..440bc48 100755
--- a/lib/state_manager.robot
+++ b/lib/state_manager.robot
@@ -33,21 +33,46 @@
... 3 min 10 sec Is Host Off
+Initiate Host Reboot
+ [Documentation] Initiate host reboot via REST.
+
+ ${args}= Create Dictionary data=${HOST_REBOOT_TRANS}
+ Write Attribute
+ ... ${HOST_STATE_URI} RequestedHostTransition data=${args}
+ Is Host Rebooted
+
+
Is Host Running
- [Documentation] Check if Chassis and Host state is ON.
- ${power_state}= Get Chassis Power State
- Should Be Equal On ${power_state}
+ [Documentation] Check if host state is "Running".
${host_state}= Get Host State
Should Be Equal Running ${host_state}
Is Host Off
- [Documentation] Check if Chassis and Host state is OFF.
- ${power_state}= Get Chassis Power State
- Should Be Equal Off ${power_state}
+ [Documentation] Check if host state is "Off".
${host_state}= Get Host State
Should Be Equal Off ${host_state}
+
+Is Host Rebooted
+ [Documentation] Checks if host rebooted.
+
+ ${host_trans_state}= Get Host Trans State
+ Should Be Equal ${host_trans_state} Reboot
+ Is Host Running
+
+
+Is Chassis On
+ [Documentation] Check if chassis state is "On".
+ ${power_state}= Get Chassis Power State
+ Should Be Equal On ${power_state}
+
+
+Is Chassis Off
+ [Documentation] Check if chassis state is "Off".
+ ${power_state}= Get Chassis Power State
+ Should Be Equal Off ${power_state}
+
Is Host Quiesced
[Documentation] Check if host state is quiesced.
${host_state}= Get Host State
@@ -66,6 +91,17 @@
... quiet=${quiet}
[Return] ${state.rsplit('.', 1)[1]}
+Get Host Trans State
+ [Documentation] Return the transition state of host as a string.
+ ... e.g. On, Off, Reboot
+ [Arguments] ${quiet}=${QUIET}
+ # Description of arguments:
+ # quiet Suppress REST output logging to console.
+
+ ${state}=
+ ... Read Attribute ${HOST_STATE_URI} RequestedHostTransition
+ ... quiet=${quiet}
+ [Return] ${state.rsplit('.', 1)[1]}
Get Chassis Power State
[Documentation] Return the power state of the Chassis