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/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;