summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorCarson Labrado <clabrado@google.com>2024-02-17 01:34:32 +0300
committerGunnar Mills <gunnar@gmills.xyz>2024-02-21 21:04:23 +0300
commitb4d593f1c6113311da4b29fc352187fbcb6d1fd4 (patch)
tree8ae74dda9f2ba7b8bb31f8154f233c55cfb4f58a /redfish-core
parent17505c63b901ea5f62071812838e412d64600f48 (diff)
downloadbmcweb-b4d593f1c6113311da4b29fc352187fbcb6d1fd4.tar.xz
Chassis: Add support for Version property
Add support for the Version property of Chassis resources. That property was added in Chassis schema v1.21.0. This makes use of the "xyz.openbmc_project.Inventory.Decorator.Revision" interface that is already defined by phosphor-dbus-interfaces. Tested: Validator passed and Version property was correctly populated. No issues on other Chassis resources which do not have a Version property. I added this to an entity-manager json config: "xyz.openbmc_project.Inventory.Decorator.Revision": { "Version": "$PRODUCT_VERSION" } The PRODUCT_VERSION field from a given FRU eeprom was picked up by FruDevice and it was exposed under the associated Chassis resource: busctl get-property xyz.openbmc_project.FruDevice \ /xyz/openbmc_project/FruDevice/Test \ xyz.openbmc_project.FruDevice PRODUCT_VERSION s "V1.0" curl -s 'localhost/redfish/v1/Chassis/TestChassis' { "@odata.id": "/redfish/v1/Chassis/TestChassis", ... "Version": "V1.0" } Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: Ie1391d46e81fd8c503fe4b1e6d683dd4553a5419
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/lib/chassis.hpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 06ce58392b..e827f03db3 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -537,6 +537,8 @@ inline void handleChassisGetSubTree(
"xyz.openbmc_project.Inventory.Decorator.AssetTag";
const std::string replaceableInterface =
"xyz.openbmc_project.Inventory.Decorator.Replaceable";
+ const std::string revisionInterface =
+ "xyz.openbmc_project.Inventory.Decorator.Revision";
for (const auto& interface : interfaces2)
{
if (interface == assetTagInterface)
@@ -573,6 +575,23 @@ inline void handleChassisGetSubTree(
asyncResp->res.jsonValue["HotPluggable"] = property;
});
}
+ else if (interface == revisionInterface)
+ {
+ sdbusplus::asio::getProperty<std::string>(
+ *crow::connections::systemBus, connectionName, path,
+ revisionInterface, "Version",
+ [asyncResp, chassisId](const boost::system::error_code& ec2,
+ const std::string& property) {
+ if (ec2)
+ {
+ BMCWEB_LOG_ERROR("DBus response error for Version: {}",
+ ec2);
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ asyncResp->res.jsonValue["Version"] = property;
+ });
+ }
}
for (const char* interface : hasIndicatorLed)