RAS Reboot test scenarios.
    - Verify Host Unrecoverable Callout Handling At Reboot.
    - Verify Pdbg Unrecoverable Callout Handling At Reboot.

Resolves openbmc/openbmc-test-automation/issues#1772

Change-Id: I6fb0a5a77a556aa9ec760dce461397e5661e9cfa
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/openpower/ras/ras_utils.robot b/openpower/ras/ras_utils.robot
index 990c9d1..d092106 100755
--- a/openpower/ras/ras_utils.robot
+++ b/openpower/ras/ras_utils.robot
@@ -63,12 +63,8 @@
     # signature_desc      Error log signature description.
     # log_prefix          Log path prefix.
 
-    Run Keyword If  '${interface_type}' == 'HOST'
-    ...     Inject Error Through HOST  ${fir}  ${chip_address}  ${threshold_limit}
-    ...     ${master_proc_chip}
-    ...  ELSE
-    ...     Inject Error Through BMC  ${fir}  ${chip_address}  ${threshold_limit}
-    ...     ${master_proc_chip}
+    Run Keyword  Inject Error Through ${interface_type}
+    ...  ${fir}  ${chip_address}  ${threshold_limit}  ${master_proc_chip}
 
     Is Host Running
     ${output}=  Gard Operations On OS  list
@@ -88,7 +84,7 @@
     ...              4. Verify error log entry & signature description.
     ...              5. Verify & clear dump entry.
     [Arguments]      ${interface_type}  ${fir}  ${chip_address}  ${threshold_limit}
-    ...              ${signature_desc}  ${log_prefix}
+    ...              ${signature_desc}  ${log_prefix}  ${bmc_reboot}=${0}
     # Description of argument(s):
     # interface_type      Inject error through 'BMC' or 'HOST'.
     # fir                 FIR (Fault isolation register) value (e.g. 2011400).
@@ -97,19 +93,23 @@
     # signature_desc      Error Log signature description.
     #                     (e.g 'mcs(n0p0c0) (MCFIR[0]) mc internal recoverable')
     # log_prefix          Log path prefix.
+    # bmc_reboot          Do bmc reboot If bmc_reboot is set.
 
-    Run Keyword If  '${interface_type}' == 'HOST'
-    ...     Inject Error Through HOST  ${fir}  ${chip_address}  ${threshold_limit}
-    ...     ${master_proc_chip}
+    Run Keyword  Inject Error Through ${interface_type}
+    ...  ${fir}  ${chip_address}  ${threshold_limit}  ${master_proc_chip}
+
+    # Do BMC Reboot after error injection.
+    Run Keyword If  ${bmc_reboot}  Run Keywords
+    ...    Initiate BMC Reboot
+    ...    Wait For BMC Ready
+    ...    Initiate Host PowerOff
+    ...    Initiate Host Boot
     ...  ELSE
-    ...     Inject Error Through BMC  ${fir}  ${chip_address}  ${threshold_limit}
-    ...     ${master_proc_chip}
+    ...    Wait Until Keyword Succeeds  500 sec  20 sec  Is Host Rebooted
 
-    Wait Until Keyword Succeeds  500 sec  20 sec  Is Host Rebooted
     Wait for OS
     Verify Error Log Entry  ${signature_desc}  ${log_prefix}
-    ${resp}=  OpenBMC Get Request  ${DUMP_ENTRY_URI}list
-    Should Not Be Equal As Strings  ${resp.status_code}  ${HTTP_NOT_FOUND}
+    Read Properties  ${DUMP_ENTRY_URI}list
     Delete All BMC Dump
     Verify And Clear Gard Records On HOST
 
@@ -154,8 +154,10 @@
     Should Not Be Empty
     ...  ${OS_PASSWORD}  msg=You must provide OS host user password.
 
+    Smart Power Off
+
     # Boot to OS.
-    REST Power On
+    REST Power On  quiet=${1}
     # Adding delay after host bring up.
     Sleep  60s
 
@@ -174,7 +176,7 @@
     Set Environment Variable  PATH  %{PATH}:${ESEL_BIN_PATH}
 
     # Boot to Os.
-    REST Power On
+    REST Power On  quiet=${1}
 
     # Check Opal-PRD service enabled on host.
     ${opal_prd_state}=  Is Opal-PRD Service Enabled
diff --git a/openpower/ras/test_reboot_ras.robot b/openpower/ras/test_reboot_ras.robot
new file mode 100755
index 0000000..e97733a
--- /dev/null
+++ b/openpower/ras/test_reboot_ras.robot
@@ -0,0 +1,39 @@
+*** Settings ***
+Documentation       This suite tests error log callout handling when checkstop
+                    is injected through HOST/BMC and BMC rebooted.
+
+Resource            ../../lib/openbmc_ffdc.robot
+Resource            ../../lib/openbmc_ffdc_utils.robot
+Resource            ../../lib/openbmc_ffdc_methods.robot
+Resource            ../../openpower/ras/ras_utils.robot
+Variables           ../../lib/ras/variables.py
+Variables           ../../data/variables.py
+
+Suite Setup         RAS Suite Setup
+Test Setup          RAS Test Setup
+Test Teardown       FFDC On Test Case Fail
+Suite Teardown      RAS Suite Cleanup
+
+Force Tags          Reboot_RAS
+
+*** Test Cases ***
+Verify Host Unrecoverable Callout Handling At Reboot
+    [Documentation]  Verify host unrecoverable callout handling at reboot.
+    [Tags]  Verify_Unrecoverable_Callout_Handling_At_Reboot
+
+    ${value}=  Get From Dictionary  ${ERROR_INJECT_DICT}  L2FIR_UE
+    ${translated_fir}=  Fetch FIR Address Translation Value  ${value[0]}  EX
+    ${err_log_path}=  Catenate  ${RAS_LOG_DIR_PATH}l2fir_ue
+    Inject Unrecoverable Error  HOST  ${translated_fir}
+    ...  ${value[1]}  1  ${value[2]}  ${err_log_path}  ${1}
+
+Verify Pdbg Unrecoverable Callout Handling At Reboot
+    [Documentation]  Verify unrecoverable callout handling
+    ...              with pdbg tool at reboot.
+    [Tags]  Verify_Pdbg_Unrecoverable_Callout_Handling_At_Reboot
+
+    ${value}=  Get From Dictionary  ${ERROR_INJECT_DICT}  L3FIR_UE
+    ${translated_fir}=  Fetch FIR Address Translation Value  ${value[0]}  EX
+    ${err_log_path}=  Catenate  ${RAS_LOG_DIR_PATH}l3fir_ue
+    Inject Unrecoverable Error  BMC  ${translated_fir}
+    ...  ${value[1]}  1  ${value[2]}  ${err_log_path}  ${1}