Move getProperty calls to utility
Having all dbus calls run through the same utility reduces the amount of
generated code, and more importantly, gives us a place where we can log
the requests and responses to help with debugging.
Tested: Redfish service validator passes.
Change-Id: Ic1bf45130b5069cd57f7af26e12c8d3159c87c67
Signed-off-by: Ed Tanous <etanous@nvidia.com>
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index c0d3103..d089381 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -62,9 +62,8 @@
const std::string& objPath)
{
BMCWEB_LOG_DEBUG("Get Processor UUID");
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, service, objPath,
- "xyz.openbmc_project.Common.UUID", "UUID",
+ dbus::utility::getProperty<std::string>(
+ service, objPath, "xyz.openbmc_project.Common.UUID", "UUID",
[objPath, asyncResp{std::move(asyncResp)}](
const boost::system::error_code& ec, const std::string& property) {
if (ec)
@@ -340,9 +339,8 @@
{
BMCWEB_LOG_DEBUG("Get processor throttle resources");
- sdbusplus::asio::getAllProperties(
- *crow::connections::systemBus, service, objectPath,
- "xyz.openbmc_project.Control.Power.Throttle",
+ dbus::utility::getAllProperties(
+ service, objectPath, "xyz.openbmc_project.Control.Power.Throttle",
[asyncResp](const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& properties) {
readThrottleProperties(asyncResp, ec, properties);
@@ -354,9 +352,8 @@
const std::string& objPath)
{
BMCWEB_LOG_DEBUG("Get Cpu Asset Data");
- sdbusplus::asio::getAllProperties(
- *crow::connections::systemBus, service, objPath,
- "xyz.openbmc_project.Inventory.Decorator.Asset",
+ dbus::utility::getAllProperties(
+ service, objPath, "xyz.openbmc_project.Inventory.Decorator.Asset",
[objPath, asyncResp{std::move(asyncResp)}](
const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& properties) {
@@ -428,9 +425,8 @@
const std::string& objPath)
{
BMCWEB_LOG_DEBUG("Get Cpu Revision Data");
- sdbusplus::asio::getAllProperties(
- *crow::connections::systemBus, service, objPath,
- "xyz.openbmc_project.Inventory.Decorator.Revision",
+ dbus::utility::getAllProperties(
+ service, objPath, "xyz.openbmc_project.Inventory.Decorator.Revision",
[objPath, asyncResp{std::move(asyncResp)}](
const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& properties) {
@@ -465,8 +461,8 @@
const std::string& service, const std::string& objPath)
{
BMCWEB_LOG_DEBUG("Get available system Accelerator resources by service.");
- sdbusplus::asio::getAllProperties(
- *crow::connections::systemBus, service, objPath, "",
+ dbus::utility::getAllProperties(
+ service, objPath, "",
[acclrtrId, asyncResp{std::move(asyncResp)}](
const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& properties) {
@@ -579,8 +575,8 @@
BMCWEB_LOG_INFO("Getting CPU operating configs for {}", cpuId);
// First, GetAll CurrentOperatingConfig properties on the object
- sdbusplus::asio::getAllProperties(
- *crow::connections::systemBus, service, objPath,
+ dbus::utility::getAllProperties(
+ service, objPath,
"xyz.openbmc_project.Control.Processor.CurrentOperatingConfig",
[asyncResp, cpuId,
service](const boost::system::error_code& ec,
@@ -640,8 +636,8 @@
// Once we found the current applied config, queue another
// request to read the base freq core ids out of that
// config.
- sdbusplus::asio::getProperty<BaseSpeedPrioritySettingsProperty>(
- *crow::connections::systemBus, service, dbusPath,
+ dbus::utility::getProperty<BaseSpeedPrioritySettingsProperty>(
+ service, dbusPath,
"xyz.openbmc_project.Inventory.Item.Cpu."
"OperatingConfig",
"BaseSpeedPrioritySettings",
@@ -681,8 +677,8 @@
const std::string& objPath)
{
BMCWEB_LOG_DEBUG("Get Cpu Location Data");
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, service, objPath,
+ dbus::utility::getProperty<std::string>(
+ service, objPath,
"xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
[objPath, asyncResp{std::move(asyncResp)}](
const boost::system::error_code& ec, const std::string& property) {
@@ -712,8 +708,8 @@
const std::string& objectPath)
{
BMCWEB_LOG_DEBUG("Get CPU UniqueIdentifier");
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, service, objectPath,
+ dbus::utility::getProperty<std::string>(
+ service, objectPath,
"xyz.openbmc_project.Inventory.Decorator.UniqueIdentifier",
"UniqueIdentifier",
[asyncResp](const boost::system::error_code& ec,
@@ -878,8 +874,8 @@
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& service, const std::string& objPath)
{
- sdbusplus::asio::getAllProperties(
- *crow::connections::systemBus, service, objPath,
+ dbus::utility::getAllProperties(
+ service, objPath,
"xyz.openbmc_project.Inventory.Item.Cpu.OperatingConfig",
[asyncResp](const boost::system::error_code& ec,
const dbus::utility::DBusPropertiesMap& properties) {