Add ServiceData callout list to PEL
Signed-off-by: Zane Shelley <zshelle@us.ibm.com>
Change-Id: I03b96f48d211c6dc057acc760a0b0eda2ea8fc42
diff --git a/analyzer/analyzer_main.cpp b/analyzer/analyzer_main.cpp
index d304ed1..3cc1d65 100644
--- a/analyzer/analyzer_main.cpp
+++ b/analyzer/analyzer_main.cpp
@@ -2,6 +2,7 @@
#include <libpdbg.h>
#include <unistd.h>
+#include <analyzer/service_data.hpp>
#include <hei_main.hpp>
#include <phosphor-logging/log.hpp>
#include <util/pdbg.hpp>
@@ -30,9 +31,11 @@
* @brief Will create and submit a PEL using the given data.
* @param i_rootCause A signature defining the attention root cause.
* @param i_isoData The data gathered during isolation (for FFDC).
+ * @param i_servData Data regarding service actions gathered during analysis.
*/
void createPel(const libhei::Signature& i_rootCause,
- const libhei::IsolationData& i_isoData);
+ const libhei::IsolationData& i_isoData,
+ const ServiceData& i_servData);
//------------------------------------------------------------------------------
@@ -139,10 +142,14 @@
util::pdbg::getPath(rootCause.getChip()),
rootCause.toUint32(), __attn(rootCause.getAttnType()));
- // TODO: Perform service actions based on the root cause.
+ // TODO: Perform service actions based on the root cause. The default
+ // callout if none other exist is level 2 support.
+ ServiceData servData{};
+ servData.addCallout(std::make_shared<ProcedureCallout>(
+ ProcedureCallout::NEXTLVL, Callout::Priority::HIGH));
// Create and commit a PEL.
- createPel(rootCause, i_isoData);
+ createPel(rootCause, i_isoData, servData);
}
return attnFound;
diff --git a/analyzer/create_pel.cpp b/analyzer/create_pel.cpp
index b77d048..64463b2 100644
--- a/analyzer/create_pel.cpp
+++ b/analyzer/create_pel.cpp
@@ -1,5 +1,6 @@
#include <unistd.h>
+#include <analyzer/service_data.hpp>
#include <analyzer/util.hpp>
#include <hei_main.hpp>
#include <phosphor-logging/elog.hpp>
@@ -90,6 +91,24 @@
//------------------------------------------------------------------------------
+void __addCalloutList(const ServiceData& i_servData,
+ std::vector<util::FFDCFile>& io_userDataFiles)
+{
+ // Get the JSON output for the callout list.
+ nlohmann::json json;
+ i_servData.getCalloutList(json);
+
+ // Create a new entry for the user data section containing the callout list.
+ io_userDataFiles.emplace_back(util::FFDCFormat::JSON, FFDC_CALLOUTS,
+ FFDC_VERSION1);
+
+ // Use a file stream to write the JSON to file.
+ std::ofstream o{io_userDataFiles.back().getPath()};
+ o << json;
+}
+
+//------------------------------------------------------------------------------
+
void __captureSignatureList(const libhei::IsolationData& i_isoData,
std::vector<util::FFDCFile>& io_userDataFiles)
{
@@ -236,7 +255,8 @@
//------------------------------------------------------------------------------
void createPel(const libhei::Signature& i_rootCause,
- const libhei::IsolationData& i_isoData)
+ const libhei::IsolationData& i_isoData,
+ const ServiceData& i_servData)
{
// The message registry will require additional log data to fill in keywords
// and additional log data.
@@ -255,6 +275,9 @@
// Set words 6-9 of the SRC.
__setSrc(i_rootCause, logData);
+ // Add the list of callouts to the PEL.
+ __addCalloutList(i_servData, userDataFiles);
+
// Capture the complete signature list.
__captureSignatureList(i_isoData, userDataFiles);