Systems: Add AssetTag Support
We can get this item from the AssetTag interface.
Tested:
{
"@odata.context": "/redfish/v1/$metadata#ComputerSystem.ComputerSystem",
"@odata.id": "/redfish/v1/Systems/system",
"@odata.type": "#ComputerSystem.v1_6_0.ComputerSystem",
"Actions": {
"#ComputerSystem.Reset": {
"ResetType@Redfish.AllowableValues": [
"On",
"ForceOff",
"ForceOn",
"ForceRestart",
"GracefulRestart",
"GracefulShutdown",
"PowerCycle"
],
"target": "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset"
}
},
"AssetTag": "abc",
"Description": "Computer System",
"Id": null,
....
Change-Id: I1c92b001cc08bd0661368d28d9fb8ae56c122d1e
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 0821cc9..6ea5f2e 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -234,9 +234,8 @@
&propertiesList) {
if (ec)
{
- BMCWEB_LOG_ERROR
- << "DBUS response error: " << ec;
- messages::internalError(aResp->res);
+ // doesn't have to include this
+ // interface
return;
}
BMCWEB_LOG_DEBUG << "Got "
@@ -276,6 +275,31 @@
"org.freedesktop.DBus.Properties", "GetAll",
"xyz.openbmc_project.Inventory.Decorator."
"Asset");
+
+ crow::connections::systemBus->async_method_call(
+ [aResp](
+ const boost::system::error_code ec,
+ const std::variant<std::string> &property) {
+ if (ec)
+ {
+ // doesn't have to include this
+ // interface
+ return;
+ }
+
+ const std::string *value =
+ std::get_if<std::string>(&property);
+ if (value != nullptr)
+ {
+ aResp->res.jsonValue["AssetTag"] =
+ *value;
+ }
+ },
+ connection.first, path,
+ "org.freedesktop.DBus.Properties", "Get",
+ "xyz.openbmc_project.Inventory.Decorator."
+ "AssetTag",
+ "AssetTag");
}
}
}