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/extended/full_suite_regression.robot b/extended/full_suite_regression.robot
index d410213..acbc2d8 100755
--- a/extended/full_suite_regression.robot
+++ b/extended/full_suite_regression.robot
@@ -3,15 +3,27 @@
 ...                Maintains log.html output.xml  for each iteration and
 ...                generate combined report
 
+Resource  ../lib/utils.robot
+Resource  ../lib/connection_client.robot
 Library  OperatingSystem
 Library  DateTime
 
+Suite Setup         Open Connection And Log In
+Suite Teardown      Close All Connections
+
 *** Variables ***
 ${ITERATION}          10
 ${RESULT_DIR_NAME}    logsdir
 ${LOOP_TEST_COMMAND}  tests
 
 *** Test Cases ***
+Validate BMC Model
+   [Documentation]  Check that OPENBMC_MODEL is correct.
+   [Tags]  Validate_BMC_Model
+   ${bmc_model}=  Get BMC System Model
+   ${status}=  Verify BMC System Model  ${bmc_model}
+   Run Keyword If  '${status}'=='False'  Fatal Error  Wrong System
+
 Run Entire Test Suite Multiple Time
    [Documentation]  Multiple iterations of Full Suite
 
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