Get BMC system model based on the device tree population.
This changes the following:
- Added a "Get BMC System Model" keyword in utils.robot
Resolves openbmc/openbmc-test-automation#332
Change-Id: Iedea5e4badc8e1a4bd635e7f2a6d797c902e1787
Signed-off-by: Sivas SRR <sivas.srr@in.ibm.com>
diff --git a/lib/utils.robot b/lib/utils.robot
index a5bb0b9..96ca03d 100755
--- a/lib/utils.robot
+++ b/lib/utils.robot
@@ -30,9 +30,29 @@
${BOOT_TIME} ${0}
${BOOT_COUNT} ${0}
+${devicetree_base} /sys/firmware/devicetree/base/model
*** Keywords ***
+Get BMC System Model
+ [Documentation] Get the BMC model from the device tree.
+
+ ${bmc_model} ${stderr}= Execute Command cat ${devicetree_base} | cut -f 1
+ ... -d ${SPACE} return_stderr=True
+ Should Be Empty ${stderr}
+ Should Not Be Empty ${bmc_model}
+ [Return] ${bmc_model}
+
+Verify BMC System Model
+ [Documentation] Verify the BMC model with ${OPENBMC_MODEL}.
+ [Arguments] ${bmc_model}
+
+ ${tmp_bmc_model}= Fetch From Right ${OPENBMC_MODEL} /
+ ${tmp_bmc_model}= Fetch From Left ${tmp_bmc_model} .
+ ${ret}= Run Keyword And Return Status Should Contain ${bmc_model}
+ ... ${tmp_bmc_model} ignore_case=True
+ [Return] ${ret}
+
Wait For Host To Ping
[Arguments] ${host} ${timeout}=${OPENBMC_REBOOT_TIMEOUT}min
... ${interval}=5 sec