PEL: Read the compatible system names property

The chassis object in the inventory has (or rather at the time of this
writing: will have) a Names property that contains a list of the
compatible system types for the current system.  An example is:
["company-systemA-4G", "company-systemA", "company"].

Add this to the DataInterface class, and remove the previous
'getSystemType' API that was there but was still stubbed out.

Also change all the calls from getSystemType() to the new call
getSystemNames(), and check against all entries in that array to see if
the desired name applies to the current system.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I86aa0c15c564153fea612f407c161dfe9041fce6
diff --git a/test/openpower-pels/mocks.hpp b/test/openpower-pels/mocks.hpp
index 1fd679f..be3291d 100644
--- a/test/openpower-pels/mocks.hpp
+++ b/test/openpower-pels/mocks.hpp
@@ -32,9 +32,10 @@
     MOCK_METHOD(void, getHWCalloutFields,
                 (const std::string&, std::string&, std::string&, std::string&),
                 (const override));
-    MOCK_METHOD(std::string, getSystemType, (), (const override));
     MOCK_METHOD(std::string, getLocationCode, (const std::string&),
                 (const override));
+    MOCK_METHOD(const std::vector<std::string>&, getSystemNames, (),
+                (const override));
 
     void changeHostState(bool newState)
     {
diff --git a/test/openpower-pels/registry_test.cpp b/test/openpower-pels/registry_test.cpp
index ec930e9..fa1aa0c 100644
--- a/test/openpower-pels/registry_test.cpp
+++ b/test/openpower-pels/registry_test.cpp
@@ -362,6 +362,8 @@
 // Test when callouts are in the JSON.
 TEST_F(RegistryTest, TestGetCallouts)
 {
+    std::vector<std::string> names;
+
     {
         // Callouts without AD, that depend on system type,
         // where there is a default entry without a system type.
@@ -403,8 +405,9 @@
         ])"_json;
 
         AdditionalData ad;
+        names.push_back("system1");
 
-        auto callouts = Registry::getCallouts(json, "system1", ad);
+        auto callouts = Registry::getCallouts(json, names, ad);
         EXPECT_EQ(callouts.size(), 3);
         EXPECT_EQ(callouts[0].priority, "high");
         EXPECT_EQ(callouts[0].locCode, "P1-C1");
@@ -423,7 +426,8 @@
         EXPECT_EQ(callouts[2].symbolicFRUTrusted, "");
 
         // system2 isn't in the JSON, so it will pick the default one
-        callouts = Registry::getCallouts(json, "system2", ad);
+        names[0] = "system2";
+        callouts = Registry::getCallouts(json, names, ad);
         EXPECT_EQ(callouts.size(), 2);
         EXPECT_EQ(callouts[0].priority, "medium");
         EXPECT_EQ(callouts[0].locCode, "");
@@ -440,7 +444,8 @@
     {
         auto json = R"([])"_json;
         AdditionalData ad;
-        EXPECT_THROW(Registry::getCallouts(json, "system1", ad),
+        names[0] = "system1";
+        EXPECT_THROW(Registry::getCallouts(json, names, ad),
                      std::runtime_error);
     }
 
@@ -479,8 +484,9 @@
         ])"_json;
 
         AdditionalData ad;
+        names[0] = "system1";
 
-        auto callouts = Registry::getCallouts(json, "system1", ad);
+        auto callouts = Registry::getCallouts(json, names, ad);
         EXPECT_EQ(callouts.size(), 2);
         EXPECT_EQ(callouts[0].priority, "high");
         EXPECT_EQ(callouts[0].locCode, "P1-C1");
@@ -493,7 +499,8 @@
         EXPECT_EQ(callouts[1].symbolicFRU, "1234567");
         EXPECT_EQ(callouts[1].symbolicFRUTrusted, "");
 
-        callouts = Registry::getCallouts(json, "system2", ad);
+        names[0] = "system2";
+        callouts = Registry::getCallouts(json, names, ad);
         EXPECT_EQ(callouts.size(), 1);
         EXPECT_EQ(callouts[0].priority, "medium");
         EXPECT_EQ(callouts[0].locCode, "P7");
@@ -503,7 +510,8 @@
 
         // There is no entry for system3 or a default system,
         // so this should fail.
-        EXPECT_THROW(Registry::getCallouts(json, "system3", ad),
+        names[0] = "system3";
+        EXPECT_THROW(Registry::getCallouts(json, names, ad),
                      std::runtime_error);
     }
 
@@ -574,8 +582,9 @@
             // Find callouts for PROC_NUM 0 on system3
             std::vector<std::string> adData{"PROC_NUM=0"};
             AdditionalData ad{adData};
+            names[0] = "system3";
 
-            auto callouts = Registry::getCallouts(json, "system3", ad);
+            auto callouts = Registry::getCallouts(json, names, ad);
             EXPECT_EQ(callouts.size(), 3);
             EXPECT_EQ(callouts[0].priority, "high");
             EXPECT_EQ(callouts[0].locCode, "P1-C5");
