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
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp
index 7aeacd6..90c7e87 100644
--- a/redfish-core/include/event_service_manager.hpp
+++ b/redfish-core/include/event_service_manager.hpp
@@ -1325,8 +1325,7 @@
}
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 c5d603a..2cb2f3d 100644
--- a/redfish-core/include/utils/collection.hpp
+++ b/redfish-core/include/utils/collection.hpp
@@ -30,9 +30,9 @@
{
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 c05f8cb..d80ce71 100644
--- a/redfish-core/include/utils/fw_utils.hpp
+++ b/redfish-core/include/utils/fw_utils.hpp
@@ -84,11 +84,7 @@
[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 @@
[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 @@
// "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())
+ std::string version;
+ std::string swInvPurpose;
+ for (const auto& propertyPair : propertiesList)
{
- 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)
- {
- 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 @@
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 @@
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 5cd70bc..4fcd540 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -67,9 +67,6 @@
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 @@
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 @@
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 05da5f6..241baf4 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 6d17a61..4882ec3 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -452,11 +452,9 @@
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 @@
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 @@
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 597e5d0..45348db 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 @@
});
}
-/**
- * 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 @@
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 @@
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 @@
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 @@
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 @@
// 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 227b4e9..85fa633 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 @@
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 c2e40c7..31adf7b 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -189,7 +189,7 @@
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 ba092c7..ed83ff6 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 @@
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 08765f2..e474f0a 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -103,9 +103,6 @@
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
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 b0e2507..96b0d5d 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -748,9 +748,8 @@
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 @@
{
if (managedItem == nullptr)
{
- output["Profiles"] = std::vector<std::string>{profile};
+ output.emplace_back("Profiles", std::vector<std::string>{profile});
}
else
{
@@ -854,7 +853,7 @@
std::vector<std::string> newProfiles =
*curProfiles;
newProfiles.push_back(profile);
- output["Profiles"] = newProfiles;
+ output.emplace_back("Profiles", newProfiles);
}
}
}
@@ -875,9 +874,9 @@
{
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 @@
"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 @@
{
key = "Outputs";
}
- output[key] = *container;
+ output.emplace_back(key, *container);
index++;
}
}
@@ -963,19 +961,19 @@
// 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 @@
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 @@
}
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 @@
"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 @@
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 @@
{
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 @@
*direction);
return CreatePIDRet::fail;
}
- output["Class"] = *direction;
+ output.emplace_back("Class", *direction);
}
}
else
@@ -1171,8 +1169,9 @@
// 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 @@
// 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 @@
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 @@
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 @@
// 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 @@
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 @@
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 @@
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 @@
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 @@
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 73d739a..d3bbc07 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 @@
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 @@
}
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 @@
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 @@
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 @@
{
for (const auto& [service, interfaces] : object)
{
- if (!found &&
- (std::find(
- interfaces.begin(), interfaces.end(),
- "xyz.openbmc_project.Inventory.Item.Dimm") !=
- interfaces.end()))
+ for (const auto& interface : interfaces)
{
- getDimmDataByService(aResp, dimmId, service, path);
- found = true;
- }
+ 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 (std::find(
- interfaces.begin(), interfaces.end(),
- "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition") !=
- interfaces.end())
- {
- getDimmPartitionData(aResp, service, path);
+ // 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 ab7c88b..a27ec6b 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -22,10 +22,10 @@
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 e221d96..aac7f66 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -253,7 +253,7 @@
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 @@
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 3c083ae..ca1eb8f 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -33,37 +33,39 @@
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;
}
+ 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)
+ {
+ continue;
+ }
- std::string devName = pcieDevicePath.substr(devStart + 1);
- if (devName.empty())
- {
- 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 @@
{
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 @@
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)
- {
- std::optional<std::string> generationInUse =
- redfishPcieGenerationFromDbus(*property);
- 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["PCIeFunctions"] = {
{"@odata.id",
"/redfish/v1/Systems/system/PCIeDevices/" +
device + "/PCIeFunctions"}};
+ for (const auto& property : pcieDevProperties)
+ {
+ const std::string* propertyString =
+ std::get_if<std::string>(&property.second);
+ if (property.first == "Manufacturer")
+ {
+ if (propertyString == nullptr)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ asyncResp->res.jsonValue["Manufacturer"] =
+ *propertyString;
+ }
+ if (property.first == "DeviceType")
+ {
+ 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;
+ }
+ }
};
std::string escapedPath = std::string(pciePath) + "/" + device;
dbus::utility::escapePathForDbus(escapedPath);
@@ -263,58 +271,62 @@
{"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)
+ auto getPCIeDeviceCallback =
+ [asyncResp, device](const boost::system::error_code ec,
+ const dbus::utility::DBusPropertiesMap&
+ pcieDevProperties) {
+ if (ec)
{
- messages::resourceNotFound(asyncResp->res,
- "PCIeDevice", device);
+ 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;
}
- else
- {
- messages::internalError(asyncResp->res);
- }
- 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 @@
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 @@
}
// 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 @@
"/redfish/v1/Systems/system/PCIeDevices/" +
device}}}}}};
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "DeviceId"]);
- property)
+ for (const auto& property : pcieDevProperties)
{
- asyncResp->res.jsonValue["DeviceId"] = *property;
- }
-
- if (std::string* property = std::get_if<std::string>(
- &pcieDevProperties["Function" + function +
- "VendorId"]);
- property)
- {
- 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 eaf7e6c..dd67aea 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -136,10 +136,11 @@
// 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 @@
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 b74b05c..f304eb8 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 @@
// 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 a42d00d..7af4ab8 100644
--- a/redfish-core/lib/redfish_util.hpp
+++ b/redfish-core/lib/redfish_util.hpp
@@ -56,7 +56,7 @@
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 3139635..d501b70 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 @@
// 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 @@
"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)
- {
- BMCWEB_LOG_ERROR
- << "getValidChassisPath respHandler DBUS error: " << ec;
- messages::internalError(asyncResp->asyncResp->res);
- return;
- }
+ 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)
+ 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())
{
- 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;
- }
+ BMCWEB_LOG_ERROR << "Failed to find '/' in " << chassis;
+ continue;
}
- callback(chassisPath);
- };
+ if (chassisName == asyncResp->chassisId)
+ {
+ chassisPath = chassis;
+ break;
+ }
+ }
+ callback(chassisPath);
+ };
// Get the Chassis Collection
crow::connections::systemBus->async_method_call(
@@ -525,7 +516,8 @@
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 @@
// 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 @@
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 @@
// 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 @@
// 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 @@
"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 @@
// 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 @@
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 a2a2201..6809958 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -64,7 +64,8 @@
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 @@
"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 @@
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 ca85098..429e992 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -122,11 +122,10 @@
}
}
-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 @@
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 @@
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 @@
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 @@
<< "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 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
// 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 @@
// 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 @@
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 @@
// 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 @@
// 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 4ebbc14..6c0a4b6 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 421985a..e0f6c03 100644
--- a/redfish-core/lib/telemetry_service.hpp
+++ b/redfish-core/lib/telemetry_service.hpp
@@ -27,10 +27,8 @@
"/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 cd49f57..729aa56 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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
"/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 @@
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 b0e3b38..7159be1 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 @@
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 @@
}
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 @@
"/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 @@
}
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