Support ProductionDate report
DSP0268 Redfish Data Model Specification provides ProductionDate
property for various schema. phosphor-dbus-interface [1] also
supports BuildDate property which we can map from FRU data, like
`Board Manufacturer Date`.
This adds code to support which gets the date from BuildDate
property and report via Redfish.
[1] https://github.com/openbmc/phosphor-dbus-interfaces/blob/master/yaml/xyz/openbmc_project/Inventory/Decorator/Asset.interface.yaml#L16
Tested: Redfish Validator passes
Signed-off-by: Hieu Huynh <hieuh@os.amperecomputing.com>
Change-Id: Ie4ae564fa00218e7896f04ec61941fa92b23b912
diff --git a/redfish-core/lib/power_supply.hpp b/redfish-core/lib/power_supply.hpp
index 26ea26c..f934a3b 100644
--- a/redfish-core/lib/power_supply.hpp
+++ b/redfish-core/lib/power_supply.hpp
@@ -8,6 +8,7 @@
#include "utils/chassis_utils.hpp"
#include "utils/dbus_utils.hpp"
#include "utils/json_utils.hpp"
+#include "utils/time_utils.hpp"
#include <boost/system/error_code.hpp>
#include <boost/url/format.hpp>
@@ -272,12 +273,13 @@
const std::string* manufacturer = nullptr;
const std::string* model = nullptr;
const std::string* sparePartNumber = nullptr;
+ const std::string* buildDate = nullptr;
const bool success = sdbusplus::unpackPropertiesNoThrow(
dbus_utils::UnpackErrorPrinter(), propertiesList, "PartNumber",
partNumber, "SerialNumber", serialNumber, "Manufacturer",
manufacturer, "Model", model, "SparePartNumber",
- sparePartNumber);
+ sparePartNumber, "BuildDate", buildDate);
if (!success)
{
@@ -310,6 +312,11 @@
{
asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber;
}
+
+ if (buildDate != nullptr)
+ {
+ time_utils::productionDateReport(asyncResp->res, *buildDate);
+ }
});
}