Add additional Redfish Memory properties
This commit adds the following properties to the memory
schema on bmcweb.
a) LocationCode, a free form, implementation-defined string
to provide the location of the DIMM. This is needed so an
implementation can identify the DIMM via system diagrams and such.
b) Model, maps to a CCIN/Card ID for IBM's implementation,
is a string for the manufacturer's part model. For IBM's
implementation, it is a four-digit value assigned for each
possible FRU.
c) SparePartNumber, also field-replaceable unit (FRU) Part Number,
is a part number that identifies the FRU for replacement
specifically ordering of a new part.
Redfish validator has been executed on this change and no new
error was found.
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: I419a9cd8e956de3fbf7093903129389ad5e0e577
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index c85b000..f6be846 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -672,6 +672,41 @@
aResp->res.jsonValue["MemoryLocation"][property.first] =
*value;
}
+ else if (property.first == "SparePartNumber")
+ {
+ const std::string* value =
+ std::get_if<std::string>(&property.second);
+ if (value == nullptr)
+ {
+ messages::internalError(aResp->res);
+ continue;
+ }
+ aResp->res.jsonValue["SparePartNumber"] = *value;
+ }
+ else if (property.first == "Model")
+ {
+ const std::string* value =
+ std::get_if<std::string>(&property.second);
+ if (value == nullptr)
+ {
+ messages::internalError(aResp->res);
+ continue;
+ }
+ aResp->res.jsonValue["Model"] = *value;
+ }
+ else if (property.first == "LocationCode")
+ {
+ const std::string* value =
+ std::get_if<std::string>(&property.second);
+ if (value == nullptr)
+ {
+ messages::internalError(aResp->res);
+ continue;
+ }
+ aResp->res
+ .jsonValue["Location"]["PartLocation"]["ServiceLabel"] =
+ *value;
+ }
else
{
getPersistentMemoryProperties(aResp, properties);
@@ -900,7 +935,7 @@
}
const std::string& dimmId = params[0];
- res.jsonValue["@odata.type"] = "#Memory.v1_7_0.Memory";
+ res.jsonValue["@odata.type"] = "#Memory.v1_11_0.Memory";
res.jsonValue["@odata.id"] =
"/redfish/v1/Systems/system/Memory/" + dimmId;
auto asyncResp = std::make_shared<AsyncResp>(res);