diff options
Diffstat (limited to 'redfish-core/lib')
23 files changed, 555 insertions, 675 deletions
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 |