Disabled processor and memory summary status

Redfish deprecated the Processor/Memory Summary Status (state, health,
healthrollup) attributes. Please refer to redfish spec for more details:
https://redfish.dmtf.org/schemas/v1/ComputerSystem.v1_20_0.json

Initially I tried to fix the summary status issues,
(https://gerrit.openbmc.org/c/openbmc/bmcweb/+/60663)
But later it was decided that we should also remove these attributes
from the bmcweb code. Here is a link to discussion on discord:
https://discord.com/channels/775381525260664832/855566794994221117/1093939076710793296

This drop hides these attributes under defined
BMCWEB_ENABLE_PROC_MEM_STATUS. This option is disabled by default.

These attributes will be permanently removed from code in 1Q 2024
(in 8-9 months).

Testing:
  - Redfish validator passed excepted couple of failures but those are
    failing without my changes too.
  - Make sure that summary status for memory and processor is not seen
    in the output.

    Without fix:
    ------------
    '''
    $ curl -s -k https://${bmc}/redfish/v1/Systems/system
    .....
    "MemorySummary": {
      "Status": {
        "Health": "OK",
        "HealthRollup": "OK",
        "State": "Enabled"
      },
      "TotalSystemMemoryGiB": 256
    },
    .....
    "ProcessorSummary": {
      "CoreCount": 20,
      "Count": 4,
      "Status": {
        "Health": "OK",
        "HealthRollup": "OK",
        "State": "Enabled"
      }
    },
    .....
    ''''

    With fix:
    ---------
    '''
    "MemorySummary": {
      "TotalSystemMemoryGiB": 256
    },
    .....
    "ProcessorSummary": {
      "CoreCount": 20,
      "Count": 4
    },
    .....
    ''''
  - Turned on BMCWEB_ALLOW_DEPRECATED_PROC_MEM_STATUS flag and made sure
    that properties are shown again.

Change-Id: I1e0ee386bd4f365599afcf46e5d587285af635ad
Signed-off-by: Ninad Palsule <ninadpalsule@us.ibm.com>
Signed-off-by: Ed Tanous <edtanous@google.com>
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 8d978f1..573bf88 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -203,21 +203,25 @@
         "xyz.openbmc_project.Inventory.Item", "Present",
         std::move(getCpuPresenceState));
 
-    auto getCpuFunctionalState = [aResp](const boost::system::error_code& ec3,
-                                         const bool cpuFunctionalCheck) {
-        if (ec3)
-        {
-            BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
-            return;
-        }
-        modifyCpuFunctionalState(aResp, cpuFunctionalCheck);
-    };
+    if constexpr (bmcwebEnableProcMemStatus)
+    {
+        auto getCpuFunctionalState =
+            [aResp](const boost::system::error_code& ec3,
+                    const bool cpuFunctionalCheck) {
+            if (ec3)
+            {
+                BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
+                return;
+            }
+            modifyCpuFunctionalState(aResp, cpuFunctionalCheck);
+        };
 
-    // Get the Functional State
-    sdbusplus::asio::getProperty<bool>(
-        *crow::connections::systemBus, service, path,
-        "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional",
-        std::move(getCpuFunctionalState));
+        // Get the Functional State
+        sdbusplus::asio::getProperty<bool>(
+            *crow::connections::systemBus, service, path,
+            "xyz.openbmc_project.State.Decorator.OperationalStatus",
+            "Functional", std::move(getCpuFunctionalState));
+    }
 
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, path,
@@ -247,26 +251,30 @@
  */
 inline void
     processMemoryProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
