diff options
-rw-r--r-- | Redfish.md | 1 | ||||
-rw-r--r-- | redfish-core/lib/chassis.hpp | 58 |
2 files changed, 42 insertions, 17 deletions
diff --git a/Redfish.md b/Redfish.md index 6036e8ad6e..1714985938 100644 --- a/Redfish.md +++ b/Redfish.md @@ -191,6 +191,7 @@ Fields common to all schemas - Actions - ChassisType +- HotPluggable - Links/ComputerSystems - Links/ManagedBy - PCIeDevices diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp index dd77195140..31b38c315f 100644 --- a/redfish-core/lib/chassis.hpp +++ b/redfish-core/lib/chassis.hpp @@ -270,7 +270,7 @@ inline void } asyncResp->res.jsonValue["@odata.type"] = - "#Chassis.v1_16_0.Chassis"; + "#Chassis.v1_22_0.Chassis"; asyncResp->res.jsonValue["@odata.id"] = crow::utility::urlFromPieces("redfish", "v1", "Chassis", chassisId); @@ -314,23 +314,47 @@ inline void const std::string assetTagInterface = "xyz.openbmc_project.Inventory.Decorator.AssetTag"; - if (std::find(interfaces2.begin(), interfaces2.end(), - assetTagInterface) != interfaces2.end()) + const std::string replaceableInterface = + "xyz.openbmc_project.Inventory.Decorator.Replaceable"; + for (const auto& interface : interfaces2) { - sdbusplus::asio::getProperty<std::string>( - *crow::connections::systemBus, connectionName, path, - assetTagInterface, "AssetTag", - [asyncResp, chassisId(std::string(chassisId))]( - const boost::system::error_code& ec2, - const std::string& property) { - if (ec2) - { - BMCWEB_LOG_DEBUG << "DBus response error for AssetTag"; - messages::internalError(asyncResp->res); - return; - } - asyncResp->res.jsonValue["AssetTag"] = property; - }); + if (interface == assetTagInterface) + { + sdbusplus::asio::getProperty<std::string>( + *crow::connections::systemBus, connectionName, path, + assetTagInterface, "AssetTag", + [asyncResp, + chassisId](const boost::system::error_code& ec2, + const std::string& property) { + if (ec2) + { + BMCWEB_LOG_ERROR + << "DBus response error for AssetTag: " << ec2; + messages::internalError(asyncResp->res); + return; + } + asyncResp->res.jsonValue["AssetTag"] = property; + }); + } + else if (interface == replaceableInterface) + { + sdbusplus::asio::getProperty<bool>( + *crow::connections::systemBus, connectionName, path, + replaceableInterface, "HotPluggable", + [asyncResp, + chassisId](const boost::system::error_code& ec2, + const bool property) { + if (ec2) + { + BMCWEB_LOG_ERROR + << "DBus response error for HotPluggable: " + << ec2; + messages::internalError(asyncResp->res); + return; + } + asyncResp->res.jsonValue["HotPluggable"] = property; + }); + } } for (const char* interface : hasIndicatorLed) |