summaryrefslogtreecommitdiff
path: root/redfish-core/lib/pcie.hpp
diff options
context:
space:
mode:
authorLakshmi Yadlapati <lakshmiy@us.ibm.com>2023-04-13 01:01:34 +0300
committerLakshmi Yadlapati <lakshmiy@us.ibm.com>2023-06-16 17:02:00 +0300
commite164f1b66eb2cde5b885df342c9a5bb4e0c2beeb (patch)
tree3400384f75877627a36beded0d3238a7234fa7e6 /redfish-core/lib/pcie.hpp
parentc49c329d2ccf45859030844eb205a8476148fb25 (diff)
downloadbmcweb-e164f1b66eb2cde5b885df342c9a5bb4e0c2beeb.tar.xz
Add Health information for PCIeDevice
This commit is to add Health information according to the Redfish PCIeDevice schema. ref: https://redfish.dmtf.org/schemas/v1/PCIeDevice.v1_9_0.json Code that updates the OperationalStatus for all the inventory https://github.com/openbmc/openpower-vpd-parser/blob/ \ 3fb026386546cfd288ab4f86156c9aa0ffa145d6/ibm_vpd_app.cpp#L620 Tested: Validator passed ''' curl -k https://$bmc/redfish/v1/Systems/system/PCIeDevices/pcie_card8 { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card8", "@odata.type": "#PCIeDevice.v1_9_0.PCIeDevice", "Id": "pcie_card8", "Manufacturer": "", "Model": "6B87", "Name": "PCIe Device", "PCIeFunctions": { "@odata.id": "/redfish/v1/Systems/system/PCIeDevices/pcie_card8/PCIeFunctions" }, "PCIeInterface": { "LanesInUse": -1 }, "PartNumber": "03FL194", "SerialNumber": "Y131UF09S00J", "Slot": { "Location": { "PartLocation": { "ServiceLabel": "U78DB.ND0.WZS0018-P0-C8" } } }, "SparePartNumber": "03FL195", "Status": { "Health": "OK", "State": "Enabled" } } ''' Change-Id: I53026792d0c223c10065c58aef9f3b9dc04a24ed Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
Diffstat (limited to 'redfish-core/lib/pcie.hpp')
-rw-r--r--redfish-core/lib/pcie.hpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index b5c6c15df1..9dee9d34fd 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -142,6 +142,33 @@ inline void requestRoutesSystemPCIeDeviceCollection(App& app)
}
inline void
+ getPCIeDeviceHealth(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& pcieDevicePath,
+ const std::string& service)
+{
+ sdbusplus::asio::getProperty<bool>(
+ *crow::connections::systemBus, service, pcieDevicePath,
+ "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional",
+ [asyncResp](const boost::system::error_code& ec, const bool value) {
+ if (ec)
+ {
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR << "DBUS response error for Health "
+ << ec.value();
+ messages::internalError(asyncResp->res);
+ }
+ return;
+ }
+
+ if (!value)
+ {
+ asyncResp->res.jsonValue["Status"]["Health"] = "Critical";
+ }
+ });
+}
+
+inline void
getPCIeDeviceState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& pcieDevicePath,
const std::string& service)
@@ -323,6 +350,7 @@ inline void addPCIeDeviceCommonProperties(
asyncResp->res.jsonValue["Name"] = "PCIe Device";
asyncResp->res.jsonValue["Id"] = pcieDeviceId;
asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
+ asyncResp->res.jsonValue["Status"]["Health"] = "OK";
}
inline void
@@ -349,6 +377,7 @@ inline void
addPCIeDeviceCommonProperties(asyncResp, pcieDeviceId);
getPCIeDeviceAsset(asyncResp, pcieDevicePath, service);
getPCIeDeviceState(asyncResp, pcieDevicePath, service);
+ getPCIeDeviceHealth(asyncResp, pcieDevicePath, service);
getPCIeDeviceProperties(
asyncResp, pcieDevicePath, service,
[asyncResp, pcieDeviceId](