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/extensions/openpower-pels/registry.cpp b/extensions/openpower-pels/registry.cpp
index 9b2262d..22cdc27 100644
--- a/extensions/openpower-pels/registry.cpp
+++ b/extensions/openpower-pels/registry.cpp
@@ -335,8 +335,9 @@
  *        ]
  *    }
  */
-const nlohmann::json& findCalloutList(const nlohmann::json& json,
-                                      const std::string& systemType)
+const nlohmann::json&
+    findCalloutList(const nlohmann::json& json,
+                    const std::vector<std::string>& systemNames)
 {
     const nlohmann::json* callouts = nullptr;
 
@@ -352,7 +353,9 @@
     {
         if (calloutList.contains("System"))
         {
-            if (systemType == calloutList["System"].get<std::string>())
+            if (std::find(systemNames.begin(), systemNames.end(),
+                          calloutList["System"].get<std::string>()) !=
+                systemNames.end())
             {
                 callouts = &calloutList["CalloutList"];
                 break;
@@ -367,13 +370,16 @@
 
     if (!callouts)
     {
+        std::string types;
+        std::for_each(systemNames.begin(), systemNames.end(),
+                      [&types](const auto& t) { types += t + '|'; });
         log<level::WARNING>(
-            "No matching system type entry or default system type entry "
+            "No matching system name entry or default system name entry "
             " for PEL callout list",
-            entry("SYSTEMTYPE=%s", systemType.c_str()));
+            entry("SYSTEMNAMES=%s", types.c_str()));
 
         throw std::runtime_error{
-            "Could not find a CalloutList JSON for this error and system type"};
+            "Could not find a CalloutList JSON for this error and system name"};
     }
 
     return *callouts;
@@ -451,17 +457,18 @@
  *    ]
  *
  * @param[in] json - The callout JSON
- * @param[in] systemType - The system type from EntityManager
+ * @param[in] systemNames - List of compatible system type names
  *
  * @return std::vector<RegistryCallout> - The callouts to use
  */
-std::vector<RegistryCallout> getCalloutsWithoutAD(const nlohmann::json& json,
-                                                  const std::string& systemType)
+std::vector<RegistryCallout>
+    getCalloutsWithoutAD(const nlohmann::json& json,
+                         const std::vector<std::string>& systemNames)
 {
     std::vector<RegistryCallout> calloutEntries;
 
     // Find the CalloutList to use based on the system type
-    const auto& calloutList = findCalloutList(json, systemType);
+    const auto& calloutList = findCalloutList(json, systemNames);
 
     // We finally found the callouts, make the objects.
     for (const auto& callout : calloutList)
@@ -503,14 +510,14 @@
  * entry used when there is no AdditionalData key.
  *
  * @param[in] json - The callout JSON
- * @param[in] systemType - The system type from EntityManager
+ * @param[in] systemNames - List of compatible system type names
  * @param[in] additionalData - The AdditionalData property
  *
  * @return std::vector<RegistryCallout> - The callouts to use
  */
 std::vector<RegistryCallout>
     getCalloutsUsingAD(const nlohmann::json& json,
-                       const std::string& systemType,
+                       const std::vector<std::string>& systemNames,
                        const AdditionalData& additionalData)
 {
     // This indicates which AD field we'll be using
@@ -550,7 +557,7 @@
     }
 
     // Proceed to find the callouts possibly based on system type.
-    return getCalloutsWithoutAD((*it)["Callouts"], systemType);
+    return getCalloutsWithoutAD((*it)["Callouts"], systemNames);
 }
 
 } // namespace helper
@@ -725,18 +732,18 @@
 
 std::vector<RegistryCallout>
     Registry::getCallouts(const nlohmann::json& calloutJSON,
-                          const std::string& systemType,
+                          const std::vector<std::string>& systemNames,
                           const AdditionalData& additionalData)
 {
     // The JSON may either use an AdditionalData key
     // as an index, or not.
     if (helper::calloutUsesAdditionalData(calloutJSON))
     {
-        return helper::getCalloutsUsingAD(calloutJSON, systemType,
+        return helper::getCalloutsUsingAD(calloutJSON, systemNames,
                                           additionalData);
     }
 
-    return helper::getCalloutsWithoutAD(calloutJSON, systemType);
+    return helper::getCalloutsWithoutAD(calloutJSON, systemNames);
 }
 
 } // namespace message