diff options
| author | James Feist <james.feist@linux.intel.com> | 2019-06-20 14:08:07 -0700 |
|---|---|---|
| committer | Ed Tanous <ed.tanous@intel.com> | 2019-06-24 23:00:05 +0000 |
| commit | e4a4b9a95622b8e1c1bae93718699ad19f4882ac (patch) | |
| tree | 9e5d3b014e9fdf09029e370b63e4297c05099c8e | |
| parent | eb2bbe56e4cce00f92d2f26fb66bfefefa28f929 (diff) | |
| download | bmcweb-e4a4b9a95622b8e1c1bae93718699ad19f4882ac.tar.gz bmcweb-e4a4b9a95622b8e1c1bae93718699ad19f4882ac.zip | |
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>
| -rw-r--r-- | redfish-core/lib/systems.hpp | 30 |
1 files changed, 27 insertions, 3 deletions
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 @@ void getComputerSystem(std::shared_ptr<AsyncResp> aResp) &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 @@ void getComputerSystem(std::shared_ptr<AsyncResp> aResp) "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"); } } } |

