Added tests to verify callout

Test cases added:
    - Verify FRU Callout
    - Verify Procedure And Symbolic FRU Callout

Change-Id: I1d832b1372e66eb27dc72f50cb56465fc0f47d31
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/openpower/pel/test_bmc_pel.robot b/openpower/pel/test_bmc_pel.robot
index 9fd0561..9c39aee 100644
--- a/openpower/pel/test_bmc_pel.robot
+++ b/openpower/pel/test_bmc_pel.robot
@@ -15,6 +15,19 @@
 ${CMD_INTERNAL_FAILURE}  busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
 ...  xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.InternalFailure
 ...  xyz.openbmc_project.Logging.Entry.Level.Error 0
+
+${CMD_FRU_CALLOUT}  busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
+...  xyz.openbmc_project.Logging.Create Create ssa{ss} xyz.openbmc_project.Common.Error.Timeout
+...  xyz.openbmc_project.Logging.Entry.Level.Error 2 "TIMEOUT_IN_MSEC" "5"
+...  "CALLOUT_INVENTORY_PATH" "/xyz/openbmc_project/inventory/system/chassis/motherboard"
+
+${CMD_PROCEDURAL_SYMBOLIC_FRU_CALLOUT}  busctl call xyz.openbmc_project.Logging /xyz/openbmc_project/logging
+...  xyz.openbmc_project.Logging.Create Create ssa{ss} org.open_power.Logging.Error.TestError1
+...  xyz.openbmc_project.Logging.Entry.Level.Error 0
+
+${CMD_INVENTORY_PREFIX}  busctl get-property xyz.openbmc_project.Inventory.Manager
+...  /xyz/openbmc_project/inventory/system/chassis/motherboard
+
 @{mandatory_pel_fileds}   Private Header  User Header  Primary SRC  Extended User Header  Failing MTMS
 
 
@@ -270,6 +283,86 @@
     Valid Value  pel_bmc_event_log_id  ['${redfish_event_logs['Members'][0]['Id']}']
 
 
