diff options
author | Tejas Patil <tejaspp@ami.com> | 2021-06-04 14:39:14 +0300 |
---|---|---|
committer | Ed Tanous <ed@tanous.net> | 2021-08-23 19:33:01 +0300 |
commit | 476b9cc5e6d3433d140e82ca5e3981e861443a2d (patch) | |
tree | 67d3ffb4f5373bfaa7917df138dbf446fd7898c3 /redfish-core/lib/chassis.hpp | |
parent | e8204933be90353ef672e62dc628448173279e1c (diff) | |
download | bmcweb-476b9cc5e6d3433d140e82ca5e3981e861443a2d.tar.xz |
Add support for AssetTag in Chassis
This commit adds the GET support for "AssetTag" property
under "/redfish/v1/Chassis/<str>/" Redfish URI.
This property indicates the AssestTag of the Chassis for the
inventory purposes.
As Redfish Service supports for multiple Chassis instances,
so each Chassis instance will have it's own AssetTag, which
can be used to track each chassis for the inventory purposes.
Tested:
- Redfish Validator Test passed.
curl -k -H "X-Auth-Token: $token" -H "Content-Type: application/json" -X GET https://${bmc}/redfish/v1/Chassis/WFP_Baseboard
{
"@odata.id": "/redfish/v1/Chassis/WFP_Baseboard",
"@odata.type": "#Chassis.v1_14_0.Chassis",
"Actions": {
"#Chassis.Reset": {
"@Redfish.ActionInfo": "/redfish/v1/Chassis/WFP_Baseboard/ResetActionInfo",
"target": "/redfish/v1/Chassis/WFP_Baseboard/Actions/Chassis.Reset"
}
},
"AssetTag": "abc",
"ChassisType": "RackMount",
"Id": "WFP_Baseboard",
"IndicatorLED": "Off",
"IndicatorLED@Redfish.AllowableValues": [
"Lit",
"Blinking",
"Off"
],
"Links": {
"ComputerSystems": [
{
"@odata.id": "/redfish/v1/Systems/system"
}
],
"ManagedBy": [
{
"@odata.id": "/redfish/v1/Managers/bmc"
}
]
},
"LocationIndicatorActive": false,
"Manufacturer": "Intel Corporation",
"Model": "S2600WFT",
"Name": "WFP_Baseboard",
"PCIeDevices": {
"@odata.id": "/redfish/v1/Systems/system/PCIeDevices"
},
"PartNumber": "..........",
"Power": {
"@odata.id": "/redfish/v1/Chassis/WFP_Baseboard/Power"
},
"PowerState": "On",
"Sensors": {
"@odata.id": "/redfish/v1/Chassis/WFP_Baseboard/Sensors"
},
"SerialNumber": "............",
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
},
"Thermal": {
"@odata.id": "/redfish/v1/Chassis/WFP_Baseboard/Thermal"
}
}
Signed-off-by: Tejas Patil <tejaspp@ami.com>
Change-Id: I2b0808fcc29057e352581f018ef55564597c7456
Diffstat (limited to 'redfish-core/lib/chassis.hpp')
-rw-r--r-- | redfish-core/lib/chassis.hpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp index c41b7e1497..5a837936ee 100644 --- a/redfish-core/lib/chassis.hpp +++ b/redfish-core/lib/chassis.hpp @@ -281,6 +281,43 @@ inline void requestRoutesChassis(App& app) "xyz.openbmc_project.Inventory.Item.Board." "Motherboard"}; + const std::string assetTagInterface = + "xyz.openbmc_project.Inventory.Decorator." + "AssetTag"; + if (std::find(interfaces2.begin(), interfaces2.end(), + assetTagInterface) != interfaces2.end()) + { + crow::connections::systemBus->async_method_call( + [asyncResp, chassisId(std::string(chassisId))]( + const boost::system::error_code ec, + const std::variant<std::string>& property) { + if (ec) + { + BMCWEB_LOG_DEBUG + << "DBus response error for " + "AssetTag"; + messages::internalError(asyncResp->res); + return; + } + + const std::string* assetTag = + std::get_if<std::string>(&property); + if (assetTag == nullptr) + { + BMCWEB_LOG_DEBUG + << "Null value returned " + "for Chassis AssetTag"; + messages::internalError(asyncResp->res); + return; + } + asyncResp->res.jsonValue["AssetTag"] = + *assetTag; + }, + connectionName, path, + "org.freedesktop.DBus.Properties", "Get", + assetTagInterface, "AssetTag"); + } + for (const char* interface : hasIndicatorLed) { if (std::find(interfaces2.begin(), |