Adds LastStateTime in Redfish BootProgress
The LastStateTime is the last time the BootProgress property was
updated. It is defined by BootProgressUpdate D-bus [1].
This commit is to support this.
[1] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml//xyz/openbmc_project/State/Boot/Progress.interface.yaml#L11
Tested:
1. Set boot progress code
# ipmitool raw 0x2c 0x02 0xae 0x01 0x00 0x00 0x00 0x00 0x10 0x01 \
0x00 0x00
2. Check the progress code from the Redfish interface
"BootProgress": {
"LastState": "OEM",
"LastStateTime": "2022-10-10T04:21:08.416796+00:00"
}
Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com>
Change-Id: I0834887e159970d5775dbfbf7753196b1e1cec29
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index fc5a804..caf6a29 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -856,6 +856,40 @@
}
/**
+ * @brief Retrieves boot progress Last Update of the system
+ *
+ * @param[in] aResp Shared pointer for generating response message.
+ *
+ * @return None.
+ */
+inline void getBootProgressLastStateTime(
+ const std::shared_ptr<bmcweb::AsyncResp>& aResp)
+{
+ sdbusplus::asio::getProperty<uint64_t>(
+ *crow::connections::systemBus, "xyz.openbmc_project.State.Host",
+ "/xyz/openbmc_project/state/host0",
+ "xyz.openbmc_project.State.Boot.Progress", "BootProgressLastUpdate",
+ [aResp](const boost::system::error_code ec,
+ const uint64_t lastStateTime) {
+ if (ec)
+ {
+ BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
+ return;
+ }
+
+ // BootProgressLastUpdate is the last time the BootProgress property
+ // was updated. The time is the Epoch time, number of microseconds
+ // since 1 Jan 1970 00::00::00 UTC."
+ // https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/
+ // yaml/xyz/openbmc_project/State/Boot/Progress.interface.yaml#L11
+
+ // Convert to ISO 8601 standard
+ aResp->res.jsonValue["BootProgress"]["LastStateTime"] =
+ redfish::time_utils::getDateTimeUintUs(lastStateTime);
+ });
+}
+
+/**
* @brief Retrieves boot override type over DBUS and fills out the response
*
* @param[in] aResp Shared pointer for generating response message.
@@ -2991,6 +3025,7 @@
getHostState(asyncResp);
getBootProperties(asyncResp);
getBootProgress(asyncResp);
+ getBootProgressLastStateTime(asyncResp);
getPCIeDeviceList(asyncResp, "PCIeDevices");
getHostWatchdogTimer(asyncResp);
getPowerRestorePolicy(asyncResp);