State Manager reset power policy
Power policy drives whether the host is going to stay Off or Running.
Resolves openbmc/openbmc-test-automation#327
Change-Id: I4e8f8c18b83bfe01869db507039a2fa9e5552bdf
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/state_map.py b/lib/state_map.py
index 586b829..e0f30a1 100644
--- a/lib/state_map.py
+++ b/lib/state_map.py
@@ -14,9 +14,13 @@
VALID_STATES = {
'reboot':
{
- # (BMC state, Chassis State, Host State)
- ('Ready','Off','Off'),
- ('Ready','On','Running'),
+ # (Power Policy, BMC state, Chassis State, Host State)
+ ('LEAVE_OFF','Ready','Off','Off'),
+ ('ALWAYS_POWER_ON','Ready','On','Running'),
+ ('ALWAYS_POWER_ON','Ready','On','Off'),
+ ('RESTORE_LAST_STATE','Ready','On','Running'),
+ ('RESTORE_LAST_STATE','Ready','On','Off'),
+ ('RESTORE_LAST_STATE','Ready','Off','Off'),
},
}
@@ -25,12 +29,17 @@
def get_system_state(self):
r"""
- Return the system state as a tuple of bmc, chassis and host states.
+ Return the system state as a tuple of power policy, bmc, chassis and
+ host states.
"""
+ power_policy = BuiltIn().run_keyword('Get System Power Policy')
bmc_state = BuiltIn().run_keyword('Get BMC State')
chassis_state = BuiltIn().run_keyword('Get Chassis Power State')
host_state = BuiltIn().run_keyword('Get Host State')
- return (bmc_state, chassis_state, host_state)
+ return (str(power_policy),
+ str(bmc_state),
+ str(chassis_state),
+ str(host_state))
def valid_boot_state(self, boot_type, state_set):
r"""
diff --git a/lib/utils.robot b/lib/utils.robot
index 0ac02f8..a5bb0b9 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -569,6 +569,10 @@
${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy
Should Be Equal ${currentPolicy} ${policy}
+Get System Power Policy
+ [Documentation] Get the BMC power policy.
+ ${currentPolicy}= Read Attribute ${HOST_SETTING} power_policy
+ [Return] ${currentPolicy}
Set BMC Reset Reference Time
[Documentation] Set current boot time as a reference and increment