From 798f21ae44996528edb9b8e9fa3b4bd5b76e1223 Mon Sep 17 00:00:00 2001 From: Oliver Brewka Date: Thu, 22 Aug 2024 13:58:35 +0200 Subject: [PATCH] testing: use new logic in systems.hpp Change-Id: I3b825e42c52f017659553ff22a7bacf9e07cfa6f --- redfish-core/lib/systems.hpp | 81 ++++++++++++++++++++---------------- 1 file changed, 45 insertions(+), 36 deletions(-) diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index b2eaaddbea..b99af9fb21 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -530,13 +530,16 @@ inline void * * @return None. */ -inline void getHostState(const std::shared_ptr& asyncResp) +inline void getHostState( + const std::map& /*reqParams*/, + const std::shared_ptr& asyncResp, + const std::string& /*systemName*/, + const sdbusplus::message::object_path& path, const std::string& service) { BMCWEB_LOG_DEBUG("Get host information."); sdbusplus::asio::getProperty( - *crow::connections::systemBus, "xyz.openbmc_project.State.Host", - "/xyz/openbmc_project/state/host0", "xyz.openbmc_project.State.Host", - "CurrentHostState", + *crow::connections::systemBus, service, path, + "xyz.openbmc_project.State.Host", "CurrentHostState", [asyncResp](const boost::system::error_code& ec, const std::string& hostState) { if (ec) @@ -2995,13 +2998,13 @@ inline void return; } - if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) - { - // Option currently returns no systems. TBD - messages::resourceNotFound(asyncResp->res, "ComputerSystem", - systemName); - return; - } + // if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM) + // { + // // Option currently returns no systems. TBD + // messages::resourceNotFound(asyncResp->res, "ComputerSystem", + // systemName); + // return; + // } if (systemName == "hypervisor") { @@ -3009,12 +3012,12 @@ inline void return; } - if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) - { - messages::resourceNotFound(asyncResp->res, "ComputerSystem", - systemName); - return; - } + // if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME) + // { + // messages::resourceNotFound(asyncResp->res, "ComputerSystem", + // systemName); + // return; + // } asyncResp->res.addHeader( boost::beast::http::field::link, "; rel=describedby"); @@ -3094,28 +3097,34 @@ inline void aRsp->res.jsonValue["Links"]["Chassis"] = std::move(chassisArray); }); + const std::map reqParams; + getSystemLocationIndicatorActive(asyncResp); // TODO (Gunnar): Remove IndicatorLED after enough time has passed getIndicatorLedState(asyncResp); - getComputerSystem(asyncResp); - getHostState(asyncResp); - getBootProperties(asyncResp); - getBootProgress(asyncResp); - getBootProgressLastStateTime(asyncResp); - pcie_util::getPCIeDeviceList(asyncResp, - nlohmann::json::json_pointer("/PCIeDevices")); - getHostWatchdogTimer(asyncResp); - getPowerRestorePolicy(asyncResp); - getStopBootOnFault(asyncResp); - getAutomaticRetryPolicy(asyncResp); - getLastResetTime(asyncResp); - if constexpr (BMCWEB_REDFISH_PROVISIONING_FEATURE) - { - getProvisioningStatus(asyncResp); - } - getTrustedModuleRequiredToBoot(asyncResp); - getPowerMode(asyncResp); - getIdlePowerSaver(asyncResp); + // getComputerSystem(asyncResp); + + // getHostState(asyncResp); + getComputerSystemDBusResources(reqParams, asyncResp, systemName, + "xyz.openbmc_project.State.Host", + getHostState); + // getBootProperties(asyncResp); + // getBootProgress(asyncResp); + // getBootProgressLastStateTime(asyncResp); + // pcie_util::getPCIeDeviceList(asyncResp, + // nlohmann::json::json_pointer("/PCIeDevices")); + // getHostWatchdogTimer(asyncResp); + // getPowerRestorePolicy(asyncResp); + // getStopBootOnFault(asyncResp); + // getAutomaticRetryPolicy(asyncResp); + // getLastResetTime(asyncResp); + // if constexpr (BMCWEB_REDFISH_PROVISIONING_FEATURE) + // { + // getProvisioningStatus(asyncResp); + // } + // getTrustedModuleRequiredToBoot(asyncResp); + // getPowerMode(asyncResp); + // getIdlePowerSaver(asyncResp); } inline void handleComputerSystemPatch(