Fix dimm present and functional property to true for robot test

Symptom:
Auto test got failed from ipmi/test_ipmi_sdr.robot
Test DIMM SDR Info At Power Off | FAIL |
Test DIMM SDR Info At Power On  | FAIL |

Root cause:
Read "Present" property from "Verify SDR" keyword and got unexpected result.
Then cause test item "Test DIMM SDR Info At Power On" and
"Test DIMM SDR Info At Power Off" both got failed.

"Present" property ${presence_rest} got false value from
/xyz/openbmc_project/inventory/system/chassis/motherboard/dimmX path
that didn't match expectation of auto test item as below:

If ${presence_ipmi} output is "Presence Detected"
then ${presence_rest} and ${functional_rest} should be true.

However, ${presence_rest} is false and another "Functional" property
didn't be added correctly according current design.
Then cause both DIMM SDR Info test items got failed.

Example of IPMI SDR elist output (ipmitool sdr elist command)
dimm0            | 72h | ok  | 32.25 | Presence Detected
dimm1            | 73h | ok  | 32.26 | Presence Detected
dimm2            | 74h | ok  | 32.27 | Presence Detected
(For example: our host inlcude one DDR4 at dimm0 is DDR4,
 dimm1 and dimm2 are NO DIMM, but output is Presence Detected also)

Solution:
According ipmi sdr elist output "Presence Detected", we need to set
present property to true and add functional property with true by default.

Tested:
Run robot test ipmi/test_ipmi_sdr.robot
Test DIMM SDR Info At Power Off | PASS |
Test DIMM SDR Info At Power On  | PASS |

Signed-off-by: Tim Lee <timlee660101@gmail.com>
Change-Id: Iaf2e130b682ec47d3b522bc07fa7859aeba559ae
diff --git a/include/dimm.hpp b/include/dimm.hpp
index 6f88ae2..66de5bb 100644
--- a/include/dimm.hpp
+++ b/include/dimm.hpp
@@ -23,6 +23,7 @@
 #include <xyz/openbmc_project/Inventory/Decorator/LocationCode/server.hpp>
 #include <xyz/openbmc_project/Inventory/Item/Dimm/server.hpp>
 #include <xyz/openbmc_project/Inventory/Item/server.hpp>
+#include <xyz/openbmc_project/State/Decorator/OperationalStatus/server.hpp>
 
 namespace phosphor
 {
@@ -46,8 +47,9 @@
     sdbusplus::server::object::object<
         sdbusplus::xyz::openbmc_project::Inventory::server::Item>,
     sdbusplus::server::object::object<
-        sdbusplus::xyz::openbmc_project::Association::server::Definitions>
-
+        sdbusplus::xyz::openbmc_project::Association::server::Definitions>,
+    sdbusplus::server::object::object<sdbusplus::xyz::openbmc_project::State::
+                                          Decorator::server::OperationalStatus>
 {
   public:
     Dimm() = delete;
@@ -79,6 +81,9 @@
         sdbusplus::server::object::object<
             sdbusplus::xyz::openbmc_project::Association::server::Definitions>(
             bus, objPath.c_str()),
+        sdbusplus::server::object::object<
+            sdbusplus::xyz::openbmc_project::State::Decorator::server::
+                OperationalStatus>(bus, objPath.c_str()),
         dimmNum(dimmId), storage(smbiosTableStorage),
         motherboardPath(motherboard)
     {
@@ -100,6 +105,7 @@
     std::string locationCode(std::string value) override;
     uint8_t memoryAttributes(uint8_t value) override;
     uint16_t memoryConfiguredSpeedInMhz(uint16_t value) override;
+    bool functional(bool value) override;
 
   private:
     uint8_t dimmNum;