summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAli Ahmed <ama213000@gmail.com>2021-09-04 00:53:53 +0300
committerEd Tanous <ed@tanous.net>2022-09-02 04:02:37 +0300
commit382d64759b0848f18bad9e0d85a8291529ced0e9 (patch)
tree701440b615e1c9c69cbe833984b8769a4d823518
parentea2b670d306d85d6975b6174024985491af04a89 (diff)
downloadbmcweb-382d64759b0848f18bad9e0d85a8291529ced0e9.tar.xz
Move nested dbus calls in getComputerSystem
Dbus calls to dbus objects 'xyz.openbmc_project.Inventory.Item' and and 'xyz.openbmc_project.State.Decorator.OperationalStatus' are nested under a call for 'xyz.openbmc_project.Inventory.Item.Cpu' properties. This change seperates these calls for clarity and to minimize variables Testing: 1. Redfish Validator Testing passed 2. Curl testing: curl -k -H "X-Auth-Token: $tok" https://$bmc/redfish/v1/Systems/system ... "ProcessorSummary": { "CoreCount": 0, "Count": 2, "Model": "", "Status": { "Health": "OK", "HealthRollup": "OK", "State": "Enabled" } }, ... Signed-off-by: Ali Ahmed <ama213000@gmail.com> Change-Id: Id4657836607a2261a188db8d565aaa2b1a414c5a Signed-off-by: Shantappa Teekappanavar <shantappa.teekappanavar@ibm.com>
-rw-r--r--redfish-core/lib/systems.hpp74
1 files changed, 37 insertions, 37 deletions
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 230598b809..76fcd59caa 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -126,46 +126,14 @@ inline void
}
}
-inline void
- getProcessorProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
- const std::string& service, const std::string& path,
- const dbus::utility::DBusPropertiesMap& properties)
+inline void getProcessorProperties(
+ const std::shared_ptr<bmcweb::AsyncResp>& aResp,
+ const std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>&
+ properties)
{
BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Cpu properties.";
- auto getCpuPresenceState = [aResp](const boost::system::error_code ec3,
- const bool cpuPresenceCheck) {
- if (ec3)
- {
- BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
- return;
- }
- modifyCpuPresenceState(aResp, cpuPresenceCheck);
- };
-
- 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 Presence of CPU
- sdbusplus::asio::getProperty<bool>(
- *crow::connections::systemBus, service, path,
- "xyz.openbmc_project.Inventory.Item", "Present",
- std::move(getCpuPresenceState));
-
- // Get the Functional State
- sdbusplus::asio::getProperty<bool>(
- *crow::connections::systemBus, service, path,
- "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional",
- std::move(getCpuFunctionalState));
-
// TODO: Get Model
const uint16_t* coreCount = nullptr;
@@ -210,6 +178,38 @@ inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
const std::string& path)
{
+ auto getCpuPresenceState = [aResp](const boost::system::error_code ec3,
+ const bool cpuPresenceCheck) {
+ if (ec3)
+ {
+ BMCWEB_LOG_ERROR << "DBUS response error " << ec3;
+ return;
+ }
+ modifyCpuPresenceState(aResp, cpuPresenceCheck);
+ };
+
+ 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 Presence of CPU
+ sdbusplus::asio::getProperty<bool>(
+ *crow::connections::systemBus, service, path,
+ "xyz.openbmc_project.Inventory.Item", "Present",
+ std::move(getCpuPresenceState));
+
+ // 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,
"xyz.openbmc_project.Inventory.Item.Cpu",
@@ -222,7 +222,7 @@ inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
messages::internalError(aResp->res);
return;
}
- getProcessorProperties(aResp, service, path, properties);
+ getProcessorProperties(aResp, properties);
});
}