PEL: Add 3 state fields to PEL UserData section
Add the following to the system info UserData section that gets added
for PELs created by BMC code:
* CurrentBMCState on /xyz/openbmc_project/state/bmc0
* CurrentHostState on /xyz/openbmc_project/state/host0
* CurrentPowerState on /xyz/openbmc_project/state/chassis0
The RequestedPowerTransition property is also read along with the
CurrentPowerState property since it's on the same interface and will
be used in a future commit.
Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Icdc225f2c9bb6d91e67a4cbe608df97803ccee6c
diff --git a/test/openpower-pels/pel_test.cpp b/test/openpower-pels/pel_test.cpp
index 2cf58d7..8832038 100644
--- a/test/openpower-pels/pel_test.cpp
+++ b/test/openpower-pels/pel_test.cpp
@@ -319,6 +319,9 @@
MockDataInterface dataIface;
EXPECT_CALL(dataIface, getBMCFWVersionID()).WillOnce(Return("ABCD1234"));
+ EXPECT_CALL(dataIface, getBMCState()).WillOnce(Return("State.Ready"));
+ EXPECT_CALL(dataIface, getChassisState()).WillOnce(Return("State.On"));
+ EXPECT_CALL(dataIface, getHostState()).WillOnce(Return("State.Off"));
std::string pid = "_PID=" + std::to_string(getpid());
std::vector<std::string> ad{pid};
@@ -343,6 +346,15 @@
auto version = json["BMC Version ID"].get<std::string>();
EXPECT_EQ(version, "ABCD1234");
+
+ auto state = json["BMCState"].get<std::string>();
+ EXPECT_EQ(state, "Ready");
+
+ state = json["ChassisState"].get<std::string>();
+ EXPECT_EQ(state, "On");
+
+ state = json["HostState"].get<std::string>();
+ EXPECT_EQ(state, "Off");
}
// Test that the sections that override