diff options
author | Logananth Sundararaj <logananth_s@hcl.com> | 2023-01-24 09:26:28 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2023-04-04 22:40:30 +0300 |
commit | 523d48689cd1341ab7d7b0946fec1d18a0c02fbd (patch) | |
tree | 536e713b8f895f6eeebaf66f2c373ecc6ce6dbfc | |
parent | a1cbc1920833ae7f7cf9c2e7df06e37dc7f9f530 (diff) | |
download | bmcweb-523d48689cd1341ab7d7b0946fec1d18a0c02fbd.tar.xz |
Add HotPluggable support in Redfish
HotPluggable is an indication of whether this component can be
inserted or removed while the equipment is in operation.
HotPluggable is a property can read from the Entity manager under
the xyz.openbmc_project.Inventory.Decorator.Replaceable interface.
Tested: Tested and verified in YosemiteV2 platform and
Redfish validator has passed.
Change-Id: I7b2203b1843fa3cbdbef7803b598d113346c0682
Signed-off-by: Logananth Sundararaj <logananth_s@hcl.com>
-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) |