extension: use map in create extension
Adjust the Create extension to use a map for metadata instead of
vector.
Tested: Unit tests updated and passing.
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
Change-Id: I9bd62b8dcc8b18a61958ed64de98b52a48333637
diff --git a/extensions.hpp b/extensions.hpp
index 727e288..52a6668 100644
--- a/extensions.hpp
+++ b/extensions.hpp
@@ -17,7 +17,7 @@
*/
using StartupFunction = std::function<void(internal::Manager&)>;
-using AdditionalDataArg = std::vector<std::string>;
+using AdditionalDataArg = std::map<std::string, std::string>;
using AssociationEndpointsArg = std::vector<std::string>;
using FFDCArg = FFDCEntries;
diff --git a/extensions/openpower-pels/additional_data.hpp b/extensions/openpower-pels/additional_data.hpp
index 09dbd20..74abce9 100644
--- a/extensions/openpower-pels/additional_data.hpp
+++ b/extensions/openpower-pels/additional_data.hpp
@@ -38,19 +38,9 @@
* @param[in] ad - the AdditionalData property vector with
* entries of "KEY=VALUE"
*/
- explicit AdditionalData(const std::vector<std::string>& ad)
- {
- for (auto& item : ad)
- {
- auto pos = item.find_first_of('=');
- if (pos == std::string::npos || pos == 0)
- {
- continue;
- }
-
- _data[item.substr(0, pos)] = std::move(item.substr(pos + 1));
- }
- }
+ explicit AdditionalData(const std::map<std::string, std::string>& ad) :
+ _data(ad)
+ {}
/**
* @brief Returns the value of the AdditionalData item for the
diff --git a/extensions/openpower-pels/manager.cpp b/extensions/openpower-pels/manager.cpp
index 03254d2..5b773c6 100644
--- a/extensions/openpower-pels/manager.cpp
+++ b/extensions/openpower-pels/manager.cpp
@@ -73,7 +73,7 @@
void Manager::create(const std::string& message, uint32_t obmcLogID,
uint64_t timestamp, Entry::Level severity,
- const std::vector<std::string>& additionalData,
+ const std::map<std::string, std::string>& additionalData,
const std::vector<std::string>& associations,
const FFDCEntries& ffdc)
{
@@ -361,7 +361,7 @@
void Manager::createPEL(
const std::string& message, uint32_t obmcLogID, uint64_t timestamp,
phosphor::logging::Entry::Level severity,
- const std::vector<std::string>& additionalData,
+ const std::map<std::string, std::string>& additionalData,
const std::vector<std::string>& /*associations*/, const FFDCEntries& ffdc)
{
auto entry = _registry.lookup(message, rg::LookupType::name);
diff --git a/extensions/openpower-pels/manager.hpp b/extensions/openpower-pels/manager.hpp
index 2429aec..787bb02 100644
--- a/extensions/openpower-pels/manager.hpp
+++ b/extensions/openpower-pels/manager.hpp
@@ -113,7 +113,7 @@
*/
void create(const std::string& message, uint32_t obmcLogID,
uint64_t timestamp, phosphor::logging::Entry::Level severity,
- const std::vector<std::string>& additionalData,
+ const std::map<std::string, std::string>& additionalData,
const std::vector<std::string>& associations,
const phosphor::logging::FFDCEntries& ffdc =
phosphor::logging::FFDCEntries{});
@@ -319,7 +319,7 @@
*/
void createPEL(const std::string& message, uint32_t obmcLogID,
uint64_t timestamp, phosphor::logging::Entry::Level severity,
- const std::vector<std::string>& additionalData,
+ const std::map<std::string, std::string>& additionalData,
const std::vector<std::string>& associations,
const phosphor::logging::FFDCEntries& ffdc);
diff --git a/log_manager.cpp b/log_manager.cpp
index fe89951..7d54e12 100644
--- a/log_manager.cpp
+++ b/log_manager.cpp
@@ -452,7 +452,7 @@
try
{
create(entry.message(), entry.id(), entry.timestamp(),
- entry.severity(), entry.additionalData(), assocs, ffdc);
+ entry.severity(), entry.additionalData2(), assocs, ffdc);
}
catch (const std::exception& e)
{
diff --git a/test/openpower-pels/additional_data_test.cpp b/test/openpower-pels/additional_data_test.cpp
index c93fdf2..45e1776 100644
--- a/test/openpower-pels/additional_data_test.cpp
+++ b/test/openpower-pels/additional_data_test.cpp
@@ -21,8 +21,8 @@
TEST(AdditionalDataTest, GetKeywords)
{
- std::vector<std::string> data{"KEY1=VALUE1", "KEY2=VALUE2",
- "KEY3=", "HELLOWORLD", "=VALUE5"};
+ std::map<std::string, std::string> data{
+ {"KEY1", "VALUE1"}, {"KEY2", "VALUE2"}, {"KEY3", ""}};
AdditionalData ad{data};
EXPECT_TRUE(ad.getValue("KEY1"));
diff --git a/test/openpower-pels/pel_manager_test.cpp b/test/openpower-pels/pel_manager_test.cpp
index e45fd55..18be5db 100644
--- a/test/openpower-pels/pel_manager_test.cpp
+++ b/test/openpower-pels/pel_manager_test.cpp
@@ -155,8 +155,8 @@
pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
pelFile.close();
- std::string adItem = "RAWPEL=" + pelFilename.string();
- std::vector<std::string> additionalData{adItem};
+ std::map<std::string, std::string> additionalData{
+ {"RAWPEL", pelFilename.string()}};
std::vector<std::string> associations;
manager.create("error message", 42, 0,
@@ -201,8 +201,8 @@
pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
pelFile.close();
- std::string adItem = "RAWPEL=" + pelFilename.string();
- std::vector<std::string> additionalData{adItem};
+ std::map<std::string, std::string> additionalData{
+ {"RAWPEL", pelFilename.string()}};
std::vector<std::string> associations;
manager.create("error message", 42, 0,
@@ -291,7 +291,7 @@
std::placeholders::_2, std::placeholders::_3),
std::move(journal)};
- std::vector<std::string> additionalData{"FOO=BAR"};
+ std::map<std::string, std::string> additionalData{{"FOO", "BAR"}};
std::vector<std::string> associations;
// Create the event log to create the PEL from.
@@ -408,8 +408,8 @@
pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
pelFile.close();
- std::string adItem = "RAWPEL=" + pelFilename.string();
- std::vector<std::string> additionalData{adItem};
+ std::map<std::string, std::string> additionalData{
+ {"RAWPEL", pelFilename.string()}};
std::vector<std::string> associations;
manager.create("error message", 42, 0,
@@ -624,8 +624,7 @@
std::move(journal)};
{
- std::string adItem = "ESEL=" + esel;
- std::vector<std::string> additionalData{adItem};
+ std::map<std::string, std::string> additionalData{{"ESEL", esel}};
std::vector<std::string> associations;
manager.create("error message", 37, 0,
@@ -639,12 +638,12 @@
// Now an invalid one
{
- std::string adItem = "ESEL=" + esel;
+ std::string adItem = esel;
// Crop it
adItem.resize(adItem.size() - 300);
- std::vector<std::string> additionalData{adItem};
+ std::map<std::string, std::string> additionalData{{"ESEL", adItem}};
std::vector<std::string> associations;
manager.create("error message", 38, 0,
@@ -680,11 +679,11 @@
std::placeholders::_2, std::placeholders::_3),
std::move(journal)};
- // Create 25 1000B (4096B on disk each, which is what is used for pruning)
- // BMC non-informational PELs in the 100KB repository. After the 24th one,
- // the repo will be 96% full and a prune should be triggered to remove all
- // but 7 to get under 30% full. Then when the 25th is added there will be
- // 8 left.
+ // Create 25 1000B (4096B on disk each, which is what is used for
+ // pruning) BMC non-informational PELs in the 100KB repository. After
+ // the 24th one, the repo will be 96% full and a prune should be
+ // triggered to remove all but 7 to get under 30% full. Then when the
+ // 25th is added there will be 8 left.
auto dir = makeTempDir();
for (int i = 1; i <= 25; i++)
@@ -696,8 +695,8 @@
pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
pelFile.close();
- std::string adItem = "RAWPEL=" + pelFilename.string();
- std::vector<std::string> additionalData{adItem};
+ std::map<std::string, std::string> additionalData{
+ {"RAWPEL", pelFilename.string()}};
std::vector<std::string> associations;
manager.create("error message", 42, 0,
@@ -759,8 +758,8 @@
auto dir = makeTempDir();
fs::path pelFilename = dir / "rawpel";
- std::string adItem = "RAWPEL=" + pelFilename.string();
- std::vector<std::string> additionalData{adItem};
+ std::map<std::string, std::string> additionalData{
+ {"RAWPEL", pelFilename.string()}};
std::vector<std::string> associations;
// Add 20 PELs, they will get incrementing IDs like
@@ -836,8 +835,8 @@
auto dir = makeTempDir();
fs::path pelFilename = dir / "rawpel";
- std::string adItem = "RAWPEL=" + pelFilename.string();
- std::vector<std::string> additionalData{adItem};
+ std::map<std::string, std::string> additionalData{
+ {"RAWPEL", pelFilename.string()}};
std::vector<std::string> associations;
// Add 200 PELs, they will get incrementing IDs like
@@ -922,8 +921,8 @@
pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
pelFile.close();
- std::string adItem = "RAWPEL=" + pelFilename.string();
- std::vector<std::string> additionalData{adItem};
+ std::map<std::string, std::string> additionalData{
+ {"RAWPEL", pelFilename.string()}};
std::vector<std::string> associations;
manager.create("error message", 42, 0,
@@ -991,7 +990,7 @@
registryFile << registry;
registryFile.close();
- std::vector<std::string> additionalData;
+ std::map<std::string, std::string> additionalData;
std::vector<std::string> associations;
manager.create("xyz.openbmc_project.Error.Test", 42, 0,
@@ -1027,8 +1026,8 @@
pelFile.write(reinterpret_cast<const char*>(data.data()), data.size());
pelFile.close();
- std::string adItem = "RAWPEL=" + pelFilename.string();
- std::vector<std::string> additionalData{adItem};
+ std::map<std::string, std::string> additionalData{
+ {"RAWPEL", pelFilename.string()}};
std::vector<std::string> associations;
manager.create("error message", 42, 0,
@@ -1052,7 +1051,8 @@
EXPECT_EQ(count, 1);
}
-// Test termination bit set for pel with critical system termination severity
+// Test termination bit set for pel with critical system termination
+// severity
TEST_F(ManagerTest, TestTerminateBitWithPELSevCriticalSysTerminate)
{
const auto registry = R"(
@@ -1097,7 +1097,7 @@
std::placeholders::_2, std::placeholders::_3),
std::move(journal)};
- std::vector<std::string> additionalData{"FOO=BAR"};
+ std::map<std::string, std::string> additionalData{{"FOO", "BAR"}};
std::vector<std::string> associations;
// Create the event log to create the PEL from.
@@ -1200,7 +1200,7 @@
std::placeholders::_2, std::placeholders::_3),
std::move(journal)};
- std::vector<std::string> additionalData;
+ std::map<std::string, std::string> additionalData;
std::vector<std::string> associations;
auto checkDeconfigured = [](bool deconfigured) {
@@ -1346,7 +1346,7 @@
std::bind(std::mem_fn(&TestLogger::log), &logger, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3),
std::move(journal)};
- std::vector<std::string> additionalData;
+ std::map<std::string, std::string> additionalData;
std::vector<std::string> associations;
// Check when there's no PEL with given id.
@@ -1363,8 +1363,8 @@
{
// Verify that the guard flag is false.
EXPECT_FALSE(pel_unguarded.getGuardFlag());
- // Check that `isDeleteProhibited` returns false when the guard flag is
- // false.
+ // Check that `isDeleteProhibited` returns false when the guard flag
+ // is false.
EXPECT_FALSE(manager.isDeleteProhibited(42));
}
manager.erase(42);
@@ -1449,7 +1449,7 @@
std::bind(std::mem_fn(&TestLogger::log), &logger, std::placeholders::_1,
std::placeholders::_2, std::placeholders::_3),
std::move(journal)};
- std::vector<std::string> additionalData;
+ std::map<std::string, std::string> additionalData;
std::vector<std::string> associations;
int fd = createHWIsolatedCalloutFile();
@@ -1468,9 +1468,9 @@
auto data = readPELFile(*pelFile);
PEL pel(*data);
EXPECT_TRUE(pel.valid());
- // Test case where the guard flag is set to true and the hardware isolation
- // guard is associated, which should result in `isDeleteProhibited`
- // returning true as expected.
+ // Test case where the guard flag is set to true and the hardware
+ // isolation guard is associated, which should result in
+ // `isDeleteProhibited` returning true as expected.
EXPECT_TRUE(pel.getGuardFlag());
EXPECT_TRUE(manager.isDeleteProhibited(42));
manager.erase(42);
diff --git a/test/openpower-pels/pel_test.cpp b/test/openpower-pels/pel_test.cpp
index fb88395..67ce75f 100644
--- a/test/openpower-pels/pel_test.cpp
+++ b/test/openpower-pels/pel_test.cpp
@@ -162,7 +162,7 @@
regEntry.src.type = 0xBD;
regEntry.src.reasonCode = 0x1234;
- std::vector<std::string> data{"KEY1=VALUE1"};
+ std::map<std::string, std::string> data{{"KEY1", "VALUE1"}};
AdditionalData ad{data};
NiceMock<MockDataInterface> dataIface;
NiceMock<MockJournal> journal;
@@ -237,10 +237,7 @@
PelFFDC ffdc;
// Over the 16KB max PEL size
- std::string bigAD{"KEY1="};
- bigAD += std::string(17000, 'G');
-
- std::vector<std::string> data{bigAD};
+ std::map<std::string, std::string> data{{"KEY1", std::string(17000, 'G')}};
AdditionalData ad{data};
NiceMock<MockDataInterface> dataIface;
NiceMock<MockJournal> journal;
@@ -362,8 +359,10 @@
// Create a UserData section out of AdditionalData
TEST_F(PELTest, MakeUDSectionTest)
{
- std::vector<std::string> ad{"KEY1=VALUE1", "KEY2=VALUE2", "KEY3=VALUE3",
- "ESEL=TEST"};
+ std::map<std::string, std::string> ad{{"KEY1", "VALUE1"},
+ {"KEY2", "VALUE2"},
+ {"KEY3", "VALUE3"},
+ {"ESEL", "TEST"}};
AdditionalData additionalData{ad};
auto ud = util::makeADUserDataSection(additionalData);
@@ -409,8 +408,7 @@
EXPECT_CALL(dataIface, getSystemIMKeyword())
.WillOnce(Return(std::vector<uint8_t>{0, 1, 0x55, 0xAA}));
- std::string pid = "_PID=" + std::to_string(getpid());
- std::vector<std::string> ad{pid};
+ std::map<std::string, std::string> ad{{"_PID", std::to_string(getpid())}};
AdditionalData additionalData{ad};
auto ud = util::makeSysInfoUserDataSection(additionalData, dataIface);
@@ -752,7 +750,7 @@
regEntry.src.type = 0xBD;
regEntry.src.reasonCode = 0x1234;
- std::vector<std::string> additionalData{"KEY1=VALUE1"};
+ std::map<std::string, std::string> additionalData{{"KEY1", "VALUE1"}};
AdditionalData ad{additionalData};
NiceMock<MockDataInterface> dataIface;
NiceMock<MockJournal> journal;
@@ -863,10 +861,10 @@
file.close();
{
- std::vector<std::string> data{
- "CALLOUT_ERRNO=5",
- "CALLOUT_DEVICE_PATH=/sys/devices/platform/ahb/ahb:apb/"
- "ahb:apb:bus@1e78a000/1e78a340.i2c-bus/i2c-14/14-0072"};
+ std::map<std::string, std::string> data{
+ {"CALLOUT_ERRNO", "5"},
+ {"CALLOUT_DEVICE_PATH",
+ "/sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a340.i2c-bus/i2c-14/14-0072"}};
AdditionalData ad{data};
@@ -917,10 +915,10 @@
{
// Device path not found (wrong i2c addr), so no callouts
- std::vector<std::string> data{
- "CALLOUT_ERRNO=5",
- "CALLOUT_DEVICE_PATH=/sys/devices/platform/ahb/ahb:apb/"
- "ahb:apb:bus@1e78a000/1e78a340.i2c-bus/i2c-14/14-0099"};
+ std::map<std::string, std::string> data{
+ {"CALLOUT_ERRNO", "5"},
+ {"CALLOUT_DEVICE_PATH",
+ "/sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a340.i2c-bus/i2c-14/14-0099"}};
AdditionalData ad{data};
@@ -1149,7 +1147,7 @@
regEntry.src.type = 0xBD;
regEntry.src.reasonCode = 0x1234;
- std::vector<std::string> data;
+ std::map<std::string, std::string> data{};
AdditionalData ad{data};
NiceMock<MockDataInterface> dataIface;
NiceMock<MockJournal> journal;
@@ -1231,7 +1229,8 @@
ad, ffdc,
dataIface, journal};
- // Two more sections than the 1 extra UD section in the first testcase
+ // Two more sections than the 1 extra UD section in the first
+ // testcase
ASSERT_EQ(pel.privateHeader().sectionCount(), pelSectsWithOneUD + 2);
const auto& optionalSections = pel.optionalSections();
@@ -1289,8 +1288,8 @@
{
auto userData = static_cast<UserData*>(optionalSection.get());
- // convert the userdata section to string and then parse in to json
- // format
+ // convert the userdata section to string and then parse in to
+ // json format
std::string userDataString{userData->data().begin(),
userData->data().end()};
nlohmann::json userDataJson = nlohmann::json::parse(userDataString);
diff --git a/test/openpower-pels/registry_test.cpp b/test/openpower-pels/registry_test.cpp
index 322c25b..b6cf738 100644
--- a/test/openpower-pels/registry_test.cpp
+++ b/test/openpower-pels/registry_test.cpp
@@ -688,7 +688,7 @@
{
// Find callouts for PROC_NUM 0 on system3
- std::vector<std::string> adData{"PROC_NUM=0"};
+ std::map<std::string, std::string> adData{{"PROC_NUM", "0"}};
AdditionalData ad{adData};
systemNames[0] = "system3";
@@ -723,7 +723,7 @@
}
{
// Find callouts for PROC_NUM 1 that uses a default system entry.
- std::vector<std::string> adData{"PROC_NUM=1"};
+ std::map<std::string, std::string> adData{{"PROC_NUM", "1"}};
AdditionalData ad{adData};
systemNames[0] = "system1";
@@ -737,7 +737,7 @@
}
{
// There is no entry for PROC_NUM 2, so no callouts
- std::vector<std::string> adData{"PROC_NUM=2"};
+ std::map<std::string, std::string> adData{{"PROC_NUM", "2"}};
AdditionalData ad{adData};
auto callouts = Registry::getCallouts(json, systemNames, ad);
@@ -783,7 +783,7 @@
// There isn't an entry in the JSON for a PROC_NUM of 8
// so it should choose the P1-C1 callout.
- std::vector<std::string> adData{"PROC_NUM=8"};
+ std::map<std::string, std::string> adData{{"PROC_NUM", "8"}};
AdditionalData ad{adData};
systemNames.clear();
diff --git a/test/openpower-pels/src_test.cpp b/test/openpower-pels/src_test.cpp
index 069dacd..2c49a7b 100644
--- a/test/openpower-pels/src_test.cpp
+++ b/test/openpower-pels/src_test.cpp
@@ -198,8 +198,11 @@
{9, {"TEST4", "DESCR4"}}};
// Values for the SRC words pointed to above
- std::vector<std::string> adData{"TEST1=0x12345678", "TEST2=12345678",
- "TEST3=0XDEF", "TEST4=Z"};
+ std::map<std::string, std::string> adData{
+ {"TEST1", "0x12345678"},
+ {"TEST2", "12345678"},
+ {"TEST3", "0XDEF"},
+ {"TEST4", "Z"}};
AdditionalData ad{adData};
NiceMock<MockDataInterface> dataIface;
@@ -260,7 +263,7 @@
entry.src.reasonCode = 0xABCD;
entry.subsystem = 0x42;
- std::vector<std::string> adData{};
+ std::map<std::string, std::string> adData{};
AdditionalData ad{adData};
NiceMock<MockDataInterface> dataIface;
@@ -301,8 +304,11 @@
message::Registry registry{path};
auto entry = registry.lookup("0xABCD", message::LookupType::reasonCode);
- std::vector<std::string> adData{"COMPID=0x1", "FREQUENCY=0x4",
- "DURATION=30", "ERRORCODE=0x01ABCDEF"};
+ std::map<std::string, std::string> adData{
+ {"COMPID", "0x1"},
+ {"FREQUENCY", "0x4"},
+ {"DURATION", "30"},
+ {"ERRORCODE", "0x01ABCDEF"}};
AdditionalData ad{adData};
NiceMock<MockDataInterface> dataIface;
@@ -324,7 +330,8 @@
entry.src.reasonCode = 0xABCD;
entry.subsystem = 0x42;
- std::vector<std::string> adData{"CALLOUT_INVENTORY_PATH=motherboard"};
+ std::map<std::string, std::string> adData{
+ {"CALLOUT_INVENTORY_PATH", "motherboard"}};
AdditionalData ad{adData};
NiceMock<MockDataInterface> dataIface;
@@ -375,7 +382,8 @@
entry.src.reasonCode = 0xABCD;
entry.subsystem = 0x42;
- std::vector<std::string> adData{"CALLOUT_INVENTORY_PATH=motherboard"};
+ std::map<std::string, std::string> adData{
+ {"CALLOUT_INVENTORY_PATH", "motherboard"}};
AdditionalData ad{adData};
NiceMock<MockDataInterface> dataIface;
@@ -415,7 +423,8 @@
entry.src.reasonCode = 0xABCD;
entry.subsystem = 0x42;
- std::vector<std::string> adData{"CALLOUT_INVENTORY_PATH=motherboard"};
+ std::map<std::string, std::string> adData{
+ {"CALLOUT_INVENTORY_PATH", "motherboard"}};
AdditionalData ad{adData};
NiceMock<MockDataInterface> dataIface;
@@ -692,7 +701,8 @@
// The location code for the first symbolic FRU callout will
// come from this inventory path since UseInventoryLocCode is set.
// In this case there will be no normal FRU callout for the motherboard.
- std::vector<std::string> adData{"CALLOUT_INVENTORY_PATH=motherboard"};
+ std::map<std::string, std::string> adData{
+ {"CALLOUT_INVENTORY_PATH", "motherboard"}};
AdditionalData ad{adData};
NiceMock<MockDataInterface> dataIface;
std::vector<std::string> names{"systemA"};
@@ -910,34 +920,36 @@
{
// Callouts based on the device path
- std::vector<std::string> items{
- "CALLOUT_ERRNO=5",
- "CALLOUT_DEVICE_PATH=/sys/devices/platform/ahb/ahb:apb/"
- "ahb:apb:bus@1e78a000/1e78a340.i2c-bus/i2c-14/14-0072"};
+ std::map<std::string, std::string> items{
+ {"CALLOUT_ERRNO", "5"},
+ {"CALLOUT_DEVICE_PATH",
+ "/sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a340.i2c-bus/i2c-14/14-0072"}};
checkCallouts(items);
}
{
// Callouts based on the I2C bus and address
- std::vector<std::string> items{"CALLOUT_ERRNO=5", "CALLOUT_IIC_BUS=14",
- "CALLOUT_IIC_ADDR=0x72"};
+ std::map<std::string, std::string> items{{"CALLOUT_ERRNO", "5"},
+ {"CALLOUT_IIC_BUS", "14"},
+ {"CALLOUT_IIC_ADDR", "0x72"}};
checkCallouts(items);
}
{
// Also based on I2C bus and address, but with bus = /dev/i2c-14
- std::vector<std::string> items{"CALLOUT_ERRNO=5", "CALLOUT_IIC_BUS=14",
- "CALLOUT_IIC_ADDR=0x72"};
+ std::map<std::string, std::string> items{{"CALLOUT_ERRNO", "5"},
+ {"CALLOUT_IIC_BUS", "14"},
+ {"CALLOUT_IIC_ADDR", "0x72"}};
checkCallouts(items);
}
{
// Callout not found
- std::vector<std::string> items{
- "CALLOUT_ERRNO=5",
- "CALLOUT_DEVICE_PATH=/sys/devices/platform/ahb/ahb:apb/"
- "ahb:apb:bus@1e78a000/1e78a340.i2c-bus/i2c-24/24-0012"};
+ std::map<std::string, std::string> items{
+ {"CALLOUT_ERRNO", "5"},
+ {"CALLOUT_DEVICE_PATH",
+ "/sys/devices/platform/ahb/ahb:apb/ahb:apb:bus@1e78a000/1e78a340.i2c-bus/i2c-24/24-0012"}};
AdditionalData ad{items};
SRC src{entry, ad, dataIface};
@@ -951,8 +963,9 @@
{
// Callout not found
- std::vector<std::string> items{"CALLOUT_ERRNO=5", "CALLOUT_IIC_BUS=22",
- "CALLOUT_IIC_ADDR=0x99"};
+ std::map<std::string, std::string> items{{"CALLOUT_ERRNO", "5"},
+ {"CALLOUT_IIC_BUS", "22"},
+ {"CALLOUT_IIC_ADDR", "0x99"}};
AdditionalData ad{items};
SRC src{entry, ad, dataIface};
@@ -1290,8 +1303,8 @@
entry.src.reasonCode = 0xABCD;
entry.subsystem = 0x42;
- std::vector<std::string> adData{"CALLOUT_INVENTORY_PATH=motherboard",
- "CALLOUT_PRIORITY=M"};
+ std::map<std::string, std::string> adData{
+ {"CALLOUT_INVENTORY_PATH", "motherboard"}, {"CALLOUT_PRIORITY", "M"}};
AdditionalData ad{adData};
NiceMock<MockDataInterface> dataIface;
@@ -1325,7 +1338,7 @@
entry.subsystem = 0x42;
// Values for the SRC words pointed to above
- std::vector<std::string> adData{"PEL_SUBSYSTEM=0x20"};
+ std::map<std::string, std::string> adData{{"PEL_SUBSYSTEM", "0x20"}};
AdditionalData ad{adData};
NiceMock<MockDataInterface> dataIface;
diff --git a/test/openpower-pels/user_header_test.cpp b/test/openpower-pels/user_header_test.cpp
index 233f08b..dfab636 100644
--- a/test/openpower-pels/user_header_test.cpp
+++ b/test/openpower-pels/user_header_test.cpp
@@ -247,7 +247,8 @@
// Leave off severity
MockDataInterface dataIface;
- std::vector<std::string> adData{"SEVERITY_DETAIL=SYSTEM_TERM"};
+ std::map<std::string, std::string> adData{
+ {"SEVERITY_DETAIL", "SYSTEM_TERM"}};
AdditionalData ad{adData};
UserHeader uh(regEntry, phosphor::logging::Entry::Level::Critical, ad,
@@ -324,7 +325,7 @@
regEntry.eventScope = 2;
MockDataInterface dataIface;
- std::vector<std::string> adData{"PEL_SUBSYSTEM=0x25"};
+ std::map<std::string, std::string> adData{{"PEL_SUBSYSTEM", "0x25"}};
AdditionalData ad{adData};
UserHeader uh(regEntry, phosphor::logging::Entry::Level::Critical, ad,
@@ -341,7 +342,7 @@
regEntry.eventScope = 2;
MockDataInterface dataIface;
- std::vector<std::string> adData{"PEL_SUBSYSTEM=0x99"};
+ std::map<std::string, std::string> adData{{"PEL_SUBSYSTEM", "0x99"}};
AdditionalData ad{adData};
UserHeader uh(regEntry, phosphor::logging::Entry::Level::Critical, ad,
@@ -358,7 +359,7 @@
regEntry.eventScope = 2;
MockDataInterface dataIface;
- std::vector<std::string> adData;
+ std::map<std::string, std::string> adData;
AdditionalData ad{adData};
UserHeader uh(regEntry, phosphor::logging::Entry::Level::Critical, ad,