PEL: Add support for raw symbolic FRUs and procs

Allow the FRUIdentity and Callout objects to take the raw maintenance
procedure and symbolic FRU names as opposed to just the PEL message
registry names.  This will allow the values to come from sources
besides the registry, such as the device tree used by PHAL.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I4171fb7128ae1b1b5e3e635f7f95b7f7df7c6638
diff --git a/test/openpower-pels/Makefile.include b/test/openpower-pels/Makefile.include
index ee7f99f..b4c6a01 100644
--- a/test/openpower-pels/Makefile.include
+++ b/test/openpower-pels/Makefile.include
@@ -252,6 +252,7 @@
 fru_identity_test_CXXFLAGS = $(test_cxxflags)
 fru_identity_test_LDADD = \
 	$(test_ldadd) \
+	$(FMT_LIBS) \
 	$(top_builddir)/extensions/openpower-pels/fru_identity.o \
 	$(top_builddir)/extensions/openpower-pels/pel_values.o
 fru_identity_test_LDFLAGS = $(test_ldflags)
@@ -280,6 +281,7 @@
 src_callout_test_LDADD = \
 	$(test_ldadd) \
 	$(pel_test_utils_ldadd) \
+	$(FMT_LIBS) \
 	$(top_builddir)/extensions/openpower-pels/callout.o \
 	$(top_builddir)/extensions/openpower-pels/fru_identity.o \
 	$(top_builddir)/extensions/openpower-pels/mru.o \
@@ -295,6 +297,7 @@
 src_callouts_test_LDADD = \
 	$(test_ldadd) \
 	$(pel_test_utils_ldadd) \
+	$(FMT_LIBS) \
 	$(top_builddir)/extensions/openpower-pels/callout.o \
 	$(top_builddir)/extensions/openpower-pels/callouts.o \
 	$(top_builddir)/extensions/openpower-pels/fru_identity.o \
@@ -311,18 +314,7 @@
 src_test_LDADD = \
 	$(test_ldadd) \
 	$(pel_test_utils_ldadd) \
-	$(top_builddir)/extensions/openpower-pels/ascii_string.o \
-	$(top_builddir)/extensions/openpower-pels/callout.o \
-	$(top_builddir)/extensions/openpower-pels/callouts.o \
-	$(top_builddir)/extensions/openpower-pels/device_callouts.o \
-	$(top_builddir)/extensions/openpower-pels/fru_identity.o \
-	$(top_builddir)/extensions/openpower-pels/json_utils.o \
-	$(top_builddir)/extensions/openpower-pels/mru.o \
-	$(top_builddir)/extensions/openpower-pels/mtms.o \
-	$(top_builddir)/extensions/openpower-pels/pce_identity.o \
-	$(top_builddir)/extensions/openpower-pels/pel_values.o \
-	$(top_builddir)/extensions/openpower-pels/registry.o \
-	$(top_builddir)/extensions/openpower-pels/src.o
+	$(pel_objects)
 src_test_LDFLAGS = $(test_ldflags)
 
 extended_user_header_test_SOURCES = \
@@ -332,20 +324,7 @@
 extended_user_header_test_LDADD = \
 	$(test_ldadd) \
 	$(pel_test_utils_ldadd) \
-	$(top_builddir)/extensions/openpower-pels/ascii_string.o \
-	$(top_builddir)/extensions/openpower-pels/callout.o \
-	$(top_builddir)/extensions/openpower-pels/callouts.o \
-	$(top_builddir)/extensions/openpower-pels/device_callouts.o \
-	$(top_builddir)/extensions/openpower-pels/data_interface.o \
-	$(top_builddir)/extensions/openpower-pels/extended_user_header.o \
-	$(top_builddir)/extensions/openpower-pels/fru_identity.o \
-	$(top_builddir)/extensions/openpower-pels/json_utils.o \
-	$(top_builddir)/extensions/openpower-pels/mru.o \
-	$(top_builddir)/extensions/openpower-pels/mtms.o \
-	$(top_builddir)/extensions/openpower-pels/pel_values.o \
-	$(top_builddir)/extensions/openpower-pels/pce_identity.o \
-	$(top_builddir)/extensions/openpower-pels/registry.o \
-	$(top_builddir)/extensions/openpower-pels/src.o
+	$(pel_objects)
 extended_user_header_test_LDFLAGS = $(test_ldflags)
 
 pel_rules_test_SOURCES = %reldir%/pel_rules_test.cpp
diff --git a/test/openpower-pels/fru_identity_test.cpp b/test/openpower-pels/fru_identity_test.cpp
index b13bf3f..116fe4d 100644
--- a/test/openpower-pels/fru_identity_test.cpp
+++ b/test/openpower-pels/fru_identity_test.cpp
@@ -201,6 +201,12 @@
         EXPECT_FALSE(fru.getCCIN());
         EXPECT_FALSE(fru.getSN());
     }
+
+    {
+        // Raw maintenance procedure
+        FRUIdentity fru{"BMCSPXXLONG", CalloutValueType::raw};
+        EXPECT_EQ(fru.getMaintProc().value(), "BMCSPXX");
+    }
 }
 
 // Test the constructor that takes in a symbolic FRU.
@@ -263,4 +269,11 @@
         EXPECT_FALSE(fru.getCCIN());
         EXPECT_FALSE(fru.getSN());
     }
+
+    // Raw symbolic FRU
+    {
+        FRUIdentity fru{"SOMEFRULONG", CalloutValueType::raw, false};
+
+        EXPECT_EQ(fru.getPN().value(), "SOMEFRU");
+    }
 }
diff --git a/test/openpower-pels/src_callout_test.cpp b/test/openpower-pels/src_callout_test.cpp
index 74c396c..fa93111 100644
--- a/test/openpower-pels/src_callout_test.cpp
+++ b/test/openpower-pels/src_callout_test.cpp
@@ -317,6 +317,13 @@
 
     auto& newFRU = newCallout.fruIdentity();
     EXPECT_EQ(newFRU->getMaintProc().value(), fru->getMaintProc().value());
+
+    // Use raw procedure value
+
+    Callout rawCallout{CalloutPriority::medium, "BMCSPXX",
+                       CalloutValueType::raw};
+    auto& rawFRU = rawCallout.fruIdentity();
+    EXPECT_EQ(rawFRU->getMaintProc().value(), "BMCSPXX");
 }
 
 // Create a callout object by passing in the symbolic FRU to add.
@@ -384,4 +391,16 @@
                   FRUIdentity::symbolicFRUTrustedLocCode);
         EXPECT_EQ(fru->getPN().value(), "SVCDOCS");
     }
+
+    // symbolic FRU with raw FRU value
+    {
+        {
+            Callout callout{CalloutPriority::high, "SYMBFRU",
+                            CalloutValueType::raw, "", false};
+
+            auto& fru = callout.fruIdentity();
+
+            EXPECT_EQ(fru->getPN().value(), "SYMBFRU");
+        }
+    }
 }