PEL: Use the real system names property

There is now a 'Names' property on the new
xyz.openbmc_project.Configuration.IBMCompatibleSystem interface that the
DataInterface::getSystemNames function will read.  The existing code was
mostly a placeholder until the actual interface showed up on D-Bus.

Since the path that holds the interface is system specific, and the PEL
code should only rarely need this, the code was changed to read it on
demand instead of at caching it startup.

Since getSystemNames() no longer returns a cached value, the signature
was changed slightly to remove the reference from the returned
std::vector<std::string> value.

The UserHeader constructor used to make a call to getSystemNames every
time, and that was changed to only call it when actually necessary,
which is when there is a severity value defined in the message registry
that depends on the system name.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I1d4f307ef38287b631f94dae2b8929307d129029
diff --git a/test/openpower-pels/user_header_test.cpp b/test/openpower-pels/user_header_test.cpp
index 526a59e..b7b6583 100644
--- a/test/openpower-pels/user_header_test.cpp
+++ b/test/openpower-pels/user_header_test.cpp
@@ -24,7 +24,6 @@
 
 using namespace openpower::pels;
 using ::testing::Return;
-using ::testing::ReturnRef;
 
 TEST(UserHeaderTest, SizeTest)
 {
@@ -113,9 +112,6 @@
         regEntry.eventScope = 2;
 
         MockDataInterface dataIface;
-        std::vector<std::string> names{"systemA"};
-
-        EXPECT_CALL(dataIface, getSystemNames).WillOnce(ReturnRef(names));
 
         UserHeader uh(regEntry, phosphor::logging::Entry::Level::Error,
                       dataIface);
@@ -140,8 +136,6 @@
             // The same thing, but as if the action flags weren't specified
             // in the registry so they are a nullopt.  The object should
             // then set them to 0xFFFF.
-            EXPECT_CALL(dataIface, getSystemNames).WillOnce(ReturnRef(names));
-
             regEntry.actionFlags = std::nullopt;
 
             UserHeader uh(regEntry, phosphor::logging::Entry::Level::Error,
@@ -164,9 +158,9 @@
         std::vector<std::string> names3{"systemC"};
 
         EXPECT_CALL(dataIface, getSystemNames)
-            .WillOnce(ReturnRef(names1))
-            .WillOnce(ReturnRef(names2))
-            .WillOnce(ReturnRef(names3));
+            .WillOnce(Return(names1))
+            .WillOnce(Return(names2))
+            .WillOnce(Return(names3));
 
         {
             UserHeader uh(regEntry, phosphor::logging::Entry::Level::Error,
@@ -224,9 +218,6 @@
 
     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);