Remove redfish-health-populate

The redfish-health-populate option was scheduled to be removed in 1Q
2024. It is now 2Q, so remove the option. No upstream layers enabled it
and did not find a downstream layer that did either.

This was always limited to a few resources. Overall this design was only
half done. A future "HealthRollup" can be proposed.

Some discord discussion:
[1]: https://discord.com/channels/775381525260664832/855566794994221117/1110728560819327069

Commit disabling this (merged 10 months ago):
[2]: https://github.com/openbmc/bmcweb/commit/6f8273e49cffdd347c223b9538558edfb05e818a

Tested: Code compiles

Change-Id: I4d33c1e674ecdb0fd256df62f3795073454ae7a1
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/config/bmcweb_config.h.in b/config/bmcweb_config.h.in
index 04dcf7e..4763796 100644
--- a/config/bmcweb_config.h.in
+++ b/config/bmcweb_config.h.in
@@ -17,8 +17,6 @@
 
 constexpr const char* bmcwebLoggingLevel = "@BMCWEB_LOGGING_LEVEL@";
 
-constexpr const bool bmcwebEnableHealthPopulate = @BMCWEB_ENABLE_HEALTH_POPULATE@ == 1;
-
 constexpr const bool bmcwebEnableMultiHost = @BMCWEB_ENABLE_MULTI_HOST@ == 1;
 
 constexpr const bool bmcwebEnableHTTP2 = @BMCWEB_ENABLE_HTTP2@ == 1;
diff --git a/config/meson.build b/config/meson.build
index e19f964..7328820 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -12,8 +12,6 @@
 conf_data.set10('BMCWEB_INSECURE_ENABLE_HTTP_PUSH_STYLE_EVENTING', insecure_push_style_notification.allowed())
 conf_data.set('MESON_INSTALL_PREFIX', get_option('prefix'))
 conf_data.set('HTTPS_PORT', get_option('https_port'))
-enable_health_populate = get_option('redfish-health-populate')
-conf_data.set10('BMCWEB_ENABLE_HEALTH_POPULATE', enable_health_populate.allowed())
 enable_multi_host = get_option('experimental-redfish-multi-computer-system')
 conf_data.set10('BMCWEB_ENABLE_MULTI_HOST', enable_multi_host.allowed())
 enable_http2 = get_option('experimental-http2')
