Skip to content

Commit

Permalink
Systems: Add AssetTag Support
Browse files Browse the repository at this point in the history
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": {
            "[email protected]": [
                "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 <[email protected]>
  • Loading branch information
feistjj authored and edtanous committed Jun 24, 2019
1 parent eb2bbe5 commit e4a4b9a
Showing 1 changed file with 27 additions and 3 deletions.
30 changes: 27 additions & 3 deletions redfish-core/lib/systems.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 "
Expand Down Expand Up @@ -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");
}
}
}
Expand Down

0 comments on commit e4a4b9a

Please sign in to comment.