-                            const std::string& service, const std::string& path,
+                            [[maybe_unused]] const std::string& service,
+                            [[maybe_unused]] const std::string& path,
                             const dbus::utility::DBusPropertiesMap& properties)
 {
     BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Dimm properties.";
 
     if (properties.empty())
     {
-        sdbusplus::asio::getProperty<bool>(
-            *crow::connections::systemBus, service, path,
-            "xyz.openbmc_project.State."
-            "Decorator.OperationalStatus",
-            "Functional",
-            [aResp](const boost::system::error_code& ec3, bool dimmState) {
-            if (ec3)
-            {
-                BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
-                return;
-            }
-            updateDimmProperties(aResp, dimmState);
-            });
+        if constexpr (bmcwebEnableProcMemStatus)
+        {
+            sdbusplus::asio::getProperty<bool>(
+                *crow::connections::systemBus, service, path,
+                "xyz.openbmc_project.State."
+                "Decorator.OperationalStatus",
+                "Functional",
+                [aResp](const boost::system::error_code& ec3, bool dimmState) {
+                if (ec3)
+                {
+                    BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
+                    return;
+                }
+                updateDimmProperties(aResp, dimmState);
+                });
+        }
         return;
     }
 
@@ -297,7 +305,11 @@
             aResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"] =
                 *memorySizeInKB / static_cast<size_t>(1024 * 1024) + *preValue;
         }
-        aResp->res.jsonValue["MemorySummary"]["Status"]["State"] = "Enabled";
+        if constexpr (bmcwebEnableProcMemStatus)
+        {
+            aResp->res.jsonValue["MemorySummary"]["Status"]["State"] =
+                "Enabled";
+        }
     }
 }
 
@@ -376,16 +388,22 @@
                 continue;
             }
 
-            auto memoryHealth = std::make_shared<HealthPopulate>(
-                aResp, "/MemorySummary/Status"_json_pointer);
+            std::shared_ptr<HealthPopulate> memoryHealth = nullptr;
+            std::shared_ptr<HealthPopulate> cpuHealth = nullptr;
 
-            auto cpuHealth = std::make_shared<HealthPopulate>(
-                aResp, "/ProcessorSummary/Status"_json_pointer);
-
-            if constexpr (bmcwebEnableHealthPopulate)
+            if constexpr (bmcwebEnableProcMemStatus)
             {
+                memoryHealth = std::make_shared<HealthPopulate>(
+                    aResp, "/MemorySummary/Status"_json_pointer);
                 systemHealth->children.emplace_back(memoryHealth);
-                systemHealth->children.emplace_back(cpuHealth);
+
+                if constexpr (bmcwebEnableHealthPopulate)
+                {
+                    cpuHealth = std::make_shared<HealthPopulate>(
+                        aResp, "/ProcessorSummary/Status"_json_pointer);
+
+                    systemHealth->children.emplace_back(cpuHealth);
+                }
             }
 
             // This is not system, so check if it's cpu, dimm, UUID or
@@ -402,7 +420,10 @@
 
                         getMemorySummary(aResp, connection.first, path);
 
-                        memoryHealth->inventory.emplace_back(path);
+                        if constexpr (bmcwebEnableProcMemStatus)
+                        {
+                            memoryHealth->inventory.emplace_back(path);
+                        }
                     }
                     else if (interfaceName ==
                              "xyz.openbmc_project.Inventory.Item.Cpu")
@@ -412,7 +433,10 @@
 
                         getProcessorSummary(aResp, connection.first, path);
 
-                        cpuHealth->inventory.emplace_back(path);
+                        if constexpr (bmcwebEnableProcMemStatus)
+                        {
+                            cpuHealth->inventory.emplace_back(path);
+                        }
                     }
                     else if (interfaceName == "xyz.openbmc_project.Common.UUID")
                     {
@@ -3054,10 +3078,13 @@
         asyncResp->res.jsonValue["SystemType"] = "Physical";
         asyncResp->res.jsonValue["Description"] = "Computer System";
         asyncResp->res.jsonValue["ProcessorSummary"]["Count"] = 0;
-        asyncResp->res.jsonValue["ProcessorSummary"]["Status"]["State"] =
-            "Disabled";
-        asyncResp->res.jsonValue["MemorySummary"]["Status"]["State"] =
-            "Disabled";
+        if constexpr (bmcwebEnableProcMemStatus)
+        {
+            asyncResp->res.jsonValue["ProcessorSummary"]["Status"]["State"] =
+                "Disabled";
+            asyncResp->res.jsonValue["MemorySummary"]["Status"]["State"] =
+                "Disabled";
+        }
         asyncResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"] =
             uint64_t(0);
         asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system";