From 367144cfa0eb857f4cb9ba786f43933469e19e34 Mon Sep 17 00:00:00 2001 From: Matt Spinler Date: Thu, 19 Sep 2019 15:33:52 -0500 Subject: PEL: Find an entry in the message registry JSON The message registry is a JSON file that holds data required to create a PEL out of an OpenBMC event log. It includes fields like 'subsystem', 'event type', 'action flags', 'SRC reason code', etc. Many fields in the message registry are optional, and a very minimal entry make look like: { "Name": "xyz.openbmc_project.Power.Error.Fault", "Subsystem": "power_supply", "ActionFlags": ["service_action", "report"], "SRC": { "ReasonCode": "0x2030" } } This commit adds support to look up a message registry entry based on an OpenBMC event log's 'Message' property (i.e. xyz.openbmc_project.Power.Error.Fault) and then fill in a structure with the fields found. Future commits will fill in the SRC related fields, as well as actually create the PEL. The message registry file can be found on the BMC at: /usr/share/phosphor-logging/pels/message_registry.json. For testing, users can put their own message_registry.json in /etc/phosphor-logging, and that will take precedence. Signed-off-by: Matt Spinler Change-Id: Ie4195ed7e58ab6a231271f6b295e63b1d0a4cd78 --- extensions/openpower-pels/manager.hpp | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'extensions/openpower-pels/manager.hpp') diff --git a/extensions/openpower-pels/manager.hpp b/extensions/openpower-pels/manager.hpp index 49ac8bf..5f092f4 100644 --- a/extensions/openpower-pels/manager.hpp +++ b/extensions/openpower-pels/manager.hpp @@ -3,6 +3,7 @@ #include "data_interface.hpp" #include "log_manager.hpp" #include "paths.hpp" +#include "registry.hpp" #include "repository.hpp" namespace openpower @@ -10,8 +11,6 @@ namespace openpower namespace pels { -using namespace phosphor::logging; - /** * @brief PEL manager object */ @@ -33,7 +32,9 @@ class Manager explicit Manager(phosphor::logging::internal::Manager& logManager, std::unique_ptr&& dataIface) : _logManager(logManager), - _repo(getPELRepoPath()), _dataIface(std::move(dataIface)) + _repo(getPELRepoPath()), + _registry(getMessageRegistryPath() / message::registryFileName), + _dataIface(std::move(dataIface)) { } @@ -50,7 +51,7 @@ class Manager * @param[in] associations - the Associations property */ void create(const std::string& message, uint32_t obmcLogID, - uint64_t timestamp, Entry::Level severity, + uint64_t timestamp, phosphor::logging::Entry::Level severity, const std::vector& additionalData, const std::vector& associations); @@ -93,20 +94,25 @@ class Manager * @param[in] associations - The associations property */ void createPEL(const std::string& message, uint32_t obmcLogID, - uint64_t timestamp, Entry::Level severity, + uint64_t timestamp, phosphor::logging::Entry::Level severity, const std::vector& additionalData, const std::vector& associations); /** * @brief Reference to phosphor-logging's Manager class */ - internal::Manager& _logManager; + phosphor::logging::internal::Manager& _logManager; /** * @brief The PEL repository object */ Repository _repo; + /** + * @brief The PEL message registry object + */ + message::Registry _registry; + /** * @brief The API the PEL sections use to gather data */ -- cgit v1.2.1