OpenBMC RAS test cases.

Automated 11 host related RAS TC's with recoverable errors with
thershold limit 1, 5, 32 & unrecoverable error.

Error injection for the following:
MCIFIR       - RECV1, RECV32, UE.
MCACALFIR    - RECV1, UE.
NXDMAENGFIR  - RECV1, UE.
CXAFIR       - RECV5, RECV32.
OB_LFIR      - RECV32.
NPU0FIR      - RECV32.

Resolves  openbmc/openbmc-test-automation#906

Change-Id: Ia3bb63bf9776b93285e938b36a47543a546fcbbd
Signed-off-by: Sridevi Ramesh <sridevra@in.ibm.com>
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index 6359c68..45e1ca7 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -319,6 +319,8 @@
 Collect eSEL Log
     [Documentation]  Collect eSEL log from logging entry and convert eSEL data
     ...              to elog formated string text file.
+    [Arguments]  ${log_prefix_path}=${LOG_PREFIX}
+
     ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}/enumerate  quiet=${1}
     ${status}=  Run Keyword And Return Status
     ...  Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK}
@@ -332,7 +334,7 @@
     # /xyz/openbmc_project/logging/entry/2
     ${esel_list}=  Get Dictionary Keys  ${content['data']}
 
-    ${logpath}=  Catenate  SEPARATOR=  ${LOG_PREFIX}  esel
+    ${logpath}=  Catenate  SEPARATOR=  ${log_prefix_path}  esel
     Create File  ${logpath}
     # Fetch data from /xyz/openbmc_project/logging/entry/1/attr/AdditionalData
     #  "ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00 "
diff --git a/lib/ras/variables.py b/lib/ras/variables.py
new file mode 100644
index 0000000..65cf5ec
--- /dev/null
+++ b/lib/ras/variables.py
@@ -0,0 +1,46 @@
+
+r"""
+Signature description in error log corresponding to error injection.
+"""
+
+DES_MCA_RECV1 = "'mca.n0p0c0.*MCACALFIR[^0].*A MBA recoverable error'"
+DES_MCA_RECV32 = "'mca.n0p0c0.*MCACALFIR[^2].*Excessive refreshes'"
+DES_MCA_UE = "'mca.n0p0c0.*MCACALFIR[^10].*State machine'"
+
+
+DES_MCS_RECV1 = "'mcs.n0p0c0.*MCFIR[^0].*mc internal recoverable'"
+DES_MCS_UE = "'mcs.n0p0c0.*MCFIR[^1].*mc internal non recovervable'"
+
+
+DES_NX_RECV1 = "'pu.n0p0.*NXDMAENGFIR[^5].*Channel 0 842 engine ECC'"
+DES_NX_RECV32 = "'pu.n0p0.*NXDMAENGFIR[^4].*Channel 0 842 engine ECC'"
+
+DES_OBUS_RECV32 = "'ob.n0p0c0.*OB_LFIR[^0].*CFIR internal parity error'"
+
+DES_CXA_RECV5 = "'capp.n0p0c0.*CXAFIR[^34].*CXA CE on data received'"
+DES_CXA_RECV32 = "'capp.n0p0c0.*CXAFIR[^2].*CXA CE on Master array'"
+
+DES_NPU0_RECV32 = "'pu.n0p0.*NPU0FIR[^0].*NTL array CE'"
+
+# The following is an error injection dictionary with each entry consisting of:
+# - field_name: Targettype_threshold_limit .
+#   - A list consisting of the following fields:
+#     - field1: FIR (Fault isolation register) value.
+#     - field2: chip address.
+#     - field3: Error log signature description.
+
+ERROR_INJECT_DICT = {'MCACALIFIR_RECV1': ['07010900', '8000000000000000',\
+                                          DES_MCA_RECV1],
+             'MCACALIFIR_RECV32': ['07010900', '2000000000000000', \
+                                   DES_MCA_RECV32],
+             'MCACALIFIR_UE': ['07010900', '0020000000000000', DES_MCA_UE],
+             'MCS_RECV1': ['05010800', '8000000000000000', DES_MCS_RECV1],
+             'MCS_UE': ['05010800', '4000000000000000', DES_MCS_UE],
+             'NX_RECV1': ['02011100','0400000000000000', DES_NX_RECV1],
+             'NX_RECV32': ['02011100', '0800000000000000', DES_NX_RECV32],
+             'CXA_RECV5': ['02010800', '0000000020000000', DES_CXA_RECV5],
+             'CXA_RECV32': ['02010800', '2000000000000000', DES_CXA_RECV32],
+             'OBUS_RECV32': ['0904000a', '8000000000000000', DES_OBUS_RECV32],
+             'NPU0_RECV32': ['05011400', '8000000000000000', DES_NPU0_RECV32]
+             }
+