Update Redfish PowerRestore policy test suites
Changes:
- Update to Redfish variables and kewyords needed.
- Add Redfish state in state mapping.
- Add new keyword to do ping , SSH and Redfish auth.
Change-Id: Ia143125f01a2fb1e5ea77c4080b52ec92576ef87
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/state_map.py b/lib/state_map.py
index 7e7b504..908b159 100644
--- a/lib/state_map.py
+++ b/lib/state_map.py
@@ -97,6 +97,58 @@
),
},
}
+REDFISH_VALID_BOOT_STATES = {
+ 'Off': # Valid states when Host is Off.
+ {
+ # (BMC , Chassis , Host , BootProgress)
+ (
+ "Enabled",
+ "Off",
+ "Disabled",
+ "None",
+ ),
+ },
+ 'Reboot': # Valid states when BMC reset to standby.
+ {
+ # (BMC , Chassis , Host , BootProgress)
+ (
+ "Enabled",
+ "Off",
+ "Disabled",
+ "None",
+ ),
+ },
+ 'Running': # Valid states when Host is powering on.
+ {
+ # (BMC , Chassis , Host , BootProgress)
+ (
+ "Enabled",
+ "On",
+ "Enabled",
+ "OSRunning",
+ ),
+ },
+ 'Booted': # Valid state when Host is booted.
+ {
+ # (BMC , Chassis , Host , BootProgress)
+ (
+ "Enabled",
+ "On",
+ "Enabled",
+ "OSRunning",
+ ),
+ },
+ 'ResetReload': # Valid state BMC reset reload when host is booted.
+ {
+ # (BMC , Chassis , Host , BootProgress)
+ (
+ "Enabled",
+ "On",
+ "Enabled",
+ "OSRunning",
+ ),
+ },
+}
if platform_arch_type == "x86":
VALID_BOOT_STATES_X86 = {}
@@ -159,3 +211,18 @@
return True
else:
return False
+
+ def redfish_valid_boot_state(self, boot_type, state_dict):
+ r"""
+ Validate a given set of states is valid.
+
+ Description of argument(s):
+ boot_type Boot type (e.g. off/running/host booted
+ etc.)
+ state_dict State dictionary.
+ """
+
+ if set(state_dict.values()) in set(REDFISH_VALID_BOOT_STATES[boot_type]):
+ return True
+ else:
+ return False
diff --git a/lib/utils.robot b/lib/utils.robot
index 5a6efde..a73a56c 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -58,6 +58,21 @@
Should Be Empty ${stderr}
+Verify Ping SSH And Redfish Authentication
+ [Documentation] Verify ping, SSH and redfish authentication.
+
+ ${l_ping}= Run Keyword And Return Status Ping Host ${OPENBMC_HOST}
+ Run Keyword If '${l_ping}' == '${False}' Fail msg=Ping Failed
+
+ ${l_rest}= Run Keyword And Return Status Redfish.Login
+ Run Keyword If '${l_rest}' == '${False}' Fail msg=REST Authentication Failed
+
+ # Just to make sure the SSH is working.
+ Open Connection And Log In
+ ${system} ${stderr}= Execute Command hostname return_stderr=True
+ Should Be Empty ${stderr}
+
+
Check If BMC is Up
[Documentation] Wait for Host to be online. Checks every X seconds
... interval for Y minutes and fails if timed out.