summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-02-27 08:42:46 +0300
committerEd Tanous <ed@tanous.net>2022-03-22 20:53:16 +0300
commitb9d36b4791d77a47e1f3c5c4564fcdf7cc68c115 (patch)
tree22a37e506310ded94a45aed79799929f94bac330
parenta2dd60a69046cdda90077463f614140aeb91edc4 (diff)
downloadbmcweb-b9d36b4791d77a47e1f3c5c4564fcdf7cc68c115.tar.xz
Consitently use dbus::utility types
This saves about 4k on the binary size Tested: Redfish service validator passes. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I9546227a19c691b1aecb80e80307889548c0293f
-rw-r--r--http/routing.hpp76
-rw-r--r--include/dbus_utility.hpp14
-rw-r--r--include/hostname_monitor.hpp17
-rw-r--r--include/image_upload.hpp5
-rw-r--r--include/nbd_proxy.hpp6
-rw-r--r--include/obmc_console.hpp1
-rw-r--r--include/openbmc_dbus_rest.hpp51
-rw-r--r--include/persistent_data.hpp1
-rw-r--r--include/sessions.hpp1
-rw-r--r--redfish-core/include/event_service_manager.hpp3
-rw-r--r--redfish-core/include/utils/collection.hpp6
-rw-r--r--redfish-core/include/utils/fw_utils.hpp114
-rw-r--r--redfish-core/lib/account_service.hpp9
-rw-r--r--redfish-core/lib/cable.hpp2
-rw-r--r--redfish-core/lib/certificate_service.hpp18
-rw-r--r--redfish-core/lib/chassis.hpp32
-rw-r--r--redfish-core/lib/ethernet.hpp10
-rw-r--r--redfish-core/lib/health.hpp2
-rw-r--r--redfish-core/lib/hypervisor_system.hpp4
-rw-r--r--redfish-core/lib/log_services.hpp41
-rw-r--r--redfish-core/lib/managers.hpp95
-rw-r--r--redfish-core/lib/memory.hpp82
-rw-r--r--redfish-core/lib/metric_report_definition.hpp8
-rw-r--r--redfish-core/lib/network_protocol.hpp4
-rw-r--r--redfish-core/lib/pcie.hpp385
-rw-r--r--redfish-core/lib/power.hpp9
-rw-r--r--redfish-core/lib/processor.hpp10
-rw-r--r--redfish-core/lib/redfish_util.hpp2
-rw-r--r--redfish-core/lib/sensors.hpp235
-rw-r--r--redfish-core/lib/storage.hpp15
-rw-r--r--redfish-core/lib/systems.hpp97
-rw-r--r--redfish-core/lib/task.hpp2
-rw-r--r--redfish-core/lib/telemetry_service.hpp6
-rw-r--r--redfish-core/lib/update_service.hpp136
-rw-r--r--redfish-core/lib/virtual_media.hpp26
35 files changed, 685 insertions, 840 deletions
diff --git a/http/routing.hpp b/http/routing.hpp
index 5b819c582c..0fa2497905 100644
--- a/http/routing.hpp
+++ b/http/routing.hpp
@@ -1275,8 +1275,7 @@ class Router
crow::connections::systemBus->async_method_call(
[&req, asyncResp, &rules, ruleIndex,
found](const boost::system::error_code ec,
- const std::map<std::string, dbus::utility::DbusVariantType>&
- userInfo) {
+ const dbus::utility::DBusPropertiesMap& userInfoMap) {
if (ec)
{
BMCWEB_LOG_ERROR << "GetUserInfo failed...";
@@ -1284,30 +1283,42 @@ class Router
boost::beast::http::status::internal_server_error);
return;
}
-
- const std::string* userRolePtr = nullptr;
- auto userInfoIter = userInfo.find("UserPrivilege");
- if (userInfoIter != userInfo.end())
- {
- userRolePtr =
- std::get_if<std::string>(&userInfoIter->second);
- }
-
std::string userRole{};
- if (userRolePtr != nullptr)
- {
- userRole = *userRolePtr;
- BMCWEB_LOG_DEBUG << "userName = " << req.session->username
- << " userRole = " << *userRolePtr;
- }
+ const bool* remoteUser = nullptr;
+ std::optional<bool> passwordExpired;
- const bool* remoteUserPtr = nullptr;
- auto remoteUserIter = userInfo.find("RemoteUser");
- if (remoteUserIter != userInfo.end())
+ for (const auto& userInfo : userInfoMap)
{
- remoteUserPtr = std::get_if<bool>(&remoteUserIter->second);
+ if (userInfo.first == "UserPrivilege")
+ {
+ const std::string* userRolePtr =
+ std::get_if<std::string>(&userInfo.second);
+ if (userRolePtr == nullptr)
+ {
+ continue;
+ }
+ userRole = *userRolePtr;
+ BMCWEB_LOG_DEBUG
+ << "userName = " << req.session->username
+ << " userRole = " << *userRolePtr;
+ }
+ else if (userInfo.first == "RemoteUser")
+ {
+ remoteUser = std::get_if<bool>(&userInfo.second);
+ }
+ else if (userInfo.first == "UserPasswordExpired")
+ {
+ const bool* passwordExpiredPtr =
+ std::get_if<bool>(&userInfo.second);
+ if (passwordExpiredPtr == nullptr)
+ {
+ continue;
+ }
+ passwordExpired = *passwordExpiredPtr;
+ }
}
- if (remoteUserPtr == nullptr)
+
+ if (remoteUser == nullptr)
{
BMCWEB_LOG_ERROR
<< "RemoteUser property missing or wrong type";
@@ -1315,24 +1326,10 @@ class Router
boost::beast::http::status::internal_server_error);
return;
}
- bool remoteUser = *remoteUserPtr;
- bool passwordExpired = false; // default for remote user
- if (!remoteUser)
+ if (passwordExpired == std::nullopt)
{
- const bool* passwordExpiredPtr = nullptr;
- auto passwordExpiredIter =
- userInfo.find("UserPasswordExpired");
- if (passwordExpiredIter != userInfo.end())
- {
- passwordExpiredPtr =
- std::get_if<bool>(&passwordExpiredIter->second);
- }
- if (passwordExpiredPtr != nullptr)
- {
- passwordExpired = *passwordExpiredPtr;
- }
- else
+ if (!*remoteUser)
{
BMCWEB_LOG_ERROR
<< "UserPasswordExpired property is expected for"
@@ -1341,6 +1338,7 @@ class Router
boost::beast::http::status::internal_server_error);
return;
}
+ passwordExpired = false;
}
// Get the userprivileges from the role
@@ -1350,7 +1348,7 @@ class Router
// Set isConfigureSelfOnly based on D-Bus results. This
// ignores the results from both pamAuthenticateUser and the
// value from any previous use of this session.
- req.session->isConfigureSelfOnly = passwordExpired;
+ req.session->isConfigureSelfOnly = *passwordExpired;
// Modifyprivileges if isConfigureSelfOnly.
if (req.session->isConfigureSelfOnly)
diff --git a/include/dbus_utility.hpp b/include/dbus_utility.hpp
index 481b33dea9..0c8019781c 100644
--- a/include/dbus_utility.hpp
+++ b/include/dbus_utility.hpp
@@ -73,6 +73,15 @@ using MapperServiceMap =
using MapperGetSubTreeResponse =
std::vector<std::pair<std::string, MapperServiceMap>>;
+using MapperGetObject =
+ std::vector<std::pair<std::string, std::vector<std::string>>>;
+
+using MapperGetAncestorsResponse = std::vector<
+ std::pair<std::string,
+ std::vector<std::pair<std::string, std::vector<std::string>>>>>;
+
+using MapperGetSubTreePathsResponse = std::vector<std::string>;
+
inline void escapePathForDbus(std::string& path)
{
const std::regex reg("[^A-Za-z0-9_/]");
@@ -109,13 +118,10 @@ inline bool getNthStringFromPath(const std::string& path, int index,
template <typename Callback>
inline void checkDbusPathExists(const std::string& path, Callback&& callback)
{
- using GetObjectType =
- std::vector<std::pair<std::string, std::vector<std::string>>>;
-
crow::connections::systemBus->async_method_call(
[callback{std::forward<Callback>(callback)}](
const boost::system::error_code ec,
- const GetObjectType& objectNames) {
+ const dbus::utility::MapperGetObject& objectNames) {
callback(!ec && !objectNames.empty());
},
"xyz.openbmc_project.ObjectMapper",
diff --git a/include/hostname_monitor.hpp b/include/hostname_monitor.hpp
index 73c315fb73..f4e6b27c2d 100644
--- a/include/hostname_monitor.hpp
+++ b/include/hostname_monitor.hpp
@@ -1,7 +1,7 @@
#pragma once
#ifdef BMCWEB_ENABLE_SSL
-#include <boost/container/flat_map.hpp>
#include <dbus_singleton.hpp>
+#include <dbus_utility.hpp>
#include <include/dbus_utility.hpp>
#include <sdbusplus/bus/match.hpp>
#include <sdbusplus/message/types.hpp>
@@ -43,20 +43,19 @@ inline int onPropertyUpdate(sd_bus_message* m, void* /* userdata */,
sdbusplus::message::message message(m);
std::string iface;
- boost::container::flat_map<std::string, dbus::utility::DbusVariantType>
- changedProperties;
+ dbus::utility::DBusPropertiesMap changedProperties;
message.read(iface, changedProperties);
- auto it = changedProperties.find("HostName");
- if (it == changedProperties.end())
+ const std::string* hostname = nullptr;
+ for (const auto& propertyPair : changedProperties)
{
- return 0;
+ if (propertyPair.first == "HostName")
+ {
+ hostname = std::get_if<std::string>(&propertyPair.second);
+ }
}
-
- std::string* hostname = std::get_if<std::string>(&it->second);
if (hostname == nullptr)
{
- BMCWEB_LOG_ERROR << "Unable to read hostname";
return 0;
}
diff --git a/include/image_upload.hpp b/include/image_upload.hpp
index 1b0a09a4ba..330ea9c379 100644
--- a/include/image_upload.hpp
+++ b/include/image_upload.hpp
@@ -64,10 +64,7 @@ inline void
BMCWEB_LOG_DEBUG << "Match fired";
sdbusplus::message::object_path path;
- std::vector<std::pair<
- std::string, std::vector<std::pair<
- std::string, dbus::utility::DbusVariantType>>>>
- interfaces;
+ dbus::utility::DBusInteracesMap interfaces;
m.read(path, interfaces);
if (std::find_if(interfaces.begin(), interfaces.end(),
diff --git a/include/nbd_proxy.hpp b/include/nbd_proxy.hpp
index afb6493a44..e0a011101e 100644
--- a/include/nbd_proxy.hpp
+++ b/include/nbd_proxy.hpp
@@ -261,10 +261,8 @@ inline void requestRoutes(App& app)
auto getUserInfoHandler = [&conn, asyncResp](
const boost::system::error_code ec,
- boost::container::flat_map<
- std::string,
- dbus::utility::DbusVariantType>
- userInfo) {
+ const dbus::utilities::
+ DBusPropertiesMap& userInfo) {
if (ec)
{
BMCWEB_LOG_ERROR << "GetUserInfo failed...";
diff --git a/include/obmc_console.hpp b/include/obmc_console.hpp
index 478649ac8d..01ee4799fc 100644
--- a/include/obmc_console.hpp
+++ b/include/obmc_console.hpp
@@ -4,7 +4,6 @@
#include <app.hpp>
#include <async_resp.hpp>
#include <boost/asio/local/stream_protocol.hpp>
-#include <boost/container/flat_map.hpp>
#include <boost/container/flat_set.hpp>
#include <websocket.hpp>
diff --git a/include/openbmc_dbus_rest.hpp b/include/openbmc_dbus_rest.hpp
index af6a720ceb..042f193952 100644
--- a/include/openbmc_dbus_rest.hpp
+++ b/include/openbmc_dbus_rest.hpp
@@ -32,11 +32,6 @@ namespace crow
{
namespace openbmc_mapper
{
-
-using GetSubTreeType = std::vector<
- std::pair<std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>;
-
const constexpr char* notFoundMsg = "404 Not Found";
const constexpr char* badReqMsg = "400 Bad Request";
const constexpr char* methodNotAllowedMsg = "405 Method Not Allowed";
@@ -139,10 +134,9 @@ inline void getPropertiesForEnumerate(
<< service << " " << interface;
crow::connections::systemBus->async_method_call(
- [asyncResp, objectPath, service, interface](
- const boost::system::error_code ec,
- const std::vector<std::pair<
- std::string, dbus::utility::DbusVariantType>>& propertiesList) {
+ [asyncResp, objectPath, service,
+ interface](const boost::system::error_code ec,
+ const dbus::utility::DBusPropertiesMap& propertiesList) {
if (ec)
{
BMCWEB_LOG_ERROR << "GetAll on path " << objectPath << " iface "
@@ -186,7 +180,7 @@ inline void getPropertiesForEnumerate(
// called after all ObjectManagers are searched for and called.
inline void findRemainingObjectsForEnumerate(
const std::string& objectPath,
- const std::shared_ptr<GetSubTreeType>& subtree,
+ const std::shared_ptr<dbus::utility::MapperGetSubTreeResponse>& subtree,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
BMCWEB_LOG_DEBUG << "findRemainingObjectsForEnumerate";
@@ -244,7 +238,7 @@ struct InProgressEnumerateData
InProgressEnumerateData& operator=(InProgressEnumerateData&&) = delete;
const std::string objectPath;
- std::shared_ptr<GetSubTreeType> subtree;
+ std::shared_ptr<dbus::utility::MapperGetSubTreeResponse> subtree;
std::shared_ptr<bmcweb::AsyncResp> asyncResp;
};
@@ -331,10 +325,7 @@ inline void findObjectManagerPathForEnumerate(
crow::connections::systemBus->async_method_call(
[transaction, objectName, connectionName](
const boost::system::error_code ec,
- const boost::container::flat_map<
- std::string, boost::container::flat_map<
- std::string, std::vector<std::string>>>&
- objects) {
+ const dbus::utility::MapperGetAncestorsResponse& objects) {
if (ec)
{
BMCWEB_LOG_ERROR << "GetAncestors on path " << objectName
@@ -369,12 +360,9 @@ inline void findObjectManagerPathForEnumerate(
inline void getObjectAndEnumerate(
const std::shared_ptr<InProgressEnumerateData>& transaction)
{
- using GetObjectType =
- std::vector<std::pair<std::string, std::vector<std::string>>>;
-
crow::connections::systemBus->async_method_call(
[transaction](const boost::system::error_code ec,
- const GetObjectType& objects) {
+ const dbus::utility::MapperGetObject& objects) {
if (ec)
{
BMCWEB_LOG_ERROR << "GetObject for path "
@@ -1627,8 +1615,9 @@ inline void handleList(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& objectPath, int32_t depth = 0)
{
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec,
- const std::vector<std::string>& objectPaths) {
+ [asyncResp](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreePathsResponse& objectPaths) {
if (ec)
{
setErrorResponse(asyncResp->res,
@@ -1658,13 +1647,15 @@ inline void handleEnumerate(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
{"data", nlohmann::json::object()}};
crow::connections::systemBus->async_method_call(
- [objectPath, asyncResp](const boost::system::error_code ec,
- const GetSubTreeType& objectNames) {
+ [objectPath, asyncResp](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& objectNames) {
auto transaction = std::make_shared<InProgressEnumerateData>(
objectPath, asyncResp);
transaction->subtree =
- std::make_shared<GetSubTreeType>(objectNames);
+ std::make_shared<dbus::utility::MapperGetSubTreeResponse>(
+ objectNames);
if (ec)
{
@@ -1696,11 +1687,10 @@ inline void handleGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
std::shared_ptr<std::string> path =
std::make_shared<std::string>(std::move(objectPath));
- using GetObjectType =
- std::vector<std::pair<std::string, std::vector<std::string>>>;
crow::connections::systemBus->async_method_call(
- [asyncResp, path, propertyName](const boost::system::error_code ec,
- const GetObjectType& objectNames) {
+ [asyncResp, path,
+ propertyName](const boost::system::error_code ec,
+ const dbus::utility::MapperGetObject& objectNames) {
if (ec || objectNames.empty())
{
setErrorResponse(asyncResp->res,
@@ -1869,12 +1859,9 @@ inline void handlePut(const crow::Request& req,
transaction->propertyName = destProperty;
transaction->propertyValue = propertySetValue;
- using GetObjectType =
- std::vector<std::pair<std::string, std::vector<std::string>>>;
-
crow::connections::systemBus->async_method_call(
[transaction](const boost::system::error_code ec2,
- const GetObjectType& objectNames) {
+ const dbus::utility::MapperGetObject& objectNames) {
if (!ec2 && objectNames.empty())
{
setErrorResponse(transaction->asyncResp->res,
diff --git a/include/persistent_data.hpp b/include/persistent_data.hpp
index 02f2ccec11..6d0f7c1a1d 100644
--- a/include/persistent_data.hpp
+++ b/include/persistent_data.hpp
@@ -2,7 +2,6 @@
#include <app.hpp>
#include <boost/beast/http/fields.hpp>
-#include <boost/container/flat_map.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
diff --git a/include/sessions.hpp b/include/sessions.hpp
index 85c0cb9208..748bb08999 100644
--- a/include/sessions.hpp
+++ b/include/sessions.hpp
@@ -6,7 +6,6 @@
#include <openssl/rand.h>
-#include <boost/container/flat_map.hpp>
#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index 7aeacd64c3..90c7e87a4f 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -1325,8 +1325,7 @@ class EventServiceManager
}
std::string interface;
- std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>
- props;
+ dbus::utility::DBusPropertiesMap props;
std::vector<std::string> invalidProps;
msg.read(interface, props, invalidProps);
diff --git a/redfish-core/include/utils/collection.hpp b/redfish-core/include/utils/collection.hpp
index c5d603ad21..2cb2f3dbbf 100644
--- a/redfish-core/include/utils/collection.hpp
+++ b/redfish-core/include/utils/collection.hpp
@@ -30,9 +30,9 @@ inline void
{
BMCWEB_LOG_DEBUG << "Get collection members for: " << collectionPath;
crow::connections::systemBus->async_method_call(
- [collectionPath,
- aResp{std::move(aResp)}](const boost::system::error_code ec,
- const std::vector<std::string>& objects) {
+ [collectionPath, aResp{std::move(aResp)}](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreePathsResponse& objects) {
if (ec == boost::system::errc::io_error)
{
aResp->res.jsonValue["Members"] = nlohmann::json::array();
diff --git a/redfish-core/include/utils/fw_utils.hpp b/redfish-core/include/utils/fw_utils.hpp
index c05f8cbb05..d80ce71f2e 100644
--- a/redfish-core/include/utils/fw_utils.hpp
+++ b/redfish-core/include/utils/fw_utils.hpp
@@ -84,11 +84,7 @@ inline void
[aResp, fwVersionPurpose, activeVersionPropName,
populateLinkToImages, functionalFwIds](
const boost::system::error_code ec2,
- const std::vector<
- std::pair<std::string,
- std::vector<std::pair<
- std::string, std::vector<std::string>>>>>&
- subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec2)
{
BMCWEB_LOG_ERROR << "error_code = " << ec2;
@@ -132,9 +128,7 @@ inline void
[aResp, swId, runningImage, fwVersionPurpose,
activeVersionPropName, populateLinkToImages](
const boost::system::error_code ec3,
- const boost::container::flat_map<
- std::string,
- dbus::utility::DbusVariantType>&
+ const dbus::utility::DBusPropertiesMap&
propertiesList) {
if (ec3)
{
@@ -149,36 +143,48 @@ inline void
// "IBM-witherspoon-OP9-v2.0.10-2.22" "Purpose"
// s
// "xyz.openbmc_project.Software.Version.VersionPurpose.Host"
-
- boost::container::flat_map<
- std::string,
- dbus::utility::DbusVariantType>::
- const_iterator it =
- propertiesList.find("Purpose");
- if (it == propertiesList.end())
- {
- BMCWEB_LOG_ERROR
- << "Can't find property \"Purpose\"!";
- messages::internalError(aResp->res);
- return;
- }
- const std::string* swInvPurpose =
- std::get_if<std::string>(&it->second);
- if (swInvPurpose == nullptr)
+ std::string version;
+ std::string swInvPurpose;
+ for (const auto& propertyPair : propertiesList)
{
- BMCWEB_LOG_ERROR << "wrong types for "
- "property \"Purpose\"!";
- messages::internalError(aResp->res);
- return;
+ if (propertyPair.first == "Purpose")
+ {
+ const std::string* purpose =
+ std::get_if<std::string>(
+ &propertyPair.second);
+ if (purpose == nullptr)
+ {
+ messages::internalError(aResp->res);
+ return;
+ }
+ swInvPurpose = *purpose;
+ }
+ if (propertyPair.first == "Version")
+ {
+ const std::string* versionPtr =
+ std::get_if<std::string>(
+ &propertyPair.second);
+ if (versionPtr == nullptr)
+ {
+ messages::internalError(aResp->res);
+ return;
+ }
+ version = *versionPtr;
+ }
}
BMCWEB_LOG_DEBUG << "Image ID: " << swId;
BMCWEB_LOG_DEBUG << "Image purpose: "
- << *swInvPurpose;
+ << swInvPurpose;
BMCWEB_LOG_DEBUG << "Running image: "
<< runningImage;
- if (*swInvPurpose != fwVersionPurpose)
+ if (version.empty())
+ {
+ messages::internalError(aResp->res);
+ return;
+ }
+ if (swInvPurpose != fwVersionPurpose)
{
// Not purpose we're looking for
return;
@@ -217,28 +223,9 @@ inline void
if (!activeVersionPropName.empty() &&
runningImage)
{
- it = propertiesList.find("Version");
- if (it == propertiesList.end())
- {
- BMCWEB_LOG_ERROR
- << "Can't find property "
- "\"Version\"!";
- messages::internalError(aResp->res);
- return;
- }
- const std::string* version =
- std::get_if<std::string>(&it->second);
- if (version == nullptr)
- {
- BMCWEB_LOG_ERROR
- << "Error getting fw version";
- messages::internalError(aResp->res);
- return;
- }
-
aResp->res
.jsonValue[activeVersionPropName] =
- *version;
+ version;
}
},
obj.second[0].first, obj.first,
@@ -327,32 +314,29 @@ inline void getFwStatus(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
BMCWEB_LOG_DEBUG << "getFwStatus: swId " << *swId << " svc " << dbusSvc;
crow::connections::systemBus->async_method_call(
- [asyncResp, swId](
- const boost::system::error_code errorCode,
- const boost::container::flat_map<
- std::string, dbus::utility::DbusVariantType>& propertiesList) {
+ [asyncResp,
+ swId](const boost::system::error_code errorCode,
+ const dbus::utility::DBusPropertiesMap& propertiesList) {
if (errorCode)
{
// not all fwtypes are updateable, this is ok
asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
return;
}
- boost::container::flat_map<
- std::string, dbus::utility::DbusVariantType>::const_iterator
- it = propertiesList.find("Activation");
- if (it == propertiesList.end())
+ const std::string* swInvActivation = nullptr;
+ for (const auto& property : propertiesList)
{
- BMCWEB_LOG_DEBUG << "Can't find property \"Activation\"!";
- messages::propertyMissing(asyncResp->res, "Activation");
- return;
+ if (property.first == "Activation")
+ {
+ swInvActivation =
+ std::get_if<std::string>(&property.second);
+ }
}
- const std::string* swInvActivation =
- std::get_if<std::string>(&it->second);
+
if (swInvActivation == nullptr)
{
BMCWEB_LOG_DEBUG << "wrong types for property\"Activation\"!";
- messages::propertyValueTypeError(asyncResp->res, "",
- "Activation");
+ messages::internalError(asyncResp->res);
return;
}
BMCWEB_LOG_DEBUG << "getFwStatus: Activation " << *swInvActivation;
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 5cd70bc2f9..4fcd540057 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -67,9 +67,6 @@ struct LDAPConfigData
std::vector<std::pair<std::string, LDAPRoleMapData>> groupRoleList;
};
-using GetObjectType =
- std::vector<std::pair<std::string, std::vector<std::string>>>;
-
inline std::string getRoleIdFromPrivilege(std::string_view role)
{
if (role == "priv-admin")
@@ -385,7 +382,7 @@ inline void getLDAPConfigData(const std::string& ldapType,
crow::connections::systemBus->async_method_call(
[callback, ldapType](const boost::system::error_code ec,
- const GetObjectType& resp) {
+ const dbus::utility::MapperGetObject& resp) {
if (ec || resp.empty())
{
BMCWEB_LOG_ERROR
@@ -1310,9 +1307,7 @@ inline void requestAccountServiceRoutes(App& app)
crow::connections::systemBus->async_method_call(
[asyncResp](
const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string, dbus::utility::DbusVariantType>>&
- propertiesList) {
+ const dbus::utility::DBusPropertiesMap& propertiesList) {
if (ec)
{
messages::internalError(asyncResp->res);
diff --git a/redfish-core/lib/cable.hpp b/redfish-core/lib/cable.hpp
index 05da5f61ae..241baf4a1f 100644
--- a/redfish-core/lib/cable.hpp
+++ b/redfish-core/lib/cable.hpp
@@ -1,5 +1,5 @@
#pragma once
-#include <boost/container/flat_map.hpp>
+#include <dbus_utility.hpp>
#include <utils/json_utils.hpp>
namespace redfish
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 6d17a6173b..4882ec30f8 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -452,11 +452,9 @@ inline void requestRoutesCertificateActionGenerateCSR(App& app)
messages::internalError(asyncResp->res);
return;
}
- std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string,
- dbus::utility::DbusVariantType>>>>
- interfacesProperties;
+
+ dbus::utility::DBusInteracesMap interfacesProperties;
+
sdbusplus::message::object_path csrObjectPath;
m.read(csrObjectPath, interfacesProperties);
BMCWEB_LOG_DEBUG << "CSR object added" << csrObjectPath.str;
@@ -572,13 +570,12 @@ static void getCertificateProperties(
const std::string& objectPath, const std::string& service, long certId,
const std::string& certURL, const std::string& name)
{
- using PropertiesMap =
- boost::container::flat_map<std::string, dbus::utility::DbusVariantType>;
BMCWEB_LOG_DEBUG << "getCertificateProperties Path=" << objectPath
<< " certId=" << certId << " certURl=" << certURL;
crow::connections::systemBus->async_method_call(
- [asyncResp, certURL, certId, name](const boost::system::error_code ec,
- const PropertiesMap& properties) {
+ [asyncResp, certURL, certId,
+ name](const boost::system::error_code ec,
+ const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -666,9 +663,6 @@ static void getCertificateProperties(
certs::certPropIntf);
}
-using GetObjectType =
- std::vector<std::pair<std::string, std::vector<std::string>>>;
-
/**
* Action to replace an existing certificate
*/
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 597e5d0261..45348dbca3 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -19,7 +19,6 @@
#include "led.hpp"
#include <app.hpp>
-#include <boost/container/flat_map.hpp>
#include <dbus_utility.hpp>
#include <registries/privilege_registry.hpp>
#include <sdbusplus/asio/property.hpp>
@@ -75,19 +74,6 @@ inline void getChassisState(std::shared_ptr<bmcweb::AsyncResp> aResp)
});
}
-/**
- * DBus types primitives for several generic DBus interfaces
- * TODO(Pawel) consider move this to separate file into boost::dbus
- */
-using ManagedObjectsType = std::vector<std::pair<
- sdbusplus::message::object_path,
- std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>>>>>;
-
-using PropertiesType =
- boost::container::flat_map<std::string, dbus::utility::DbusVariantType>;
-
inline void getIntrusionByService(std::shared_ptr<bmcweb::AsyncResp> aResp,
const std::string& service,
const std::string& objPath)
@@ -120,10 +106,7 @@ inline void getPhysicalSecurityData(std::shared_ptr<bmcweb::AsyncResp> aResp)
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)}](
const boost::system::error_code ec,
- const std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>&
- subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
// do not add err msg in redfish response, because this is not
@@ -234,7 +217,7 @@ inline void requestRoutesChassis(App& app)
crow::connections::systemBus->async_method_call(
[asyncResp, chassisId(std::string(chassisId))](
const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
messages::internalError(asyncResp->res);
@@ -346,9 +329,7 @@ inline void requestRoutesChassis(App& app)
crow::connections::systemBus->async_method_call(
[asyncResp, chassisId(std::string(chassisId))](
const boost::system::error_code /*ec2*/,
- const std::vector<
- std::pair<std::string,
- dbus::utility::DbusVariantType>>&
+ const dbus::utility::DBusPropertiesMap&
propertiesList) {
for (const std::pair<
std::string,
@@ -496,7 +477,7 @@ inline void requestRoutesChassis(App& app)
crow::connections::systemBus->async_method_call(
[asyncResp, chassisId, locationIndicatorActive, indicatorLed](
const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
messages::internalError(asyncResp->res);
@@ -595,8 +576,9 @@ inline void
// Use mapper to get subtree paths.
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec,
- const std::vector<std::string>& chassisList) {
+ [asyncResp](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreePathsResponse& chassisList) {
if (ec)
{
BMCWEB_LOG_DEBUG << "[mapper] Bad D-Bus request error: " << ec;
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 227b4e9d9f..85fa633330 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -16,7 +16,6 @@
#pragma once
#include <app.hpp>
-#include <boost/container/flat_map.hpp>
#include <boost/container/flat_set.hpp>
#include <dbus_singleton.hpp>
#include <dbus_utility.hpp>
@@ -30,13 +29,6 @@
namespace redfish
{
-/**
- * DBus types primitives for several generic DBus interfaces
- * TODO(Pawel) consider move this to separate file into boost::dbus
- */
-using PropertiesMapType =
- boost::container::flat_map<std::string, dbus::utility::DbusVariantType>;
-
enum class LinkType
{
Local,
@@ -1713,7 +1705,7 @@ inline void parseInterfaceData(
crow::connections::systemBus->async_method_call(
[health](const boost::system::error_code ec,
- const std::vector<std::string>& resp) {
+ const dbus::utility::MapperGetSubTreePathsResponse& resp) {
if (ec)
{
return;
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index c2e40c7a87..31adf7b431 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -189,7 +189,7 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
std::shared_ptr<HealthPopulate> self = shared_from_this();
crow::connections::systemBus->async_method_call(
[self](const boost::system::error_code ec,
- const std::vector<std::string>& resp) {
+ const dbus::utility::MapperGetSubTreePathsResponse& resp) {
if (ec || resp.size() != 1)
{
// no global item, or too many
diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp
index ba092c7029..ed83ff6ff9 100644
--- a/redfish-core/lib/hypervisor_system.hpp
+++ b/redfish-core/lib/hypervisor_system.hpp
@@ -1,7 +1,6 @@
#pragma once
#include <app.hpp>
-#include <boost/container/flat_map.hpp>
#include <boost/container/flat_set.hpp>
#include <dbus_singleton.hpp>
#include <dbus_utility.hpp>
@@ -782,7 +781,8 @@ inline void requestRoutesHypervisorSystems(App& app)
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code error,
- const std::vector<std::string>& ifaceList) {
+ const dbus::utility::MapperGetSubTreePathsResponse&
+ ifaceList) {
if (error)
{
messages::resourceNotFound(asyncResp->res, "System",
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 08765f26f3..e474f0ac44 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -103,9 +103,6 @@ static const Message* getMessage(const std::string_view& messageID)
namespace fs = std::filesystem;
-using GetManagedPropertyType =
- boost::container::flat_map<std::string, dbus::utility::DbusVariantType>;
-
inline std::string translateSeverityDbusToRedfish(const std::string& s)
{
if ((s == "xyz.openbmc_project.Logging.Entry.Level.Alert") ||
@@ -733,10 +730,8 @@ inline void
taskData->state = "Cancelled";
return task::completed;
}
- std::vector<std::pair<
- std::string, std::vector<std::pair<
- std::string, dbus::utility::DbusVariantType>>>>
- interfacesList;
+
+ dbus::utility::DBusInteracesMap interfacesList;
sdbusplus::message::object_path objPath;
@@ -865,8 +860,9 @@ inline void clearDump(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
std::string(boost::algorithm::to_lower_copy(dumpType));
crow::connections::systemBus->async_method_call(
- [asyncResp, dumpType](const boost::system::error_code ec,
- const std::vector<std::string>& subTreePaths) {
+ [asyncResp, dumpType](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreePathsResponse& subTreePaths) {
if (ec)
{
BMCWEB_LOG_ERROR << "resp_handler got error " << ec;
@@ -893,10 +889,10 @@ inline void clearDump(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
dumpType});
}
-inline static void parseCrashdumpParameters(
- const std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>&
- params,
- std::string& filename, std::string& timestamp, std::string& logfile)
+inline static void
+ parseCrashdumpParameters(const dbus::utility::DBusPropertiesMap& params,
+ std::string& filename, std::string& timestamp,
+ std::string& logfile)
{
for (auto property : params)
{
@@ -980,8 +976,10 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
logServiceArray.size();
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec,
- const std::vector<std::string>& subtreePath) {
+ [asyncResp](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreePathsResponse&
+ subtreePath) {
if (ec)
{
BMCWEB_LOG_ERROR << ec;
@@ -1513,8 +1511,9 @@ inline void requestRoutesDBusEventLogEntry(App& app)
// DBus implementation of EventLog/Entries
// Make call to Logging Service to find all log entry objects
crow::connections::systemBus->async_method_call(
- [asyncResp, entryID](const boost::system::error_code ec,
- const GetManagedPropertyType& resp) {
+ [asyncResp,
+ entryID](const boost::system::error_code ec,
+ const dbus::utility::DBusPropertiesMap& resp) {
if (ec.value() == EBADR)
{
messages::resourceNotFound(
@@ -2614,11 +2613,9 @@ static void
const std::string& logID, nlohmann::json& logEntryJson)
{
auto getStoredLogCallback =
- [asyncResp, logID, &logEntryJson](
- const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string, dbus::utility::DbusVariantType>>&
- params) {
+ [asyncResp, logID,
+ &logEntryJson](const boost::system::error_code ec,
+ const dbus::utility::DBusPropertiesMap& params) {
if (ec)
{
BMCWEB_LOG_DEBUG << "failed to get log ec: " << ec.message();
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index b0e2507270..96b0d5d205 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -748,9 +748,8 @@ inline CreatePIDRet createPidInterface(
const std::shared_ptr<bmcweb::AsyncResp>& response, const std::string& type,
const nlohmann::json::iterator& it, const std::string& path,
const dbus::utility::ManagedObjectType& managedObj, bool createNewObject,
- boost::container::flat_map<std::string, dbus::utility::DbusVariantType>&
- output,
- std::string& chassis, const std::string& profile)
+ dbus::utility::DBusPropertiesMap& output, std::string& chassis,
+ const std::string& profile)
{
// common deleter
@@ -814,7 +813,7 @@ inline CreatePIDRet createPidInterface(
{
if (managedItem == nullptr)
{
- output["Profiles"] = std::vector<std::string>{profile};
+ output.emplace_back("Profiles", std::vector<std::string>{profile});
}
else
{
@@ -854,7 +853,7 @@ inline CreatePIDRet createPidInterface(
std::vector<std::string> newProfiles =
*curProfiles;
newProfiles.push_back(profile);
- output["Profiles"] = newProfiles;
+ output.emplace_back("Profiles", newProfiles);
}
}
}
@@ -875,9 +874,9 @@ inline CreatePIDRet createPidInterface(
{
if (createNewObject)
{
- output["Class"] = type == "PidControllers" ? std::string("temp")
- : std::string("fan");
- output["Type"] = std::string("Pid");
+ output.emplace_back("Class",
+ type == "PidControllers" ? "temp" : "fan");
+ output.emplace_back("Type", "Pid");
}
std::optional<std::vector<nlohmann::json>> zones;
@@ -922,8 +921,7 @@ inline CreatePIDRet createPidInterface(
"redfish", "v1", "Chassis", chassis));
return CreatePIDRet::fail;
}
-
- output["Zones"] = std::move(zonesStr);
+ output.emplace_back("Zones", std::move(zonesStr));
}
if (inputs || outputs)
{
@@ -953,7 +951,7 @@ inline CreatePIDRet createPidInterface(
{
key = "Outputs";
}
- output[key] = *container;
+ output.emplace_back(key, *container);
index++;
}
}
@@ -963,19 +961,19 @@ inline CreatePIDRet createPidInterface(
// translate between redfish and dbus names
if (*setpointOffset == "UpperThresholdNonCritical")
{
- output["SetPointOffset"] = std::string("WarningLow");
+ output.emplace_back("SetPointOffset", "WarningLow");
}
else if (*setpointOffset == "LowerThresholdNonCritical")
{
- output["SetPointOffset"] = std::string("WarningHigh");
+ output.emplace_back("SetPointOffset", "WarningHigh");
}
else if (*setpointOffset == "LowerThresholdCritical")
{
- output["SetPointOffset"] = std::string("CriticalLow");
+ output.emplace_back("SetPointOffset", "CriticalLow");
}
else if (*setpointOffset == "UpperThresholdCritical")
{
- output["SetPointOffset"] = std::string("CriticalHigh");
+ output.emplace_back("SetPointOffset", "CriticalHigh");
}
else
{
@@ -995,13 +993,13 @@ inline CreatePIDRet createPidInterface(
continue;
}
BMCWEB_LOG_DEBUG << pairs.first << " = " << *pairs.second;
- output[pairs.first] = *(pairs.second);
+ output.emplace_back(pairs.first, *pairs.second);
}
}
else if (type == "FanZones")
{
- output["Type"] = std::string("Pid.Zone");
+ output.emplace_back("Type", "Pid.Zone");
std::optional<nlohmann::json> chassisContainer;
std::optional<double> failSafePercent;
@@ -1045,16 +1043,16 @@ inline CreatePIDRet createPidInterface(
}
if (minThermalOutput)
{
- output["MinThermalOutput"] = *minThermalOutput;
+ output.emplace_back("MinThermalOutput", *minThermalOutput);
}
if (failSafePercent)
{
- output["FailSafePercent"] = *failSafePercent;
+ output.emplace_back("FailSafePercent", *failSafePercent);
}
}
else if (type == "StepwiseControllers")
{
- output["Type"] = std::string("Stepwise");
+ output.emplace_back("Type", "Stepwise");
std::optional<std::vector<nlohmann::json>> zones;
std::optional<std::vector<nlohmann::json>> steps;
@@ -1092,7 +1090,7 @@ inline CreatePIDRet createPidInterface(
"redfish", "v1", "Chassis", chassis));
return CreatePIDRet::fail;
}
- output["Zones"] = std::move(zonesStrs);
+ output.emplace_back("Zones", std::move(zonesStrs));
}
if (steps)
{
@@ -1116,8 +1114,8 @@ inline CreatePIDRet createPidInterface(
readings.emplace_back(target);
outputs.emplace_back(out);
}
- output["Reading"] = std::move(readings);
- output["Output"] = std::move(outputs);
+ output.emplace_back("Reading", std::move(readings));
+ output.emplace_back("Output", std::move(outputs));
}
if (inputs)
{
@@ -1125,15 +1123,15 @@ inline CreatePIDRet createPidInterface(
{
boost::replace_all(value, "_", " ");
}
- output["Inputs"] = std::move(*inputs);
+ output.emplace_back("Inputs", std::move(*inputs));
}
if (negativeHysteresis)
{
- output["NegativeHysteresis"] = *negativeHysteresis;
+ output.emplace_back("NegativeHysteresis", *negativeHysteresis);
}
if (positiveHysteresis)
{
- output["PositiveHysteresis"] = *positiveHysteresis;
+ output.emplace_back("PositiveHysteresis", *positiveHysteresis);
}
if (direction)
{
@@ -1146,7 +1144,7 @@ inline CreatePIDRet createPidInterface(
*direction);
return CreatePIDRet::fail;
}
- output["Class"] = *direction;
+ output.emplace_back("Class", *direction);
}
}
else
@@ -1171,8 +1169,9 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
// get all configurations
crow::connections::systemBus->async_method_call(
- [self](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtreeLocal) {
+ [self](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtreeLocal) {
if (ec)
{
BMCWEB_LOG_ERROR << ec;
@@ -1190,8 +1189,9 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
// at the same time get the selected profile
crow::connections::systemBus->async_method_call(
- [self](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtreeLocal) {
+ [self](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtreeLocal) {
if (ec || subtreeLocal.empty())
{
return;
@@ -1209,9 +1209,7 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
crow::connections::systemBus->async_method_call(
[path, owner,
self](const boost::system::error_code ec2,
- const boost::container::flat_map<
- std::string, dbus::utility::DbusVariantType>&
- resp) {
+ const dbus::utility::DBusPropertiesMap& resp) {
if (ec2)
{
BMCWEB_LOG_ERROR
@@ -1332,7 +1330,7 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
std::vector<std::string> supportedProfiles;
std::string currentProfile;
- crow::openbmc_mapper::GetSubTreeType subtree;
+ dbus::utility::MapperGetSubTreeResponse subtree;
std::shared_ptr<bmcweb::AsyncResp> asyncResp;
};
@@ -1417,7 +1415,7 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
// at the same time get the profile information
crow::connections::systemBus->async_method_call(
[self](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec || subtree.empty())
{
return;
@@ -1433,10 +1431,9 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
const std::string& path = subtree[0].first;
const std::string& owner = subtree[0].second[0].first;
crow::connections::systemBus->async_method_call(
- [self, path, owner](
- const boost::system::error_code ec2,
- const boost::container::flat_map<
- std::string, dbus::utility::DbusVariantType>& r) {
+ [self, path,
+ owner](const boost::system::error_code ec2,
+ const dbus::utility::DBusPropertiesMap& r) {
if (ec2)
{
BMCWEB_LOG_ERROR
@@ -1552,9 +1549,7 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
return boost::algorithm::ends_with(
obj.first.str, "/" + name);
});
- boost::container::flat_map<std::string,
- dbus::utility::DbusVariantType>
- output;
+ dbus::utility::DBusPropertiesMap output;
output.reserve(16); // The pid interface length
@@ -1620,8 +1615,8 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
messages::resourceExhaustion(response->res, type);
continue;
}
-
- output["Name"] = boost::replace_all_copy(name, "_", " ");
+ output.emplace_back("Name",
+ boost::replace_all_copy(name, "_", " "));
std::string chassis;
CreatePIDRet ret = createPidInterface(
@@ -2099,11 +2094,7 @@ inline void requestRoutesManager(App& app)
crow::connections::systemBus->async_method_call(
[asyncResp](
const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string,
- std::vector<std::pair<
- std::string, std::vector<std::string>>>>>&
- subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -2146,9 +2137,7 @@ inline void requestRoutesManager(App& app)
crow::connections::systemBus->async_method_call(
[asyncResp](
const boost::system::error_code ec,
- const std::vector<std::pair<
- std::string,
- dbus::utility::DbusVariantType>>&
+ const dbus::utility::DBusPropertiesMap&
propertiesList) {
if (ec)
{
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 73d739a164..d3bbc072a7 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -18,7 +18,6 @@
#include "health.hpp"
#include <app.hpp>
-#include <boost/container/flat_map.hpp>
#include <dbus_utility.hpp>
#include <registries/privilege_registry.hpp>
#include <utils/collection.hpp>
@@ -28,9 +27,6 @@
namespace redfish
{
-using DimmProperties =
- boost::container::flat_map<std::string, dbus::utility::DbusVariantType>;
-
inline std::string translateMemoryTypeToRedfish(const std::string& memoryType)
{
if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR")
@@ -440,31 +436,17 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp,
BMCWEB_LOG_DEBUG << "Get available system components.";
crow::connections::systemBus->async_method_call(
- [dimmId, aResp{std::move(aResp)}](const boost::system::error_code ec,
- const DimmProperties& properties) {
+ [dimmId, aResp{std::move(aResp)}](
+ const boost::system::error_code ec,
+ const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
messages::internalError(aResp->res);
-
return;
}
aResp->res.jsonValue["Id"] = dimmId;
aResp->res.jsonValue["Name"] = "DIMM Slot";
-
- const auto memorySizeProperty = properties.find("MemorySizeInKB");
- if (memorySizeProperty != properties.end())
- {
- const uint32_t* memorySize =
- std::get_if<uint32_t>(&memorySizeProperty->second);
- if (memorySize == nullptr)
- {
- // Important property not in desired type
- messages::internalError(aResp->res);
- return;
- }
- aResp->res.jsonValue["CapacityMiB"] = (*memorySize >> 10);
- }
aResp->res.jsonValue["Status"]["State"] = "Enabled";
aResp->res.jsonValue["Status"]["Health"] = "OK";
@@ -480,6 +462,18 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp,
}
aResp->res.jsonValue["DataWidthBits"] = *value;
}
+ else if (property.first == "MemorySizeInKB")
+ {
+ const uint32_t* memorySize =
+ std::get_if<uint32_t>(&property.second);
+ if (memorySize == nullptr)
+ {
+ // Important property not in desired type
+ messages::internalError(aResp->res);
+ return;
+ }
+ aResp->res.jsonValue["CapacityMiB"] = (*memorySize >> 10);
+ }
else if (property.first == "PartNumber")
{
const std::string* value =
@@ -731,8 +725,7 @@ inline void getDimmPartitionData(std::shared_ptr<bmcweb::AsyncResp> aResp,
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)}](
const boost::system::error_code ec,
- const boost::container::flat_map<
- std::string, dbus::utility::DbusVariantType>& properties) {
+ const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -814,10 +807,7 @@ inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> aResp,
crow::connections::systemBus->async_method_call(
[dimmId, aResp{std::move(aResp)}](
const boost::system::error_code ec,
- const boost::container::flat_map<
- std::string, boost::container::flat_map<
- std::string, std::vector<std::string>>>&
- subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -832,26 +822,26 @@ inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> aResp,
{
for (const auto& [service, interfaces] : object)
{
- if (!found &&
- (std::find(
- interfaces.begin(), interfaces.end(),
- "xyz.openbmc_project.Inventory.Item.Dimm") !=
- interfaces.end()))
- {
- getDimmDataByService(aResp, dimmId, service, path);
- found = true;
- }
-
- // partitions are separate as there can be multiple per
- // device, i.e.
- // /xyz/openbmc_project/Inventory/Item/Dimm1/Partition1
- // /xyz/openbmc_project/Inventory/Item/Dimm1/Partition2
- if (std::find(
- interfaces.begin(), interfaces.end(),
- "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition") !=
- interfaces.end())
+ for (const auto& interface : interfaces)
{
- getDimmPartitionData(aResp, service, path);
+ if (interface ==
+ "xyz.openbmc_project.Inventory.Item.Dimm")
+ {
+ getDimmDataByService(aResp, dimmId, service,
+ path);
+ found = true;
+ }
+
+ // partitions are separate as there can be multiple
+ // per
+ // device, i.e.
+ // /xyz/openbmc_project/Inventory/Item/Dimm1/Partition1
+ // /xyz/openbmc_project/Inventory/Item/Dimm1/Partition2
+ if (interface ==
+ "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition")
+ {
+ getDimmPartitionData(aResp, service, path);
+ }
}
}
}
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index ab7c88ba4d..a27ec6beda 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -22,10 +22,10 @@ using ReadingParameters =
std::vector<std::tuple<sdbusplus::message::object_path, std::string,
std::string, std::string>>;
-inline void fillReportDefinition(
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& id,
- const std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>&
- ret)
+inline void
+ fillReportDefinition(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& id,
+ const dbus::utility::DBusPropertiesMap& ret)
{
asyncResp->res.jsonValue["@odata.type"] =
"#MetricReportDefinition.v1_3_0.MetricReportDefinition";
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index e221d96d4a..aac7f668a6 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -253,7 +253,7 @@ inline void
crow::connections::systemBus->async_method_call(
[asyncResp,
ntpServers](boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", "
@@ -306,7 +306,7 @@ inline void
crow::connections::systemBus->async_method_call(
[protocolEnabled, asyncResp,
netBasePath](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
messages::internalError(asyncResp->res);
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index 3c083aea49..ca1eb8f9fd 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -33,37 +33,39 @@ static inline void
getPCIeDeviceList(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
const std::string& name)
{
- auto getPCIeMapCallback = [asyncResp, name](
- const boost::system::error_code ec,
- std::vector<std::string>& pcieDevicePaths) {
- if (ec)
- {
- BMCWEB_LOG_DEBUG << "no PCIe device paths found ec: "
- << ec.message();
- // Not an error, system just doesn't have PCIe info
- return;
- }
- nlohmann::json& pcieDeviceList = asyncResp->res.jsonValue[name];
- pcieDeviceList = nlohmann::json::array();
- for (const std::string& pcieDevicePath : pcieDevicePaths)
- {
- size_t devStart = pcieDevicePath.rfind('/');
- if (devStart == std::string::npos)
+ auto getPCIeMapCallback =
+ [asyncResp, name](const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreePathsResponse&
+ pcieDevicePaths) {
+ if (ec)
{
- continue;
+ BMCWEB_LOG_DEBUG << "no PCIe device paths found ec: "
+ << ec.message();
+ // Not an error, system just doesn't have PCIe info
+ return;
}
-
- std::string devName = pcieDevicePath.substr(devStart + 1);
- if (devName.empty())
+ nlohmann::json& pcieDeviceList = asyncResp->res.jsonValue[name];
+ pcieDeviceList = nlohmann::json::array();
+ for (const std::string& pcieDevicePath : pcieDevicePaths)
{
- continue;
+ size_t devStart = pcieDevicePath.rfind('/');
+ if (devStart == std::string::npos)
+ {
+ continue;
+ }
+
+ std::string devName = pcieDevicePath.substr(devStart + 1);
+ if (devName.empty())
+ {
+ continue;
+ }
+ pcieDeviceList.push_back(
+ {{"@odata.id",
+ "/redfish/v1/Systems/system/PCIeDevices/" + devName}});
}
- pcieDeviceList.push_back(
- {{"@odata.id",
- "/redfish/v1/Systems/system/PCIeDevices/" + devName}});
- }
- asyncResp->res.jsonValue[name + "@odata.count"] = pcieDeviceList.size();
- };
+ asyncResp->res.jsonValue[name + "@odata.count"] =
+ pcieDeviceList.size();
+ };
crow::connections::systemBus->async_method_call(
std::move(getPCIeMapCallback), "xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
@@ -145,11 +147,9 @@ inline void requestRoutesSystemPCIeDevice(App& app)
{
auto getPCIeDeviceCallback =
- [asyncResp,
- device](const boost::system::error_code ec,
- boost::container::flat_map<
- std::string, dbus::utility::DbusVariantType>&
- pcieDevProperties) {
+ [asyncResp, device](const boost::system::error_code ec,
+ const dbus::utility::DBusPropertiesMap&
+ pcieDevProperties) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -175,61 +175,69 @@ inline void requestRoutesSystemPCIeDevice(App& app)
device},
{"Name", "PCIe Device"},
{"Id", device}};
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Manufacturer"]);
- property)
- {
- asyncResp->res.jsonValue["Manufacturer"] =
- *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["DeviceType"]);
- property)
- {
- asyncResp->res.jsonValue["DeviceType"] = *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Manufacturer"]);
- property)
- {
- asyncResp->res.jsonValue["Manufacturer"] =
- *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["DeviceType"]);
- property)
- {
- asyncResp->res.jsonValue["DeviceType"] = *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["GenerationInUse"]);
- property)
+ asyncResp->res.jsonValue["PCIeFunctions"] = {
+ {"@odata.id",
+ "/redfish/v1/Systems/system/PCIeDevices/" +
+ device + "/PCIeFunctions"}};
+ for (const auto& property : pcieDevProperties)
{
- std::optional<std::string> generationInUse =
- redfishPcieGenerationFromDbus(*property);
- if (!generationInUse)
+ const std::string* propertyString =
+ std::get_if<std::string>(&property.second);
+ if (property.first == "Manufacturer")
{
- messages::internalError(asyncResp->res);
- return;
+ if (propertyString == nullptr)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ asyncResp->res.jsonValue["Manufacturer"] =
+ *propertyString;
}
- if (generationInUse->empty())
+ if (property.first == "DeviceType")
{
- // unknown, no need to handle
- return;
+ if (propertyString == nullptr)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ asyncResp->res.jsonValue["DeviceType"] =
+ *propertyString;
+ }
+ if (property.first == "DeviceType")
+ {
+ if (propertyString == nullptr)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ asyncResp->res.jsonValue["DeviceType"] =
+ *propertyString;
+ }
+ if (property.first == "GenerationInUse")
+ {
+ if (propertyString == nullptr)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ std::optional<std::string> generationInUse =
+ redfishPcieGenerationFromDbus(
+ *propertyString);
+ if (!generationInUse)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ if (generationInUse->empty())
+ {
+ // unknown, no need to handle
+ return;
+ }
+ asyncResp->res
+ .jsonValue["PCIeInterface"]["PCIeType"] =
+ *generationInUse;
}
- asyncResp->res
- .jsonValue["PCIeInterface"]["PCIeType"] =
- *generationInUse;
}
- asyncResp->res.jsonValue["PCIeFunctions"] = {
- {"@odata.id",
- "/redfish/v1/Systems/system/PCIeDevices/" +
- device + "/PCIeFunctions"}};
};
std::string escapedPath = std::string(pciePath) + "/" + device;
dbus::utility::escapePathForDbus(escapedPath);
@@ -263,58 +271,62 @@ inline void requestRoutesSystemPCIeFunctionCollection(App& app)
{"Description",
"Collection of PCIe Functions for PCIe Device " + device}};
- auto getPCIeDeviceCallback = [asyncResp, device](
- const boost::system::error_code
- ec,
- boost::container::flat_map<
- std::string,
- dbus::utility::
- DbusVariantType>&
- pcieDevProperties) {
- if (ec)
- {
- BMCWEB_LOG_DEBUG
- << "failed to get PCIe Device properties ec: "
- << ec.value() << ": " << ec.message();
- if (ec.value() ==
- boost::system::linux_error::bad_request_descriptor)
- {
- messages::resourceNotFound(asyncResp->res,
- "PCIeDevice", device);
- }
- else
+ auto getPCIeDeviceCallback =
+ [asyncResp, device](const boost::system::error_code ec,
+ const dbus::utility::DBusPropertiesMap&
+ pcieDevProperties) {
+ if (ec)
{
- messages::internalError(asyncResp->res);
+ BMCWEB_LOG_DEBUG
+ << "failed to get PCIe Device properties ec: "
+ << ec.value() << ": " << ec.message();
+ if (ec.value() == boost::system::linux_error::
+ bad_request_descriptor)
+ {
+ messages::resourceNotFound(
+ asyncResp->res, "PCIeDevice", device);
+ }
+ else
+ {
+ messages::internalError(asyncResp->res);
+ }
+ return;
}
- return;
- }
- nlohmann::json& pcieFunctionList =
- asyncResp->res.jsonValue["Members"];
- pcieFunctionList = nlohmann::json::array();
- static constexpr const int maxPciFunctionNum = 8;
- for (int functionNum = 0; functionNum < maxPciFunctionNum;
- functionNum++)
- {
- // Check if this function exists by looking for a device
- // ID
- std::string devIDProperty =
- "Function" + std::to_string(functionNum) +
- "DeviceId";
- std::string* property = std::get_if<std::string>(
- &pcieDevProperties[devIDProperty]);
- if (property != nullptr && !property->empty())
+ nlohmann::json& pcieFunctionList =
+ asyncResp->res.jsonValue["Members"];
+ pcieFunctionList = nlohmann::json::array();
+ static constexpr const int maxPciFunctionNum = 8;
+ for (int functionNum = 0;
+ functionNum < maxPciFunctionNum; functionNum++)
{
+ // Check if this function exists by looking for a
+ // device ID
+ std::string devIDProperty =
+ "Function" + std::to_string(functionNum) +
+ "DeviceId";
+ const std::string* property = nullptr;
+ for (const auto& propEntry : pcieDevProperties)
+ {
+ if (propEntry.first == devIDProperty)
+ {
+ property = std::get_if<std::string>(
+ &propEntry.second);
+ }
+ }
+ if (property == nullptr || !property->empty())
+ {
+ return;
+ }
pcieFunctionList.push_back(
{{"@odata.id",
"/redfish/v1/Systems/system/PCIeDevices/" +
device + "/PCIeFunctions/" +
std::to_string(functionNum)}});
}
- }
- asyncResp->res.jsonValue["Members@odata.count"] =
- pcieFunctionList.size();
- };
+ asyncResp->res.jsonValue["Members@odata.count"] =
+ pcieFunctionList.size();
+ };
std::string escapedPath = std::string(pciePath) + "/" + device;
dbus::utility::escapePathForDbus(escapedPath);
crow::connections::systemBus->async_method_call(
@@ -339,9 +351,7 @@ inline void requestRoutesSystemPCIeFunction(App& app)
auto getPCIeDeviceCallback =
[asyncResp, device, function](
const boost::system::error_code ec,
- boost::container::flat_map<std::string,
- dbus::utility::DbusVariantType>&
- pcieDevProperties) {
+ const dbus::utility::DBusPropertiesMap& pcieDevProperties) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -361,11 +371,20 @@ inline void requestRoutesSystemPCIeFunction(App& app)
}
// Check if this function exists by looking for a device ID
- std::string devIDProperty =
- "Function" + function + "DeviceId";
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties[devIDProperty]);
- property != nullptr && property->empty())
+ std::string functionName = "Function" + function;
+ std::string devIDProperty = functionName + "DeviceId";
+
+ const std::string* devIdProperty = nullptr;
+ for (const auto& property : pcieDevProperties)
+ {
+ if (property.first == devIDProperty)
+ {
+ devIdProperty =
+ std::get_if<std::string>(&property.second);
+ continue;
+ }
+ }
+ if (devIdProperty == nullptr || !devIdProperty->empty())
{
messages::resourceNotFound(asyncResp->res,
"PCIeFunction", function);
@@ -386,69 +405,49 @@ inline void requestRoutesSystemPCIeFunction(App& app)
"/redfish/v1/Systems/system/PCIeDevices/" +
device}}}}}};
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "DeviceId"]);
- property)
- {
- asyncResp->res.jsonValue["DeviceId"] = *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "VendorId"]);
- property)
+ for (const auto& property : pcieDevProperties)
{
- asyncResp->res.jsonValue["VendorId"] = *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "FunctionType"]);
- property)
- {
- asyncResp->res.jsonValue["FunctionType"] = *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "DeviceClass"]);
- property)
- {
- asyncResp->res.jsonValue["DeviceClass"] = *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "ClassCode"]);
- property)
- {
- asyncResp->res.jsonValue["ClassCode"] = *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "RevisionId"]);
- property)
- {
- asyncResp->res.jsonValue["RevisionId"] = *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "SubsystemId"]);
- property)
- {
- asyncResp->res.jsonValue["SubsystemId"] = *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "SubsystemVendorId"]);
- property)
- {
- asyncResp->res.jsonValue["SubsystemVendorId"] =
- *property;
+ const std::string* strProperty =
+ std::get_if<std::string>(&property.second);
+ if (property.first == functionName + "DeviceId")
+ {
+ asyncResp->res.jsonValue["DeviceId"] = *strProperty;
+ }
+ if (property.first == functionName + "VendorId")
+ {
+ asyncResp->res.jsonValue["VendorId"] = *strProperty;
+ }
+ if (property.first == functionName + "FunctionType")
+ {
+ asyncResp->res.jsonValue["FunctionType"] =
+ *strProperty;
+ }
+ if (property.first == functionName + "DeviceClass")
+ {
+ asyncResp->res.jsonValue["DeviceClass"] =
+ *strProperty;
+ }
+ if (property.first == functionName + "ClassCode")
+ {
+ asyncResp->res.jsonValue["ClassCode"] =
+ *strProperty;
+ }
+ if (property.first == functionName + "RevisionId")
+ {
+ asyncResp->res.jsonValue["RevisionId"] =
+ *strProperty;
+ }
+ if (property.first == functionName + "SubsystemId")
+ {
+ asyncResp->res.jsonValue["SubsystemId"] =
+ *strProperty;
+ }
+ if (property.first ==
+ functionName + "SubsystemVendorId")
+ {
+ asyncResp->res.jsonValue["SubsystemVendorId"] =
+ *strProperty;
+ }
}
};
std::string escapedPath = std::string(pciePath) + "/" + device;
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index eaf7e6cbef..dd67aea06f 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -136,10 +136,11 @@ inline void requestRoutesPower(App& app)
// for the chassis that implements the Chassis inventory item.
// This prevents things like power supplies providing the
// chassis power limit
+
+ using Mapper = dbus::utility::MapperGetSubTreePathsResponse;
auto chassisHandler = [sensorAsyncResp](
const boost::system::error_code e,
- const std::vector<std::string>&
- chassisPaths) {
+ const Mapper& chassisPaths) {
if (e)
{
BMCWEB_LOG_ERROR
@@ -189,9 +190,7 @@ inline void requestRoutesPower(App& app)
auto valueHandler =
[sensorAsyncResp](
const boost::system::error_code ec,
- const std::vector<std::pair<
- std::string, dbus::utility::DbusVariantType>>&
- properties) {
+ const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
messages::internalError(
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index b74b05ce2c..f304eb86c0 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -32,10 +32,6 @@
namespace redfish
{
-using InterfacesProperties = boost::container::flat_map<
- std::string,
- boost::container::flat_map<std::string, dbus::utility::DbusVariantType>>;
-
// Interfaces which imply a D-Bus object represents a Processor
constexpr std::array<const char*, 2> processorInterfaces = {
"xyz.openbmc_project.Inventory.Item.Cpu",
@@ -1072,8 +1068,10 @@ inline void requestRoutesOperatingConfigCollection(App& app)
// First find the matching CPU object so we know how to
// constrain our search for related Config objects.
crow::connections::systemBus->async_method_call(
- [asyncResp, cpuName](const boost::system::error_code ec,
- const std::vector<std::string>& objects) {
+ [asyncResp,
+ cpuName](const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreePathsResponse&
+ objects) {
if (ec)
{
BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", "
diff --git a/redfish-core/lib/redfish_util.hpp b/redfish-core/lib/redfish_util.hpp
index a42d00d862..7af4ab88af 100644
--- a/redfish-core/lib/redfish_util.hpp
+++ b/redfish-core/lib/redfish_util.hpp
@@ -56,7 +56,7 @@ void getMainChassisId(std::shared_ptr<bmcweb::AsyncResp> asyncResp,
crow::connections::systemBus->async_method_call(
[callback,
asyncResp](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_ERROR << ec;
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 3139635648..d501b70022 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -33,16 +33,6 @@
namespace redfish
{
-using GetSubTreeType = std::vector<
- std::pair<std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>;
-
-using ManagedObjectsVectorType = std::vector<std::pair<
- sdbusplus::message::object_path,
- boost::container::flat_map<
- std::string, boost::container::flat_map<
- std::string, dbus::utility::DbusVariantType>>>>;
-
namespace sensors
{
namespace node
@@ -329,9 +319,10 @@ void getObjectsWithConnection(
// Response handler for parsing objects subtree
auto respHandler = [callback{std::forward<Callback>(callback)},
- sensorsAsyncResp,
- sensorNames](const boost::system::error_code ec,
- const GetSubTreeType& subtree) {
+ sensorsAsyncResp, sensorNames](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse&
+ subtree) {
BMCWEB_LOG_DEBUG << "getObjectsWithConnection resp_handler enter";
if (ec)
{
@@ -467,38 +458,38 @@ void getValidChassisPath(const std::shared_ptr<SensorsAsyncResp>& asyncResp,
"xyz.openbmc_project.Inventory.Item.Board",
"xyz.openbmc_project.Inventory.Item.Chassis"};
- auto respHandler =
- [callback{std::forward<Callback>(callback)},
- asyncResp](const boost::system::error_code ec,
- const std::vector<std::string>& chassisPaths) mutable {
- BMCWEB_LOG_DEBUG << "getValidChassisPath respHandler enter";
- if (ec)
+ auto respHandler = [callback{std::forward<Callback>(callback)}, asyncResp](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreePathsResponse&
+ chassisPaths) mutable {
+ BMCWEB_LOG_DEBUG << "getValidChassisPath respHandler enter";
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR << "getValidChassisPath respHandler DBUS error: "
+ << ec;
+ messages::internalError(asyncResp->asyncResp->res);
+ return;
+ }
+
+ std::optional<std::string> chassisPath;
+ std::string chassisName;
+ for (const std::string& chassis : chassisPaths)
+ {
+ sdbusplus::message::object_path path(chassis);
+ chassisName = path.filename();
+ if (chassisName.empty())
{
- BMCWEB_LOG_ERROR
- << "getValidChassisPath respHandler DBUS error: " << ec;
- messages::internalError(asyncResp->asyncResp->res);
- return;
+ BMCWEB_LOG_ERROR << "Failed to find '/' in " << chassis;
+ continue;
}
-
- std::optional<std::string> chassisPath;
- std::string chassisName;
- for (const std::string& chassis : chassisPaths)
+ if (chassisName == asyncResp->chassisId)
{
- sdbusplus::message::object_path path(chassis);
- chassisName = path.filename();
- if (chassisName.empty())
- {
- BMCWEB_LOG_ERROR << "Failed to find '/' in " << chassis;
- continue;
- }
- if (chassisName == asyncResp->chassisId)
- {
- chassisPath = chassis;
- break;
- }
+ chassisPath = chassis;
+ break;
}
- callback(chassisPath);
- };
+ }
+ callback(chassisPath);
+ };
// Get the Chassis Collection
crow::connections::systemBus->async_method_call(
@@ -525,7 +516,8 @@ void getChassis(const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
auto respHandler = [callback{std::forward<Callback>(callback)},
sensorsAsyncResp](
const boost::system::error_code ec,
- const std::vector<std::string>& chassisPaths) {
+ const dbus::utility::MapperGetSubTreePathsResponse&
+ chassisPaths) {
BMCWEB_LOG_DEBUG << "getChassis respHandler enter";
if (ec)
{
@@ -658,8 +650,10 @@ void getObjectManagerPaths(
// Response handler for GetSubTree DBus method
auto respHandler = [callback{std::forward<Callback>(callback)},
- sensorsAsyncResp](const boost::system::error_code ec,
- const GetSubTreeType& subtree) {
+ sensorsAsyncResp](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse&
+ subtree) {
BMCWEB_LOG_DEBUG << "getObjectManagerPaths respHandler enter";
if (ec)
{
@@ -1119,8 +1113,9 @@ inline void populateFanRedundancy(
const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp)
{
crow::connections::systemBus->async_method_call(
- [sensorsAsyncResp](const boost::system::error_code ec,
- const GetSubTreeType& resp) {
+ [sensorsAsyncResp](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& resp) {
if (ec)
{
return; // don't have to have this interface
@@ -1699,9 +1694,10 @@ static void getInventoryItemsConnections(
// Response handler for parsing output from GetSubTree
auto respHandler = [callback{std::forward<Callback>(callback)},
- sensorsAsyncResp,
- inventoryItems](const boost::system::error_code ec,
- const GetSubTreeType& subtree) {
+ sensorsAsyncResp, inventoryItems](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse&
+ subtree) {
BMCWEB_LOG_DEBUG << "getInventoryItemsConnections respHandler enter";
if (ec)
{
@@ -2054,9 +2050,10 @@ void getInventoryLeds(
// Response handler for parsing output from GetSubTree
auto respHandler = [callback{std::forward<Callback>(callback)},
- sensorsAsyncResp,
- inventoryItems](const boost::system::error_code ec,
- const GetSubTreeType& subtree) {
+ sensorsAsyncResp, inventoryItems](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse&
+ subtree) {
BMCWEB_LOG_DEBUG << "getInventoryLeds respHandler enter";
if (ec)
{
@@ -2231,57 +2228,58 @@ void getPowerSupplyAttributes(
"xyz.openbmc_project.Control.PowerSupplyAttributes"};
// Response handler for parsing output from GetSubTree
- auto respHandler = [callback{std::forward<Callback>(callback)},
- sensorsAsyncResp,
- inventoryItems](const boost::system::error_code ec,
- const GetSubTreeType& subtree) {
- BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler enter";
- if (ec)
- {
- messages::internalError(sensorsAsyncResp->asyncResp->res);
- BMCWEB_LOG_ERROR
- << "getPowerSupplyAttributes respHandler DBus error " << ec;
- return;
- }
- if (subtree.empty())
- {
- BMCWEB_LOG_DEBUG << "Can't find Power Supply Attributes!";
- callback(inventoryItems);
- return;
- }
+ auto respHandler =
+ [callback{std::forward<Callback>(callback)}, sensorsAsyncResp,
+ inventoryItems](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
+ BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler enter";
+ if (ec)
+ {
+ messages::internalError(sensorsAsyncResp->asyncResp->res);
+ BMCWEB_LOG_ERROR
+ << "getPowerSupplyAttributes respHandler DBus error " << ec;
+ return;
+ }
+ if (subtree.empty())
+ {
+ BMCWEB_LOG_DEBUG << "Can't find Power Supply Attributes!";
+ callback(inventoryItems);
+ return;
+ }
- // Currently we only support 1 power supply attribute, use this for
- // all the power supplies. Build map of object path to connection.
- // Assume just 1 connection and 1 path for now.
- boost::container::flat_map<std::string, std::string>
- psAttributesConnections;
+ // Currently we only support 1 power supply attribute, use this for
+ // all the power supplies. Build map of object path to connection.
+ // Assume just 1 connection and 1 path for now.
+ boost::container::flat_map<std::string, std::string>
+ psAttributesConnections;
- if (subtree[0].first.empty() || subtree[0].second.empty())
- {
- BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
- callback(inventoryItems);
- return;
- }
+ if (subtree[0].first.empty() || subtree[0].second.empty())
+ {
+ BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
+ callback(inventoryItems);
+ return;
+ }
- const std::string& psAttributesPath = subtree[0].first;
- const std::string& connection = subtree[0].second.begin()->first;
+ const std::string& psAttributesPath = subtree[0].first;
+ const std::string& connection = subtree[0].second.begin()->first;
- if (connection.empty())
- {
- BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
- callback(inventoryItems);
- return;
- }
+ if (connection.empty())
+ {
+ BMCWEB_LOG_DEBUG << "Power Supply Attributes mapper error!";
+ callback(inventoryItems);
+ return;
+ }
- psAttributesConnections[psAttributesPath] = connection;
- BMCWEB_LOG_DEBUG << "Added mapping " << psAttributesPath << " -> "
- << connection;
+ psAttributesConnections[psAttributesPath] = connection;
+ BMCWEB_LOG_DEBUG << "Added mapping " << psAttributesPath << " -> "
+ << connection;
- getPowerSupplyAttributesData(sensorsAsyncResp, inventoryItems,
- psAttributesConnections,
- std::move(callback));
- BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler exit";
- };
+ getPowerSupplyAttributesData(sensorsAsyncResp, inventoryItems,
+ psAttributesConnections,
+ std::move(callback));
+ BMCWEB_LOG_DEBUG << "getPowerSupplyAttributes respHandler exit";
+ };
// Make call to ObjectMapper to find the PowerSupplyAttributes service
crow::connections::systemBus->async_method_call(
std::move(respHandler), "xyz.openbmc_project.ObjectMapper",
@@ -3000,8 +2998,9 @@ inline void requestRoutesSensor(App& app)
// Get a list of all of the sensors that implement Sensor.Value
// and get the path and service name associated with the sensor
crow::connections::systemBus->async_method_call(
- [asyncResp, sensorName](const boost::system::error_code ec,
- const GetSubTreeType& subtree) {
+ [asyncResp, sensorName](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
BMCWEB_LOG_DEBUG << "respHandler1 enter";
if (ec)
{
@@ -3012,25 +3011,27 @@ inline void requestRoutesSensor(App& app)
return;
}
- GetSubTreeType::const_iterator it = std::find_if(
- subtree.begin(), subtree.end(),
- [sensorName](
- const std::pair<
- std::string,
- std::vector<std::pair<
- std::string, std::vector<std::string>>>>&
- object) {
- sdbusplus::message::object_path path(object.first);
- std::string name = path.filename();
- if (name.empty())
- {
- BMCWEB_LOG_ERROR << "Invalid sensor path: "
- << object.first;
- return false;
- }
+ dbus::utility::MapperGetSubTreeResponse::const_iterator it =
+ std::find_if(
+ subtree.begin(), subtree.end(),
+ [sensorName](
+ const std::pair<std::string,
+ std::vector<std::pair<
+ std::string,
+ std::vector<std::string>>>>&
+ object) {
+ sdbusplus::message::object_path path(
+ object.first);
+ std::string name = path.filename();
+ if (name.empty())
+ {
+ BMCWEB_LOG_ERROR << "Invalid sensor path: "
+ << object.first;
+ return false;
+ }
- return name == sensorName;
- });
+ return name == sensorName;
+ });
if (it == subtree.end())
{
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index a2a2201dfa..6809958e05 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -64,7 +64,8 @@ inline void requestRoutesStorage(App& app)
crow::connections::systemBus->async_method_call(
[asyncResp,
health](const boost::system::error_code ec,
- const std::vector<std::string>& storageList) {
+ const dbus::utility::MapperGetSubTreePathsResponse&
+ storageList) {
nlohmann::json& storageArray =
asyncResp->res.jsonValue["Drives"];
storageArray = nlohmann::json::array();
@@ -110,9 +111,9 @@ inline void requestRoutesStorage(App& app)
"xyz.openbmc_project.Inventory.Item.Drive"});
crow::connections::systemBus->async_method_call(
- [asyncResp,
- health](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtree) {
+ [asyncResp, health](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec || subtree.empty())
{
// doesn't have to be there
@@ -481,9 +482,9 @@ inline void requestRoutesDrive(App& app)
bmcweb::AsyncResp>& asyncResp,
const std::string& driveId) {
crow::connections::systemBus->async_method_call(
- [asyncResp,
- driveId](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType& subtree) {
+ [asyncResp, driveId](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_ERROR << "Drive mapper call error";
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index ca85098e4a..429e99242c 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -122,11 +122,10 @@ inline void
}
}
-inline void getProcessorProperties(
- const std::shared_ptr<bmcweb::AsyncResp>& aResp, const std::string& service,
- const std::string& path,
- const std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>&
- properties)
+inline void
+ getProcessorProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
+ const std::string& service, const std::string& path,
+ const dbus::utility::DBusPropertiesMap& properties)
{
BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Cpu properties.";
@@ -215,8 +214,7 @@ inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
crow::connections::systemBus->async_method_call(
[aResp, service,
path](const boost::system::error_code ec2,
- const std::vector<std::pair<
- std::string, dbus::utility::DbusVariantType>>& properties) {
+ const dbus::utility::DBusPropertiesMap& properties) {
if (ec2)
{
BMCWEB_LOG_ERROR << "DBUS response error " << ec2;
@@ -244,12 +242,9 @@ inline void
BMCWEB_LOG_DEBUG << "Get available system components.";
crow::connections::systemBus->async_method_call(
- [aResp, systemHealth](
- const boost::system::error_code ec,
- const std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>&
- subtree) {
+ [aResp,
+ systemHealth](const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -296,9 +291,7 @@ inline void
crow::connections::systemBus->async_method_call(
[aResp, service{connection.first},
path](const boost::system::error_code ec2,
- const std::vector<std::pair<
- std::string,
- dbus::utility::DbusVariantType>>&
+ const dbus::utility::DBusPropertiesMap&
properties) {
if (ec2)
{
@@ -402,9 +395,7 @@ inline void
<< "Found UUID, now get its properties.";
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec3,
- const std::vector<std::pair<
- std::string,
- dbus::utility::DbusVariantType>>&
+ const dbus::utility::DBusPropertiesMap&
properties) {
if (ec3)
{
@@ -454,9 +445,7 @@ inline void
{
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec2,
- const std::vector<std::pair<
- std::string,
- dbus::utility::DbusVariantType>>&
+ const dbus::utility::DBusPropertiesMap&
propertiesList) {
if (ec2)
{
@@ -1237,12 +1226,8 @@ inline void getTrustedModuleRequiredToBoot(
BMCWEB_LOG_DEBUG << "Get TPM required to boot.";
crow::connections::systemBus->async_method_call(
- [aResp](
- const boost::system::error_code ec,
- std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>&
- subtree) {
+ [aResp](const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -1329,12 +1314,8 @@ inline void setTrustedModuleRequiredToBoot(
BMCWEB_LOG_DEBUG << "Set TrustedModuleRequiredToBoot.";
crow::connections::systemBus->async_method_call(
- [aResp, tpmRequired](
- const boost::system::error_code ec,
- std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>&
- subtree) {
+ [aResp, tpmRequired](const boost::system::error_code ec,
+ dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -1660,12 +1641,9 @@ inline void setAssetTag(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
const std::string& assetTag)
{
crow::connections::systemBus->async_method_call(
- [aResp, assetTag](
- const boost::system::error_code ec,
- const std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>&
- subtree) {
+ [aResp,
+ assetTag](const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "D-Bus response error on GetSubTree " << ec;
@@ -1835,9 +1813,7 @@ inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> aResp)
BMCWEB_LOG_DEBUG << "Get OEM information.";
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string, dbus::utility::DbusVariantType>>&
- propertiesList) {
+ const dbus::utility::DBusPropertiesMap& propertiesList) {
nlohmann::json& oemPFR =
aResp->res.jsonValue["Oem"]["OpenBmc"]["FirmwareProvisioning"];
aResp->res.jsonValue["Oem"]["OpenBmc"]["@odata.type"] =
@@ -1950,12 +1926,8 @@ inline void getPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp)
// Get Power Mode object path:
crow::connections::systemBus->async_method_call(
- [aResp](
- const boost::system::error_code ec,
- const std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>&
- subtree) {
+ [aResp](const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -2077,12 +2049,9 @@ inline void setPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
// Get Power Mode object path:
crow::connections::systemBus->async_method_call(
- [aResp, powerMode](
- const boost::system::error_code ec,
- const std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>&
- subtree) {
+ [aResp,
+ powerMode](const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -2219,7 +2188,7 @@ inline void
BMCWEB_LOG_DEBUG << "Get host watchodg";
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const PropertiesType& properties) {
+ const dbus::utility::DBusPropertiesMap& properties) {
if (ec)
{
// watchdog service is stopped
@@ -2434,12 +2403,8 @@ inline void getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp)
// Get IdlePowerSaver object path:
crow::connections::systemBus->async_method_call(
- [aResp](
- const boost::system::error_code ec,
- const std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>&
- subtree) {
+ [aResp](const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -2539,12 +2504,8 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
// Get IdlePowerSaver object path:
crow::connections::systemBus->async_method_call(
[aResp, ipsEnable, ipsEnterUtil, ipsEnterTime, ipsExitUtil,
- ipsExitTime](
- const boost::system::error_code ec,
- const std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>&
- subtree) {
+ ipsExitTime](const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index 4ebbc14fce..6c0a4b61fe 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -18,7 +18,7 @@
#include <app.hpp>
#include <boost/asio/post.hpp>
#include <boost/asio/steady_timer.hpp>
-#include <boost/container/flat_map.hpp>
+#include <dbus_utility.hpp>
#include <registries/privilege_registry.hpp>
#include <task_messages.hpp>
diff --git a/redfish-core/lib/telemetry_service.hpp b/redfish-core/lib/telemetry_service.hpp
index 421985a64f..e0f6c03819 100644
--- a/redfish-core/lib/telemetry_service.hpp
+++ b/redfish-core/lib/telemetry_service.hpp
@@ -27,10 +27,8 @@ inline void handleTelemetryServiceGet(
"/redfish/v1/TelemetryService/Triggers";
crow::connections::systemBus->async_method_call(
- [asyncResp](
- const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string, dbus::utility::DbusVariantType>>& ret) {
+ [asyncResp](const boost::system::error_code ec,
+ const dbus::utility::DBusPropertiesMap& ret) {
if (ec == boost::system::errc::host_unreachable)
{
asyncResp->res.jsonValue["Status"]["State"] = "Absent";
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index cd49f577e1..729aa564fa 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -18,7 +18,6 @@
#include "bmcweb_config.h"
#include <app.hpp>
-#include <boost/container/flat_map.hpp>
#include <dbus_utility.hpp>
#include <registries/privilege_registry.hpp>
#include <sdbusplus/asio/property.hpp>
@@ -66,10 +65,7 @@ static void
sdbusplus::message::message& m,
task::Payload&& payload)
{
- std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>>>
- interfacesProperties;
+ dbus::utility::DBusInteracesMap interfacesProperties;
sdbusplus::message::object_path objPath;
@@ -133,10 +129,7 @@ static void
}
std::string iface;
- boost::container::flat_map<
- std::string,
- dbus::utility::DbusVariantType>
- values;
+ dbus::utility::DBusPropertiesMap values;
std::string index =
std::to_string(taskData->index);
@@ -145,21 +138,28 @@ static void
if (iface ==
"xyz.openbmc_project.Software.Activation")
{
- auto findActivation =
- values.find("Activation");
- if (findActivation == values.end())
+ std::string* state = nullptr;
+ for (const auto& property : values)
{
- return !task::completed;
+ if (property.first == "Activation")
+ {
+ const std::string* state =
+ std::get_if<std::string>(
+ &property.second);
+ if (state == nullptr)
+ {
+ taskData->messages
+ .emplace_back(
+ messages::
+ internalError());
+ return task::completed;
+ }
+ }
}
- std::string* state =
- std::get_if<std::string>(
- &(findActivation->second));
if (state == nullptr)
{
- taskData->messages.emplace_back(
- messages::internalError());
- return task::completed;
+ return !task::completed;
}
if (boost::ends_with(*state,
@@ -202,21 +202,29 @@ static void
iface ==
"xyz.openbmc_project.Software.ActivationProgress")
{
- auto findProgress =
- values.find("Progress");
- if (findProgress == values.end())
+
+ const uint8_t* progress = nullptr;
+ for (const auto& property : values)
{
- return !task::completed;
+ if (property.first == "Progress")
+ {
+ const std::string* progress =
+ std::get_if<std::string>(
+ &property.second);
+ if (progress == nullptr)
+ {
+ taskData->messages
+ .emplace_back(
+ messages::
+ internalError());
+ return task::completed;
+ }
+ }
}
- uint8_t* progress =
- std::get_if<uint8_t>(
- &(findProgress->second));
if (progress == nullptr)
{
- taskData->messages.emplace_back(
- messages::internalError());
- return task::completed;
+ return !task::completed;
}
taskData->percentComplete =
static_cast<int>(*progress);
@@ -710,11 +718,7 @@ inline void requestRoutesSoftwareInventoryCollection(App& app)
crow::connections::systemBus->async_method_call(
[asyncResp](
const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string,
- std::vector<std::pair<
- std::string, std::vector<std::string>>>>>&
- subtree) {
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
if (ec)
{
messages::internalError(asyncResp->res);
@@ -798,13 +802,9 @@ inline void requestRoutesSoftwareInventory(App& app)
"/redfish/v1/UpdateService/FirmwareInventory/" + *swId;
crow::connections::systemBus->async_method_call(
- [asyncResp, swId](
- const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string,
- std::vector<std::pair<
- std::string, std::vector<std::string>>>>>&
- subtree) {
+ [asyncResp,
+ swId](const boost::system::error_code ec,
+ const dbus::utility::MapperGetSubTreeResponse& subtree) {
BMCWEB_LOG_DEBUG << "doGet callback...";
if (ec)
{
@@ -837,63 +837,47 @@ inline void requestRoutesSoftwareInventory(App& app)
crow::connections::systemBus->async_method_call(
[asyncResp,
swId](const boost::system::error_code errorCode,
- const boost::container::flat_map<
- std::string,
- dbus::utility::DbusVariantType>&
+ const dbus::utility::DBusPropertiesMap&
propertiesList) {
if (errorCode)
{
messages::internalError(asyncResp->res);
return;
}
- boost::container::flat_map<
- std::string,
- dbus::utility::DbusVariantType>::
- const_iterator it =
- propertiesList.find("Purpose");
- if (it == propertiesList.end())
+ const std::string* swInvPurpose = nullptr;
+ const std::string* version = nullptr;
+ for (const auto& property : propertiesList)
{
- BMCWEB_LOG_DEBUG
- << "Can't find property \"Purpose\"!";
- messages::propertyMissing(asyncResp->res,
- "Purpose");
- return;
+ if (property.first == "Purpose")
+ {
+ swInvPurpose = std::get_if<std::string>(
+ &property.second);
+ }
+ if (property.first == "Version")
+ {
+ version = std::get_if<std::string>(
+ &property.second);
+ }
}
- const std::string* swInvPurpose =
- std::get_if<std::string>(&it->second);
+
if (swInvPurpose == nullptr)
{
BMCWEB_LOG_DEBUG
- << "wrong types for property\"Purpose\"!";
- messages::propertyValueTypeError(
- asyncResp->res, "", "Purpose");
+ << "Can't find property \"Purpose\"!";
+ messages::internalError(asyncResp->res);
return;
}
BMCWEB_LOG_DEBUG << "swInvPurpose = "
<< *swInvPurpose;
- it = propertiesList.find("Version");
- if (it == propertiesList.end())
- {
- BMCWEB_LOG_DEBUG
- << "Can't find property \"Version\"!";
- messages::propertyMissing(asyncResp->res,
- "Version");
- return;
- }
-
- BMCWEB_LOG_DEBUG << "Version found!";
-
- const std::string* version =
- std::get_if<std::string>(&it->second);
if (version == nullptr)
{
BMCWEB_LOG_DEBUG
<< "Can't find property \"Version\"!";
- messages::propertyValueTypeError(
- asyncResp->res, "", "Version");
+ messages::internalError(asyncResp->res);
+
return;
}
asyncResp->res.jsonValue["Version"] = *version;
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index b0e3b38c34..7159be15a3 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -15,16 +15,13 @@
*/
#pragma once
+#include <account_service.hpp>
#include <app.hpp>
-#include <boost/container/flat_map.hpp>
#include <boost/process/async_pipe.hpp>
#include <boost/type_traits/has_dereference.hpp>
-#include <utils/json_utils.hpp>
-// for GetObjectType and ManagedObjectType
-
-#include <account_service.hpp>
#include <boost/url/url_view.hpp>
#include <registries/privilege_registry.hpp>
+#include <utils/json_utils.hpp>
namespace redfish
{
@@ -821,7 +818,8 @@ inline void requestNBDVirtualMediaRoutes(App& app)
crow::connections::systemBus->async_method_call(
[asyncResp, actionParams,
resName](const boost::system::error_code ec,
- const GetObjectType& getObjectType) mutable {
+ const dbus::utility::MapperGetObject&
+ getObjectType) mutable {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -927,8 +925,9 @@ inline void requestNBDVirtualMediaRoutes(App& app)
}
crow::connections::systemBus->async_method_call(
- [asyncResp, resName](const boost::system::error_code ec,
- const GetObjectType& getObjectType) {
+ [asyncResp, resName](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetObject& getObjectType) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -1022,8 +1021,9 @@ inline void requestNBDVirtualMediaRoutes(App& app)
"/redfish/v1/Managers/" + name + "/VirtualMedia";
crow::connections::systemBus->async_method_call(
- [asyncResp, name](const boost::system::error_code ec,
- const GetObjectType& getObjectType) {
+ [asyncResp, name](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetObject& getObjectType) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -1060,9 +1060,9 @@ inline void requestNBDVirtualMediaRoutes(App& app)
}
crow::connections::systemBus->async_method_call(
- [asyncResp, name,
- resName](const boost::system::error_code ec,
- const GetObjectType& getObjectType) {
+ [asyncResp, name, resName](
+ const boost::system::error_code ec,
+ const dbus::utility::MapperGetObject& getObjectType) {
if (ec)
{
BMCWEB_LOG_ERROR