lib: state_manager: support x86 platform get OperatingSystemState attribute
Symptom:
When host CPU based on the x86 architecture, the attribute OperatingSystemState
cannot get correctly then cause test case got failed.
Root cause:
Based on x86 architecture, using x86-power-control to manager host power
operation that add OS state interface at "/xyz/openbmc_project/state/os"
this object path. However, "Get Host State Attribute" keyword in
state_manager.robot always using "/xyz/openbmc_project/state/host0" by default.
Thus, cause this OperatingSystemState attribute cannot be found.
x86-power-control:
// OS State Interface
osIface = osServer.add_interface(
"/xyz/openbmc_project/state/os",
"xyz.openbmc_project.State.OperatingSystem.Status");
openbmc-test-automation/data/variables.py:
HOST_STATE_URI = /xyz/openbmc_project/state/host0/
Solution:
Add support x86 platform to get OperatingSystemState attribute.
Tested:
Run keyword "Is OS Booted" with -v PLATFORM_ARCH_TYPE:x86
${HOST_STATE_URI} = /xyz/openbmc_project/state/os/
Run keyword "Is OS Booted" with -v PLATFORM_ARCH_TYPE:power
${HOST_STATE_URI} = /xyz/openbmc_project/state/host0/
Related commit:
Suggest Automation test should be adjusted to match the design in this case.
https://gerrit.openbmc-project.xyz/c/openbmc/smbios-mdr/+/51691
Signed-off-by: Tim Lee <timlee660101@gmail.com>
Change-Id: If263c41c45baba0b3901d645f6e139970b3e51d0
diff --git a/data/variables.py b/data/variables.py
index 06271fe..6d15860 100755
--- a/data/variables.py
+++ b/data/variables.py
@@ -45,6 +45,9 @@
CHASSIS_STATE_URI = OPENBMC_BASE_URI + 'state/chassis0/'
HOST_WATCHDOG_URI = OPENBMC_BASE_URI + 'watchdog/host0/'
+# OS state for x86 architecture
+OS_STATE_URI = OPENBMC_BASE_URI + 'state/os/'
+
# Logging URI variables
BMC_LOGGING_URI = OPENBMC_BASE_URI + 'logging/'
BMC_LOGGING_ENTRY = BMC_LOGGING_URI + 'entry/'
diff --git a/lib/state_manager.robot b/lib/state_manager.robot
index 66df12d..b2fc6b5 100755
--- a/lib/state_manager.robot
+++ b/lib/state_manager.robot
@@ -113,6 +113,9 @@
# host_attribute Host attribute name.
# quiet Suppress REST output logging to console.
+ ${HOST_STATE_URI}= Set Variable If '${PLATFORM_ARCH_TYPE}' == 'x86' and '${host_attribute}' == 'OperatingSystemState'
+ ... ${OS_STATE_URI} ${HOST_STATE_URI}
+
${state}=
... Read Attribute ${HOST_STATE_URI} ${host_attribute} quiet=${quiet}
[Return] ${state}