summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--redfish-core/lib/fabric_adapters.hpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp
index ba52e679c3..768a2f735f 100644
--- a/redfish-core/lib/fabric_adapters.hpp
+++ b/redfish-core/lib/fabric_adapters.hpp
@@ -144,6 +144,32 @@ inline void
});
}
+inline void
+ getFabricAdapterHealth(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
+ const std::string& serviceName,
+ const std::string& fabricAdapterPath)
+{
+ sdbusplus::asio::getProperty<bool>(
+ *crow::connections::systemBus, serviceName, fabricAdapterPath,
+ "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional",
+ [aResp](const boost::system::error_code ec, const bool functional) {
+ if (ec)
+ {
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR << "DBUS response error for Health";
+ messages::internalError(aResp->res);
+ }
+ return;
+ }
+
+ if (!functional)
+ {
+ aResp->res.jsonValue["Status"]["Health"] = "Critical";
+ }
+ });
+}
+
inline void doAdapterGet(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
const std::string& systemName,
const std::string& adapterId,
@@ -160,10 +186,12 @@ inline void doAdapterGet(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
"redfish", "v1", "Systems", systemName, "FabricAdapters", adapterId);
aResp->res.jsonValue["Status"]["State"] = "Enabled";
+ aResp->res.jsonValue["Status"]["Health"] = "OK";
getFabricAdapterLocation(aResp, serviceName, fabricAdapterPath);
getFabricAdapterAsset(aResp, serviceName, fabricAdapterPath);
getFabricAdapterState(aResp, serviceName, fabricAdapterPath);
+ getFabricAdapterHealth(aResp, serviceName, fabricAdapterPath);
}
inline bool checkFabricAdapterId(const std::string& adapterPath,