Fix eSEL indexing from error log "AdditionalData"

Change-Id: I2d83e175f9295a0bddb3c167e5543f9990f4ad52
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/openbmc_ffdc_list.py b/lib/openbmc_ffdc_list.py
index 896ac1d..9a1e4fb 100755
--- a/lib/openbmc_ffdc_list.py
+++ b/lib/openbmc_ffdc_list.py
@@ -277,3 +277,14 @@
         ########################################################################
         """
         return ''.join(e for e in i_str if e.isalnum())
+
+    def get_esel_index(self, esel_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(esel_list) if 'ESEL=' in str]
+        return index[0]
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index df959af..3e7f922 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -338,11 +338,15 @@
     # }
 
     :FOR  ${entry_path}  IN  @{esel_list}
+    # Skip reading attribute if entry URI is a callout.
+    # Example: /xyz/openbmc_project/logging/entry/1/callout
+    \  Continue For Loop If  '${entry_path.rsplit('/', 1)[1]}' == 'callout'
     \  ${esel_data}=  Read Attribute  ${entry_path}  AdditionalData  quiet=${1}
     \  ${length}=  Get Length  ${esel_data}
     # Skip writting to file if eSEL AdditionalData is empty
     \  Continue For Loop If  ${length} == ${0}
-    \  Write Data To File  "${esel_data[0]}"  ${logpath}
+    \  ${index}=  Get Esel Index  ${esel_data}
+    \  Write Data To File  "${esel_data[${index}]}"  ${logpath}
     \  Write Data To File  ${\n}  ${logpath}
 
     ${out}=  Run  which eSEL.pl