OCC test cases
Added:
- Supporting utility keywords for OCC testing.
- Verify OCC object created.
- Verify active OCC state.
Resolves openbmc/openbmc-test-automation#952
Change-Id: I4fe553e6c0df437de8095a274759ba86d2547ab2
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/open_power_utils.robot b/lib/open_power_utils.robot
index 262486c..327b67b 100644
--- a/lib/open_power_utils.robot
+++ b/lib/open_power_utils.robot
@@ -18,7 +18,7 @@
# "OccActive": 1
# }
- ${occ_list}= Get Endpoint Paths ${OPENBMC_POWER} occ*
+ ${occ_list}= Get Endpoint Paths ${OPENPOWER_CONTROL} occ*
[Return] ${occ_list}
@@ -33,3 +33,35 @@
${occ_attribute}= Read Attribute ${occ_object} OccActive
[Return] ${occ_attribute}
+
+
+Count Object Entries
+ [Documentation] Count the occurence number of a given object.
+ [Arguments] ${object_base_uri_path} ${object_name}
+
+ # Description of argument(s):
+ # object_base_uri_path Object base path
+ # (e.g. "/org/open_power/control/").
+ # object_name Object name (e.g. "occ", "cpu" etc).
+
+ ${object_list}= Get Endpoint Paths
+ ... ${object_base_uri_path} ${object_name}
+ ${list_count}= Get Length ${object_list}
+ [Return] ${list_count}
+
+
+Read Object Attribute
+ [Documentation] Return object attribute data.
+ [Arguments] ${object_base_uri_path} ${attribute_name}
+
+ # Description of argument(s):
+ # object_base_uri_path Object path.
+ # (e.g. "/org/open_power/control/occ0").
+ # attribute_name Object attribute name.
+
+ ${resp}= OpenBMC Get Request
+ ... ${object_base_uri_path}/attr/${attribute_name} quiet=${1}
+ Return From Keyword If ${resp.status_code} != ${HTTP_OK}
+ ${content}= To JSON ${resp.content}
+ [Return] ${content["data"]}
+