PEL: Save BMC Version ID in UserData section
When creating a PEL, save the VERSION_ID value from the /etc/os-release
file in the UserData section that keeps useful system information.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: I6d9008b15c5347239bf8c21ef79219d3b6ee08e6
diff --git a/test/openpower-pels/pel_test.cpp b/test/openpower-pels/pel_test.cpp
index 1a5f81f..32f8d5e 100644
--- a/test/openpower-pels/pel_test.cpp
+++ b/test/openpower-pels/pel_test.cpp
@@ -26,6 +26,7 @@
namespace fs = std::filesystem;
using namespace openpower::pels;
+using ::testing::Return;
class PELTest : public CleanLogID
{
@@ -313,10 +314,12 @@
}
// Create the UserData section that contains system info
-TEST_F(PELTest, MakeSysInfoSectionTest)
+TEST_F(PELTest, SysInfoSectionTest)
{
MockDataInterface dataIface;
+ EXPECT_CALL(dataIface, getBMCFWVersionID()).WillOnce(Return("ABCD1234"));
+
std::string pid = "_PID=" + std::to_string(getpid());
std::vector<std::string> ad{pid};
AdditionalData additionalData{ad};
@@ -337,4 +340,7 @@
// Ensure the 'Process Name' entry contains 'pel_test'
auto name = json["Process Name"].get<std::string>();
EXPECT_NE(name.find("pel_test"), std::string::npos);
+
+ auto version = json["BMC Version ID"].get<std::string>();
+ EXPECT_EQ(version, "ABCD1234");
}