Move OCC keyword to lib for other test power on usage.
Changes:
- "Verify OCC State" keyword move from tests/test_occ_power.robot
to lib/open_power_utils.robot.
Change-Id: I2d4032d5bba8ed01e16f35812774720a61035792
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/open_power_utils.robot b/lib/open_power_utils.robot
index e9dd042..17b14ee 100644
--- a/lib/open_power_utils.robot
+++ b/lib/open_power_utils.robot
@@ -65,3 +65,23 @@
${content}= To JSON ${resp.content}
[Return] ${content["data"]}
+
+Verify OCC State
+ [Documentation] Check OCC active state.
+ [Arguments] ${expected_occ_active}=${1}
+ # Description of Argument(s):
+ # expected_occ_active The expected occ_active value (i.e. 1/0).
+
+ # Example cpu_list data output:
+ # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu0
+ # /xyz/openbmc_project/inventory/system/chassis/motherboard/cpu1
+ ${cpu_list}= Get Endpoint Paths
+ ... ${HOST_INVENTORY_URI}system/chassis/motherboard/ cpu*
+
+ :FOR ${endpoint_path} IN @{cpu_list}
+ \ ${is_functional}= Read Object Attribute ${endpoint_path} Functional
+ \ Continue For Loop If ${is_functional} == ${0}
+ \ ${num}= Set Variable ${endpoint_path[-1]}
+ \ ${occ_active}= Get OCC Active State ${OPENPOWER_CONTROL}occ${num}
+ \ Should Be Equal ${occ_active} ${expected_occ_active}
+ ... msg=OCC not in right state