PEL: Find message registry callouts to use
Add Registry::getCallouts() to find, based on the system type and
AdditionalData property, the callouts that apply for the callout JSON
passed in. This will be used to choose the callouts to add to a PEL
based on the system and current failure informaton.
These files describe the actual JSON format:
* extensions/openpower-pels/registry/README.md
* extensions/openpower-pels/registry/schema/schema.json
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I5901e459981b10f6c338d3ef827d9128338dca50
diff --git a/extensions/openpower-pels/registry.hpp b/extensions/openpower-pels/registry.hpp
index 09666f3..047853d 100644
--- a/extensions/openpower-pels/registry.hpp
+++ b/extensions/openpower-pels/registry.hpp
@@ -1,4 +1,6 @@
#pragma once
+#include "additional_data.hpp"
+
#include <filesystem>
#include <nlohmann/json.hpp>
#include <optional>
@@ -169,6 +171,18 @@
};
/**
+ * @brief Holds callout information pulled out of the JSON.
+ */
+struct RegistryCallout
+{
+ std::string priority;
+ std::string locCode;
+ std::string procedure;
+ std::string symbolicFRU;
+ std::string symbolicFRUTrusted;
+};
+
+/**
* @class Registry
*
* This class wraps the message registry JSON data and allows one to find
@@ -235,6 +249,26 @@
std::optional<Entry> lookup(const std::string& name, LookupType type,
bool toCache = false);
+ /**
+ * @brief Find the callouts to put into the PEL based on the calloutJSON
+ * data.
+ *
+ * The system type and AdditionalData are used to index into the correct
+ * callout table.
+ *
+ * Throws exceptions on failures.
+ *
+ * @param[in] calloutJSON - Where to look up the callouts
+ * @param[in] systemType - The system type from EntityManager
+ * @param[in] additionalData - The AdditionalData property
+ *
+ * @return std::vector<RegistryCallout> - The callouts to use
+ */
+ static std::vector<RegistryCallout>
+ getCallouts(const nlohmann::json& calloutJSON,
+ const std::string& systemType,
+ const AdditionalData& additionalData);
+
private:
/**
* @brief Parse message registry file using nlohmann::json