Redfish SEL test and keyword update

Changes:
   - Update keyword "Verify eSEL Entries" to redfish.
   - Update test setup and poweron to redfish.
   - Added TODO openbmc/openbmc-test-automation#1789 for
     feature currently not available.

Change-Id: I5db375bc0cbd7a8cdcfdad1c3f83bdedb1d18393
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/esel_utils.robot b/lib/esel_utils.robot
index 35d61c1..4cb7569 100755
--- a/lib/esel_utils.robot
+++ b/lib/esel_utils.robot
@@ -3,6 +3,7 @@
 
 Resource            ../lib/ipmi_client.robot
 Resource            ../lib/utils.robot
+Resource            ../lib/logging_utils.robot
 Variables           ../data/variables.py
 
 
@@ -42,22 +43,19 @@
 
 Verify eSEL Entries
     [Documentation]  Verify eSEL entries logged.
-    ${elog_entry}=  Get URL List  ${BMC_LOGGING_ENTRY}
-    ${resp}=  OpenBMC Get Request  ${elog_entry[0]}
-    #  "data": {
-    #       "AdditionalData": [
-    #           "ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00 "
-    #          ],
-    #       "Id": 1,
-    #       "Message": "org.open_power.Host.Error.Event",
-    #       "Severity": "xyz.openbmc_project.Logging.Entry.Level.Error",
-    #       "Timestamp": 1485904869061
-    # }
-    ${entry_id}=  Read Attribute  ${elog_entry[0]}  Message
-    Should Be Equal  ${entry_id}
-    ...  org.open_power.Host.Error.Event
 
-    ${entry_id}=  Read Attribute  ${elog_entry[0]}  Severity
-    # Could be either xyz.openbmc_project.Logging.Entry.Level.Error
-    # or xyz.openbmc_project.Logging.Entry.Level.Warning.
-    Should Contain  ${entry_id}  xyz.openbmc_project.Logging.Entry.Level
+    # {
+    #    "@odata.context": "/redfish/v1/$metadata#LogEntry.LogEntry",
+    #    "@odata.id": "/redfish/v1/Systems/system/LogServices/EventLog/Entries/2",
+    #    "@odata.type": "#LogEntry.v1_4_0.LogEntry",
+    #    "Created": "2019-06-03T14:47:31+00:00",
+    #    "EntryType": "Event",
+    #    "Id": "2",
+    #    "Message": "org.open_power.Host.Error.Event",
+    #    "Name": "System DBus Event Log Entry",
+    #    "Severity": "Critical"
+    # }
+
+    ${elog_entry}=  Get Event Logs
+    Should Be Equal  ${elog_entry[0]["Message"]}  org.open_power.Host.Error.Event
+    Should Be Equal  ${elog_entry[0]["Severity"]}  Critical
diff --git a/redfish/systems/eventlog/test_esel.robot b/redfish/systems/eventlog/test_esel.robot
index 9f49378..16f27ce 100644
--- a/redfish/systems/eventlog/test_esel.robot
+++ b/redfish/systems/eventlog/test_esel.robot
@@ -5,15 +5,15 @@
 Resource            ../../../lib/ipmi_client.robot
 Resource            ../../../lib/openbmc_ffdc.robot
 Resource            ../../../lib/utils.robot
-Variables           ../../../data/variables.py
 Resource            ../../../lib/boot_utils.robot
 Resource            ../../../lib/esel_utils.robot
-Resource            ../../../lib/logging_utils.robot
+Resource            ../../../lib/boot_utils.robot
+Variables           ../../../data/variables.py
 
 Suite Setup         Suite Setup Execution
 Suite Teardown      Suite Teardown Execution
+Test Setup          Test Setup Execution
 Test Teardown       FFDC On Test Case Fail
-Test Setup          Delete All Error Logs
 
 Force Tags  eSEL_Logging
 
@@ -27,24 +27,24 @@
 
 *** Test Cases ***
 
-Verify eSEL Using REST
-    [Documentation]  Generate eSEL log and verify using REST.
-    [Tags]  Verify_eSEL_Using_REST
+Verify eSEL Using Redfish
+    [Documentation]  Generate eSEL log and verify using redfish.
+    [Tags]  Verify_eSEL_Using_Redfish
 
     Create eSEL
-    # New eSEL log should exist
-    ${resp}=  OpenBMC Get Request  ${BMC_LOGGING_ENTRY}list
-    Should Be Equal As Strings  ${resp.status_code}  ${HTTP_OK}
+    Event Log Should Exist
 
 
-Verify eSEL Entries Using REST
+Verify eSEL Entries Using Redfish
     [Documentation]  Verify that eSEL entries have data.
-    [Tags]  Verify_eSEL_Entries_Using_REST
+    [Tags]  Verify_eSEL_Entries_Using_Redfish
 
     Create eSEL
+    Redfish.Login
     Verify eSEL Entries
 
 
+# TODO: openbmc/openbmc-test-automation#1789
 Verify eSEL Description And EntryID Using REST
     [Documentation]  Create eSEL log and verify "Description" and "EntryID"
     ...  are not empty via REST.
@@ -83,9 +83,9 @@
     ...  msg=${event_id} is populated default "None".
 
 
-Verify Multiple eSEL Using REST
-    [Documentation]  Generate multiple eSEL log and verify using REST.
-    [Tags]  Verify_Multiple_eSEL_Using_REST
+Verify Multiple eSEL Using Redfish
+    [Documentation]  Generate multiple eSEL log and verify using redfish
+    [Tags]  Verify_Multiple_eSEL_Using_Redfish
 
     Create eSEL
     Create eSEL
@@ -94,6 +94,7 @@
     ...  msg=Expecting 2 eSELs but found ${entries}.
 
 
+# TODO: openbmc/openbmc-test-automation#1789
 Check eSEL AdditionalData
     [Documentation]  Generate eSEL log and verify AdditionalData is
     ...              not empty.
@@ -151,6 +152,7 @@
 Suite Teardown Execution
     [Documentation]  Cleanup test logs and connection.
     Close All Connections
+    Redfish.Logout
 
 
 Restart Logging Service
@@ -178,6 +180,13 @@
     [Return]  ${stderr}
 
 
+Test Setup Execution
+   [Documentation]  Do test case setup tasks.
+
+    Redfish.Login
+    Redfish Purge Event Log
+
+
 Suite Setup Execution
     [Documentation]  Validates input parameters & check if HOST OS is up.
 
@@ -189,7 +198,10 @@
     ...   ${OS_PASSWORD}  msg=You must provide OS host user password.
 
     # Boot to OS.
-    REST Power On
+    Redfish Power On
+
+    Redfish.Login
+    Redfish Purge Event Log
 
     Login To OS Host  ${OS_HOST}  ${OS_USERNAME}  ${OS_PASSWORD}
     Open Connection And Log In
@@ -203,3 +215,10 @@
     ...         return_stdout=True  return_stderr=True  return_rc=True
     Should Be Equal  ${output_3}  ${0}  msg=${stderr}
     [Return]  ${stderr}
+
+
+Event Log Should Exist
+    [Documentation]  Event log entries should exist.
+
+    ${elogs}=  Get Event Logs
+    Should Not Be Empty  ${elogs}  msg=System event log entry is not empty.