Adding Channel checkstop through OS testcase

Inject Channel checkstop through OS and check if
the gard records are present after error injection.

Resolves openbmc/openbmc-test-automation#413

Change-Id: Idf223cce020a32836e0aa803cc5043a1dddd44c3
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/lib/ras/host_utils.robot b/lib/ras/host_utils.robot
index 769e185..1d332ee 100644
--- a/lib/ras/host_utils.robot
+++ b/lib/ras/host_utils.robot
@@ -7,10 +7,11 @@
 *** Keywords ***
 
 Getscom Operations On OS
-    [Documentation]  Executes getscom command on OS
-    ...              with the given input command.
+    [Documentation]  Executes getscom command on OS with the given
+    ...              input command.
     [Arguments]      ${input_cmd}
-    #input_cmd       -l|--list-chips
+    # Description of arguments:
+    # input_cmd      -l|--list-chips
     #                -c|--chip <chip-id> <addr>
 
     ${output}  ${stderr}=  Execute Command  getscom ${input_cmd}
@@ -19,10 +20,11 @@
     [Return]  ${output}
 
 Gard Operations On OS
-    [Documentation]  Executes opal-gard command on OS
-    ...              with the given input command.
+    [Documentation]  Executes opal-gard command on OS with the given
+    ...              input command.
     [Arguments]      ${input_cmd}
-    #input_cmd       list/clear all/show <gard_record_id>
+    # Description of arguments:
+    # input_cmd      list/clear all/show <gard_record_id>
 
     ${output}  ${stderr}=  Execute Command  opal-gard ${input_cmd}
     ...        return_stderr=True
@@ -30,12 +32,30 @@
     [Return]  ${output}
 
 Putscom Through OS
-    [Documentation]  Executes putscom command on OS
-    ...              with the given input arguments.
-    [Arguments]  ${chip_id}  ${fru}  ${address}
-    #chip_id           processor ID
-    #fru               FRU value
-    #address           chip address
+    [Documentation]  Executes putscom command on OS with the given
+    ...              input arguments.
+    [Arguments]      ${chip_id}  ${fru}  ${address}
+    # Description of arguments:
+    # chip_id        processor ID (e.g 00000000).
+    # fru            FRU value (e.g. 2011400).
+    # address        chip address (e.g 4000000000000000).
 
     ${cmd}=  Catenate  putscom -c 0x${chip_id} 0x${fru} 0x${address}
     Start Command  ${cmd}
+
+Get Cores Values From OS
+    [Documentation]  Check if cores present on HOST OS & return core values.
+    ${cmd}=  Catenate  cat /sys/firmware/opal/msglog|grep -i chip|grep -i core
+    ${output}=  Execute Command  ${cmd}
+    Should Not Be Empty  ${output}
+    [Return]  ${output}
+
+Get ChipID From OS
+    [Documentation]  Get chip ID values based on the input.
+    [Arguments]      ${chip_type}
+    # Description of arguments:
+    # chip_type      The chip type (Processor/Centaur).
+
+    ${cmd}=  Catenate  -l | grep -i ${chip_type} | cut -c1-8
+    ${chip_id}=  Getscom Operations On OS  ${cmd}
+    [Return]  ${chip_id}