OS boot progress and status changes
Resolves openbmc/openbmc-test-automation#842
Change-Id: Ibebc212bceb89aa22b3dbf2a84ce58396fde8156
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/data/variables.py b/data/variables.py
index e975b35..4a7c8dd 100644
--- a/data/variables.py
+++ b/data/variables.py
@@ -75,6 +75,12 @@
DUMP_URI = '/xyz/openbmc_project/dump/'
DUMP_ENTRY_URI = DUMP_URI + 'entry/'
+# Boot progress variables.
+STATE_DBUS_BASE = 'xyz.openbmc_project.State.'
+OS_BOOT_START = STATE_DBUS_BASE + 'Boot.Progress.ProgressStages.OSStart'
+OS_BOOT_OFF = STATE_DBUS_BASE + 'Boot.Progress.ProgressStages.Unspecified'
+OS_BOOT_COMPLETE = STATE_DBUS_BASE + 'OperatingSystem.Status.OSStatus.BootComplete'
+
'''
QEMU HTTPS variable:
diff --git a/lib/state_manager.robot b/lib/state_manager.robot
index 33ce170..60d55ba 100755
--- a/lib/state_manager.robot
+++ b/lib/state_manager.robot
@@ -67,7 +67,43 @@
${host_state}= Get Host State
Should Be Equal Running ${host_state}
# Check to verify that the host is really booted.
- Is OS Starting
+ Is OS Booted
+
+
+Get Host State Attribute
+ [Documentation] Return the state of the host as a string.
+ [Arguments] ${host_attribute} ${quiet}=${QUIET}
+
+ # Description of argument(s):
+ # host_attribute Host attribute name.
+ # quiet Suppress REST output logging to console.
+
+ ${state}=
+ ... Read Attribute ${HOST_STATE_URI} ${host_attribute} quiet=${quiet}
+ [Return] ${state}
+
+
+Is OS Booted
+ [Documentation] Check OS status.
+
+ # Example:
+ # "/xyz/openbmc_project/state/host0": {
+ # "AttemptsLeft": 0,
+ # "BootProgress": "xyz.openbmc_project.State.Boot.Progress.ProgressStages.OSStart",
+ # "CurrentHostState": "xyz.openbmc_project.State.Host.HostState.Running",
+ # "OperatingSystemState": "xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.BootComplete",
+ # "RequestedHostTransition": "xyz.openbmc_project.State.Host.Transition.On"
+ # }
+
+ # TODO: Remove this logic once migration is complete.
+ ${status}= Run Keyword And Return Status Is OS Starting
+ Return From Keyword If '${status}' == '${True}' ${True}
+
+ ${boot_stage}= Get Host State Attribute BootProgress
+ Should Be Equal ${OS_BOOT_START} ${boot_stage}
+
+ ${os_state}= Get Host State Attribute OperatingSystemState
+ Should Be Equal ${OS_BOOT_COMPLETE} ${os_state}
Is Host Off