bmcweb:Check for dimm presense for State Attribute
The state attribute was showing Enabled even if dimm was not present.
Added Present property under Inventory Item interface to read the dimm
presence and accordingly populate jsonValue["Status"]["State"]
to Enabled or Absent.
Tested:
-Get of redfish/v1/Systems/system/Memory/dimm shows correct
State values in both the cases.
-Redfish validator passed.
Signed-off-by: Joshi-Mansi <mansi.joshi@linux.intel.com>
Change-Id: I0629fffcc8ca5abf09dd645af6640341d37e446e
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 62d8bf9..70886d2 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -532,6 +532,21 @@
aResp->res.jsonValue["FirmwareRevision"] =
std::to_string(*value);
}
+ else if (property.first == "Present")
+ {
+ const bool* value = std::get_if<bool>(&property.second);
+ if (value == nullptr)
+ {
+ messages::internalError(aResp->res);
+ BMCWEB_LOG_DEBUG
+ << "Invalid property type for Dimm Presence";
+ return;
+ }
+ if (*value == false)
+ {
+ aResp->res.jsonValue["Status"]["State"] = "Absent";
+ }
+ }
else if (property.first == "MemoryTotalWidth")
{
const uint16_t* value =