PEL: Start creating PELs from event logs
Look up incoming OpenBMC event logs in the message registry and create
PELs for them if a registry entry is found.
What happens when an event log can't be found in the message registry,
such as creating a different PEL, will be addressed in a separate
commit.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I45c634830021fdf2efb54e3cbfd6d496fd3d7d01
diff --git a/extensions/openpower-pels/manager.cpp b/extensions/openpower-pels/manager.cpp
index fd3670c..2141a71 100644
--- a/extensions/openpower-pels/manager.cpp
+++ b/extensions/openpower-pels/manager.cpp
@@ -110,7 +110,20 @@
const std::vector<std::string>& additionalData,
const std::vector<std::string>& associations)
{
- // TODO: look up the error in _registry and create a PEL
+ auto entry = _registry.lookup(message);
+
+ if (entry)
+ {
+ AdditionalData ad{additionalData};
+
+ auto pel =
+ std::make_unique<PEL>(*entry, obmcLogID, timestamp, severity, ad);
+
+ _repo.add(pel);
+ }
+
+ // TODO ibm-openbmc/dev/1151: When the message registry is actually filled
+ // in, handle the case where an error isn't in it.
}
} // namespace pels