+Verify FRU Callout
+    [Documentation]  Verify FRU callout entries from PEL log.
+    [Tags]  Verify_FRU_Callout
+
+    Create Test PEL Log  FRU Callout
+
+    ${pel_ids}=  Get PEL Log Via BMC CLI
+    ${id}=  Get From List  ${pel_ids}  -1
+    ${pel_callout_section}=  Get PEL Field Value  ${id}  Primary SRC  Callout Section
+
+    # Example of PEL Callout Section from "peltool -i <id>" command.
+    #  [Callouts]:
+    #    [0]:
+    #      [FRU Type]:                 Normal Hardware FRU
+    #      [Priority]:                 Mandatory, replace all with this type as a unit
+    #      [Location Code]:            U78DA.ND1.1234567-P0
+    #      [Part Number]:              F191014
+    #      [CCIN]:                     2E2D
+    #      [Serial Number]:            YL2E2D010000
+    #  [Callout Count]:                1
+
+    Valid Value  pel_callout_section['Callout Count']  ['1']
+    Valid Value  pel_callout_section['Callouts'][0]['FRU Type']  ['Normal Hardware FRU']
+    Should Contain  ${pel_callout_section['Callouts'][0]['Priority']}  Mandatory
+
+    # Verify Location Code field of PEL callout with motherboard's Location Code.
+    ${busctl_output}=  BMC Execute Command  ${CMD_INVENTORY_PREFIX} com.ibm.ipzvpd.Location LocationCode
+    Should Be Equal  ${pel_callout_section['Callouts'][0]['Location Code']}
+    ...  ${busctl_output[0].split('"')[1].strip('"')}
+
+    # TODO: Compare CCIN and part number fields of PEL callout with Redfish or busctl output.
+    Should Match Regexp  ${pel_callout_section['Callouts'][0]['CCIN']}  [a-zA-Z0-9]
+    Should Match Regexp  ${pel_callout_section['Callouts'][0]['Part Number']}  [a-zA-Z0-9]
+
+    # Verify Serial Number field of PEL callout with motherboard's Serial Number.
+    ${busctl_output}=  BMC Execute Command
+    ...  ${CMD_INVENTORY_PREFIX} xyz.openbmc_project.Inventory.Decorator.Asset SerialNumber
+    Should Be Equal  ${pel_callout_section['Callouts'][0]['Serial Number']}
+    ...  ${busctl_output[0].split('"')[1].strip('"')}
+
+
+Verify Procedure And Symbolic FRU Callout
+    [Documentation]  Verify procedure and symbolic FRU callout from PEL log.
+    [Tags]  Verify_Procedure_And_Symbolic_FRU_Callout
+
+    Create Test PEL Log   Procedure And Symbolic FRU Callout
+
+    ${pel_ids}=  Get PEL Log Via BMC CLI
+    ${id}=  Get From List  ${pel_ids}  -1
+    ${pel_callout_section}=  Get PEL Field Value  ${id}  Primary SRC  Callout Section
+
+    # Example of PEL Callout Section from "peltool -i <id>" command.
+    #  [Callouts]:
+    #    [0]:
+    #      [Priority]:                                 Mandatory, replace all with this type as a unit
+    #      [Procedure Number]:                         BMCSP02
+    #      [FRU Type]:                                 Maintenance Procedure Required
+    #    [1]:
+    #      [Priority]:                                 Medium Priority
+    #      [Part Number]:                              SVCDOCS
+    #      [FRU Type]:                                 Symbolic FRU
+    #  [Callout Count]:                                2
+
+    Valid Value  pel_callout_section['Callout Count']  ['2']
+
+    # Verify procedural callout info.
+
+    Valid Value  pel_callout_section['Callouts'][0]['FRU Type']  ['Maintenance Procedure Required']
+    Should Contain  ${pel_callout_section['Callouts'][0]['Priority']}  Mandatory
+    # Verify if "Procedure Number" field of PEL has an alphanumeric value.
+    Should Match Regexp  ${pel_callout_section['Callouts'][0]['Procedure Number']}  [a-zA-Z0-9]
+
+    # Verify procedural callout info.
+
+    Valid Value  pel_callout_section['Callouts'][1]['FRU Type']  ['Symbolic FRU']
+    Should Contain  ${pel_callout_section['Callouts'][1]['Priority']}  Medium Priority
+    # Verify if "Part Number" field of Symbolic FRU has an alphanumeric value.
+    Should Match Regexp  ${pel_callout_section['Callouts'][1]['Part Number']}  [a-zA-Z0-9]
+
+
 Verify Delete All PEL
     [Documentation]  Verify deleting all PEL logs.
     [Tags]  Verify_Delete_All_PEL
@@ -286,6 +379,10 @@
 
 Create Test PEL Log
     [Documentation]  Generate test PEL log.
+    [Arguments]  ${pel_type}=Internal Failure
+
+    # Description of argument(s):
+    # pel_type      The PEL type (e.g. Internal Failure, FRU Callout, Procedural Callout).
 
     # Test PEL log entry example:
     # {
@@ -301,7 +398,12 @@
     #    }
     # }
 
-    BMC Execute Command  ${CMD_INTERNAL_FAILURE}
+    Run Keyword If  '${pel_type}' == 'Internal Failure'
+    ...   BMC Execute Command  ${CMD_INTERNAL_FAILURE}
+    ...  ELSE IF  '${pel_type}' == 'FRU Callout'
+    ...   BMC Execute Command  ${CMD_FRU_CALLOUT}
+    ...  ELSE IF  '${pel_type}' == 'Procedure And Symbolic FRU Callout'
+    ...   BMC Execute Command  ${CMD_PROCEDURAL_SYMBOLIC_FRU_CALLOUT}
 
 
 Get PEL Log IDs