diff --git a/meson_options.txt b/meson_options.txt
index f84e59a..39a410b 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -241,14 +241,6 @@
 )
 
 option(
-    'redfish-health-populate',
-    type: 'feature',
-    value: 'disabled',
-    description: '''Enables HealthPopulate and generate the Status property for
-                    the resource. This option will be removed Q1 2024'''
-)
-
-option(
     'https_port',
     type: 'integer',
     min: 1,
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 6038384..4a79783 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -15,11 +15,8 @@
 */
 #pragma once
 
-#include "bmcweb_config.h"
-
 #include "app.hpp"
 #include "dbus_utility.hpp"
-#include "health.hpp"
 #include "led.hpp"
 #include "query.hpp"
 #include "redfish_util.hpp"
@@ -472,24 +469,6 @@
 
         getChassisConnectivity(asyncResp, chassisId, path);
 
-        auto health = std::make_shared<HealthPopulate>(asyncResp);
-
-        if constexpr (bmcwebEnableHealthPopulate)
-        {
-            dbus::utility::getAssociationEndPoints(
-                path + "/all_sensors",
-                [health](const boost::system::error_code& ec2,
-                         const dbus::utility::MapperEndPoints& resp) {
-                if (ec2)
-                {
-                    return; // no sensors = no failures
-                }
-                health->inventory = resp;
-            });
-
-            health->populate();
-        }
-
         if (connectionNames.empty())
         {
             BMCWEB_LOG_ERROR("Got 0 Connection names");
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index ee84c14..2d538d7 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -15,13 +15,10 @@
 */
 #pragma once
 
-#include "bmcweb_config.h"
-
 #include "app.hpp"
 #include "dbus_singleton.hpp"
 #include "dbus_utility.hpp"
 #include "error_messages.hpp"
-#include "health.hpp"
 #include "human_sort.hpp"
 #include "query.hpp"
 #include "registries/privilege_registry.hpp"
@@ -1779,26 +1776,6 @@
         "/redfish/v1/Managers/bmc/EthernetInterfaces/{}", ifaceId);
     jsonResponse["InterfaceEnabled"] = ethData.nicEnabled;
 
-    if constexpr (bmcwebEnableHealthPopulate)
-    {
-        constexpr std::array<std::string_view, 1> inventoryForEthernet = {
-            "xyz.openbmc_project.Inventory.Item.Ethernet"};
-        auto health = std::make_shared<HealthPopulate>(asyncResp);
-        dbus::utility::getSubTreePaths(
-            "/", 0, inventoryForEthernet,
-            [health](const boost::system::error_code& ec,
-                     const dbus::utility::MapperGetSubTreePathsResponse& resp) {
-            if (ec)
-            {
-                return;
-            }
-
-            health->inventory = resp;
-        });
-
-        health->populate();
-    }
-
     if (ethData.nicEnabled)
     {
         jsonResponse["LinkStatus"] = ethData.linkUp ? "LinkUp" : "LinkDown";
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
deleted file mode 100644
index 20ea0f6..0000000
--- a/redfish-core/lib/health.hpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/*
-// Copyright (c) 2019 Intel Corporation
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-*/
-#pragma once
-
-#include "app.hpp"
-#include "async_resp.hpp"
-#include "dbus_singleton.hpp"
-#include "dbus_utility.hpp"
-
-#include <nlohmann/json.hpp>
-
-#include <array>
-#include <ranges>
-#include <string_view>
-#include <variant>
-
-namespace redfish
-{
-
-struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
-{
-    // By default populate status to "/Status" of |asyncResp->res.jsonValue|.
-    explicit HealthPopulate(
-        const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn) :
-        asyncResp(asyncRespIn),
-        statusPtr("/Status")
-    {}
-
-    // Takes a JSON pointer rather than a reference. This is pretty useful when
-    // the address of the status JSON might change, for example, elements in an
-    // array.
-    HealthPopulate(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn,
-                   const nlohmann::json::json_pointer& ptr) :
-        asyncResp(asyncRespIn),
-        statusPtr(ptr)
-    {}
-
-    HealthPopulate(const HealthPopulate&) = delete;
-    HealthPopulate(HealthPopulate&&) = delete;
-    HealthPopulate& operator=(const HealthPopulate&) = delete;
-    HealthPopulate& operator=(const HealthPopulate&&) = delete;
-
-    ~HealthPopulate()
-    {
-        nlohmann::json& jsonStatus = asyncResp->res.jsonValue[statusPtr];
-        nlohmann::json& health = jsonStatus["Health"];
-        nlohmann::json& rollup = jsonStatus["HealthRollup"];
-
-        health = "OK";
-        rollup = "OK";
-
-        for (const std::shared_ptr<HealthPopulate>& healthChild : children)
-        {
-            healthChild->globalInventoryPath = globalInventoryPath;
-            healthChild->statuses = statuses;
-        }
-
-        for (const auto& [path, interfaces] : statuses)
-        {
-            bool isSelf = false;
-            if (selfPath)
-            {
-                if (path.str == *selfPath ||
-                    path.str.starts_with(*selfPath + "/"))
-                {
-                    isSelf = true;
-                }
-            }
-
-            // managers inventory is all the inventory, don't skip any
-            if (!isManagersHealth && !isSelf)
-            {
-                // We only want to look at this association if either the path
-                // of this association is an inventory item, or one of the
-                // endpoints in this association is a child
-
-                bool isChild = false;
-                for (const std::string& child : inventory)
-                {
-                    if (path.str.starts_with(child))
-                    {
-                        isChild = true;
-                        break;
-                    }
-                }
-                if (!isChild)
-                {
-                    for (const auto& [interface, association] : interfaces)
-                    {
-                        if (interface != "xyz.openbmc_project.Association")
-                        {
-                            continue;
-                        }
-                        for (const auto& [name, value] : association)
-                        {
-                            if (name != "endpoints")
-                            {
-                                continue;
-                            }
-
-                            const std::vector<std::string>* endpoints =
-                                std::get_if<std::vector<std::string>>(&value);
-                            if (endpoints == nullptr)
-                            {
-                                BMCWEB_LOG_ERROR("Illegal association at {}",
-                                                 path.str);
-                                continue;
-                            }
-                            bool containsChild = false;
-                            for (const std::string& endpoint : *endpoints)
-                            {
-                                if (std::ranges::find(inventory, endpoint) !=
-                                    inventory.end())
-                                {
-                                    containsChild = true;
-                                    break;
-                                }
-                            }
-                            if (!containsChild)
-                            {
-                                continue;
-                            }
-                        }
-                    }
-                }
-            }
-
-            if (path.str.starts_with(globalInventoryPath) &&
-                path.str.ends_with("critical"))
-            {
-                health = "Critical";
-                rollup = "Critical";
-                return;
-            }
-            if (path.str.starts_with(globalInventoryPath) &&
-                path.str.ends_with("warning"))
-            {
-                health = "Warning";
-                if (rollup != "Critical")
-                {
-                    rollup = "Warning";
-                }
-            }
-            else if (path.str.ends_with("critical"))
-            {
-                rollup = "Critical";
-                if (isSelf)
-                {
-                    health = "Critical";
-                    return;
-                }
-            }
-            else if (path.str.ends_with("warning"))
-            {
-                if (rollup != "Critical")
-                {
-                    rollup = "Warning";
-                }
-
-                if (isSelf)
-                {
-                    health = "Warning";
-                }
-            }
-        }
-    }
-
-    // this should only be called once per url, others should get updated by
-    // being added as children to the 'main' health object for the page
-    void populate()
-    {
-        if (populated)
-        {
-            return;
-        }
-        populated = true;
-        getAllStatusAssociations();
-        getGlobalPath();
-    }
-
-    void getGlobalPath()
-    {
-        constexpr std::array<std::string_view, 1> interfaces = {
-            "xyz.openbmc_project.Inventory.Item.Global"};
-        std::shared_ptr<HealthPopulate> self = shared_from_this();
-        dbus::utility::getSubTreePaths(
-            "/", 0, interfaces,
-            [self](const boost::system::error_code& ec,
-                   const dbus::utility::MapperGetSubTreePathsResponse& resp) {
-            if (ec || resp.size() != 1)
-            {
-                // no global item, or too many
-                return;
-            }
-            self->globalInventoryPath = resp[0];
-        });
-    }
-
-    void getAllStatusAssociations()
-    {
-        std::shared_ptr<HealthPopulate> self = shared_from_this();
-        sdbusplus::message::object_path path("/");
-        dbus::utility::getManagedObjects(
-            "xyz.openbmc_project.ObjectMapper", path,
-            [self](const boost::system::error_code& ec,
-                   const dbus::utility::ManagedObjectType& resp) {
-            if (ec)
-            {
-                return;
-            }
-            self->statuses = resp;
-            for (auto it = self->statuses.begin(); it != self->statuses.end();)
-            {
-                if (it->first.str.ends_with("critical") ||
-                    it->first.str.ends_with("warning"))
-                {
-                    it++;
-                    continue;
-                }
-                it = self->statuses.erase(it);
-            }
-        });
-    }
-
-    std::shared_ptr<bmcweb::AsyncResp> asyncResp;
-
-    // Will populate the health status into |asyncResp_json[statusPtr]|
-    nlohmann::json::json_pointer statusPtr;
-
-    // we store pointers to other HealthPopulate items so we can update their
-    // members and reduce dbus calls. As we hold a shared_ptr to them, they get
-    // destroyed last, and they need not call populate()
-    std::vector<std::shared_ptr<HealthPopulate>> children;
-
-    // self is used if health is for an individual items status, as this is the
-    // 'lowest most' item, the rollup will equal the health
-    std::optional<std::string> selfPath;
-
-    std::vector<std::string> inventory;
-    bool isManagersHealth = false;
-    dbus::utility::ManagedObjectType statuses;
-    std::string globalInventoryPath = "-"; // default to illegal dbus path
-    bool populated = false;
-};
-} // namespace redfish
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 2f50ca0..5b87cc5 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -19,7 +19,6 @@
 
 #include "app.hpp"
 #include "dbus_utility.hpp"
-#include "health.hpp"
 #include "query.hpp"
 #include "redfish_util.hpp"
 #include "registries/privilege_registry.hpp"
@@ -2019,12 +2018,6 @@
             asyncResp->res.jsonValue["Links"]["ManagerForServers"] =
                 std::move(managerForServers);
         }
-        if constexpr (bmcwebEnableHealthPopulate)
-        {
-            auto health = std::make_shared<HealthPopulate>(asyncResp);
-            health->isManagersHealth = true;
-            health->populate();
-        }
 
         sw_util::populateSoftwareInformation(asyncResp, sw_util::bmcPurpose,
                                              "FirmwareVersion", true);
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 58d51786..2882da0 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -19,7 +19,6 @@
 
 #include "app.hpp"
 #include "dbus_utility.hpp"
-#include "health.hpp"
 #include "query.hpp"
 #include "registries/privilege_registry.hpp"
 #include "utils/collection.hpp"
@@ -607,13 +606,6 @@
                                  const std::string& service,
                                  const std::string& objPath)
 {
-    if constexpr (bmcwebEnableHealthPopulate)
-    {
-        auto health = std::make_shared<HealthPopulate>(asyncResp);
-        health->selfPath = objPath;
-        health->populate();
-    }
-
     BMCWEB_LOG_DEBUG("Get available system components.");
     sdbusplus::asio::getAllProperties(
         *crow::connections::systemBus, service, objPath, "",
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 34aa42f..5c229f4 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -20,7 +20,6 @@
 #include "dbus_utility.hpp"
 #include "error_messages.hpp"
 #include "generated/enums/processor.hpp"
-#include "health.hpp"
 #include "query.hpp"
 #include "registries/privilege_registry.hpp"
 #include "utils/collection.hpp"
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 3a38fce..9438144 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -21,7 +21,6 @@
 #include "dbus_utility.hpp"
 #include "generated/enums/drive.hpp"
 #include "generated/enums/protocol.hpp"
-#include "health.hpp"
 #include "human_sort.hpp"
 #include "openbmc_dbus_rest.hpp"
 #include "query.hpp"
@@ -104,7 +103,6 @@
 
 inline void afterChassisDriveCollectionSubtree(
     const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-    const std::shared_ptr<HealthPopulate>& health,
     const boost::system::error_code& ec,
     const dbus::utility::MapperGetSubTreePathsResponse& driveList)
 {
@@ -120,12 +118,6 @@
     auto& count = asyncResp->res.jsonValue["Drives@odata.count"];
     count = 0;
 
-    if constexpr (bmcwebEnableHealthPopulate)
-    {
-        health->inventory.insert(health->inventory.end(), driveList.begin(),
-                                 driveList.end());
-    }
-
     for (const std::string& drive : driveList)
     {
         sdbusplus::message::object_path object(drive);
@@ -144,14 +136,13 @@
 
     count = driveArray.size();
 }
-inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
-                      const std::shared_ptr<HealthPopulate>& health)
+inline void getDrives(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
 {
     const std::array<std::string_view, 1> interfaces = {
         "xyz.openbmc_project.Inventory.Item.Drive"};
     dbus::utility::getSubTreePaths(
         "/xyz/openbmc_project/inventory", 0, interfaces,
-        std::bind_front(afterChassisDriveCollectionSubtree, asyncResp, health));
+        std::bind_front(afterChassisDriveCollectionSubtree, asyncResp));
 }
 
 inline void afterSystemsStorageGetSubtree(
@@ -187,13 +178,7 @@
     asyncResp->res.jsonValue["Id"] = storageId;
     asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
 
-    auto health = std::make_shared<HealthPopulate>(asyncResp);
-    if constexpr (bmcwebEnableHealthPopulate)
-    {
-        health->populate();
-    }
-
-    getDrives(asyncResp, health);
+    getDrives(asyncResp);
     asyncResp->res.jsonValue["Controllers"]["@odata.id"] = boost::urls::format(
         "/redfish/v1/Systems/system/Storage/{}/Controllers", storageId);
 }
@@ -692,13 +677,6 @@
     // default it to Enabled
     asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
 
-    if constexpr (bmcwebEnableHealthPopulate)
-    {
-        auto health = std::make_shared<HealthPopulate>(asyncResp);
-        health->inventory.emplace_back(path);
-        health->populate();
-    }
-
     addAllDriveInfo(asyncResp, connectionNames[0].first, path,
                     connectionNames[0].second);
 }
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 272a24b..082af64 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -22,7 +22,6 @@
 #include "dbus_utility.hpp"
 #include "generated/enums/computer_system.hpp"
 #include "generated/enums/resource.hpp"
-#include "health.hpp"
 #include "hypervisor_system.hpp"
 #include "led.hpp"
 #include "query.hpp"
@@ -3227,30 +3226,6 @@
 
 #endif // BMCWEB_ENABLE_KVM
 
-    auto health = std::make_shared<HealthPopulate>(asyncResp);
-    if constexpr (bmcwebEnableHealthPopulate)
-    {
-        constexpr std::array<std::string_view, 4> inventoryForSystems{
-            "xyz.openbmc_project.Inventory.Item.Dimm",
-            "xyz.openbmc_project.Inventory.Item.Cpu",
-            "xyz.openbmc_project.Inventory.Item.Drive",
-            "xyz.openbmc_project.Inventory.Item.StorageController"};
-
-        dbus::utility::getSubTreePaths(
-            "/", 0, inventoryForSystems,
-            [health](const boost::system::error_code& ec,
-                     const std::vector<std::string>& resp) {
-            if (ec)
-            {
-                // no inventory
-                return;
-            }
-
-            health->inventory = resp;
-        });
-        health->populate();
-    }
-
     getMainChassisId(asyncResp,
                      [](const std::string& chassisId,
                         const std::shared_ptr<bmcweb::AsyncResp>& aRsp) {
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index 136412c..a2959b8 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -14,12 +14,10 @@
 // limitations under the License.
 */
 #pragma once
-#include "bmcweb_config.h"
 
 #include "app.hpp"
 #include "dbus_utility.hpp"
 #include "event_service_manager.hpp"
-#include "health.hpp"
 #include "http/parsing.hpp"
 #include "query.hpp"
 #include "registries/privilege_registry.hpp"
@@ -492,11 +490,6 @@
 
         asyncResp->res.jsonValue["LifeCycleEventOnTaskStateChange"] = true;
 
-        if constexpr (bmcwebEnableHealthPopulate)
-        {
-            auto health = std::make_shared<HealthPopulate>(asyncResp);
-            health->populate();
-        }
         asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
         asyncResp->res.jsonValue["ServiceEnabled"] = true;
         asyncResp->res.jsonValue["Tasks"]["@odata.id"] =