Collect Redfish Enumerate log for FFDC

Resolves openbmc/openbmc-test-automation#1537

Change-Id: I59a741b8df2628160b313fbf192217b87b6ed73e
Signed-off-by: Steven Sombar <ssombar@us.ibm.com>
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index 65caed7..97ddcab 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -7,6 +7,7 @@
 Resource               utils.robot
 Resource               list_utils.robot
 Resource               logging_utils.robot
+Resource               bmc_redfish_resource.robot
 Library                SSHLibrary
 Library                OperatingSystem
 Library                Collections
@@ -58,6 +59,7 @@
 
     [Return]  ${ffdc_file_list}
 
+
 Method Call Keyword List
     [Documentation]  Process FFDC request and return a list of generated files.
     [Arguments]  ${index}  ${ffdc_function_list}=${EMPTY}
@@ -441,6 +443,7 @@
 
     [Return]  ${ffdc_file_list}
 
+
 SCP Dump Files
     [Documentation]  Copy all dump files from BMC to local system.
 
@@ -449,6 +452,7 @@
 
     [Return]  ${ffdc_file_list}
 
+
 Collect Dump Log
     [Documentation]  Collect dumps from dump entry.
     [Arguments]  ${log_prefix_path}=${LOG_PREFIX}
@@ -464,6 +468,49 @@
     ${dump_list}=  Get Dictionary Keys  ${data}
 
 
+Enumerate Redfish Resources
+    [Documentation]  Enumerate /redfish/v1 resources and properties to
+    ...              a file. Return a list which contains the file name.
+    [Arguments]  ${log_prefix_path}=${LOG_PREFIX}
+
+    # Description of argument(s):
+    # log_prefix_path    The location specifying where to create FFDC file(s).
+
+    # Login is needed to fetch Redfish information.
+    # If login fails, return from keyword.
+    ${status}=  Run Keyword And Return Status  redfish.Login
+    Return From Keyword If   ${status} == ${False}
+
+    # Get the Redfish resources and properties.
+    ${json_data}=  redfish.Enumerate Request  /redfish/v1
+    # Typical output:
+    # {
+    #  "@odata.id": "/redfish/v1",
+    #  "@odata.type": "#ServiceRoot.v1_1_1.ServiceRoot",
+    #  "AccountService": {
+    #    "@odata.id": "/redfish/v1/AccountService"
+    #  },
+    #  "Chassis": {
+    #    "@odata.id": "/redfish/v1/Chassis"
+    #  },
+    #  "Id": "RootService",
+    #  "JsonSchemas": {
+    #    "@odata.id": "/redfish/v1/JsonSchemas"
+    #  },
+    # ..etc...
+    # }
+
+    @{ffdc_file_list}=  Create List
+    ${logpath}=  Catenate  SEPARATOR=  ${log_prefix_path}
+    ...  redfish_resource_properties.txt
+    Create File  ${logpath}
+    Write Data To File  "${\n}${json_data}${\n}"  ${logpath}
+
+    Append To List  ${ffdc_file_list}  ${logpath}
+
+    [Return]  ${ffdc_file_list}
+
+
 Collect eSEL Log
     [Documentation]  Create raw and formatted eSEL files.
     [Arguments]  ${log_prefix_path}=${LOG_PREFIX}