PEL: Allow pretty symFRU/proc name in callout JSON
When callouts are passed in via JSON FFDC files, allow maintenance
procedures and symbolic FRUs to be the pretty names used in the
message registry as well as the raw 7 character names.
Do this by attempting to look up the name as a key in the pretty name ->
raw name maps, and if found then use the raw name.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I576e56932dd101e32caf495c65de6fed65de43e7
diff --git a/extensions/openpower-pels/src.cpp b/extensions/openpower-pels/src.cpp
index 19d140d..f0f530e 100644
--- a/extensions/openpower-pels/src.cpp
+++ b/extensions/openpower-pels/src.cpp
@@ -1276,6 +1276,13 @@
{
auto procedure = jsonCallout.at("Procedure").get<std::string>();
+ // If it's the registry name instead of the raw name, convert.
+ if (pv::maintenanceProcedures.find(procedure) !=
+ pv::maintenanceProcedures.end())
+ {
+ procedure = pv::maintenanceProcedures.at(procedure);
+ }
+
callout = std::make_unique<src::Callout>(
static_cast<CalloutPriority>(priority), procedure,
src::CalloutValueType::raw);
@@ -1284,6 +1291,12 @@
{
auto fru = jsonCallout.at("SymbolicFRU").get<std::string>();
+ // If it's the registry name instead of the raw name, convert.
+ if (pv::symbolicFRUs.find(fru) != pv::symbolicFRUs.end())
+ {
+ fru = pv::symbolicFRUs.at(fru);
+ }
+
bool trusted = false;
if (jsonCallout.contains("TrustedLocationCode") && !locCode.empty())
{
diff --git a/test/openpower-pels/src_test.cpp b/test/openpower-pels/src_test.cpp
index ea497a3..a4c5628 100644
--- a/test/openpower-pels/src_test.cpp
+++ b/test/openpower-pels/src_test.cpp
@@ -1057,6 +1057,14 @@
{
"SymbolicFRU": "FRUTST2LONG",
"Priority": "L"
+ },
+ {
+ "Procedure": "fsi_path",
+ "Priority": "L"
+ },
+ {
+ "SymbolicFRU": "ambient_temp",
+ "Priority": "L"
}
]
)"_json;
@@ -1123,7 +1131,7 @@
EXPECT_TRUE(src.hexwordData()[3] & 0x03000000);
const auto& callouts = src.callouts()->callouts();
- ASSERT_EQ(callouts.size(), 6);
+ ASSERT_EQ(callouts.size(), 8);
// Check callout 0
{
@@ -1200,6 +1208,27 @@
EXPECT_EQ(fru->failingComponentType(), src::FRUIdentity::symbolicFRU);
}
+ // Check callout 6
+ {
+ EXPECT_EQ(callouts[6]->priority(), 'L');
+ EXPECT_EQ(callouts[6]->locationCode(), "");
+
+ auto& fru = callouts[6]->fruIdentity();
+ EXPECT_EQ(fru->getMaintProc().value(), "BMC0004");
+ EXPECT_EQ(fru->failingComponentType(),
+ src::FRUIdentity::maintenanceProc);
+ }
+
+ // Check callout 7
+ {
+ EXPECT_EQ(callouts[7]->priority(), 'L');
+ EXPECT_EQ(callouts[7]->locationCode(), "");
+
+ auto& fru = callouts[7]->fruIdentity();
+ EXPECT_EQ(fru->getPN().value(), "AMBTEMP");
+ EXPECT_EQ(fru->failingComponentType(), src::FRUIdentity::symbolicFRU);
+ }
+
// Check that it didn't find any errors
const auto& data = src.getDebugData();
EXPECT_TRUE(data.empty());