@@ -594,7 +603,9 @@
             EXPECT_EQ(callouts[2].symbolicFRUTrusted, "");
 
             // Find callouts for PROC_NUM 0 that uses the default system entry.
-            callouts = Registry::getCallouts(json, "system99", ad);
+            names[0] = "system99";
+
+            callouts = Registry::getCallouts(json, names, ad);
             EXPECT_EQ(callouts.size(), 1);
             EXPECT_EQ(callouts[0].priority, "low");
             EXPECT_EQ(callouts[0].locCode, "P55");
@@ -606,8 +617,9 @@
             // Find callouts for PROC_NUM 1 that uses a default system entry.
             std::vector<std::string> adData{"PROC_NUM=1"};
             AdditionalData ad{adData};
+            names[0] = "system1";
 
-            auto callouts = Registry::getCallouts(json, "system1", ad);
+            auto callouts = Registry::getCallouts(json, names, ad);
             EXPECT_EQ(callouts.size(), 1);
             EXPECT_EQ(callouts[0].priority, "high");
             EXPECT_EQ(callouts[0].locCode, "P1-C6");
@@ -620,7 +632,7 @@
             std::vector<std::string> adData{"PROC_NUM=2"};
             AdditionalData ad{adData};
 
-            EXPECT_THROW(Registry::getCallouts(json, "system1", ad),
+            EXPECT_THROW(Registry::getCallouts(json, names, ad),
                          std::runtime_error);
         }
     }
diff --git a/test/openpower-pels/src_test.cpp b/test/openpower-pels/src_test.cpp
index e9abb8e..d767c53 100644
--- a/test/openpower-pels/src_test.cpp
+++ b/test/openpower-pels/src_test.cpp
@@ -26,6 +26,7 @@
 using ::testing::InvokeWithoutArgs;
 using ::testing::NiceMock;
 using ::testing::Return;
+using ::testing::ReturnRef;
 using ::testing::SetArgReferee;
 namespace fs = std::filesystem;
 
@@ -517,7 +518,9 @@
         // Call out a symbolic FRU and a procedure
         AdditionalData ad;
         NiceMock<MockDataInterface> dataIface;
-        EXPECT_CALL(dataIface, getSystemType).WillOnce(Return("systemA"));
+        std::vector<std::string> names{"systemA"};
+
+        EXPECT_CALL(dataIface, getSystemNames).WillOnce(ReturnRef(names));
 
         SRC src{entry, ad, dataIface};
 
@@ -551,7 +554,9 @@
         // another one without.
         AdditionalData ad;
         NiceMock<MockDataInterface> dataIface;
-        EXPECT_CALL(dataIface, getSystemType).WillOnce(Return("systemB"));
+        std::vector<std::string> names{"systemB"};
+
+        EXPECT_CALL(dataIface, getSystemNames).WillOnce(ReturnRef(names));
 
         SRC src{entry, ad, dataIface};
 
diff --git a/test/openpower-pels/user_header_test.cpp b/test/openpower-pels/user_header_test.cpp
index f37b085..546b480 100644
--- a/test/openpower-pels/user_header_test.cpp
+++ b/test/openpower-pels/user_header_test.cpp
@@ -24,6 +24,7 @@
 
 using namespace openpower::pels;
 using ::testing::Return;
+using ::testing::ReturnRef;
 
 TEST(UserHeaderTest, SizeTest)
 {
@@ -112,7 +113,9 @@
         regEntry.eventScope = 2;
 
         MockDataInterface dataIface;
-        EXPECT_CALL(dataIface, getSystemType).WillOnce(Return("systemA"));
+        std::vector<std::string> names{"systemA"};
+
+        EXPECT_CALL(dataIface, getSystemNames).WillOnce(ReturnRef(names));
 
         UserHeader uh(regEntry, phosphor::logging::Entry::Level::Error,
                       dataIface);
@@ -143,10 +146,14 @@
         regEntry.severity = {{"", 0x20}, {"systemB", 0x10}, {"systemA", 0x00}};
 
         MockDataInterface dataIface;
-        EXPECT_CALL(dataIface, getSystemType)
-            .WillOnce(Return("systemA"))
-            .WillOnce(Return("systemB"))
-            .WillOnce(Return("systemC"));
+        std::vector<std::string> names1{"systemA"};
+        std::vector<std::string> names2{"systemB"};
+        std::vector<std::string> names3{"systemC"};
+
+        EXPECT_CALL(dataIface, getSystemNames)
+            .WillOnce(ReturnRef(names1))
+            .WillOnce(ReturnRef(names2))
+            .WillOnce(ReturnRef(names3));
 
         {
             UserHeader uh(regEntry, phosphor::logging::Entry::Level::Error,
@@ -204,6 +211,9 @@
 
     MockDataInterface dataIface;
 
+    std::vector<std::string> names{"systemA"};
+    EXPECT_CALL(dataIface, getSystemNames).WillOnce(ReturnRef(names));
+
     UserHeader uh(regEntry, phosphor::logging::Entry::Level::Error, dataIface);
 
     ASSERT_EQ(uh.eventType(), 0);