summaryrefslogtreecommitdiff
path: root/redfish-core/lib/fabric_adapters.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'redfish-core/lib/fabric_adapters.hpp')
-rw-r--r--redfish-core/lib/fabric_adapters.hpp29
1 files changed, 29 insertions, 0 deletions
diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp
index f6099e6392..ba52e679c3 100644
--- a/redfish-core/lib/fabric_adapters.hpp
+++ b/redfish-core/lib/fabric_adapters.hpp
@@ -118,6 +118,32 @@ inline void
});
}
+inline void
+ getFabricAdapterState(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.Inventory.Item", "Present",
+ [aResp](const boost::system::error_code ec, const bool present) {
+ if (ec)
+ {
+ if (ec.value() != EBADR)
+ {
+ BMCWEB_LOG_ERROR << "DBUS response error for State";
+ messages::internalError(aResp->res);
+ }
+ return;
+ }
+
+ if (!present)
+ {
+ aResp->res.jsonValue["Status"]["State"] = "Absent";
+ }
+ });
+}
+
inline void doAdapterGet(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
const std::string& systemName,
const std::string& adapterId,
@@ -133,8 +159,11 @@ inline void doAdapterGet(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
aResp->res.jsonValue["@odata.id"] = crow::utility::urlFromPieces(
"redfish", "v1", "Systems", systemName, "FabricAdapters", adapterId);
+ aResp->res.jsonValue["Status"]["State"] = "Enabled";
+
getFabricAdapterLocation(aResp, serviceName, fabricAdapterPath);
getFabricAdapterAsset(aResp, serviceName, fabricAdapterPath);
+ getFabricAdapterState(aResp, serviceName, fabricAdapterPath);
}
inline bool checkFabricAdapterId(const std::string& adapterPath,