diff options
author | Andrew Geissler <geissonator@yahoo.com> | 2019-02-13 22:54:15 +0300 |
---|---|---|
committer | Ed Tanous <ed.tanous@intel.com> | 2019-03-30 00:00:06 +0300 |
commit | 54daabe7b7213551db91c1225a66a22088d1181e (patch) | |
tree | 61514d2c8a947f1853ff6586f9a5b3b29d1ff4d3 | |
parent | e278c18fc22faa2e5099f3f43a813942144c7560 (diff) | |
download | bmcweb-54daabe7b7213551db91c1225a66a22088d1181e.tar.xz |
fw-inventory: description of FirmwareInventory obj
This will allow one to identify what a firmware inventory object
represents.
The Purpose was already being pulled from the Dbus data but not put into
anything. The description field looks like the best fit for it.
Schema Reference:
http://redfish.dmtf.org/schemas/v1/SoftwareInventory.v1_2_1.json#/definitions/SoftwareInventory
Other Implementations: Not a lot of reference material out there for
what other implementers have used for this field.
HP:
"Description": "SystemBMC"
"Description": "SystemRomActive"
SuperMicro:
<BMC description not available>
"Description: "Description of SUPERMICRO BIOS"
Tested:
- Verified RedfishServiceValidator.py shows no new errors
VERBO - Resource.v1_0_0.Resource:Description
VERBO - value: BMC update <class 'str'>
VERBO - has Type: Resource.Description Edm.String
VERBO - is Optional
VERBO - permission OData.Permission/Read
VERBO - Success
- Description now correctly returned in data
$ curl -k -H "X-Auth-Token: $TOKEN" -X GET https://${BMC_IP}/redfish/v1/UpdateService/FirmwareInventory/58a9b6db
{
"@odata.context": "/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory",
"@odata.id": "/redfish/v1/UpdateService/FirmwareInventory/58a9b6db",
"@odata.type": "#SoftwareInventory.v1_1_0.SoftwareInventory",
"Description": "BMC update",
"Id": "58a9b6db",
"Name": "Software Inventory",
"Status": {
"Health": "OK",
"HealthRollup": "OK",
"State": "Enabled"
},
"Updateable": false,
"Version": "2.6.0-rc1-265-gfb721b2"
}
Change-Id: I55d1b1a5901878da2566713de9dc72e88a8c6359
Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Signed-off-by: Ed Tanous <ed.tanous@intel.com>
-rw-r--r-- | redfish-core/lib/update_service.hpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp index 9e6ea4fe5e..d3d30c2029 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -437,6 +437,27 @@ class SoftwareInventory : public Node } asyncResp->res.jsonValue["Version"] = *version; asyncResp->res.jsonValue["Id"] = *swId; + + // swInvPurpose is of format: + // xyz.openbmc_project.Software.Version.VersionPurpose.ABC + // Translate this to "ABC update" + size_t endDesc = swInvPurpose->rfind("."); + if (endDesc == std::string::npos) + { + messages::internalError(asyncResp->res); + return; + } + endDesc++; + if (endDesc >= swInvPurpose->size()) + { + messages::internalError(asyncResp->res); + return; + } + + std::string formatDesc = + swInvPurpose->substr(endDesc); + asyncResp->res.jsonValue["Description"] = + formatDesc + " update"; }, obj.second[0].first, obj.first, "org.freedesktop.DBus.Properties", "GetAll", |