diff options
-rw-r--r-- | Redfish.md | 1 | ||||
-rw-r--r-- | redfish-core/lib/fabric_adapters.hpp | 29 |
2 files changed, 30 insertions, 0 deletions
diff --git a/Redfish.md b/Redfish.md index 1f2ca29573..3ebb8d1272 100644 --- a/Redfish.md +++ b/Redfish.md @@ -681,6 +681,7 @@ other. - PartNumber - SerialNumber - SparePartNumber +- Status ### /redfish/v1/Systems/system/LogServices/ 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, |