FFDC Add Redfish GET event log entries

Change-Id: Ie7e0374ae800873ee8c69b2a88049ec487bac523
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/openbmc_ffdc_list.py b/lib/openbmc_ffdc_list.py
index 49a5fe6..db5cda6 100755
--- a/lib/openbmc_ffdc_list.py
+++ b/lib/openbmc_ffdc_list.py
@@ -157,6 +157,19 @@
         'BMC_USER.txt': ENUMERATE_USER,
     },
 }
+
+REDFISH_BASE = '/redfish/v1/'
+REDFISH_ELOG = REDFISH_BASE + 'Systems/system/LogServices/EventLog/Entries'
+
+# Add file name and corresponding Get Request
+FFDC_GET_REDFISH_REQUEST = {
+    'GET REQUESTS':
+    {
+        # File Name         Command
+        'BMC_redfish_elog.txt': REDFISH_ELOG,
+    },
+}
+
 # Define your keywords in method/utils and call here
 FFDC_METHOD_CALL = {
     'BMC LOGS':
@@ -165,6 +178,7 @@
         'FFDC Generic Report': 'BMC FFDC Manifest',
         'BMC Specific Files': 'BMC FFDC Files',
         'Get Request FFDC': 'BMC FFDC Get Requests',
+        'Get Redfish Request FFDC': 'BMC FFDC Get Redfish Requests',
         'OS FFDC': 'OS FFDC Files',
         'Core Files': 'SCP Coredump Files',
         'SEL Log': 'Collect eSEL Log',
@@ -225,6 +239,16 @@
         """
         return FFDC_GET_REQUEST[i_type].items()
 
+    def get_ffdc_get_redfish_request(self, i_type):
+        r"""
+        #######################################################################
+        #   @brief    This method returns the list from the dictionary for scp
+        #   @param    i_type: @type string: string index lookup
+        #   @return   List of key pair from the dictionary
+        #######################################################################
+        """
+        return FFDC_GET_REDFISH_REQUEST[i_type].items()
+
     def get_ffdc_cmd_index(self):
         r"""
         #######################################################################
@@ -243,6 +267,15 @@
         """
         return FFDC_GET_REQUEST.keys()
 
+    def get_ffdc_get_redfish_request_index(self):
+        r"""
+        #######################################################################
+        #   @brief    This method returns the list index from dictionary
+        #   @return   List of index to the dictionary
+        #######################################################################
+        """
+        return FFDC_GET_REDFISH_REQUEST.keys()
+
     def get_ffdc_file_index(self):
         r"""
         #######################################################################
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index c13d16e..bf43233 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -294,6 +294,31 @@
 
     [Return]  ${ffdc_file_list}
 
+
+Log FFDC Get Redfish Requests
+    [Documentation]  Run the get requests associated with the key and return a
+    ...              list of generated files.
+    [Arguments]  ${key_index}
+
+    # Note: Output will be in JSON pretty_print format.
+
+    # Description of argument(s):
+    # key_index  The key to the FFDC_GET_REDFISH_REQUEST dictionary that contains the
+    #            get requests that are to be run.
+
+    @{ffdc_file_list}=  Create List
+    @{cmd_list}=  Get FFDC Get Redfish Request  ${key_index}
+
+    FOR  ${cmd}  IN  @{cmd_list}
+      ${logpath}=  Catenate  SEPARATOR=  ${LOG_PREFIX}  ${cmd[0]}
+      ${resp}=  Redfish.Get  ${cmd[1]}
+      Write Data To File  ${\n}${resp}${\n}  ${logpath}
+      Append To List  ${ffdc_file_list}  ${logpath}
+    END
+
+    [Return]  ${ffdc_file_list}
+
+
 BMC FFDC Get Requests
     [Documentation]  Iterate over get request list and return a list of
     ...              generated files.
@@ -312,6 +337,26 @@
 
     [Return]  ${ffdc_file_list}
 
+
+BMC FFDC Get Redfish Requests
+    [Documentation]  Iterate over get request list and return a list of
+    ...              generated files.
+
+    @{ffdc_file_list}=  Create List
+
+    @{entries}=  Get ffdc get redfish request index
+    # Example of entries:
+    # entries:
+    #  entries[0]:  GET REQUESTS
+
+    FOR  ${index}  IN  @{entries}
+      ${ffdc_file_sub_list}=  Log FFDC Get Redfish Requests  ${index}
+      ${ffdc_file_list}=  Smart Combine Lists  ${ffdc_file_list}  ${ffdc_file_sub_list}
+    END
+
+    [Return]  ${ffdc_file_list}
+
+
 Log OS All distros FFDC
     [Documentation]  Run commands from FFDC_OS_ALL_DISTROS_FILE to create FFDC
     ...              files and return a list of generated files.