Collect the BMC dump if exists during FFDC collection.

Resolves openbmc/openbmc-test-automation#981

Change-Id: I4c1490333fa8e0701e682e56894f0d496dd4c16d
Signed-off-by: Sweta Potthuri <spotthur@in.ibm.com>
diff --git a/lib/openbmc_ffdc_list.py b/lib/openbmc_ffdc_list.py
index c260740..376d50d 100755
--- a/lib/openbmc_ffdc_list.py
+++ b/lib/openbmc_ffdc_list.py
@@ -106,6 +106,8 @@
 ENUMERATE_CONTROL = OPENBMC_BASE + 'control/enumerate'
 ENUMERATE_STATE = OPENBMC_BASE + 'state/enumerate'
 ENUMERATE_OCC = OPENPOWER_BASE + 'control/enumerate'
+ENUMERATE_DUMPS = OPENBMC_BASE + 'dumps/enumerate'
+
 # Add file name and correcponding Get Request
 FFDC_GET_REQUEST = {
     'GET REQUESTS':
@@ -119,6 +121,7 @@
         'BMC_led': ENUMERATE_LED,
         'BMC_state': ENUMERATE_STATE,
         'OCC_state': ENUMERATE_OCC,
+        'BMC_dumps': ENUMERATE_DUMPS,
     },
 }
 # Define your keywords in method/utils and call here
@@ -133,6 +136,8 @@
         'Core Files': 'SCP Coredump Files',
         'SEL Log': 'Collect eSEL Log',
         'Sys Inventory Files': 'System Inventory Files',
+        'Dump Log': 'Collect Dump Log',
+        'Dump Files': 'SCP Dump Files'
     },
 }
 # -----------------------------------------------------------------
@@ -267,3 +272,15 @@
         """
         index = [i for i, str in enumerate(esel_list) if 'ESEL=' in str]
         return index[0]
+
+    def get_dump_index(self, dump_list):
+        r"""
+        #######################################################################
+        #   @brief    Returns the eSEL binary index.
+        #   @param    esel_ist: @type list: eSEL list.
+        #   @return   Index of "ESEL=" in the list.
+        #######################################################################
+        """
+        index = [i for i, str in enumerate(dump_list) if 'DUMP=' in str]
+        return index[0]
+
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index 682e96b..b007718 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -12,6 +12,7 @@
 Library            String
 Library            gen_print.py
 Library            gen_robot_keyword.py
+Library            dump_utils.py
 
 *** Keywords ***
 
@@ -430,6 +431,27 @@
 
     [Return]  ${ffdc_file_list}
 
+SCP Dump Files
+    [Documentation]  Copy all dump files from BMC to local system.
+
+    # Check if dumps exist
+    ${ffdc_file_list}=  Scp Dumps  ${FFDC_DIR_PATH}  ${FFDC_PREFIX}
+
+    [Return]  ${ffdc_file_list}
+
+Collect Dump Log
+    [Documentation]  Collect dumps from dump entry.
+    [Arguments]  ${log_prefix_path}=${LOG_PREFIX}
+
+    ${data}=  Read Properties  ${DUMP_ENTRY_URI}/enumerate  quiet=${1}
+
+    # Grab the list of entries from dump/entry/
+    # The data shown below is the result of the "Get Dictionary Keys".
+    # Example:
+    # /xyz/openbmc_project/dump/entry/1
+    # /xyz/openbmc_project/dump/entry/2
+
+    ${dump_list}=  Get Dictionary Keys  ${data}
 
 Collect eSEL Log
     [Documentation]  Collect eSEL log from logging entry and convert eSEL data