diff options
author | Matt Spinler <spinler@us.ibm.com> | 2019-10-23 09:26:48 -0500 |
---|---|---|
committer | Matt Spinler <spinler@us.ibm.com> | 2019-11-04 16:14:16 -0600 |
commit | aa659477fa398f255c5a87207224d59aea15aa34 (patch) | |
tree | eb3eef6ec6cd089eca8b92d80534c0ce0bad7d75 | |
parent | 67456c2baa53c96118cd0565a8ec0f3814b38f68 (diff) | |
download | phosphor-logging-aa659477fa398f255c5a87207224d59aea15aa34.tar.gz phosphor-logging-aa659477fa398f255c5a87207224d59aea15aa34.zip |
PEL: Create FailingMTMS section for new PELs
When a PEL is created from an OpenBMC event log, add the FailingMTMS
section to the PEL. This contains the machine type, model, and serial
number fields.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I8d08e6dda00260efebd2c6ac165270d2aaf98d67
-rw-r--r-- | extensions/openpower-pels/failing_mtms.cpp | 2 | ||||
-rw-r--r-- | extensions/openpower-pels/manager.cpp | 4 | ||||
-rw-r--r-- | extensions/openpower-pels/pel.cpp | 7 | ||||
-rw-r--r-- | extensions/openpower-pels/pel.hpp | 5 | ||||
-rw-r--r-- | test/openpower-pels/pel_test.cpp | 8 |
5 files changed, 17 insertions, 9 deletions
diff --git a/extensions/openpower-pels/failing_mtms.cpp b/extensions/openpower-pels/failing_mtms.cpp index 1b15c16..b60ce31 100644 --- a/extensions/openpower-pels/failing_mtms.cpp +++ b/extensions/openpower-pels/failing_mtms.cpp @@ -20,6 +20,8 @@ FailingMTMS::FailingMTMS(const DataInterfaceBase& dataIface) : _header.version = failingMTMSVersion; _header.subType = 0; _header.componentID = static_cast<uint16_t>(ComponentID::phosphorLogging); + + _valid = true; } FailingMTMS::FailingMTMS(Stream& pel) diff --git a/extensions/openpower-pels/manager.cpp b/extensions/openpower-pels/manager.cpp index 2141a71..bc62bd3 100644 --- a/extensions/openpower-pels/manager.cpp +++ b/extensions/openpower-pels/manager.cpp @@ -116,8 +116,8 @@ void Manager::createPEL(const std::string& message, uint32_t obmcLogID, { AdditionalData ad{additionalData}; - auto pel = - std::make_unique<PEL>(*entry, obmcLogID, timestamp, severity, ad); + auto pel = std::make_unique<PEL>(*entry, obmcLogID, timestamp, severity, + ad, *_dataIface); _repo.add(pel); } diff --git a/extensions/openpower-pels/pel.cpp b/extensions/openpower-pels/pel.cpp index 157af5a..ffd4974 100644 --- a/extensions/openpower-pels/pel.cpp +++ b/extensions/openpower-pels/pel.cpp @@ -1,6 +1,7 @@ #include "pel.hpp" #include "bcd_time.hpp" +#include "failing_mtms.hpp" #include "log_id.hpp" #include "section_factory.hpp" #include "src.hpp" @@ -16,7 +17,8 @@ namespace message = openpower::pels::message; PEL::PEL(const message::Entry& entry, uint32_t obmcLogID, uint64_t timestamp, phosphor::logging::Entry::Level severity, - const AdditionalData& additionalData) + const AdditionalData& additionalData, + const DataInterfaceBase& dataIface) { _ph = std::make_unique<PrivateHeader>(entry.componentID, obmcLogID, timestamp); @@ -25,7 +27,8 @@ PEL::PEL(const message::Entry& entry, uint32_t obmcLogID, uint64_t timestamp, auto src = std::make_unique<SRC>(entry, additionalData); _optionalSections.push_back(std::move(src)); - // Add future sections here + auto mtms = std::make_unique<FailingMTMS>(dataIface); + _optionalSections.push_back(std::move(mtms)); _ph->sectionCount() = 2 + _optionalSections.size(); } diff --git a/extensions/openpower-pels/pel.hpp b/extensions/openpower-pels/pel.hpp index 9f34b62..bc857e2 100644 --- a/extensions/openpower-pels/pel.hpp +++ b/extensions/openpower-pels/pel.hpp @@ -1,6 +1,7 @@ #pragma once #include "additional_data.hpp" +#include "data_interface.hpp" #include "private_header.hpp" #include "registry.hpp" #include "src.hpp" @@ -85,10 +86,12 @@ class PEL * @param[in] timestamp - Timestamp from the event log * @param[in] severity - Severity from the event log * @param[in] additionalData - The AdditionalData contents + * @param[in] dataIface - The data interface object */ PEL(const openpower::pels::message::Entry& entry, uint32_t obmcLogID, uint64_t timestamp, phosphor::logging::Entry::Level severity, - const AdditionalData& additionalData); + const AdditionalData& additionalData, + const DataInterfaceBase& dataIface); /** * @brief Convenience function to return the log ID field from the diff --git a/test/openpower-pels/pel_test.cpp b/test/openpower-pels/pel_test.cpp index 1f9917a..b0c6528 100644 --- a/test/openpower-pels/pel_test.cpp +++ b/test/openpower-pels/pel_test.cpp @@ -1,6 +1,7 @@ #include "elog_entry.hpp" #include "extensions/openpower-pels/generic.hpp" #include "extensions/openpower-pels/pel.hpp" +#include "mocks.hpp" #include "pel_utils.hpp" #include <filesystem> @@ -121,9 +122,10 @@ TEST_F(PELTest, CreateFromRegistryTest) regEntry.src.reasonCode = 0x1234; AdditionalData ad; + MockDataInterface dataIface; - PEL pel{regEntry, 42, timestamp, phosphor::logging::Entry::Level::Error, - ad}; + PEL pel{regEntry, 42, timestamp, phosphor::logging::Entry::Level::Error, ad, + dataIface}; EXPECT_TRUE(pel.valid()); EXPECT_EQ(pel.privateHeader()->obmcLogID(), 42); @@ -131,8 +133,6 @@ TEST_F(PELTest, CreateFromRegistryTest) EXPECT_EQ(pel.primarySRC().value()->asciiString(), "BD051234 "); - - // Add more checks as more sections are added } // Test that we'll create Generic optional sections for sections that |