diff options
author | Joshi-Mansi <mansi.joshi@linux.intel.com> | 2021-03-19 01:00:17 +0300 |
---|---|---|
committer | Gunnar Mills <gmills@us.ibm.com> | 2021-04-21 22:26:56 +0300 |
commit | 9a128eb3fc3008f802974360e98de6495ed1a66b (patch) | |
tree | a02d61f296cd117c8c04c66448770c5c9499e4b9 /redfish-core/lib/memory.hpp | |
parent | 601af5ed832deae3f525064d94bb5a65b04554ae (diff) | |
download | bmcweb-9a128eb3fc3008f802974360e98de6495ed1a66b.tar.xz |
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
Diffstat (limited to 'redfish-core/lib/memory.hpp')
-rw-r--r-- | redfish-core/lib/memory.hpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp index 62d8bf9ffb..70886d286f 100644 --- a/redfish-core/lib/memory.hpp +++ b/redfish-core/lib/memory.hpp @@ -532,6 +532,21 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, 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 = |