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/chassis.hpp b/redfish-core/lib/chassis.hpp
index e2461e9..d405e75 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -104,9 +104,9 @@
inline void getStorageLink(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const sdbusplus::message::object_path& path)
{
- sdbusplus::asio::getProperty<std::vector<std::string>>(
- *crow::connections::systemBus, "xyz.openbmc_project.ObjectMapper",
- (path / "storage").str, "xyz.openbmc_project.Association", "endpoints",
+ dbus::utility::getProperty<std::vector<std::string>>(
+ "xyz.openbmc_project.ObjectMapper", (path / "storage").str,
+ "xyz.openbmc_project.Association", "endpoints",
[asyncResp](const boost::system::error_code& ec,
const std::vector<std::string>& storageList) {
if (ec)
@@ -147,8 +147,8 @@
inline void getChassisState(std::shared_ptr<bmcweb::AsyncResp> asyncResp)
{
// crow::connections::systemBus->async_method_call(
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, "xyz.openbmc_project.State.Chassis",
+ dbus::utility::getProperty<std::string>(
+ "xyz.openbmc_project.State.Chassis",
"/xyz/openbmc_project/state/chassis0",
"xyz.openbmc_project.State.Chassis", "CurrentPowerState",
[asyncResp{std::move(asyncResp)}](const boost::system::error_code& ec,
@@ -212,8 +212,8 @@
BMCWEB_LOG_DEBUG("Get intrusion status by service ");
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, service.first, object.first,
+ dbus::utility::getProperty<std::string>(
+ service.first, object.first,
"xyz.openbmc_project.Chassis.Intrusion", "Status",
[asyncResp](const boost::system::error_code& ec1,
const std::string& value) {
@@ -377,8 +377,8 @@
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& connectionName, const std::string& path)
{
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, connectionName, path,
+ dbus::utility::getProperty<std::string>(
+ connectionName, path,
"xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode",
[asyncResp](const boost::system::error_code& ec,
const std::string& property) {
@@ -399,9 +399,8 @@
const std::string& connectionName,
const std::string& path)
{
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, connectionName, path,
- "xyz.openbmc_project.Common.UUID", "UUID",
+ dbus::utility::getProperty<std::string>(
+ connectionName, path, "xyz.openbmc_project.Common.UUID", "UUID",
[asyncResp](const boost::system::error_code& ec,
const std::string& chassisUUID) {
if (ec)
@@ -619,9 +618,8 @@
{
if (interface == assetTagInterface)
{
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, connectionName, path,
- assetTagInterface, "AssetTag",
+ dbus::utility::getProperty<std::string>(
+ connectionName, path, assetTagInterface, "AssetTag",
[asyncResp, chassisId](const boost::system::error_code& ec2,
const std::string& property) {
if (ec2)
@@ -636,9 +634,8 @@
}
else if (interface == replaceableInterface)
{
- sdbusplus::asio::getProperty<bool>(
- *crow::connections::systemBus, connectionName, path,
- replaceableInterface, "HotPluggable",
+ dbus::utility::getProperty<bool>(
+ connectionName, path, replaceableInterface, "HotPluggable",
[asyncResp, chassisId](const boost::system::error_code& ec2,
const bool property) {
if (ec2)
@@ -654,9 +651,8 @@
}
else if (interface == revisionInterface)
{
- sdbusplus::asio::getProperty<std::string>(
- *crow::connections::systemBus, connectionName, path,
- revisionInterface, "Version",
+ dbus::utility::getProperty<std::string>(
+ connectionName, path, revisionInterface, "Version",
[asyncResp, chassisId](const boost::system::error_code& ec2,
const std::string& property) {
if (ec2)
@@ -681,7 +677,7 @@
}
}
- sdbusplus::asio::getAllProperties(
+ dbus::utility::getAllProperties(
*crow::connections::systemBus, connectionName, path,
"xyz.openbmc_project.Inventory.Decorator.Asset",
[asyncResp, chassisId,