Add support for x86 architecture in a state map file
Remove 'BootProgress' and 'OperatingSystem' states from the
'VALID_BOOT_STATES' table for x86 as these interfaces currently
aren't properly supported on this architecture.
Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Change-Id: I6b2914ccd082adf1d0c2869b1ef0314344ae9a61
diff --git a/lib/state_map.py b/lib/state_map.py
index a54ea6b..ae64af5 100644
--- a/lib/state_map.py
+++ b/lib/state_map.py
@@ -22,6 +22,8 @@
BuiltIn().import_resource("state_manager.robot")
BuiltIn().import_resource("rest_client.robot")
+platform_arch_type = BuiltIn().get_variable_value("${PLATFORM_ARCH_TYPE}", default="power")
+
# We will build eventually the mapping for warm, cold reset as well.
VALID_STATES = {
'reboot':
@@ -95,6 +97,22 @@
},
}
+if platform_arch_type == "x86":
+ VALID_BOOT_STATES_X86 = {}
+ for state_name, state_set in VALID_BOOT_STATES.items():
+ VALID_BOOT_STATES_X86[state_name] = set()
+ for state_tuple in state_set:
+ state_tuple_new = tuple(
+ x
+ for x in state_tuple
+ if not (
+ x.startswith("xyz.openbmc_project.State.Boot.Progress")
+ or x.startswith("xyz.openbmc_project.State.OperatingSystem")
+ )
+ )
+ VALID_BOOT_STATES_X86[state_name].add(state_tuple_new)
+ VALID_BOOT_STATES = VALID_BOOT_STATES_X86
+
class state_map():
@@ -110,15 +128,20 @@
chassis_state = \
state[var.SYSTEM_STATE_URI + 'chassis0']['CurrentPowerState']
host_state = state[var.SYSTEM_STATE_URI + 'host0']['CurrentHostState']
- boot_state = state[var.SYSTEM_STATE_URI + 'host0']['BootProgress']
- os_state = \
- state[var.SYSTEM_STATE_URI + 'host0']['OperatingSystemState']
+ if platform_arch_type == "x86":
+ return (str(bmc_state),
+ str(chassis_state),
+ str(host_state))
+ else:
+ boot_state = state[var.SYSTEM_STATE_URI + 'host0']['BootProgress']
+ os_state = \
+ state[var.SYSTEM_STATE_URI + 'host0']['OperatingSystemState']
- return (str(bmc_state),
- str(chassis_state),
- str(host_state),
- str(boot_state),
- str(os_state))
+ return (str(bmc_state),
+ str(chassis_state),
+ str(host_state),
+ str(boot_state),
+ str(os_state))
def valid_boot_state(self, boot_type, state_set):
r"""