Enable basic infrastructure for PEL testing

What infrastructure support is enabled
     - Added keyword to run peltool command.
     - Added basic test case to create and verify PEL log.

Change-Id: I9e902adbeef317293571d77c72b01e19891b2336
Signed-off-by: Rahul Maheshwari <rahulmaheshwari@in.ibm.com>
diff --git a/lib/pel_utils.py b/lib/pel_utils.py
new file mode 100644
index 0000000..cf2eeab
--- /dev/null
+++ b/lib/pel_utils.py
@@ -0,0 +1,41 @@
+#!/usr/bin/env python
+
+r"""
+PEL functions.
+"""
+
+import func_args as fa
+import bmc_ssh_utils as bsu
+import json
+
+
+def peltool(option_string, **bsu_options):
+    r"""
+    Run peltool on the BMC with the caller's option string and return the result.
+
+    Example:
+
+    ${pel_results}=  Peltool  -l
+    Rprint Vars  pel_results
+
+    pel_results:
+      [0x50000031]:
+        [CompID]:                       0x1000
+        [PLID]:                         0x50000031
+        [Subsystem]:                    BMC Firmware
+        [Message]:                      An application had an internal failure
+        [SRC]:                          BD8D1002
+        [Commit Time]:                  02/25/2020  04:51:31
+        [Sev]:                          Unrecoverable Error
+        [CreatorID]:                    BMC
+
+    Description of argument(s):
+    option_string           A string of options which are to be processed by the peltool command.
+    bsu_options             Options to be passed directly to bmc_execute_command. See its prolog for
+                            details.
+    """
+
+    bsu_options = fa.args_to_objects(bsu_options)
+    out_buf, stderr, rc = bsu.bmc_execute_command('peltool ' + option_string, **bsu_options)
+    out_buf = json.loads(out_buf)
+    return out_buf
diff --git a/openpower/pel/test_bmc_pel.robot b/openpower/pel/test_bmc_pel.robot
new file mode 100644
index 0000000..792ae74
--- /dev/null
+++ b/openpower/pel/test_bmc_pel.robot
@@ -0,0 +1,55 @@
+*** Settings ***
+Documentation   This suite tests Platform Event Log (PEL) functionality of OpenBMC.
+
+Library         ../../lib/pel_utils.py
+Resource        ../../lib/openbmc_ffdc.robot
+
+Test Setup      Run Keywords  Redfish.Login  AND  Redfish Purge Event Log
+Test Teardown   FFDC On Test Case Fail
+
+
+*** Variables ***
+
+${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
+
+
+*** Test Cases ***
+
+Create Test PEL Log And Verify
+    [Documentation]  Create PEL log using busctl command and verify via peltool.
+    [Tags]  Create_Test_PEL_Log_And_Verify
+
+    Create Test PEL Log
+    PEL Log Should Exist
+
+
+*** Keywords ***
+
+Create Test PEL Log
+    [Documentation]  Generate test PEL log.
+
+    # Test PEL log entry example:
+    # {
+    #    "0x5000002D": {
+    #            "SRC": "BD8D1002",
+    #            "Message": "An application had an internal failure",
+    #            "PLID": "0x5000002D",
+    #            "CreatorID": "BMC",
+    #            "Subsystem": "BMC Firmware",
+    #            "Commit Time": "02/25/2020  04:47:09",
+    #            "Sev": "Unrecoverable Error",
+    #            "CompID": "0x1000"
+    #    }
+    # }
+
+    BMC Execute Command  ${CMD_INTERNAL_FAILURE}
+
+
+PEL Log Should Exist
+    [Documentation]  PEL log entries should exist.
+
+    ${pel_records}=  Peltool  -l
+    Should Not Be Empty  ${pel_records}  msg=System PEL log entry is not empty.
+