Create eSEL data file for parser conversion
Resolves openbmc/openbmc-test-automation#418
Change-Id: Ib0d3f458f5cd74f228a5eb1eb39d13147e73bc7c
Signed-off-by: George Keishing <gkeishin@in.ibm.com>
diff --git a/lib/openbmc_ffdc_list.py b/lib/openbmc_ffdc_list.py
index 1283dbf..62072eb 100755
--- a/lib/openbmc_ffdc_list.py
+++ b/lib/openbmc_ffdc_list.py
@@ -135,6 +135,7 @@
'Get Request FFDC': 'BMC FFDC Get Requests',
'OS FFDC': 'OS FFDC Files',
'Core Files': 'SCP Coredump Files',
+ 'SEL Log': 'Collect eSEL Log',
},
}
diff --git a/lib/openbmc_ffdc_methods.robot b/lib/openbmc_ffdc_methods.robot
index f0fa402..c667057 100755
--- a/lib/openbmc_ffdc_methods.robot
+++ b/lib/openbmc_ffdc_methods.robot
@@ -246,3 +246,41 @@
# Remove the file from remote to avoid re-copying on next FFDC call
\ Execute Command On BMC rm ${index}
+
+##############################################################################
+Collect eSEL Log
+ [Documentation] Collect eSEL log from logging entry.
+ ${resp}= OpenBMC Get Request ${BMC_LOGGING_ENTRY}/enumerate quiet=${1}
+ ${status}= Run Keyword And Return Status
+ ... Should Be Equal As Strings ${resp.status_code} ${HTTP_OK}
+ Return From Keyword If '${status}' == '${False}'
+
+ ${content}= To Json ${resp.content}
+ # Grab the list of entries from logging/entry/
+ # The data shown below is the result of the "Get Dictionary Keys".
+ # Example:
+ # /xyz/openbmc_project/logging/entry/1
+ # /xyz/openbmc_project/logging/entry/2
+ ${esel_list}= Get Dictionary Keys ${content['data']}
+
+ ${logpath}= Catenate SEPARATOR= ${LOG_PREFIX} esel.txt
+ Create File ${logpath}
+ # Fetch data from /xyz/openbmc_project/logging/entry/1/attr/AdditionalData
+ # "ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00 "
+ # Sample eSEL entry:
+ # "/xyz/openbmc_project/logging/entry/1": {
+ # "Timestamp": 1487744317025,
+ # "AdditionalData": [
+ # "ESEL=00 00 df 00 00 00 00 20 00 04 12 35 6f aa 00 00 "
+ # ],
+ # "Message": "org.open_power.Error.Host.Event.Event",
+ # "Id": 1,
+ # "Severity": "xyz.openbmc_project.Logging.Entry.Level.Emergency"
+ # }
+
+ :FOR ${entry_path} IN @{esel_list}
+ \ ${esel_data}= Read Attribute ${entry_path} AdditionalData quiet=${1}
+ \ Write Data To File "${esel_data[0]}" ${logpath}
+ \ Write Data To File ${\n} ${logpath}
+
+##############################################################################