diff options
author | George Liu <liuxiwei@inspur.com> | 2022-10-05 12:03:20 +0300 |
---|---|---|
committer | George Liu <liuxiwei@inspur.com> | 2023-06-15 10:38:54 +0300 |
commit | a0dba87be2fb6053d52af124aabc7d6ad489ade0 (patch) | |
tree | d5042e1f487f1661baf6596b586f9e458cbbf2b5 /redfish-core | |
parent | 2b45fb3b8bd8684886a6ba3249183be0f541d592 (diff) | |
download | bmcweb-a0dba87be2fb6053d52af124aabc7d6ad489ade0.tar.xz |
Add FirmwareVersion For PowerSupply
This commit is to add firmware version information according to the
Redfish PowerSupply schema.
If the `xyz.openbmc_project.Software.Version` interface does not
exist, the firmware version information property is not displayed.
ref: http://redfish.dmtf.org/schemas/v1/PowerSupply.v1_5_0.json
Tested: Validator passes
curl -k -H "X-Auth-Token: $token" -X GET
https://${bmc}/redfish/v1/Chassis/chassis/PowerSubsystem/
PowerSupplies/powersupply0
{
"@odata.id": "/redfish/v1/Chassis/chassis/PowerSubsystem/
PowerSupplies/powersupply0",
"@odata.type": "#PowerSupply.v1_5_0.PowerSupply",
"FirmwareVersion": "383239323732",
"Id": "powersupply0",
"Manufacturer": "",
"Model": "51E9",
"Name": "powersupply0",
"PartNumber": "03KP466",
"SerialNumber": "YL10KY26E073",
"SparePartNumber": "03FP378",
"Status": {
"Health": "OK"
}
}
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: I3ced467faf49d08c46a8b9bb2aa722f35353c811
Diffstat (limited to 'redfish-core')
-rw-r--r-- | redfish-core/lib/power_supply.hpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/redfish-core/lib/power_supply.hpp b/redfish-core/lib/power_supply.hpp index aa88e09988..4fc0ce9e48 100644 --- a/redfish-core/lib/power_supply.hpp +++ b/redfish-core/lib/power_supply.hpp @@ -310,6 +310,29 @@ inline void }); } +inline void getPowerSupplyFirmwareVersion( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& service, const std::string& path) +{ + sdbusplus::asio::getProperty<std::string>( + *crow::connections::systemBus, service, path, + "xyz.openbmc_project.Software.Version", "Version", + [asyncResp](const boost::system::error_code& ec, + const std::string& value) { + if (ec) + { + if (ec.value() != EBADR) + { + BMCWEB_LOG_ERROR << "DBUS response error for FirmwareVersion " + << ec.value(); + messages::internalError(asyncResp->res); + } + return; + } + asyncResp->res.jsonValue["FirmwareVersion"] = value; + }); +} + inline void doPowerSupplyGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& chassisId, @@ -359,6 +382,8 @@ inline void powerSupplyPath); getPowerSupplyAsset(asyncResp, object.begin()->first, powerSupplyPath); + getPowerSupplyFirmwareVersion(asyncResp, object.begin()->first, + powerSupplyPath); }); }); } |