Boot test Error log format for Redfish

Change-Id: I6f034d98049fc8633cafba2ec1ed2802df53258f
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/data/variables.py b/data/variables.py
index 295b673..d3d2c13 100755
--- a/data/variables.py
+++ b/data/variables.py
@@ -48,6 +48,7 @@
 # Logging URI variables
 BMC_LOGGING_URI = OPENBMC_BASE_URI + 'logging/'
 BMC_LOGGING_ENTRY = BMC_LOGGING_URI + 'entry/'
+REDFISH_BMC_LOGGING_ENTRY = '/redfish/v1/Systems/system/LogServices/EventLog/Entries/'
 
 # Software manager version
 SOFTWARE_VERSION_URI = OPENBMC_BASE_URI + 'software/'
diff --git a/lib/logging_utils.py b/lib/logging_utils.py
index fa441a1..5186b17 100644
--- a/lib/logging_utils.py
+++ b/lib/logging_utils.py
@@ -17,6 +17,10 @@
 gru.my_import_resource("logging_utils.robot")
 
 
+redfish_support_trans_state = int(os.environ.get('REDFISH_SUPPORT_TRANS_STATE', 0)) or \
+    int(BuiltIn().get_variable_value("${REDFISH_SUPPORT_TRANS_STATE}", default=0))
+
+
 def print_error_logs(error_logs, key_list=None):
     r"""
     Print the error logs to the console screen.
@@ -72,7 +76,10 @@
             key_list = key_list.split(" ")
         except AttributeError:
             pass
-        key_list.insert(0, var.BMC_LOGGING_ENTRY + ".*")
+        if redfish_support_trans_state:
+            key_list.insert(0, var.REDFISH_BMC_LOGGING_ENTRY + ".*")
+        else:
+            key_list.insert(0, var.BMC_LOGGING_ENTRY + ".*")
 
     gp.print_var(error_logs, key_list=key_list)
 
diff --git a/lib/logging_utils.robot b/lib/logging_utils.robot
index 9e28a80..0ef8cbe 100644
--- a/lib/logging_utils.robot
+++ b/lib/logging_utils.robot
@@ -260,6 +260,19 @@
     [Return]  ${members}
 
 
+Get Redfish Event Logs
+    [Documentation]  Pack the list of all available EventLog entries in dictionary.
+
+    ${packed_dict}=  Create Dictionary
+    ${error_logs}=  Get Event Logs
+
+    :FOR  ${idx}   IN  @{error_logs}
+       Set To Dictionary  ${packed_dict}    ${idx['@odata.id']}=${idx}
+    END
+
+    [Return]  &{packed_dict}
+
+
 Get Event Logs Not Ok
     [Documentation]  Get all event logs where the 'Severity' is not 'OK'.
 
diff --git a/lib/obmc_boot_test.py b/lib/obmc_boot_test.py
index 1729ed1..17a329e 100755
--- a/lib/obmc_boot_test.py
+++ b/lib/obmc_boot_test.py
@@ -976,9 +976,13 @@
 
     if delete_errlogs:
         # print error logs before delete
-        status, error_logs = grk.run_key_u("Get Error Logs")
+        if redfish_support_trans_state:
+            status, error_logs = grk.run_key_u("Get Redfish Event Logs")
+            log.print_error_logs(error_logs, "AdditionalDataURI Message Severity")
+        else:
+            status, error_logs = grk.run_key_u("Get Error Logs")
+            log.print_error_logs(error_logs, "AdditionalData Message Severity")
         pels = pel.peltool("-l", ignore_err=1)
-        log.print_error_logs(error_logs, "AdditionalData Message Severity")
         gp.qprint_var(pels)
 
         # We need to purge error logs between boots or they build up.
@@ -1166,9 +1170,13 @@
 
     if delete_errlogs:
         # print error logs before delete
-        status, error_logs = grk.run_key_u("Get Error Logs")
+        if redfish_support_trans_state:
+            status, error_logs = grk.run_key_u("Get Redfish Event Logs")
+            log.print_error_logs(error_logs, "AdditionalDataURI Message Severity")
+        else:
+            status, error_logs = grk.run_key_u("Get Error Logs")
+            log.print_error_logs(error_logs, "AdditionalData Message Severity")
         pels = pel.peltool("-l", ignore_err=1)
-        log.print_error_logs(error_logs, "AdditionalData Message Severity")
         gp.qprint_var(pels)
 
         # Delete errlogs prior to doing any boot tests.