diff options
-rw-r--r-- | redfish-core/include/utils/collection.hpp | 16 | ||||
-rw-r--r-- | redfish-core/include/utils/pcie_util.hpp | 4 | ||||
-rw-r--r-- | redfish-core/include/utils/sw_utils.hpp | 47 | ||||
-rw-r--r-- | redfish-core/lib/chassis.hpp | 38 | ||||
-rw-r--r-- | redfish-core/lib/fabric_adapters.hpp | 141 | ||||
-rw-r--r-- | redfish-core/lib/hypervisor_system.hpp | 72 | ||||
-rw-r--r-- | redfish-core/lib/led.hpp | 66 | ||||
-rw-r--r-- | redfish-core/lib/log_services.hpp | 58 | ||||
-rw-r--r-- | redfish-core/lib/manager_diagnostic_data.hpp | 17 | ||||
-rw-r--r-- | redfish-core/lib/managers.hpp | 55 | ||||
-rw-r--r-- | redfish-core/lib/memory.hpp | 186 | ||||
-rw-r--r-- | redfish-core/lib/pcie.hpp | 193 | ||||
-rw-r--r-- | redfish-core/lib/processor.hpp | 264 | ||||
-rw-r--r-- | redfish-core/lib/sensors.hpp | 22 | ||||
-rw-r--r-- | redfish-core/lib/systems.hpp | 733 | ||||
-rw-r--r-- | redfish-core/lib/update_service.hpp | 12 | ||||
-rw-r--r-- | redfish-core/lib/virtual_media.hpp | 49 |
17 files changed, 1012 insertions, 961 deletions
diff --git a/redfish-core/include/utils/collection.hpp b/redfish-core/include/utils/collection.hpp index 05e4b4df2f..500749cd54 100644 --- a/redfish-core/include/utils/collection.hpp +++ b/redfish-core/include/utils/collection.hpp @@ -23,7 +23,7 @@ namespace collection_util * @brief Populate the collection "Members" from a GetSubTreePaths search of * inventory * - * @param[i,o] aResp Async response object + * @param[i,o] asyncResp Async response object * @param[i] collectionPath Redfish collection path which is used for the * Members Redfish Path * @param[i] interfaces List of interfaces to constrain the GetSubTree search @@ -32,7 +32,7 @@ namespace collection_util * @return void */ inline void - getCollectionMembers(std::shared_ptr<bmcweb::AsyncResp> aResp, + getCollectionMembers(std::shared_ptr<bmcweb::AsyncResp> asyncResp, const boost::urls::url& collectionPath, std::span<const std::string_view> interfaces, const char* subtree = "/xyz/openbmc_project/inventory") @@ -41,20 +41,20 @@ inline void << collectionPath.buffer(); dbus::utility::getSubTreePaths( subtree, 0, interfaces, - [collectionPath, aResp{std::move(aResp)}]( + [collectionPath, asyncResp{std::move(asyncResp)}]( 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(); - aResp->res.jsonValue["Members@odata.count"] = 0; + asyncResp->res.jsonValue["Members"] = nlohmann::json::array(); + asyncResp->res.jsonValue["Members@odata.count"] = 0; return; } if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec.value(); - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -72,7 +72,7 @@ inline void std::sort(pathNames.begin(), pathNames.end(), AlphanumLess<std::string>()); - nlohmann::json& members = aResp->res.jsonValue["Members"]; + nlohmann::json& members = asyncResp->res.jsonValue["Members"]; members = nlohmann::json::array(); for (const std::string& leaf : pathNames) { @@ -82,7 +82,7 @@ inline void member["@odata.id"] = std::move(url); members.emplace_back(std::move(member)); } - aResp->res.jsonValue["Members@odata.count"] = members.size(); + asyncResp->res.jsonValue["Members@odata.count"] = members.size(); }); } diff --git a/redfish-core/include/utils/pcie_util.hpp b/redfish-core/include/utils/pcie_util.hpp index 51423b435f..7b094feed1 100644 --- a/redfish-core/include/utils/pcie_util.hpp +++ b/redfish-core/include/utils/pcie_util.hpp @@ -23,8 +23,8 @@ namespace pcie_util * @brief Populate the PCIe Device list from a GetSubTreePaths search of * inventory * - * @param[i,o] aResp Async response object - * @param[i] Name Key to store the list of PCIe devices in aResp + * @param[i,o] asyncResp Async response object + * @param[i] Name Key to store the list of PCIe devices in asyncResp * * @return void */ diff --git a/redfish-core/include/utils/sw_utils.hpp b/redfish-core/include/utils/sw_utils.hpp index de4868bceb..a46dd5a519 100644 --- a/redfish-core/include/utils/sw_utils.hpp +++ b/redfish-core/include/utils/sw_utils.hpp @@ -32,26 +32,26 @@ constexpr const char* bmcPurpose = /** * @brief Populate the running software version and image links * - * @param[i,o] aResp Async response object + * @param[i,o] asyncResp Async response object * @param[i] swVersionPurpose Indicates what target to look for - * @param[i] activeVersionPropName Index in aResp->res.jsonValue to write + * @param[i] activeVersionPropName Index in asyncResp->res.jsonValue to write * the running software version to - * @param[i] populateLinkToImages Populate aResp->res "Links" + * @param[i] populateLinkToImages Populate asyncResp->res "Links" * "ActiveSoftwareImage" with a link to the running software image and * "SoftwareImages" with a link to the all its software images * * @return void */ -inline void - populateSoftwareInformation(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& swVersionPurpose, - const std::string& activeVersionPropName, - const bool populateLinkToImages) +inline void populateSoftwareInformation( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& swVersionPurpose, + const std::string& activeVersionPropName, const bool populateLinkToImages) { // Used later to determine running (known on Redfish as active) Sw images dbus::utility::getAssociationEndPoints( "/xyz/openbmc_project/software/functional", - [aResp, swVersionPurpose, activeVersionPropName, populateLinkToImages]( + [asyncResp, swVersionPurpose, activeVersionPropName, + populateLinkToImages]( const boost::system::error_code& ec, const dbus::utility::MapperEndPoints& functionalSw) { BMCWEB_LOG_DEBUG << "populateSoftwareInformation enter"; @@ -59,7 +59,7 @@ inline void { BMCWEB_LOG_ERROR << "error_code = " << ec; BMCWEB_LOG_ERROR << "error msg = " << ec.message(); - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -68,7 +68,7 @@ inline void // Could keep going and try to populate SoftwareImages but // something is seriously wrong, so just fail BMCWEB_LOG_ERROR << "Zero functional software in system"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -92,7 +92,7 @@ inline void "xyz.openbmc_project.Software.Version"}; dbus::utility::getSubTree( "/xyz/openbmc_project/software", 0, interfaces, - [aResp, swVersionPurpose, activeVersionPropName, + [asyncResp, swVersionPurpose, activeVersionPropName, populateLinkToImages, functionalSwIds]( const boost::system::error_code& ec2, const dbus::utility::MapperGetSubTreeResponse& subtree) { @@ -100,7 +100,7 @@ inline void { BMCWEB_LOG_ERROR << "error_code = " << ec2; BMCWEB_LOG_ERROR << "error msg = " << ec2.message(); - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -115,7 +115,7 @@ inline void std::string swId = path.filename(); if (swId.empty()) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); BMCWEB_LOG_ERROR << "Invalid software ID"; return; @@ -135,7 +135,7 @@ inline void sdbusplus::asio::getAllProperties( *crow::connections::systemBus, obj.second[0].first, obj.first, "xyz.openbmc_project.Software.Version", - [aResp, swId, runningImage, swVersionPurpose, + [asyncResp, swId, runningImage, swVersionPurpose, activeVersionPropName, populateLinkToImages]( const boost::system::error_code& ec3, const dbus::utility::DBusPropertiesMap& @@ -152,7 +152,7 @@ inline void { return; } - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } // example propertiesList @@ -169,13 +169,13 @@ inline void if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (version == nullptr || version->empty()) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (swInvPurpose == nullptr || @@ -192,7 +192,7 @@ inline void if (populateLinkToImages) { nlohmann::json& softwareImageMembers = - aResp->res.jsonValue["Links"]["SoftwareImages"]; + asyncResp->res.jsonValue["Links"]["SoftwareImages"]; // Firmware images are at // /redfish/v1/UpdateService/FirmwareInventory/<Id> // e.g. .../FirmwareInventory/82d3ec86 @@ -201,7 +201,7 @@ inline void "/redfish/v1/UpdateService/FirmwareInventory/{}", swId); softwareImageMembers.emplace_back(std::move(member)); - aResp->res + asyncResp->res .jsonValue["Links"]["SoftwareImages@odata.count"] = softwareImageMembers.size(); @@ -212,14 +212,15 @@ inline void "/redfish/v1/UpdateService/FirmwareInventory/{}", swId); // Create the link to the running image - aResp->res + asyncResp->res .jsonValue["Links"]["ActiveSoftwareImage"] = std::move(runningMember); } } if (!activeVersionPropName.empty() && runningImage) { - aResp->res.jsonValue[activeVersionPropName] = *version; + asyncResp->res.jsonValue[activeVersionPropName] = + *version; } }); } @@ -286,7 +287,7 @@ inline std::string getRedfishSwHealth(const std::string& swState) * This function will put the appropriate Redfish state of the input * software id to ["Status"]["State"] within the json response * - * @param[i,o] aResp Async response object + * @param[i,o] asyncResp Async response object * @param[i] swId The software ID to get status for * @param[i] dbusSvc The dbus service implementing the software object * diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp index 99e305bde6..6cb877f845 100644 --- a/redfish-core/lib/chassis.hpp +++ b/redfish-core/lib/chassis.hpp @@ -42,19 +42,19 @@ namespace redfish /** * @brief Retrieves chassis state properties over dbus * - * @param[in] aResp - Shared pointer for completing asynchronous calls. + * @param[in] asyncResp - Shared pointer for completing asynchronous calls. * * @return None. */ -inline void getChassisState(std::shared_ptr<bmcweb::AsyncResp> aResp) +inline void getChassisState(std::shared_ptr<bmcweb::AsyncResp> asyncResp) { // crow::connections::systemBus->async_method_call( sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, "xyz.openbmc_project.State.Chassis", "/xyz/openbmc_project/state/chassis0", "xyz.openbmc_project.State.Chassis", "CurrentPowerState", - [aResp{std::move(aResp)}](const boost::system::error_code& ec, - const std::string& chassisState) { + [asyncResp{std::move(asyncResp)}](const boost::system::error_code& ec, + const std::string& chassisState) { if (ec) { if (ec == boost::system::errc::host_unreachable) @@ -64,8 +64,8 @@ inline void getChassisState(std::shared_ptr<bmcweb::AsyncResp> aResp) BMCWEB_LOG_DEBUG << "Service not available " << ec; return; } - BMCWEB_LOG_ERROR << "DBUS response error " << ec; - messages::internalError(aResp->res); + BMCWEB_LOG_DEBUG << "DBUS response error " << ec; + messages::internalError(asyncResp->res); return; } @@ -73,19 +73,19 @@ inline void getChassisState(std::shared_ptr<bmcweb::AsyncResp> aResp) // Verify Chassis State if (chassisState == "xyz.openbmc_project.State.Chassis.PowerState.On") { - aResp->res.jsonValue["PowerState"] = "On"; - aResp->res.jsonValue["Status"]["State"] = "Enabled"; + asyncResp->res.jsonValue["PowerState"] = "On"; + asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; } else if (chassisState == "xyz.openbmc_project.State.Chassis.PowerState.Off") { - aResp->res.jsonValue["PowerState"] = "Off"; - aResp->res.jsonValue["Status"]["State"] = "StandbyOffline"; + asyncResp->res.jsonValue["PowerState"] = "Off"; + asyncResp->res.jsonValue["Status"]["State"] = "StandbyOffline"; } }); } -inline void getIntrusionByService(std::shared_ptr<bmcweb::AsyncResp> aResp, +inline void getIntrusionByService(std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& service, const std::string& objPath) { @@ -94,8 +94,8 @@ inline void getIntrusionByService(std::shared_ptr<bmcweb::AsyncResp> aResp, sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, service, objPath, "xyz.openbmc_project.Chassis.Intrusion", "Status", - [aResp{std::move(aResp)}](const boost::system::error_code& ec, - const std::string& value) { + [asyncResp{std::move(asyncResp)}](const boost::system::error_code& ec, + const std::string& value) { if (ec) { // do not add err msg in redfish response, because this is not @@ -104,21 +104,23 @@ inline void getIntrusionByService(std::shared_ptr<bmcweb::AsyncResp> aResp, return; } - aResp->res.jsonValue["PhysicalSecurity"]["IntrusionSensorNumber"] = 1; - aResp->res.jsonValue["PhysicalSecurity"]["IntrusionSensor"] = value; + asyncResp->res.jsonValue["PhysicalSecurity"]["IntrusionSensorNumber"] = + 1; + asyncResp->res.jsonValue["PhysicalSecurity"]["IntrusionSensor"] = value; }); } /** * Retrieves physical security properties over dbus */ -inline void getPhysicalSecurityData(std::shared_ptr<bmcweb::AsyncResp> aResp) +inline void + getPhysicalSecurityData(std::shared_ptr<bmcweb::AsyncResp> asyncResp) { constexpr std::array<std::string_view, 1> interfaces = { "xyz.openbmc_project.Chassis.Intrusion"}; dbus::utility::getSubTree( "/xyz/openbmc_project/Intrusion", 1, interfaces, - [aResp{std::move(aResp)}]( + [asyncResp{std::move(asyncResp)}]( const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreeResponse& subtree) { if (ec) @@ -134,7 +136,7 @@ inline void getPhysicalSecurityData(std::shared_ptr<bmcweb::AsyncResp> aResp) if (!object.second.empty()) { const auto service = object.second.front(); - getIntrusionByService(aResp, service.first, object.first); + getIntrusionByService(asyncResp, service.first, object.first); return; } } diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp index 16174bf4bd..2b4b4aefba 100644 --- a/redfish-core/lib/fabric_adapters.hpp +++ b/redfish-core/lib/fabric_adapters.hpp @@ -37,48 +37,47 @@ inline void handleAdapterError(const boost::system::error_code& ec, messages::internalError(res); } -inline void - getFabricAdapterLocation(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& serviceName, - const std::string& fabricAdapterPath) +inline void getFabricAdapterLocation( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& serviceName, const std::string& fabricAdapterPath) { sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, serviceName, fabricAdapterPath, "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode", - [aResp](const boost::system::error_code& ec, - const std::string& property) { + [asyncResp](const boost::system::error_code& ec, + const std::string& property) { if (ec) { if (ec.value() != EBADR) { BMCWEB_LOG_ERROR << "DBUS response error for Location"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); } return; } - aResp->res.jsonValue["Location"]["PartLocation"]["ServiceLabel"] = + asyncResp->res.jsonValue["Location"]["PartLocation"]["ServiceLabel"] = property; }); } inline void - getFabricAdapterAsset(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + getFabricAdapterAsset(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& serviceName, const std::string& fabricAdapterPath) { sdbusplus::asio::getAllProperties( *crow::connections::systemBus, serviceName, fabricAdapterPath, "xyz.openbmc_project.Inventory.Decorator.Asset", - [fabricAdapterPath, - aResp{aResp}](const boost::system::error_code& ec, - const dbus::utility::DBusPropertiesMap& propertiesList) { + [fabricAdapterPath, asyncResp{asyncResp}]( + const boost::system::error_code& ec, + const dbus::utility::DBusPropertiesMap& propertiesList) { if (ec) { if (ec.value() != EBADR) { BMCWEB_LOG_ERROR << "DBUS response error for Properties"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); } return; } @@ -95,106 +94,108 @@ inline void if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (serialNumber != nullptr) { - aResp->res.jsonValue["SerialNumber"] = *serialNumber; + asyncResp->res.jsonValue["SerialNumber"] = *serialNumber; } if (model != nullptr) { - aResp->res.jsonValue["Model"] = *model; + asyncResp->res.jsonValue["Model"] = *model; } if (partNumber != nullptr) { - aResp->res.jsonValue["PartNumber"] = *partNumber; + asyncResp->res.jsonValue["PartNumber"] = *partNumber; } if (sparePartNumber != nullptr && !sparePartNumber->empty()) { - aResp->res.jsonValue["SparePartNumber"] = *sparePartNumber; + asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber; } }); } inline void - getFabricAdapterState(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + getFabricAdapterState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& serviceName, const std::string& fabricAdapterPath) { sdbusplus::asio::getProperty<bool>( *crow::connections::systemBus, serviceName, fabricAdapterPath, "xyz.openbmc_project.Inventory.Item", "Present", - [aResp](const boost::system::error_code& ec, const bool present) { + [asyncResp](const boost::system::error_code& ec, const bool present) { if (ec) { if (ec.value() != EBADR) { BMCWEB_LOG_ERROR << "DBUS response error for State"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); } return; } if (!present) { - aResp->res.jsonValue["Status"]["State"] = "Absent"; + asyncResp->res.jsonValue["Status"]["State"] = "Absent"; } }); } inline void - getFabricAdapterHealth(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + getFabricAdapterHealth(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& serviceName, const std::string& fabricAdapterPath) { sdbusplus::asio::getProperty<bool>( *crow::connections::systemBus, serviceName, fabricAdapterPath, "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional", - [aResp](const boost::system::error_code& ec, const bool functional) { + [asyncResp](const boost::system::error_code& ec, + const bool functional) { if (ec) { if (ec.value() != EBADR) { BMCWEB_LOG_ERROR << "DBUS response error for Health"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); } return; } if (!functional) { - aResp->res.jsonValue["Status"]["Health"] = "Critical"; + asyncResp->res.jsonValue["Status"]["Health"] = "Critical"; } }); } -inline void doAdapterGet(const std::shared_ptr<bmcweb::AsyncResp>& aResp, +inline void doAdapterGet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& systemName, const std::string& adapterId, const std::string& fabricAdapterPath, const std::string& serviceName) { - aResp->res.addHeader( + asyncResp->res.addHeader( boost::beast::http::field::link, "</redfish/v1/JsonSchemas/FabricAdapter/FabricAdapter.json>; rel=describedby"); - aResp->res.jsonValue["@odata.type"] = "#FabricAdapter.v1_4_0.FabricAdapter"; - aResp->res.jsonValue["Name"] = "Fabric Adapter"; - aResp->res.jsonValue["Id"] = adapterId; - aResp->res.jsonValue["@odata.id"] = boost::urls::format( + asyncResp->res.jsonValue["@odata.type"] = + "#FabricAdapter.v1_4_0.FabricAdapter"; + asyncResp->res.jsonValue["Name"] = "Fabric Adapter"; + asyncResp->res.jsonValue["Id"] = adapterId; + asyncResp->res.jsonValue["@odata.id"] = boost::urls::format( "/redfish/v1/Systems/{}/FabricAdapters/{}", systemName, adapterId); - aResp->res.jsonValue["Status"]["State"] = "Enabled"; - aResp->res.jsonValue["Status"]["Health"] = "OK"; + asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; + asyncResp->res.jsonValue["Status"]["Health"] = "OK"; - getFabricAdapterLocation(aResp, serviceName, fabricAdapterPath); - getFabricAdapterAsset(aResp, serviceName, fabricAdapterPath); - getFabricAdapterState(aResp, serviceName, fabricAdapterPath); - getFabricAdapterHealth(aResp, serviceName, fabricAdapterPath); + getFabricAdapterLocation(asyncResp, serviceName, fabricAdapterPath); + getFabricAdapterAsset(asyncResp, serviceName, fabricAdapterPath); + getFabricAdapterState(asyncResp, serviceName, fabricAdapterPath); + getFabricAdapterHealth(asyncResp, serviceName, fabricAdapterPath); } inline bool checkFabricAdapterId(const std::string& adapterPath, @@ -208,13 +209,14 @@ inline bool checkFabricAdapterId(const std::string& adapterPath, inline void getValidFabricAdapterPath( const std::string& adapterId, const std::string& systemName, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, std::function<void(const std::string& fabricAdapterPath, const std::string& serviceName)>&& callback) { if (systemName != "system") { - messages::resourceNotFound(aResp->res, "ComputerSystem", systemName); + messages::resourceNotFound(asyncResp->res, "ComputerSystem", + systemName); return; } constexpr std::array<std::string_view, 1> interfaces{ @@ -222,12 +224,12 @@ inline void getValidFabricAdapterPath( dbus::utility::getSubTree( "/xyz/openbmc_project/inventory", 0, interfaces, - [adapterId, aResp, + [adapterId, asyncResp, callback](const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreeResponse& subtree) { if (ec) { - handleAdapterError(ec, aResp->res, adapterId); + handleAdapterError(ec, asyncResp->res, adapterId); return; } for (const auto& [adapterPath, serviceMap] : subtree) @@ -239,98 +241,101 @@ inline void getValidFabricAdapterPath( } } BMCWEB_LOG_WARNING << "Adapter not found"; - messages::resourceNotFound(aResp->res, "FabricAdapter", adapterId); + messages::resourceNotFound(asyncResp->res, "FabricAdapter", adapterId); }); } inline void handleFabricAdapterGet(App& app, const crow::Request& req, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& systemName, const std::string& adapterId) { - if (!redfish::setUpRedfishRoute(app, req, aResp)) + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } getValidFabricAdapterPath( - adapterId, systemName, aResp, - [aResp, systemName, adapterId](const std::string& fabricAdapterPath, - const std::string& serviceName) { - doAdapterGet(aResp, systemName, adapterId, fabricAdapterPath, + adapterId, systemName, asyncResp, + [asyncResp, systemName, adapterId](const std::string& fabricAdapterPath, + const std::string& serviceName) { + doAdapterGet(asyncResp, systemName, adapterId, fabricAdapterPath, serviceName); }); } inline void handleFabricAdapterCollectionGet( crow::App& app, const crow::Request& req, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& systemName) { - if (!redfish::setUpRedfishRoute(app, req, aResp)) + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } if (systemName != "system") { - messages::resourceNotFound(aResp->res, "ComputerSystem", systemName); + messages::resourceNotFound(asyncResp->res, "ComputerSystem", + systemName); return; } - aResp->res.addHeader( + asyncResp->res.addHeader( boost::beast::http::field::link, "</redfish/v1/JsonSchemas/FabricAdapterCollection/FabricAdapterCollection.json>; rel=describedby"); - aResp->res.jsonValue["@odata.type"] = + asyncResp->res.jsonValue["@odata.type"] = "#FabricAdapterCollection.FabricAdapterCollection"; - aResp->res.jsonValue["Name"] = "Fabric Adapter Collection"; - aResp->res.jsonValue["@odata.id"] = boost::urls::format( + asyncResp->res.jsonValue["Name"] = "Fabric Adapter Collection"; + asyncResp->res.jsonValue["@odata.id"] = boost::urls::format( "/redfish/v1/Systems/{}/FabricAdapters", systemName); constexpr std::array<std::string_view, 1> interfaces{ "xyz.openbmc_project.Inventory.Item.FabricAdapter"}; collection_util::getCollectionMembers( - aResp, boost::urls::url("/redfish/v1/Systems/system/FabricAdapters"), + asyncResp, + boost::urls::url("/redfish/v1/Systems/system/FabricAdapters"), interfaces); } inline void handleFabricAdapterCollectionHead( crow::App& app, const crow::Request& req, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& systemName) { - if (!redfish::setUpRedfishRoute(app, req, aResp)) + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } if (systemName != "system") { - messages::resourceNotFound(aResp->res, "ComputerSystem", systemName); + messages::resourceNotFound(asyncResp->res, "ComputerSystem", + systemName); return; } - aResp->res.addHeader( + asyncResp->res.addHeader( boost::beast::http::field::link, "</redfish/v1/JsonSchemas/FabricAdapterCollection/FabricAdapterCollection.json>; rel=describedby"); } inline void handleFabricAdapterHead(crow::App& app, const crow::Request& req, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& systemName, const std::string& adapterId) { - if (!redfish::setUpRedfishRoute(app, req, aResp)) + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } - getValidFabricAdapterPath( - adapterId, systemName, aResp, - [aResp, systemName, adapterId](const std::string&, const std::string&) { - aResp->res.addHeader( + getValidFabricAdapterPath(adapterId, systemName, asyncResp, + [asyncResp, systemName, adapterId]( + const std::string&, const std::string&) { + asyncResp->res.addHeader( boost::beast::http::field::link, "</redfish/v1/JsonSchemas/FabricAdapter/FabricAdapter.json>; rel=describedby"); - }); + }); } inline void requestRoutesFabricAdapterCollection(App& app) diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp index bf5b5efc18..c06bd1f870 100644 --- a/redfish-core/lib/hypervisor_system.hpp +++ b/redfish-core/lib/hypervisor_system.hpp @@ -27,19 +27,20 @@ namespace redfish * The hypervisor state object is optional so this function will only set the * state variables if the object is found * - * @param[in] aResp Shared pointer for completing asynchronous calls. + * @param[in] asyncResp Shared pointer for completing asynchronous calls. * * @return None. */ -inline void getHypervisorState(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void + getHypervisorState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get hypervisor state information."; sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, "xyz.openbmc_project.State.Hypervisor", "/xyz/openbmc_project/state/hypervisor0", "xyz.openbmc_project.State.Host", "CurrentHostState", - [aResp](const boost::system::error_code& ec, - const std::string& hostState) { + [asyncResp](const boost::system::error_code& ec, + const std::string& hostState) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; @@ -52,41 +53,41 @@ inline void getHypervisorState(const std::shared_ptr<bmcweb::AsyncResp>& aResp) // Verify Host State if (hostState == "xyz.openbmc_project.State.Host.HostState.Running") { - aResp->res.jsonValue["PowerState"] = "On"; - aResp->res.jsonValue["Status"]["State"] = "Enabled"; + asyncResp->res.jsonValue["PowerState"] = "On"; + asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; } else if (hostState == "xyz.openbmc_project.State.Host.HostState." "Quiesced") { - aResp->res.jsonValue["PowerState"] = "On"; - aResp->res.jsonValue["Status"]["State"] = "Quiesced"; + asyncResp->res.jsonValue["PowerState"] = "On"; + asyncResp->res.jsonValue["Status"]["State"] = "Quiesced"; } else if (hostState == "xyz.openbmc_project.State.Host.HostState." "Standby") { - aResp->res.jsonValue["PowerState"] = "On"; - aResp->res.jsonValue["Status"]["State"] = "StandbyOffline"; + asyncResp->res.jsonValue["PowerState"] = "On"; + asyncResp->res.jsonValue["Status"]["State"] = "StandbyOffline"; } else if (hostState == "xyz.openbmc_project.State.Host.HostState." "TransitioningToRunning") { - aResp->res.jsonValue["PowerState"] = "PoweringOn"; - aResp->res.jsonValue["Status"]["State"] = "Starting"; + asyncResp->res.jsonValue["PowerState"] = "PoweringOn"; + asyncResp->res.jsonValue["Status"]["State"] = "Starting"; } else if (hostState == "xyz.openbmc_project.State.Host.HostState." "TransitioningToOff") { - aResp->res.jsonValue["PowerState"] = "PoweringOff"; - aResp->res.jsonValue["Status"]["State"] = "Enabled"; + asyncResp->res.jsonValue["PowerState"] = "PoweringOff"; + asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; } else if (hostState == "xyz.openbmc_project.State.Host.HostState.Off") { - aResp->res.jsonValue["PowerState"] = "Off"; - aResp->res.jsonValue["Status"]["State"] = "Disabled"; + asyncResp->res.jsonValue["PowerState"] = "Off"; + asyncResp->res.jsonValue["Status"]["State"] = "Disabled"; } else { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }); @@ -98,19 +99,19 @@ inline void getHypervisorState(const std::shared_ptr<bmcweb::AsyncResp>& aResp) * The hypervisor state object is optional so this function will only set the * Action if the object is found * - * @param[in] aResp Shared pointer for completing asynchronous calls. + * @param[in] asyncResp Shared pointer for completing asynchronous calls. * * @return None. */ inline void - getHypervisorActions(const std::shared_ptr<bmcweb::AsyncResp>& aResp) + getHypervisorActions(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get hypervisor actions."; constexpr std::array<std::string_view, 1> interfaces = { "xyz.openbmc_project.State.Host"}; dbus::utility::getDbusObject( "/xyz/openbmc_project/state/hypervisor0", interfaces, - [aResp]( + [asyncResp]( const boost::system::error_code& ec, const std::vector<std::pair<std::string, std::vector<std::string>>>& objInfo) { @@ -133,13 +134,13 @@ inline void { // More then one hypervisor object is not supported and is an // error - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } // Object present so system support limited ComputerSystem Action nlohmann::json& reset = - aResp->res.jsonValue["Actions"]["#ComputerSystem.Reset"]; + asyncResp->res.jsonValue["Actions"]["#ComputerSystem.Reset"]; reset["target"] = "/redfish/v1/Systems/hypervisor/Actions/ComputerSystem.Reset"; reset["@Redfish.ActionInfo"] = @@ -338,21 +339,20 @@ void getHypervisorIfaceData(const std::string& ethIfaceId, /** * @brief Sets the Hypervisor Interface IPAddress DBUS * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] ipv4Address Address from the incoming request * @param[in] ethIfaceId Hypervisor Interface Id * * @return None. */ -inline void - setHypervisorIPv4Address(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& ethIfaceId, - const std::string& ipv4Address) +inline void setHypervisorIPv4Address( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& ethIfaceId, const std::string& ipv4Address) { BMCWEB_LOG_DEBUG << "Setting the Hypervisor IPaddress : " << ipv4Address << " on Iface: " << ethIfaceId; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { BMCWEB_LOG_ERROR << "DBUS response error " << ec; @@ -370,21 +370,21 @@ inline void /** * @brief Sets the Hypervisor Interface SubnetMask DBUS * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] subnet SubnetMask from the incoming request * @param[in] ethIfaceId Hypervisor Interface Id * * @return None. */ inline void - setHypervisorIPv4Subnet(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + setHypervisorIPv4Subnet(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& ethIfaceId, const uint8_t subnet) { BMCWEB_LOG_DEBUG << "Setting the Hypervisor subnet : " << subnet << " on Iface: " << ethIfaceId; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { BMCWEB_LOG_ERROR << "DBUS response error " << ec; @@ -402,21 +402,21 @@ inline void /** * @brief Sets the Hypervisor Interface Gateway DBUS * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] gateway Gateway from the incoming request * @param[in] ethIfaceId Hypervisor Interface Id * * @return None. */ -inline void - setHypervisorIPv4Gateway(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& gateway) +inline void setHypervisorIPv4Gateway( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& gateway) { BMCWEB_LOG_DEBUG << "Setting the DefaultGateway to the last configured gateway"; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { BMCWEB_LOG_ERROR << "DBUS response error " << ec; diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp index a5725f1e9e..64b097a360 100644 --- a/redfish-core/lib/led.hpp +++ b/redfish-core/lib/led.hpp @@ -27,34 +27,34 @@ namespace redfish /** * @brief Retrieves identify led group properties over dbus * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ // TODO (Gunnar): Remove IndicatorLED after enough time has passed inline void - getIndicatorLedState(const std::shared_ptr<bmcweb::AsyncResp>& aResp) + getIndicatorLedState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get led groups"; sdbusplus::asio::getProperty<bool>( *crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager", "/xyz/openbmc_project/led/groups/enclosure_identify_blink", "xyz.openbmc_project.Led.Group", "Asserted", - [aResp](const boost::system::error_code& ec, const bool blinking) { + [asyncResp](const boost::system::error_code& ec, const bool blinking) { // Some systems may not have enclosure_identify_blink object so // proceed to get enclosure_identify state. if (ec == boost::system::errc::invalid_argument) { BMCWEB_LOG_DEBUG << "Get identity blinking LED failed, missmatch in property type"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } // Blinking ON, no need to check enclosure_identify assert. if (!ec && blinking) { - aResp->res.jsonValue["IndicatorLED"] = "Blinking"; + asyncResp->res.jsonValue["IndicatorLED"] = "Blinking"; return; } @@ -63,12 +63,13 @@ inline void "xyz.openbmc_project.LED.GroupManager", "/xyz/openbmc_project/led/groups/enclosure_identify", "xyz.openbmc_project.Led.Group", "Asserted", - [aResp](const boost::system::error_code& ec2, const bool ledOn) { + [asyncResp](const boost::system::error_code& ec2, + const bool ledOn) { if (ec2 == boost::system::errc::invalid_argument) { BMCWEB_LOG_DEBUG << "Get enclosure identity led failed, missmatch in property type"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -79,11 +80,11 @@ inline void if (ledOn) { - aResp->res.jsonValue["IndicatorLED"] = "Lit"; + asyncResp->res.jsonValue["IndicatorLED"] = "Lit"; } else { - aResp->res.jsonValue["IndicatorLED"] = "Off"; + asyncResp->res.jsonValue["IndicatorLED"] = "Off"; } }); }); @@ -92,14 +93,14 @@ inline void /** * @brief Sets identify led group properties * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] ledState LED state passed from request * * @return None. */ // TODO (Gunnar): Remove IndicatorLED after enough time has passed inline void - setIndicatorLedState(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + setIndicatorLedState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& ledState) { BMCWEB_LOG_DEBUG << "Set led groups"; @@ -116,12 +117,13 @@ inline void } else if (ledState != "Off") { - messages::propertyValueNotInList(aResp->res, ledState, "IndicatorLED"); + messages::propertyValueNotInList(asyncResp->res, ledState, + "IndicatorLED"); return; } crow::connections::systemBus->async_method_call( - [aResp, ledOn, + [asyncResp, ledOn, ledBlinkng](const boost::system::error_code& ec) mutable { if (ec) { @@ -134,14 +136,14 @@ inline void } } crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - messages::success(aResp->res); + messages::success(asyncResp->res); }, "xyz.openbmc_project.LED.GroupManager", "/xyz/openbmc_project/led/groups/enclosure_identify", @@ -159,33 +161,33 @@ inline void /** * @brief Retrieves identify led group properties over dbus * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ -inline void - getLocationIndicatorActive(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void getLocationIndicatorActive( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get LocationIndicatorActive"; sdbusplus::asio::getProperty<bool>( *crow::connections::systemBus, "xyz.openbmc_project.LED.GroupManager", "/xyz/openbmc_project/led/groups/enclosure_identify_blink", "xyz.openbmc_project.Led.Group", "Asserted", - [aResp](const boost::system::error_code& ec, const bool blinking) { + [asyncResp](const boost::system::error_code& ec, const bool blinking) { // Some systems may not have enclosure_identify_blink object so // proceed to get enclosure_identify state. if (ec == boost::system::errc::invalid_argument) { BMCWEB_LOG_DEBUG << "Get identity blinking LED failed, missmatch in property type"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } // Blinking ON, no need to check enclosure_identify assert. if (!ec && blinking) { - aResp->res.jsonValue["LocationIndicatorActive"] = true; + asyncResp->res.jsonValue["LocationIndicatorActive"] = true; return; } @@ -194,12 +196,13 @@ inline void "xyz.openbmc_project.LED.GroupManager", "/xyz/openbmc_project/led/groups/enclosure_identify", "xyz.openbmc_project.Led.Group", "Asserted", - [aResp](const boost::system::error_code& ec2, const bool ledOn) { + [asyncResp](const boost::system::error_code& ec2, + const bool ledOn) { if (ec2 == boost::system::errc::invalid_argument) { BMCWEB_LOG_DEBUG << "Get enclosure identity led failed, missmatch in property type"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -208,7 +211,7 @@ inline void return; } - aResp->res.jsonValue["LocationIndicatorActive"] = ledOn; + asyncResp->res.jsonValue["LocationIndicatorActive"] = ledOn; }); }); } @@ -216,30 +219,29 @@ inline void /** * @brief Sets identify led group properties * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] ledState LED state passed from request * * @return None. */ -inline void - setLocationIndicatorActive(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const bool ledState) +inline void setLocationIndicatorActive( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const bool ledState) { BMCWEB_LOG_DEBUG << "Set LocationIndicatorActive"; crow::connections::systemBus->async_method_call( - [aResp, ledState](const boost::system::error_code& ec) mutable { + [asyncResp, ledState](const boost::system::error_code& ec) mutable { if (ec) { // Some systems may not have enclosure_identify_blink object so // lets set enclosure_identify state also if // enclosure_identify_blink failed crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index b0c711b2bf..ceb80d4320 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -3686,7 +3686,7 @@ inline static bool parsePostCode(const std::string& postCodeID, } static bool fillPostCodeEntry( - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const boost::container::flat_map< uint64_t, std::tuple<uint64_t, std::vector<uint8_t>>>& postcode, const uint16_t bootIndex, const uint64_t codeIndex = 0, @@ -3808,11 +3808,11 @@ static bool fillPostCodeEntry( // that entry in this case if (codeIndex != 0) { - aResp->res.jsonValue.update(bmcLogEntry); + asyncResp->res.jsonValue.update(bmcLogEntry); return true; } - nlohmann::json& logEntryArray = aResp->res.jsonValue["Members"]; + nlohmann::json& logEntryArray = asyncResp->res.jsonValue["Members"]; logEntryArray.emplace_back(std::move(bmcLogEntry)); } @@ -3820,27 +3820,28 @@ static bool fillPostCodeEntry( return false; } -static void getPostCodeForEntry(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& entryId) +static void + getPostCodeForEntry(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& entryId) { uint16_t bootIndex = 0; uint64_t codeIndex = 0; if (!parsePostCode(entryId, codeIndex, bootIndex)) { // Requested ID was not found - messages::resourceNotFound(aResp->res, "LogEntry", entryId); + messages::resourceNotFound(asyncResp->res, "LogEntry", entryId); return; } if (bootIndex == 0 || codeIndex == 0) { // 0 is an invalid index - messages::resourceNotFound(aResp->res, "LogEntry", entryId); + messages::resourceNotFound(asyncResp->res, "LogEntry", entryId); return; } crow::connections::systemBus->async_method_call( - [aResp, entryId, bootIndex, + [asyncResp, entryId, bootIndex, codeIndex](const boost::system::error_code& ec, const boost::container::flat_map< uint64_t, std::tuple<uint64_t, std::vector<uint8_t>>>& @@ -3848,19 +3849,19 @@ static void getPostCodeForEntry(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (ec) { BMCWEB_LOG_DEBUG << "DBUS POST CODE PostCode response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (postcode.empty()) { - messages::resourceNotFound(aResp->res, "LogEntry", entryId); + messages::resourceNotFound(asyncResp->res, "LogEntry", entryId); return; } - if (!fillPostCodeEntry(aResp, postcode, bootIndex, codeIndex)) + if (!fillPostCodeEntry(asyncResp, postcode, bootIndex, codeIndex)) { - messages::resourceNotFound(aResp->res, "LogEntry", entryId); + messages::resourceNotFound(asyncResp->res, "LogEntry", entryId); return; } }, @@ -3870,14 +3871,13 @@ static void getPostCodeForEntry(const std::shared_ptr<bmcweb::AsyncResp>& aResp, bootIndex); } -static void getPostCodeForBoot(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const uint16_t bootIndex, - const uint16_t bootCount, - const uint64_t entryCount, size_t skip, - size_t top) +static void + getPostCodeForBoot(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const uint16_t bootIndex, const uint16_t bootCount, + const uint64_t entryCount, size_t skip, size_t top) { crow::connections::systemBus->async_method_call( - [aResp, bootIndex, bootCount, entryCount, skip, + [asyncResp, bootIndex, bootCount, entryCount, skip, top](const boost::system::error_code& ec, const boost::container::flat_map< uint64_t, std::tuple<uint64_t, std::vector<uint8_t>>>& @@ -3885,7 +3885,7 @@ static void getPostCodeForBoot(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (ec) { BMCWEB_LOG_DEBUG << "DBUS POST CODE PostCode response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -3902,21 +3902,21 @@ static void getPostCodeForBoot(const std::shared_ptr<bmcweb::AsyncResp>& aResp, std::min(static_cast<uint64_t>(top + skip), endCount) - entryCount; - fillPostCodeEntry(aResp, postcode, bootIndex, 0, thisBootSkip, - thisBootTop); + fillPostCodeEntry(asyncResp, postcode, bootIndex, 0, + thisBootSkip, thisBootTop); } - aResp->res.jsonValue["Members@odata.count"] = endCount; + asyncResp->res.jsonValue["Members@odata.count"] = endCount; } // continue to previous bootIndex if (bootIndex < bootCount) { - getPostCodeForBoot(aResp, static_cast<uint16_t>(bootIndex + 1), + getPostCodeForBoot(asyncResp, static_cast<uint16_t>(bootIndex + 1), bootCount, endCount, skip, top); } else if (skip + top < endCount) { - aResp->res.jsonValue["Members@odata.nextLink"] = + asyncResp->res.jsonValue["Members@odata.nextLink"] = "/redfish/v1/Systems/system/LogServices/PostCodes/Entries?$skip=" + std::to_string(skip + top); } @@ -3928,7 +3928,7 @@ static void getPostCodeForBoot(const std::shared_ptr<bmcweb::AsyncResp>& aResp, } static void - getCurrentBootNumber(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + getCurrentBootNumber(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, size_t skip, size_t top) { uint64_t entryCount = 0; @@ -3937,15 +3937,15 @@ static void "xyz.openbmc_project.State.Boot.PostCode0", "/xyz/openbmc_project/State/Boot/PostCode0", "xyz.openbmc_project.State.Boot.PostCode", "CurrentBootCycleCount", - [aResp, entryCount, skip, top](const boost::system::error_code& ec, - const uint16_t bootCount) { + [asyncResp, entryCount, skip, top](const boost::system::error_code& ec, + const uint16_t bootCount) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - getPostCodeForBoot(aResp, 1, bootCount, entryCount, skip, top); + getPostCodeForBoot(asyncResp, 1, bootCount, entryCount, skip, top); }); } diff --git a/redfish-core/lib/manager_diagnostic_data.hpp b/redfish-core/lib/manager_diagnostic_data.hpp index 14b75feaf1..ec742310c3 100644 --- a/redfish-core/lib/manager_diagnostic_data.hpp +++ b/redfish-core/lib/manager_diagnostic_data.hpp @@ -16,10 +16,9 @@ namespace redfish { -inline void - afterGetManagerStartTime(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const boost::system::error_code& ec, - uint64_t bmcwebResetTime) +inline void afterGetManagerStartTime( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const boost::system::error_code& ec, uint64_t bmcwebResetTime) { if (ec) { @@ -39,7 +38,7 @@ inline void if (runTime < steady_clock::duration::zero()) { BMCWEB_LOG_CRITICAL << "Uptime was negative????"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -50,17 +49,17 @@ inline void using SecondsFloat = std::chrono::duration<double>; SecondsFloat sec = std::chrono::duration_cast<SecondsFloat>(milli); - aResp->res.jsonValue["ServiceRootUptimeSeconds"] = sec.count(); + asyncResp->res.jsonValue["ServiceRootUptimeSeconds"] = sec.count(); } -inline void - managerGetServiceRootUptime(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void managerGetServiceRootUptime( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { sdbusplus::asio::getProperty<uint64_t>( *crow::connections::systemBus, "org.freedesktop.systemd1", "/org/freedesktop/systemd1/unit/bmcweb_2eservice", "org.freedesktop.systemd1.Unit", "ActiveEnterTimestampMonotonic", - std::bind_front(afterGetManagerStartTime, aResp)); + std::bind_front(afterGetManagerStartTime, asyncResp)); } /** * handleManagerDiagnosticData supports ManagerDiagnosticData. diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp index 827cfdb138..21f74b77c8 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp @@ -1692,12 +1692,12 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues> /** * @brief Retrieves BMC manager location data over DBus * - * @param[in] aResp Shared pointer for completing asynchronous calls + * @param[in] asyncResp Shared pointer for completing asynchronous calls * @param[in] connectionName - service name * @param[in] path - object path * @return none */ -inline void getLocation(const std::shared_ptr<bmcweb::AsyncResp>& aResp, +inline void getLocation(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& connectionName, const std::string& path) { @@ -1706,23 +1706,23 @@ inline void getLocation(const std::shared_ptr<bmcweb::AsyncResp>& aResp, sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, connectionName, path, "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode", - [aResp](const boost::system::error_code& ec, - const std::string& property) { + [asyncResp](const boost::system::error_code& ec, + const std::string& property) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error for " "Location"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - aResp->res.jsonValue["Location"]["PartLocation"]["ServiceLabel"] = + asyncResp->res.jsonValue["Location"]["PartLocation"]["ServiceLabel"] = property; }); } // avoid name collision systems.hpp inline void - managerGetLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& aResp) + managerGetLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Getting Manager Last Reset Time"; @@ -1730,8 +1730,8 @@ inline void *crow::connections::systemBus, "xyz.openbmc_project.State.BMC", "/xyz/openbmc_project/state/bmc0", "xyz.openbmc_project.State.BMC", "LastRebootTime", - [aResp](const boost::system::error_code& ec, - const uint64_t lastResetTime) { + [asyncResp](const boost::system::error_code& ec, + const uint64_t lastResetTime) { if (ec) { BMCWEB_LOG_DEBUG << "D-BUS response error " << ec; @@ -1743,7 +1743,7 @@ inline void uint64_t lastResetTimeStamp = lastResetTime / 1000; // Convert to ISO 8601 standard - aResp->res.jsonValue["LastResetTime"] = + asyncResp->res.jsonValue["LastResetTime"] = redfish::time_utils::getDateTimeUint(lastResetTimeStamp); }); } @@ -1751,20 +1751,20 @@ inline void /** * @brief Set the running firmware image * - * @param[i,o] aResp - Async response object + * @param[i,o] asyncResp - Async response object * @param[i] runningFirmwareTarget - Image to make the running image * * @return void */ inline void - setActiveFirmwareImage(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + setActiveFirmwareImage(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& runningFirmwareTarget) { // Get the Id from /redfish/v1/UpdateService/FirmwareInventory/<Id> std::string::size_type idPos = runningFirmwareTarget.rfind('/'); if (idPos == std::string::npos) { - messages::propertyValueNotInList(aResp->res, runningFirmwareTarget, + messages::propertyValueNotInList(asyncResp->res, runningFirmwareTarget, "@odata.id"); BMCWEB_LOG_DEBUG << "Can't parse firmware ID!"; return; @@ -1772,7 +1772,7 @@ inline void idPos++; if (idPos >= runningFirmwareTarget.size()) { - messages::propertyValueNotInList(aResp->res, runningFirmwareTarget, + messages::propertyValueNotInList(asyncResp->res, runningFirmwareTarget, "@odata.id"); BMCWEB_LOG_DEBUG << "Invalid firmware ID."; return; @@ -1781,20 +1781,20 @@ inline void // Make sure the image is valid before setting priority crow::connections::systemBus->async_method_call( - [aResp, firmwareId, + [asyncResp, firmwareId, runningFirmwareTarget](const boost::system::error_code& ec, dbus::utility::ManagedObjectType& subtree) { if (ec) { BMCWEB_LOG_DEBUG << "D-Bus response error getting objects."; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (subtree.empty()) { BMCWEB_LOG_DEBUG << "Can't find image!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -1825,8 +1825,8 @@ inline void if (!foundImage) { - messages::propertyValueNotInList(aResp->res, runningFirmwareTarget, - "@odata.id"); + messages::propertyValueNotInList( + asyncResp->res, runningFirmwareTarget, "@odata.id"); BMCWEB_LOG_DEBUG << "Invalid firmware ID."; return; } @@ -1838,14 +1838,14 @@ inline void // An addition could be a Redfish Setting like // ActiveSoftwareImageApplyTime and support OnReset crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "D-Bus response error setting."; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - doBMCGracefulRestart(aResp); + doBMCGracefulRestart(asyncResp); }, "xyz.openbmc_project.Software.BMC.Updater", @@ -1859,7 +1859,7 @@ inline void "GetManagedObjects"); } -inline void setDateTime(std::shared_ptr<bmcweb::AsyncResp> aResp, +inline void setDateTime(std::shared_ptr<bmcweb::AsyncResp> asyncResp, std::string datetime) { BMCWEB_LOG_DEBUG << "Set date time: " << datetime; @@ -1868,21 +1868,22 @@ inline void setDateTime(std::shared_ptr<bmcweb::AsyncResp> aResp, redfish::time_utils::dateStringToEpoch(datetime); if (!us) { - messages::propertyValueFormatError(aResp->res, datetime, "DateTime"); + messages::propertyValueFormatError(asyncResp->res, datetime, + "DateTime"); return; } crow::connections::systemBus->async_method_call( - [aResp{std::move(aResp)}, + [asyncResp{std::move(asyncResp)}, datetime{std::move(datetime)}](const boost::system::error_code& ec) { if (ec) { BMCWEB_LOG_DEBUG << "Failed to set elapsed time. " "DBUS response error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - aResp->res.jsonValue["DateTime"] = datetime; + asyncResp->res.jsonValue["DateTime"] = datetime; }, "xyz.openbmc_project.Time.Manager", "/xyz/openbmc_project/time/bmc", "org.freedesktop.DBus.Properties", "Set", diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp index 1f554ccfb6..328cc09203 100644 --- a/redfish-core/lib/memory.hpp +++ b/redfish-core/lib/memory.hpp @@ -152,7 +152,7 @@ inline std::string translateMemoryTypeToRedfish(const std::string& memoryType) return ""; } -inline void dimmPropToHex(const std::shared_ptr<bmcweb::AsyncResp>& aResp, +inline void dimmPropToHex(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const char* key, const uint16_t* value, const nlohmann::json::json_pointer& jsonPtr) { @@ -160,11 +160,11 @@ inline void dimmPropToHex(const std::shared_ptr<bmcweb::AsyncResp>& aResp, { return; } - aResp->res.jsonValue[jsonPtr][key] = "0x" + intToHexString(*value, 4); + asyncResp->res.jsonValue[jsonPtr][key] = "0x" + intToHexString(*value, 4); } inline void getPersistentMemoryProperties( - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const dbus::utility::DBusPropertiesMap& properties, const nlohmann::json::json_pointer& jsonPtr) { @@ -221,108 +221,111 @@ inline void getPersistentMemoryProperties( if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - dimmPropToHex(aResp, "ModuleManufacturerID", moduleManufacturerID, jsonPtr); - dimmPropToHex(aResp, "ModuleProductID", moduleProductID, jsonPtr); - dimmPropToHex(aResp, "MemorySubsystemControllerManufacturerID", + dimmPropToHex(asyncResp, "ModuleManufacturerID", moduleManufacturerID, + jsonPtr); + dimmPropToHex(asyncResp, "ModuleProductID", moduleProductID, jsonPtr); + dimmPropToHex(asyncResp, "MemorySubsystemControllerManufacturerID", subsystemVendorID, jsonPtr); - dimmPropToHex(aResp, "MemorySubsystemControllerProductID", + dimmPropToHex(asyncResp, "MemorySubsystemControllerProductID", subsystemDeviceID, jsonPtr); if (volatileRegionSizeLimitInKiB != nullptr) { - aResp->res.jsonValue[jsonPtr]["VolatileRegionSizeLimitMiB"] = + asyncResp->res.jsonValue[jsonPtr]["VolatileRegionSizeLimitMiB"] = (*volatileRegionSizeLimitInKiB) >> 10; } if (pmRegionSizeLimitInKiB != nullptr) { - aResp->res.jsonValue[jsonPtr]["PersistentRegionSizeLimitMiB"] = + asyncResp->res.jsonValue[jsonPtr]["PersistentRegionSizeLimitMiB"] = (*pmRegionSizeLimitInKiB) >> 10; } if (volatileSizeInKiB != nullptr) { - aResp->res.jsonValue[jsonPtr]["VolatileSizeMiB"] = + asyncResp->res.jsonValue[jsonPtr]["VolatileSizeMiB"] = (*volatileSizeInKiB) >> 10; } if (pmSizeInKiB != nullptr) { - aResp->res.jsonValue[jsonPtr]["NonVolatileSizeMiB"] = (*pmSizeInKiB) >> - 10; + asyncResp->res.jsonValue[jsonPtr]["NonVolatileSizeMiB"] = + (*pmSizeInKiB) >> 10; } if (cacheSizeInKB != nullptr) { - aResp->res.jsonValue[jsonPtr]["CacheSizeMiB"] = (*cacheSizeInKB >> 10); + asyncResp->res.jsonValue[jsonPtr]["CacheSizeMiB"] = + (*cacheSizeInKB >> 10); } if (voltaileRegionMaxSizeInKib != nullptr) { - aResp->res.jsonValue[jsonPtr]["VolatileRegionSizeMaxMiB"] = + asyncResp->res.jsonValue[jsonPtr]["VolatileRegionSizeMaxMiB"] = (*voltaileRegionMaxSizeInKib) >> 10; } if (pmRegionMaxSizeInKiB != nullptr) { - aResp->res.jsonValue[jsonPtr]["PersistentRegionSizeMaxMiB"] = + asyncResp->res.jsonValue[jsonPtr]["PersistentRegionSizeMaxMiB"] = (*pmRegionMaxSizeInKiB) >> 10; } if (allocationIncrementInKiB != nullptr) { - aResp->res.jsonValue[jsonPtr]["AllocationIncrementMiB"] = + asyncResp->res.jsonValue[jsonPtr]["AllocationIncrementMiB"] = (*allocationIncrementInKiB) >> 10; } if (allocationAlignmentInKiB != nullptr) { - aResp->res.jsonValue[jsonPtr]["AllocationAlignmentMiB"] = + asyncResp->res.jsonValue[jsonPtr]["AllocationAlignmentMiB"] = (*allocationAlignmentInKiB) >> 10; } if (volatileRegionNumberLimit != nullptr) { - aResp->res.jsonValue[jsonPtr]["VolatileRegionNumberLimit"] = + asyncResp->res.jsonValue[jsonPtr]["VolatileRegionNumberLimit"] = *volatileRegionNumberLimit; } if (pmRegionNumberLimit != nullptr) { - aResp->res.jsonValue[jsonPtr]["PersistentRegionNumberLimit"] = + asyncResp->res.jsonValue[jsonPtr]["PersistentRegionNumberLimit"] = *pmRegionNumberLimit; } if (spareDeviceCount != nullptr) { - aResp->res.jsonValue[jsonPtr]["SpareDeviceCount"] = *spareDeviceCount; + asyncResp->res.jsonValue[jsonPtr]["SpareDeviceCount"] = + *spareDeviceCount; } if (isSpareDeviceInUse != nullptr) { - aResp->res.jsonValue[jsonPtr]["IsSpareDeviceEnabled"] = + asyncResp->res.jsonValue[jsonPtr]["IsSpareDeviceEnabled"] = *isSpareDeviceInUse; } if (isRankSpareEnabled != nullptr) { - aResp->res.jsonValue[jsonPtr]["IsRankSpareEnabled"] = + asyncResp->res.jsonValue[jsonPtr]["IsRankSpareEnabled"] = *isRankSpareEnabled; } if (maxAveragePowerLimitmW != nullptr) { - aResp->res.jsonValue[jsonPtr]["MaxTDPMilliWatts"] = + asyncResp->res.jsonValue[jsonPtr]["MaxTDPMilliWatts"] = *maxAveragePowerLimitmW; } if (configurationLocked != nullptr) { - aResp->res.jsonValue[jsonPtr]["ConfigurationLocked"] = + asyncResp->res.jsonValue[jsonPtr]["ConfigurationLocked"] = *configurationLocked; } @@ -335,8 +338,8 @@ inline void getPersistentMemoryProperties( { if (allowedMemoryModes->ends_with(v)) { - aResp->res.jsonValue[jsonPtr]["OperatingMemoryModes"].push_back( - v); + asyncResp->res.jsonValue[jsonPtr]["OperatingMemoryModes"] + .push_back(v); break; } } @@ -351,7 +354,7 @@ inline void getPersistentMemoryProperties( { if (memoryMedia->ends_with(v)) { - aResp->res.jsonValue[jsonPtr]["MemoryMedia"].push_back(v); + asyncResp->res.jsonValue[jsonPtr]["MemoryMedia"].push_back(v); break; } } @@ -359,46 +362,46 @@ inline void getPersistentMemoryProperties( if (configurationLockCapable != nullptr) { - aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] - ["ConfigurationLockCapable"] = + asyncResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["ConfigurationLockCapable"] = *configurationLockCapable; } if (dataLockCapable != nullptr) { - aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] - ["DataLockCapable"] = *dataLockCapable; + asyncResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["DataLockCapable"] = *dataLockCapable; } if (passphraseCapable != nullptr) { - aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] - ["PassphraseCapable"] = *passphraseCapable; + asyncResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["PassphraseCapable"] = *passphraseCapable; } if (maxPassphraseCount != nullptr) { - aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] - ["MaxPassphraseCount"] = *maxPassphraseCount; + asyncResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["MaxPassphraseCount"] = *maxPassphraseCount; } if (passphraseLockLimit != nullptr) { - aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] - ["PassphraseLockLimit"] = *passphraseLockLimit; + asyncResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["PassphraseLockLimit"] = *passphraseLockLimit; } } inline void assembleDimmProperties(std::string_view dimmId, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const dbus::utility::DBusPropertiesMap& properties, const nlohmann::json::json_pointer& jsonPtr) { - aResp->res.jsonValue[jsonPtr]["Id"] = dimmId; - aResp->res.jsonValue[jsonPtr]["Name"] = "DIMM Slot"; - aResp->res.jsonValue[jsonPtr]["Status"]["State"] = "Enabled"; - aResp->res.jsonValue[jsonPtr]["Status"]["Health"] = "OK"; + asyncResp->res.jsonValue[jsonPtr]["Id"] = dimmId; + asyncResp->res.jsonValue[jsonPtr]["Name"] = "DIMM Slot"; + asyncResp->res.jsonValue[jsonPtr]["Status"]["State"] = "Enabled"; + asyncResp->res.jsonValue[jsonPtr]["Status"]["Health"] = "OK"; const uint16_t* memoryDataWidth = nullptr; const size_t* memorySizeInKB = nullptr; @@ -437,49 +440,50 @@ inline void if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (memoryDataWidth != nullptr) { - aResp->res.jsonValue[jsonPtr]["DataWidthBits"] = *memoryDataWidth; + asyncResp->res.jsonValue[jsonPtr]["DataWidthBits"] = *memoryDataWidth; } if (memorySizeInKB != nullptr) { - aResp->res.jsonValue[jsonPtr]["CapacityMiB"] = (*memorySizeInKB >> 10); + asyncResp->res.jsonValue[jsonPtr]["CapacityMiB"] = + (*memorySizeInKB >> 10); } if (partNumber != nullptr) { - aResp->res.jsonValue[jsonPtr]["PartNumber"] = *partNumber; + asyncResp->res.jsonValue[jsonPtr]["PartNumber"] = *partNumber; } if (serialNumber != nullptr) { - aResp->res.jsonValue[jsonPtr]["SerialNumber"] = *serialNumber; + asyncResp->res.jsonValue[jsonPtr]["SerialNumber"] = *serialNumber; } if (manufacturer != nullptr) { - aResp->res.jsonValue[jsonPtr]["Manufacturer"] = *manufacturer; + asyncResp->res.jsonValue[jsonPtr]["Manufacturer"] = *manufacturer; } if (revisionCode != nullptr) { - aResp->res.jsonValue[jsonPtr]["FirmwareRevision"] = + asyncResp->res.jsonValue[jsonPtr]["FirmwareRevision"] = std::to_string(*revisionCode); } if (present != nullptr && !*present) { - aResp->res.jsonValue[jsonPtr]["Status"]["State"] = "Absent"; + asyncResp->res.jsonValue[jsonPtr]["Status"]["State"] = "Absent"; } if (memoryTotalWidth != nullptr) { - aResp->res.jsonValue[jsonPtr]["BusWidthBits"] = *memoryTotalWidth; + asyncResp->res.jsonValue[jsonPtr]["BusWidthBits"] = *memoryTotalWidth; } if (ecc != nullptr) @@ -491,7 +495,7 @@ inline void { if (ecc->ends_with(v)) { - aResp->res.jsonValue[jsonPtr]["ErrorCorrection"] = v; + asyncResp->res.jsonValue[jsonPtr]["ErrorCorrection"] = v; break; } } @@ -508,7 +512,7 @@ inline void { if (formFactor->ends_with(v)) { - aResp->res.jsonValue[jsonPtr]["BaseModuleType"] = v; + asyncResp->res.jsonValue[jsonPtr]["BaseModuleType"] = v; break; } } @@ -517,7 +521,7 @@ inline void if (allowedSpeedsMT != nullptr) { nlohmann::json& jValue = - aResp->res.jsonValue[jsonPtr]["AllowedSpeedsMHz"]; + asyncResp->res.jsonValue[jsonPtr]["AllowedSpeedsMHz"]; jValue = nlohmann::json::array(); for (uint16_t subVal : *allowedSpeedsMT) { @@ -527,13 +531,13 @@ inline void if (memoryAttributes != nullptr) { - aResp->res.jsonValue[jsonPtr]["RankCount"] = + asyncResp->res.jsonValue[jsonPtr]["RankCount"] = static_cast<uint64_t>(*memoryAttributes); } if (memoryConfiguredSpeedInMhz != nullptr) { - aResp->res.jsonValue[jsonPtr]["OperatingSpeedMhz"] = + asyncResp->res.jsonValue[jsonPtr]["OperatingSpeedMhz"] = *memoryConfiguredSpeedInMhz; } @@ -545,67 +549,68 @@ inline void // so just leave off if (!memoryDeviceType.empty()) { - aResp->res.jsonValue[jsonPtr]["MemoryDeviceType"] = + asyncResp->res.jsonValue[jsonPtr]["MemoryDeviceType"] = memoryDeviceType; } if (memoryType->find("DDR") != std::string::npos) { - aResp->res.jsonValue[jsonPtr]["MemoryType"] = "DRAM"; + asyncResp->res.jsonValue[jsonPtr]["MemoryType"] = "DRAM"; } else if (memoryType->ends_with("Logical")) { - aResp->res.jsonValue[jsonPtr]["MemoryType"] = "IntelOptane"; + asyncResp->res.jsonValue[jsonPtr]["MemoryType"] = "IntelOptane"; } } if (channel != nullptr) { - aResp->res.jsonValue[jsonPtr]["MemoryLocation"]["Channel"] = *channel; + asyncResp->res.jsonValue[jsonPtr]["MemoryLocation"]["Channel"] = + *channel; } if (memoryController != nullptr) { - aResp->res.jsonValue[jsonPtr]["MemoryLocation"]["MemoryController"] = - *memoryController; + asyncResp->res.jsonValue[jsonPtr]["MemoryLocation"] + ["MemoryController"] = *memoryController; } if (slot != nullptr) { - aResp->res.jsonValue[jsonPtr]["MemoryLocation"]["Slot"] = *slot; + asyncResp->res.jsonValue[jsonPtr]["MemoryLocation"]["Slot"] = *slot; } if (socket != nullptr) { - aResp->res.jsonValue[jsonPtr]["MemoryLocation"]["Socket"] = *socket; + asyncResp->res.jsonValue[jsonPtr]["MemoryLocation"]["Socket"] = *socket; } if (sparePartNumber != nullptr) { - aResp->res.jsonValue[jsonPtr]["SparePartNumber"] = *sparePartNumber; + asyncResp->res.jsonValue[jsonPtr]["SparePartNumber"] = *sparePartNumber; } if (model != nullptr) { - aResp->res.jsonValue[jsonPtr]["Model"] = *model; + asyncResp->res.jsonValue[jsonPtr]["Model"] = *model; } if (locationCode != nullptr) { - aResp->res.jsonValue[jsonPtr]["Location"]["PartLocation"] - ["ServiceLabel"] = *locationCode; + asyncResp->res.jsonValue[jsonPtr]["Location"]["PartLocation"] + ["ServiceLabel"] = *locationCode; } - getPersistentMemoryProperties(aResp, properties, jsonPtr); + getPersistentMemoryProperties(asyncResp, properties, jsonPtr); } -inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, +inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& dimmId, const std::string& service, const std::string& objPath) { if constexpr (bmcwebEnableHealthPopulate) { - auto health = std::make_shared<HealthPopulate>(aResp); + auto health = std::make_shared<HealthPopulate>(asyncResp); health->selfPath = objPath; health->populate(); } @@ -613,21 +618,21 @@ inline void getDimmDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, BMCWEB_LOG_DEBUG << "Get available system components."; sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, objPath, "", - [dimmId, aResp{std::move(aResp)}]( + [dimmId, asyncResp{std::move(asyncResp)}]( const boost::system::error_code& ec, const dbus::utility::DBusPropertiesMap& properties) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - assembleDimmProperties(dimmId, aResp, properties, ""_json_pointer); + assembleDimmProperties(dimmId, asyncResp, properties, ""_json_pointer); }); } inline void assembleDimmPartitionData( - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const dbus::utility::DBusPropertiesMap& properties, const nlohmann::json::json_pointer& regionPtr) { @@ -645,7 +650,7 @@ inline void assembleDimmPartitionData( if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -676,34 +681,34 @@ inline void assembleDimmPartitionData( partition["SizeMiB"] = (*sizeInKiB >> 10); } - aResp->res.jsonValue[regionPtr].emplace_back(std::move(partition)); + asyncResp->res.jsonValue[regionPtr].emplace_back(std::move(partition)); } -inline void getDimmPartitionData(std::shared_ptr<bmcweb::AsyncResp> aResp, +inline void getDimmPartitionData(std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& service, const std::string& path) { sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, path, "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition", - [aResp{std::move(aResp)}]( + [asyncResp{std::move(asyncResp)}]( const boost::system::error_code& ec, const dbus::utility::DBusPropertiesMap& properties) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } nlohmann::json::json_pointer regionPtr = "/Regions"_json_pointer; - assembleDimmPartitionData(aResp, properties, regionPtr); + assembleDimmPartitionData(asyncResp, properties, regionPtr); } ); } -inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> aResp, +inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& dimmId) { BMCWEB_LOG_DEBUG << "Get available system dimm resources."; @@ -712,13 +717,13 @@ inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> aResp, "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition"}; dbus::utility::getSubTree( "/xyz/openbmc_project/inventory", 0, dimmInterfaces, - [dimmId, aResp{std::move(aResp)}]( + [dimmId, asyncResp{std::move(asyncResp)}]( const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreeResponse& subtree) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -734,7 +739,8 @@ inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> aResp, "xyz.openbmc_project.Inventory.Item.Dimm" && path.filename() == dimmId) { - getDimmDataByService(aResp, dimmId, service, rawPath); + getDimmDataByService(asyncResp, dimmId, service, + rawPath); found = true; } @@ -747,7 +753,7 @@ inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> aResp, "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition" && path.parent_path().filename() == dimmId) { - getDimmPartitionData(aResp, service, rawPath); + getDimmPartitionData(asyncResp, service, rawPath); } } } @@ -755,12 +761,12 @@ inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> aResp, // Object not found if (!found) { - messages::resourceNotFound(aResp->res, "Memory", dimmId); + messages::resourceNotFound(asyncResp->res, "Memory", dimmId); return; } // Set @odata only if object is found - aResp->res.jsonValue["@odata.type"] = "#Memory.v1_11_0.Memory"; - aResp->res.jsonValue["@odata.id"] = + asyncResp->res.jsonValue["@odata.type"] = "#Memory.v1_11_0.Memory"; + asyncResp->res.jsonValue["@odata.id"] = boost::urls::format("/redfish/v1/Systems/system/Memory/{}", dimmId); return; }); diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp index f98d6c8797..1c36b181ae 100644 --- a/redfish-core/lib/pcie.hpp +++ b/redfish-core/lib/pcie.hpp @@ -38,7 +38,7 @@ static constexpr std::array<std::string_view, 1> pcieDeviceInterface = { static inline void handlePCIeDevicePath( const std::string& pcieDeviceId, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const dbus::utility::MapperGetSubTreePathsResponse& pcieDevicePaths, const std::function<void(const std::string& pcieDevicePath, const std::string& service)>& callback) @@ -55,13 +55,13 @@ static inline void handlePCIeDevicePath( dbus::utility::getDbusObject( pcieDevicePath, {}, - [pcieDevicePath, aResp, + [pcieDevicePath, asyncResp, callback](const boost::system::error_code& ec, const dbus::utility::MapperGetObject& object) { if (ec || object.empty()) { BMCWEB_LOG_ERROR << "DBUS response error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } callback(pcieDevicePath, object.begin()->first); @@ -70,61 +70,63 @@ static inline void handlePCIeDevicePath( } BMCWEB_LOG_WARNING << "PCIe Device not found"; - messages::resourceNotFound(aResp->res, "PCIeDevice", pcieDeviceId); + messages::resourceNotFound(asyncResp->res, "PCIeDevice", pcieDeviceId); } static inline void getValidPCIeDevicePath( const std::string& pcieDeviceId, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::function<void(const std::string& pcieDevicePath, const std::string& service)>& callback) { dbus::utility::getSubTreePaths( inventoryPath, 0, pcieDeviceInterface, - [pcieDeviceId, aResp, + [pcieDeviceId, asyncResp, callback](const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreePathsResponse& pcieDevicePaths) { if (ec) { BMCWEB_LOG_ERROR << "D-Bus response error on GetSubTree " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - handlePCIeDevicePath(pcieDeviceId, aResp, pcieDevicePaths, callback); + handlePCIeDevicePath(pcieDeviceId, asyncResp, pcieDevicePaths, + callback); return; }); } static inline void handlePCIeDeviceCollectionGet( crow::App& app, const crow::Request& req, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& systemName) { - if (!redfish::setUpRedfishRoute(app, req, aResp)) + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } if (systemName != "system") { - messages::resourceNotFound(aResp->res, "ComputerSystem", systemName); + messages::resourceNotFound(asyncResp->res, "ComputerSystem", + systemName); return; } - aResp->res.addHeader(boost::beast::http::field::link, - "</redfish/v1/JsonSchemas/PCIeDeviceCollection/" - "PCIeDeviceCollection.json>; rel=describedby"); - aResp->res.jsonValue["@odata.type"] = + asyncResp->res.addHeader(boost::beast::http::field::link, + "</redfish/v1/JsonSchemas/PCIeDeviceCollection/" + "PCIeDeviceCollection.json>; rel=describedby"); + asyncResp->res.jsonValue["@odata.type"] = "#PCIeDeviceCollection.PCIeDeviceCollection"; - aResp->res.jsonValue["@odata.id"] = + asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/PCIeDevices"; - aResp->res.jsonValue["Name"] = "PCIe Device Collection"; - aResp->res.jsonValue["Description"] = "Collection of PCIe Devices"; - aResp->res.jsonValue["Members"] = nlohmann::json::array(); - aResp->res.jsonValue["Members@odata.count"] = 0; + asyncResp->res.jsonValue["Name"] = "PCIe Device Collection"; + asyncResp->res.jsonValue["Description"] = "Collection of PCIe Devices"; + asyncResp->res.jsonValue["Members"] = nlohmann::json::array(); + asyncResp->res.jsonValue["Members@odata.count"] = 0; collection_util::getCollectionMembers( - aResp, boost::urls::url("/redfish/v1/Systems/system/PCIeDevices"), + asyncResp, boost::urls::url("/redfish/v1/Systems/system/PCIeDevices"), pcieDeviceInterface); } @@ -178,48 +180,50 @@ inline std::optional<pcie_device::PCIeTypes> return std::nullopt; } -inline void getPCIeDeviceState(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& pcieDevicePath, - const std::string& service) +inline void + getPCIeDeviceState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& pcieDevicePath, + const std::string& service) { sdbusplus::asio::getProperty<bool>( *crow::connections::systemBus, service, pcieDevicePath, "xyz.openbmc_project.Inventory.Item", "Present", - [aResp](const boost::system::error_code& ec, const bool value) { + [asyncResp](const boost::system::error_code& ec, const bool value) { if (ec) { if (ec.value() != EBADR) { BMCWEB_LOG_ERROR << "DBUS response error for State"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); } return; } if (!value) { - aResp->res.jsonValue["Status"]["State"] = "Absent"; + asyncResp->res.jsonValue["Status"]["State"] = "Absent"; } }); } -inline void getPCIeDeviceAsset(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& pcieDevicePath, - const std::string& service) +inline void + getPCIeDeviceAsset(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& pcieDevicePath, + const std::string& service) { sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, pcieDevicePath, "xyz.openbmc_project.Inventory.Decorator.Asset", - [pcieDevicePath, - aResp{aResp}](const boost::system::error_code& ec, - const dbus::utility::DBusPropertiesMap& assetList) { + [pcieDevicePath, asyncResp{asyncResp}]( + const boost::system::error_code& ec, + const dbus::utility::DBusPropertiesMap& assetList) { if (ec) { if (ec.value() != EBADR) { BMCWEB_LOG_ERROR << "DBUS response error for Properties" << ec.value(); - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); } return; } @@ -237,32 +241,32 @@ inline void getPCIeDeviceAsset(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (manufacturer != nullptr) { - aResp->res.jsonValue["Manufacturer"] = *manufacturer; + asyncResp->res.jsonValue["Manufacturer"] = *manufacturer; } if (model != nullptr) { - aResp->res.jsonValue["Model"] = *model; + asyncResp->res.jsonValue["Model"] = *model; } if (partNumber != nullptr) { - aResp->res.jsonValue["PartNumber"] = *partNumber; + asyncResp->res.jsonValue["PartNumber"] = *partNumber; } if (serialNumber != nullptr) { - aResp->res.jsonValue["SerialNumber"] = *serialNumber; + asyncResp->res.jsonValue["SerialNumber"] = *serialNumber; } if (sparePartNumber != nullptr && !sparePartNumber->empty()) { - aResp->res.jsonValue["SparePartNumber"] = *sparePartNumber; + asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber; } }); } @@ -321,7 +325,7 @@ inline void addPCIeDeviceProperties( } inline void getPCIeDeviceProperties( - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& pcieDevicePath, const std::string& service, const std::function<void( const dbus::utility::DBusPropertiesMap& pcieDevProperties)>&& callback) @@ -329,7 +333,7 @@ inline void getPCIeDeviceProperties( sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, pcieDevicePath, "xyz.openbmc_project.Inventory.Item.PCIeDevice", - [aResp, + [asyncResp, callback](const boost::system::error_code& ec, const dbus::utility::DBusPropertiesMap& pcieDevProperties) { if (ec) @@ -337,7 +341,7 @@ inline void getPCIeDeviceProperties( if (ec.value() != EBADR) { BMCWEB_LOG_ERROR << "DBUS response error for Properties"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); } return; } @@ -346,47 +350,49 @@ inline void getPCIeDeviceProperties( } inline void addPCIeDeviceCommonProperties( - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& pcieDeviceId) { - aResp->res.addHeader( + asyncResp->res.addHeader( boost::beast::http::field::link, "</redfish/v1/JsonSchemas/PCIeDevice/PCIeDevice.json>; rel=describedby"); - aResp->res.jsonValue["@odata.type"] = "#PCIeDevice.v1_9_0.PCIeDevice"; - aResp->res.jsonValue["@odata.id"] = boost::urls::format( + asyncResp->res.jsonValue["@odata.type"] = "#PCIeDevice.v1_9_0.PCIeDevice"; + asyncResp->res.jsonValue["@odata.id"] = boost::urls::format( "/redfish/v1/Systems/system/PCIeDevices/{}", pcieDeviceId); - aResp->res.jsonValue["Name"] = "PCIe Device"; - aResp->res.jsonValue["Id"] = pcieDeviceId; - aResp->res.jsonValue["Status"]["State"] = "Enabled"; + asyncResp->res.jsonValue["Name"] = "PCIe Device"; + asyncResp->res.jsonValue["Id"] = pcieDeviceId; + asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; } -inline void handlePCIeDeviceGet(App& app, const crow::Request& req, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& systemName, - const std::string& pcieDeviceId) +inline void + handlePCIeDeviceGet(App& app, const crow::Request& req, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& systemName, + const std::string& pcieDeviceId) { - if (!redfish::setUpRedfishRoute(app, req, aResp)) + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } if (systemName != "system") { - messages::resourceNotFound(aResp->res, "ComputerSystem", systemName); + messages::resourceNotFound(asyncResp->res, "ComputerSystem", + systemName); return; } getValidPCIeDevicePath( - pcieDeviceId, aResp, - [aResp, pcieDeviceId](const std::string& pcieDevicePath, - const std::string& service) { - addPCIeDeviceCommonProperties(aResp, pcieDeviceId); - getPCIeDeviceAsset(aResp, pcieDevicePath, service); - getPCIeDeviceState(aResp, pcieDevicePath, service); + pcieDeviceId, asyncResp, + [asyncResp, pcieDeviceId](const std::string& pcieDevicePath, + const std::string& service) { + addPCIeDeviceCommonProperties(asyncResp, pcieDeviceId); + getPCIeDeviceAsset(asyncResp, pcieDevicePath, service); + getPCIeDeviceState(asyncResp, pcieDevicePath, service); getPCIeDeviceProperties( - aResp, pcieDevicePath, service, - [aResp, pcieDeviceId]( + asyncResp, pcieDevicePath, service, + [asyncResp, pcieDeviceId]( const dbus::utility::DBusPropertiesMap& pcieDevProperties) { - addPCIeDeviceProperties(aResp->res, pcieDeviceId, + addPCIeDeviceProperties(asyncResp->res, pcieDeviceId, pcieDevProperties); }); }); @@ -439,34 +445,35 @@ inline void addPCIeFunctionList( inline void handlePCIeFunctionCollectionGet( App& app, const crow::Request& req, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& pcieDeviceId) { - if (!redfish::setUpRedfishRoute(app, req, aResp)) + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } getValidPCIeDevicePath( - pcieDeviceId, aResp, - [aResp, pcieDeviceId](const std::string& pcieDevicePath, - const std::string& service) { - aResp->res.addHeader( + pcieDeviceId, asyncResp, + [asyncResp, pcieDeviceId](const std::string& pcieDevicePath, + const std::string& service) { + asyncResp->res.addHeader( boost::beast::http::field::link, "</redfish/v1/JsonSchemas/PCIeFunctionCollection/PCIeFunctionCollection.json>; rel=describedby"); - aResp->res.jsonValue["@odata.type"] = + asyncResp->res.jsonValue["@odata.type"] = "#PCIeFunctionCollection.PCIeFunctionCollection"; - aResp->res.jsonValue["@odata.id"] = boost::urls::format( + asyncResp->res.jsonValue["@odata.id"] = boost::urls::format( "/redfish/v1/Systems/system/PCIeDevices/{}/PCIeFunctions", pcieDeviceId); - aResp->res.jsonValue["Name"] = "PCIe Function Collection"; - aResp->res.jsonValue["Description"] = + asyncResp->res.jsonValue["Name"] = "PCIe Function Collection"; + asyncResp->res.jsonValue["Description"] = "Collection of PCIe Functions for PCIe Device " + pcieDeviceId; getPCIeDeviceProperties( - aResp, pcieDevicePath, service, - [aResp, pcieDeviceId]( + asyncResp, pcieDevicePath, service, + [asyncResp, pcieDeviceId]( const dbus::utility::DBusPropertiesMap& pcieDevProperties) { - addPCIeFunctionList(aResp->res, pcieDeviceId, pcieDevProperties); + addPCIeFunctionList(asyncResp->res, pcieDeviceId, + pcieDevProperties); }); }); } @@ -576,11 +583,11 @@ inline void addPCIeFunctionCommonProperties(crow::Response& resp, inline void handlePCIeFunctionGet(App& app, const crow::Request& req, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& pcieDeviceId, const std::string& pcieFunctionIdStr) { - if (!redfish::setUpRedfishRoute(app, req, aResp)) + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } @@ -589,31 +596,25 @@ inline void &*pcieFunctionIdStr.begin(), &*pcieFunctionIdStr.end(), pcieFunctionId); if (result.ec != std::errc{} || result.ptr != &*pcieFunctionIdStr.end()) { - messages::resourceNotFound(aResp->res, "PCIeFunction", + messages::resourceNotFound(asyncResp->res, "PCIeFunction", pcieFunctionIdStr); return; } - getValidPCIeDevicePath( - pcieDeviceId, aResp, - [aResp, pcieDeviceId, pcieFunctionId](const std::string& pcieDevicePath, - const std::string& service) { + getValidPCIeDevicePath(pcieDeviceId, asyncResp, + [asyncResp, pcieDeviceId, + pcieFunctionId](const std::string& pcieDevicePath, + const std::string& service) { getPCIeDeviceProperties( - aResp, pcieDevicePath, service, - [aResp, pcieDeviceId, pcieFunctionId]( + asyncResp, pcieDevicePath, service, + [asyncResp, pcieDeviceId, pcieFunctionId]( const dbus::utility::DBusPropertiesMap& pcieDevProperties) { - if (!validatePCIeFunctionId(pcieFunctionId, pcieDevProperties)) - { - messages::resourceNotFound(aResp->res, "PCIeFunction", - std::to_string(pcieFunctionId)); - return; - } - addPCIeFunctionCommonProperties(aResp->res, pcieDeviceId, + addPCIeFunctionCommonProperties(asyncResp->res, pcieDeviceId, pcieFunctionId); - addPCIeFunctionProperties(aResp->res, pcieFunctionId, + addPCIeFunctionProperties(asyncResp->res, pcieFunctionId, pcieDevProperties); }); - }); + }); } inline void requestRoutesSystemPCIeFunction(App& app) diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp index 90938c9d25..a2c49a630f 100644 --- a/redfish-core/lib/processor.hpp +++ b/redfish-core/lib/processor.hpp @@ -51,11 +51,11 @@ constexpr std::array<std::string_view, 2> processorInterfaces = { * @brief Fill out uuid info of a processor by * requesting data from the given D-Bus object. * - * @param[in,out] aResp Async HTTP response. + * @param[in,out] asyncResp Async HTTP response. * @param[in] service D-Bus service to query. * @param[in] objPath D-Bus object to query. */ -inline void getProcessorUUID(std::shared_ptr<bmcweb::AsyncResp> aResp, +inline void getProcessorUUID(std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& service, const std::string& objPath) { @@ -63,27 +63,27 @@ inline void getProcessorUUID(std::shared_ptr<bmcweb::AsyncResp> aResp, sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, service, objPath, "xyz.openbmc_project.Common.UUID", "UUID", - [objPath, aResp{std::move(aResp)}](const boost::system::error_code& ec, - const std::string& property) { + [objPath, asyncResp{std::move(asyncResp)}]( + const boost::system::error_code& ec, const std::string& property) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - aResp->res.jsonValue["UUID"] = property; + asyncResp->res.jsonValue["UUID"] = property; }); } inline void getCpuDataByInterface( - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const dbus::utility::DBusInteracesMap& cpuInterfacesProperties) { BMCWEB_LOG_DEBUG << "Get CPU resources by interface."; // Set the default value of state - aResp->res.jsonValue["Status"]["State"] = "Enabled"; - aResp->res.jsonValue["Status"]["Health"] = "OK"; + asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; + asyncResp->res.jsonValue["Status"]["Health"] = "OK"; for (const auto& interface : cpuInterfacesProperties) { @@ -95,13 +95,13 @@ inline void getCpuDataByInterface( if (cpuPresent == nullptr) { // Important property not in desired type - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (!*cpuPresent) { // Slot is not populated - aResp->res.jsonValue["Status"]["State"] = "Absent"; + asyncResp->res.jsonValue["Status"]["State"] = "Absent"; } } else if (property.first == "Functional") @@ -109,12 +109,12 @@ inline void getCpuDataByInterface( const bool* cpuFunctional = std::get_if<bool>(&property.second); if (cpuFunctional == nullptr) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (!*cpuFunctional) { - aResp->res.jsonValue["Status"]["Health"] = "Critical"; + asyncResp->res.jsonValue["Status"]["Health"] = "Critical"; } } else if (property.first == "CoreCount") @@ -123,17 +123,17 @@ inline void getCpuDataByInterface( std::get_if<uint16_t>(&property.second); if (coresCount == nullptr) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - aResp->res.jsonValue["TotalCores"] = *coresCount; + asyncResp->res.jsonValue["TotalCores"] = *coresCount; } else if (property.first == "MaxSpeedInMhz") { const uint32_t* value = std::get_if<uint32_t>(&property.second); if (value != nullptr) { - aResp->res.jsonValue["MaxSpeedMHz"] = *value; + asyncResp->res.jsonValue["MaxSpeedMHz"] = *value; } } else if (property.first == "Socket") @@ -142,7 +142,7 @@ inline void getCpuDataByInterface( std::get_if<std::string>(&property.second); if (value != nullptr) { - aResp->res.jsonValue["Socket"] = *value; + asyncResp->res.jsonValue["Socket"] = *value; } } else if (property.first == "ThreadCount") @@ -150,7 +150,7 @@ inline void getCpuDataByInterface( const uint16_t* value = std::get_if<uint16_t>(&property.second); if (value != nullptr) { - aResp->res.jsonValue["TotalThreads"] = *value; + asyncResp->res.jsonValue["TotalThreads"] = *value; } } else if (property.first == "EffectiveFamily") @@ -158,7 +158,7 @@ inline void getCpuDataByInterface( const uint16_t* value = std::get_if<uint16_t>(&property.second); if (value != nullptr && *value != 2) { - aResp->res.jsonValue["ProcessorId"]["EffectiveFamily"] = + asyncResp->res.jsonValue["ProcessorId"]["EffectiveFamily"] = "0x" + intToHexString(*value, 4); } } @@ -167,12 +167,12 @@ inline void getCpuDataByInterface( const uint16_t* value = std::get_if<uint16_t>(&property.second); if (value == nullptr) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (*value != 0) { - aResp->res.jsonValue["ProcessorId"]["EffectiveModel"] = + asyncResp->res.jsonValue["ProcessorId"]["EffectiveModel"] = "0x" + intToHexString(*value, 4); } } @@ -181,7 +181,7 @@ inline void getCpuDataByInterface( const uint64_t* value = std::get_if<uint64_t>(&property.second); if (value != nullptr && *value != 0) { - aResp->res + asyncResp->res .jsonValue["ProcessorId"]["IdentificationRegisters"] = "0x" + intToHexString(*value, 16); } @@ -191,12 +191,12 @@ inline void getCpuDataByInterface( const uint32_t* value = std::get_if<uint32_t>(&property.second); if (value == nullptr) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (*value != 0) { - aResp->res.jsonValue["ProcessorId"]["MicrocodeInfo"] = + asyncResp->res.jsonValue["ProcessorId"]["MicrocodeInfo"] = "0x" + intToHexString(*value, 8); } } @@ -205,12 +205,12 @@ inline void getCpuDataByInterface( const uint16_t* value = std::get_if<uint16_t>(&property.second); if (value == nullptr) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (*value != std::numeric_limits<uint16_t>::max()) { - aResp->res.jsonValue["ProcessorId"]["Step"] = + asyncResp->res.jsonValue["ProcessorId"]["Step"] = "0x" + intToHexString(*value, 4); } } @@ -218,7 +218,7 @@ inline void getCpuDataByInterface( } } -inline void getCpuDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, +inline void getCpuDataByService(std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& cpuId, const std::string& service, const std::string& objPath) @@ -226,18 +226,18 @@ inline void getCpuDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, BMCWEB_LOG_DEBUG << "Get available system cpu resources by service."; crow::connections::systemBus->async_method_call( - [cpuId, service, objPath, aResp{std::move(aResp)}]( + [cpuId, service, objPath, asyncResp{std::move(asyncResp)}]( const boost::system::error_code& ec, const dbus::utility::ManagedObjectType& dbusData) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - aResp->res.jsonValue["Id"] = cpuId; - aResp->res.jsonValue["Name"] = "Processor"; - aResp->res.jsonValue["ProcessorType"] = "CPU"; + asyncResp->res.jsonValue["Id"] = cpuId; + asyncResp->res.jsonValue["Name"] = "Processor"; + asyncResp->res.jsonValue["ProcessorType"] = "CPU"; bool slotPresent = false; std::string corePath = objPath + "/core"; @@ -246,7 +246,7 @@ inline void getCpuDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, { if (object.first.str == objPath) { - getCpuDataByInterface(aResp, object.second); + getCpuDataByInterface(asyncResp, object.second); } else if (object.first.str.starts_with(corePath)) { @@ -282,10 +282,10 @@ inline void getCpuDataByService(std::shared_ptr<bmcweb::AsyncResp> aResp, if (totalCores == 0) { // Slot is not populated, set status end return - aResp->res.jsonValue["Status"]["State"] = "Absent"; - aResp->res.jsonValue["Status"]["Health"] = "OK"; + asyncResp->res.jsonValue["Status"]["State"] = "Absent"; + asyncResp->res.jsonValue["Status"]["Health"] = "OK"; } - aResp->res.jsonValue["TotalCores"] = totalCores; + asyncResp->res.jsonValue["TotalCores"] = totalCores; } return; }, @@ -333,14 +333,14 @@ inline processor::ThrottleCause } inline void - readThrottleProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + readThrottleProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const boost::system::error_code& ec, const dbus::utility::DBusPropertiesMap& properties) { if (ec) { BMCWEB_LOG_ERROR << "Processor Throttle getAllProperties error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -351,28 +351,28 @@ inline void properties, "Throttled", status, "ThrottleCauses", causes)) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - aResp->res.jsonValue["Throttled"] = *status; + asyncResp->res.jsonValue["Throttled"] = *status; nlohmann::json::array_t rCauses; for (const std::string& cause : *causes) { processor::ThrottleCause rfCause = dbusToRfThrottleCause(cause); if (rfCause == processor::ThrottleCause::Invalid) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } rCauses.emplace_back(rfCause); } - aResp->res.jsonValue["ThrottleCauses"] = std::move(rCauses); + asyncResp->res.jsonValue["ThrottleCauses"] = std::move(rCauses); } inline void - getThrottleProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + getThrottleProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& service, const std::string& objectPath) { @@ -381,13 +381,13 @@ inline void sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, objectPath, "xyz.openbmc_project.Control.Power.Throttle", - [aResp](const boost::system::error_code& ec, - const dbus::utility::DBusPropertiesMap& properties) { - readThrottleProperties(aResp, ec, properties); + [asyncResp](const boost::system::error_code& ec, + const dbus::utility::DBusPropertiesMap& properties) { + readThrottleProperties(asyncResp, ec, properties); }); } -inline void getCpuAssetData(std::shared_ptr<bmcweb::AsyncResp> aResp, +inline void getCpuAssetData(std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& service, const std::string& objPath) { @@ -395,13 +395,13 @@ inline void getCpuAssetData(std::shared_ptr<bmcweb::AsyncResp> aResp, sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, objPath, "xyz.openbmc_project.Inventory.Decorator.Asset", - [objPath, aResp{std::move(aResp)}]( + [objPath, asyncResp{std::move(asyncResp)}]( const boost::system::error_code& ec, const dbus::utility::DBusPropertiesMap& properties) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -418,50 +418,50 @@ inline void getCpuAssetData(std::shared_ptr<bmcweb::AsyncResp> aResp, if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (serialNumber != nullptr && !serialNumber->empty()) { - aResp->res.jsonValue["SerialNumber"] = *serialNumber; + asyncResp->res.jsonValue["SerialNumber"] = *serialNumber; } if ((model != nullptr) && !model->empty()) { - aResp->res.jsonValue["Model"] = *model; + asyncResp->res.jsonValue["Model"] = *model; } if (manufacturer != nullptr) { - aResp->res.jsonValue["Manufacturer"] = *manufacturer; + asyncResp->res.jsonValue["Manufacturer"] = *manufacturer; // Otherwise would be unexpected. if (manufacturer->find("Intel") != std::string::npos) { - aResp->res.jsonValue["ProcessorArchitecture"] = "x86"; - aResp->res.jsonValue["InstructionSet"] = "x86-64"; + asyncResp->res.jsonValue["ProcessorArchitecture"] = "x86"; + asyncResp->res.jsonValue["InstructionSet"] = "x86-64"; } else if (manufacturer->find("IBM") != std::string::npos) { - aResp->res.jsonValue["ProcessorArchitecture"] = "Power"; - aResp->res.jsonValue["InstructionSet"] = "PowerISA"; + asyncResp->res.jsonValue["ProcessorArchitecture"] = "Power"; + asyncResp->res.jsonValue["InstructionSet"] = "PowerISA"; } } if (partNumber != nullptr) { - aResp->res.jsonValue["PartNumber"] = *partNumber; + asyncResp->res.jsonValue["PartNumber"] = *partNumber; } if (sparePartNumber != nullptr && !sparePartNumber->empty()) { - aResp->res.jsonValue["SparePartNumber"] = *sparePartNumber; + asyncResp->res.jsonValue["SparePartNumber"] = *sparePartNumber; } }); } -inline void getCpuRevisionData(std::shared_ptr<bmcweb::AsyncResp> aResp, +inline void getCpuRevisionData(std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& service, const std::string& objPath) { @@ -469,13 +469,13 @@ inline void getCpuRevisionData(std::shared_ptr<bmcweb::AsyncResp> aResp, sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, objPath, "xyz.openbmc_project.Inventory.Decorator.Revision", - [objPath, aResp{std::move(aResp)}]( + [objPath, asyncResp{std::move(asyncResp)}]( const boost::system::error_code& ec, const dbus::utility::DBusPropertiesMap& properties) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -486,32 +486,32 @@ inline void getCpuRevisionData(std::shared_ptr<bmcweb::AsyncResp> aResp, if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (version != nullptr) { - aResp->res.jsonValue["Version"] = *version; + asyncResp->res.jsonValue["Version"] = *version; } }); } inline void getAcceleratorDataByService( - std::shared_ptr<bmcweb::AsyncResp> aResp, const std::string& acclrtrId, + std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& acclrtrId, const std::string& service, const std::string& objPath) { BMCWEB_LOG_DEBUG << "Get available system Accelerator resources by service."; sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, objPath, "", - [acclrtrId, aResp{std::move(aResp)}]( + [acclrtrId, asyncResp{std::move(asyncResp)}]( const boost::system::error_code& ec, const dbus::utility::DBusPropertiesMap& properties) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -524,7 +524,7 @@ inline void getAcceleratorDataByService( if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -544,11 +544,11 @@ inline void getAcceleratorDataByService( } } - aResp->res.jsonValue["Id"] = acclrtrId; - aResp->res.jsonValue["Name"] = "Processor"; - aResp->res.jsonValue["Status"]["State"] = state; - aResp->res.jsonValue["Status"]["Health"] = health; - aResp->res.jsonValue["ProcessorType"] = "Accelerator"; + asyncResp->res.jsonValue["Id"] = acclrtrId; + asyncResp->res.jsonValue["Name"] = "Processor"; + asyncResp->res.jsonValue["Status"]["State"] = state; + asyncResp->res.jsonValue["Status"]["Health"] = health; + asyncResp->res.jsonValue["ProcessorType"] = "Accelerator"; }); } @@ -563,13 +563,13 @@ using BaseSpeedPrioritySettingsProperty = * Fill out the HighSpeedCoreIDs in a Processor resource from the given * OperatingConfig D-Bus property. * - * @param[in,out] aResp Async HTTP response. + * @param[in,out] asyncResp Async HTTP response. * @param[in] baseSpeedSettings Full list of base speed priority groups, * to use to determine the list of high * speed cores. */ inline void highSpeedCoreIdsHandler( - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const BaseSpeedPrioritySettingsProperty& baseSpeedSettings) { // The D-Bus property does not indicate which bucket is the "high @@ -588,7 +588,7 @@ inline void highSpeedCoreIdsHandler( } } - nlohmann::json& jsonCoreIds = aResp->res.jsonValue["HighSpeedCoreIDs"]; + nlohmann::json& jsonCoreIds = asyncResp->res.jsonValue["HighSpeedCoreIDs"]; jsonCoreIds = nlohmann::json::array(); // There may not be any entries in the D-Bus property, so only populate @@ -603,15 +603,15 @@ inline void highSpeedCoreIdsHandler( * Fill out OperatingConfig related items in a Processor resource by requesting * data from the given D-Bus object. * - * @param[in,out] aResp Async HTTP response. + * @param[in,out] asyncResp Async HTTP response. * @param[in] cpuId CPU D-Bus name. * @param[in] service D-Bus service to query. * @param[in] objPath D-Bus object to query. */ -inline void getCpuConfigData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& cpuId, - const std::string& service, - const std::string& objPath) +inline void + getCpuConfigData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& cpuId, const std::string& service, + const std::string& objPath) { BMCWEB_LOG_INFO << "Getting CPU operating configs for " << cpuId; @@ -619,17 +619,17 @@ inline void getCpuConfigData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, objPath, "xyz.openbmc_project.Control.Processor.CurrentOperatingConfig", - [aResp, cpuId, + [asyncResp, cpuId, service](const boost::system::error_code& ec, const dbus::utility::DBusPropertiesMap& properties) { if (ec) { BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", " << ec.message(); - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - nlohmann::json& json = aResp->res.jsonValue; + nlohmann::json& json = asyncResp->res.jsonValue; const sdbusplus::message::object_path* appliedConfig = nullptr; const bool* baseSpeedPriorityEnabled = nullptr; @@ -641,7 +641,7 @@ inline void getCpuConfigData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -663,7 +663,7 @@ inline void getCpuConfigData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, // If the AppliedConfig was somehow not a valid path, // skip adding any more properties, since everything // else is tied to this applied config. - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } nlohmann::json::object_t appliedOperatingConfig; @@ -680,17 +680,17 @@ inline void getCpuConfigData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, "xyz.openbmc_project.Inventory.Item.Cpu." "OperatingConfig", "BaseSpeedPrioritySettings", - [aResp]( + [asyncResp]( const boost::system::error_code& ec2, const BaseSpeedPrioritySettingsProperty& baseSpeedList) { if (ec2) { BMCWEB_LOG_WARNING << "D-Bus Property Get error: " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - highSpeedCoreIdsHandler(aResp, baseSpeedList); + highSpeedCoreIdsHandler(asyncResp, baseSpeedList); }); } @@ -706,11 +706,11 @@ inline void getCpuConfigData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, * @brief Fill out location info of a processor by * requesting data from the given D-Bus object. * - * @param[in,out] aResp Async HTTP response. + * @param[in,out] asyncResp Async HTTP response. * @param[in] service D-Bus service to query. * @param[in] objPath D-Bus object to query. */ -inline void getCpuLocationCode(std::shared_ptr<bmcweb::AsyncResp> aResp, +inline void getCpuLocationCode(std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& service, const std::string& objPath) { @@ -718,16 +718,16 @@ inline void getCpuLocationCode(std::shared_ptr<bmcweb::AsyncResp> aResp, sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, service, objPath, "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode", - [objPath, aResp{std::move(aResp)}](const boost::system::error_code& ec, - const std::string& property) { + [objPath, asyncResp{std::move(asyncResp)}]( + const boost::system::error_code& ec, const std::string& property) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - aResp->res.jsonValue["Location"]["PartLocation"]["ServiceLabel"] = + asyncResp->res.jsonValue["Location"]["PartLocation"]["ServiceLabel"] = property; }); } @@ -736,11 +736,11 @@ inline void getCpuLocationCode(std::shared_ptr<bmcweb::AsyncResp> aResp, * Populate the unique identifier in a Processor resource by requesting data * from the given D-Bus object. * - * @param[in,out] aResp Async HTTP response. + * @param[in,out] asyncResp Async HTTP response. * @param[in] service D-Bus service to query. * @param[in] objPath D-Bus object to query. */ -inline void getCpuUniqueId(const std::shared_ptr<bmcweb::AsyncResp>& aResp, +inline void getCpuUniqueId(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& service, const std::string& objectPath) { @@ -749,15 +749,16 @@ inline void getCpuUniqueId(const std::shared_ptr<bmcweb::AsyncResp>& aResp, *crow::connections::systemBus, service, objectPath, "xyz.openbmc_project.Inventory.Decorator.UniqueIdentifier", "UniqueIdentifier", - [aResp](const boost::system::error_code& ec, const std::string& id) { + [asyncResp](const boost::system::error_code& ec, + const std::string& id) { if (ec) { BMCWEB_LOG_ERROR << "Failed to read cpu unique id: " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - aResp->res.jsonValue["ProcessorId"]["ProtectedIdentificationNumber"] = - id; + asyncResp->res + .jsonValue["ProcessorId"]["ProtectedIdentificationNumber"] = id; }); } @@ -841,10 +842,11 @@ inline void getProcessorObject(const std::shared_ptr<bmcweb::AsyncResp>& resp, }); } -inline void getProcessorData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& processorId, - const std::string& objectPath, - const dbus::utility::MapperServiceMap& serviceMap) +inline void + getProcessorData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& processorId, + const std::string& objectPath, + const dbus::utility::MapperServiceMap& serviceMap) { for (const auto& [serviceName, interfaceList] : serviceMap) { @@ -852,47 +854,48 @@ inline void getProcessorData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, { if (interface == "xyz.openbmc_project.Inventory.Decorator.Asset") { - getCpuAssetData(aResp, serviceName, objectPath); + getCpuAssetData(asyncResp, serviceName, objectPath); } else if (interface == "xyz.openbmc_project.Inventory.Decorator.Revision") { - getCpuRevisionData(aResp, serviceName, objectPath); + getCpuRevisionData(asyncResp, serviceName, objectPath); } else if (interface == "xyz.openbmc_project.Inventory.Item.Cpu") { - getCpuDataByService(aResp, processorId, serviceName, + getCpuDataByService(asyncResp, processorId, serviceName, objectPath); } else if (interface == "xyz.openbmc_project.Inventory.Item.Accelerator") { - getAcceleratorDataByService(aResp, processorId, serviceName, + getAcceleratorDataByService(asyncResp, processorId, serviceName, objectPath); } else if ( interface == "xyz.openbmc_project.Control.Processor.CurrentOperatingConfig") { - getCpuConfigData(aResp, processorId, serviceName, objectPath); + getCpuConfigData(asyncResp, processorId, serviceName, + objectPath); } else if (interface == "xyz.openbmc_project.Inventory.Decorator.LocationCode") { - getCpuLocationCode(aResp, serviceName, objectPath); + getCpuLocationCode(asyncResp, serviceName, objectPath); } else if (interface == "xyz.openbmc_project.Common.UUID") { - getProcessorUUID(aResp, serviceName, objectPath); + getProcessorUUID(asyncResp, serviceName, objectPath); } else if (interface == "xyz.openbmc_project.Inventory.Decorator.UniqueIdentifier") { - getCpuUniqueId(aResp, serviceName, objectPath); + getCpuUniqueId(asyncResp, serviceName, objectPath); } else if (interface == "xyz.openbmc_project.Control.Power.Throttle") { - getThrottleProperties(aResp, serviceName, objectPath); + getThrottleProperties(asyncResp, serviceName, objectPath); } } } @@ -902,24 +905,24 @@ inline void getProcessorData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, * Request all the properties for the given D-Bus object and fill out the * related entries in the Redfish OperatingConfig response. * - * @param[in,out] aResp Async HTTP response. + * @param[in,out] asyncResp Async HTTP response. * @param[in] service D-Bus service name to query. * @param[in] objPath D-Bus object to query. */ inline void - getOperatingConfigData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + getOperatingConfigData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& service, const std::string& objPath) { sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, objPath, "xyz.openbmc_project.Inventory.Item.Cpu.OperatingConfig", - [aResp](const boost::system::error_code& ec, - const dbus::utility::DBusPropertiesMap& properties) { + [asyncResp](const boost::system::error_code& ec, + const dbus::utility::DBusPropertiesMap& properties) { if (ec) { BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", " << ec.message(); - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -941,11 +944,11 @@ inline void if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - nlohmann::json& json = aResp->res.jsonValue; + nlohmann::json& json = asyncResp->res.jsonValue; if (availableCoreCount != nullptr) { @@ -1129,30 +1132,31 @@ inline void patchAppliedOperatingConfig( "AppliedConfig", dbus::utility::DbusVariantType(std::move(configPath))); } -inline void handleProcessorHead(crow::App& app, const crow::Request& req, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& /* systemName */, - const std::string& /* processorId */) +inline void + handleProcessorHead(crow::App& app, const crow::Request& req, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& /* systemName */, + const std::string& /* processorId */) { - if (!redfish::setUpRedfishRoute(app, req, aResp)) + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } - aResp->res.addHeader( + asyncResp->res.addHeader( boost::beast::http::field::link, "</redfish/v1/JsonSchemas/Processor/Processor.json>; rel=describedby"); } inline void handleProcessorCollectionHead( crow::App& app, const crow::Request& req, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& /* systemName */) { - if (!redfish::setUpRedfishRoute(app, req, aResp)) + if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; } - aResp->res.addHeader( + asyncResp->res.addHeader( boost::beast::http::field::link, "</redfish/v1/JsonSchemas/ProcessorCollection/ProcessorCollection.json>; rel=describedby"); } diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 3b212c2aea..49cd087447 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -2819,16 +2819,16 @@ inline void getChassisCallback( BMCWEB_LOG_DEBUG << "getChassisCallback exit"; } -inline void - handleSensorCollectionGet(App& app, const crow::Request& req, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& chassisId) +inline void handleSensorCollectionGet( + App& app, const crow::Request& req, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& chassisId) { query_param::QueryCapabilities capabilities = { .canDelegateExpandLevel = 1, }; query_param::Query delegatedQuery; - if (!redfish::setUpRedfishRouteWithDelegation(app, req, aResp, + if (!redfish::setUpRedfishRouteWithDelegation(app, req, asyncResp, delegatedQuery, capabilities)) { return; @@ -2837,11 +2837,11 @@ inline void if (delegatedQuery.expandType != query_param::ExpandType::None) { // we perform efficient expand. - auto asyncResp = std::make_shared<SensorsAsyncResp>( - aResp, chassisId, sensors::dbus::sensorPaths, + auto sensorsAsyncResp = std::make_shared<SensorsAsyncResp>( + asyncResp, chassisId, sensors::dbus::sensorPaths, sensors::node::sensors, /*efficientExpand=*/true); - getChassisData(asyncResp); + getChassisData(sensorsAsyncResp); BMCWEB_LOG_DEBUG << "SensorCollection doGet exit via efficient expand handler"; @@ -2850,9 +2850,9 @@ inline void // We get all sensors as hyperlinkes in the chassis (this // implies we reply on the default query parameters handler) - getChassis(aResp, chassisId, sensors::node::sensors, dbus::sensorPaths, - std::bind_front(sensors::getChassisCallback, aResp, chassisId, - sensors::node::sensors)); + getChassis(asyncResp, chassisId, sensors::node::sensors, dbus::sensorPaths, + std::bind_front(sensors::getChassisCallback, asyncResp, + chassisId, sensors::node::sensors)); } inline void diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index 81db36b628..86730a5368 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -54,13 +54,13 @@ const static std::array<std::pair<std::string_view, std::string_view>, 2> /** * @brief Updates the Functional State of DIMMs * - * @param[in] aResp Shared pointer for completing asynchronous calls + * @param[in] asyncResp Shared pointer for completing asynchronous calls * @param[in] dimmState Dimm's Functional state, true/false * * @return None. */ inline void - updateDimmProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + updateDimmProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, bool isDimmFunctional) { BMCWEB_LOG_DEBUG << "Dimm Functional: " << isDimmFunctional; @@ -69,12 +69,12 @@ inline void // Update STATE only if previous State was DISABLED and current Dimm is // ENABLED. const nlohmann::json& prevMemSummary = - aResp->res.jsonValue["MemorySummary"]["Status"]["State"]; + asyncResp->res.jsonValue["MemorySummary"]["Status"]["State"]; if (prevMemSummary == "Disabled") { if (isDimmFunctional) { - aResp->res.jsonValue["MemorySummary"]["Status"]["State"] = + asyncResp->res.jsonValue["MemorySummary"]["Status"]["State"] = "Enabled"; } } @@ -84,19 +84,18 @@ inline void * @brief Update "ProcessorSummary" "Status" "State" based on * CPU Functional State * - * @param[in] aResp Shared pointer for completing asynchronous calls + * @param[in] asyncResp Shared pointer for completing asynchronous calls * @param[in] cpuFunctionalState is CPU functional true/false * * @return None. */ -inline void - modifyCpuFunctionalState(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - bool isCpuFunctional) +inline void modifyCpuFunctionalState( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, bool isCpuFunctional) { BMCWEB_LOG_DEBUG << "Cpu Functional: " << isCpuFunctional; const nlohmann::json& prevProcState = - aResp->res.jsonValue["ProcessorSummary"]["Status"]["State"]; + asyncResp->res.jsonValue["ProcessorSummary"]["Status"]["State"]; // Set it as Enabled if at least one CPU is functional // Update STATE only if previous State was Non_Functional and current CPU is @@ -105,7 +104,7 @@ inline void { if (isCpuFunctional) { - aResp->res.jsonValue["ProcessorSummary"]["Status"]["State"] = + asyncResp->res.jsonValue["ProcessorSummary"]["Status"]["State"] = "Enabled"; } } @@ -114,13 +113,13 @@ inline void /* * @brief Update "ProcessorSummary" "Count" based on Cpu PresenceState * - * @param[in] aResp Shared pointer for completing asynchronous calls + * @param[in] asyncResp Shared pointer for completing asynchronous calls * @param[in] cpuPresenceState CPU present or not * * @return None. */ inline void - modifyCpuPresenceState(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + modifyCpuPresenceState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, bool isCpuPresent) { BMCWEB_LOG_DEBUG << "Cpu Present: " << isCpuPresent; @@ -128,7 +127,7 @@ inline void if (isCpuPresent) { nlohmann::json& procCount = - aResp->res.jsonValue["ProcessorSummary"]["Count"]; + asyncResp->res.jsonValue["ProcessorSummary"]["Count"]; auto* procCountPtr = procCount.get_ptr<nlohmann::json::number_integer_t*>(); if (procCountPtr != nullptr) @@ -140,7 +139,7 @@ inline void } inline void getProcessorProperties( - const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>& properties) { @@ -155,14 +154,14 @@ inline void getProcessorProperties( if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (coreCount != nullptr) { nlohmann::json& coreCountJson = - aResp->res.jsonValue["ProcessorSummary"]["CoreCount"]; + asyncResp->res.jsonValue["ProcessorSummary"]["CoreCount"]; uint64_t* coreCountJsonPtr = coreCountJson.get_ptr<uint64_t*>(); if (coreCountJsonPtr == nullptr) @@ -179,24 +178,24 @@ inline void getProcessorProperties( /* * @brief Get ProcessorSummary fields * - * @param[in] aResp Shared pointer for completing asynchronous calls + * @param[in] asyncResp Shared pointer for completing asynchronous calls * @param[in] service dbus service for Cpu Information * @param[in] path dbus path for Cpu * * @return None. */ -inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& service, - const std::string& path) +inline void + getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& service, const std::string& path) { - auto getCpuPresenceState = [aResp](const boost::system::error_code& ec3, - const bool cpuPresenceCheck) { + auto getCpuPresenceState = [asyncResp](const boost::system::error_code& ec3, + const bool cpuPresenceCheck) { if (ec3) { BMCWEB_LOG_ERROR << "DBUS response error " << ec3; return; } - modifyCpuPresenceState(aResp, cpuPresenceCheck); + modifyCpuPresenceState(asyncResp, cpuPresenceCheck); }; // Get the Presence of CPU @@ -208,14 +207,14 @@ inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if constexpr (bmcwebEnableProcMemStatus) { auto getCpuFunctionalState = - [aResp](const boost::system::error_code& ec3, - const bool cpuFunctionalCheck) { + [asyncResp](const boost::system::error_code& ec3, + const bool cpuFunctionalCheck) { if (ec3) { BMCWEB_LOG_ERROR << "DBUS response error " << ec3; return; } - modifyCpuFunctionalState(aResp, cpuFunctionalCheck); + modifyCpuFunctionalState(asyncResp, cpuFunctionalCheck); }; // Get the Functional State @@ -228,23 +227,23 @@ inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp, sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, path, "xyz.openbmc_project.Inventory.Item.Cpu", - [aResp, service, + [asyncResp, service, path](const boost::system::error_code& ec2, const dbus::utility::DBusPropertiesMap& properties) { if (ec2) { BMCWEB_LOG_ERROR << "DBUS response error " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - getProcessorProperties(aResp, properties); + getProcessorProperties(asyncResp, properties); }); } /* * @brief processMemoryProperties fields * - * @param[in] aResp Shared pointer for completing asynchronous calls + * @param[in] asyncResp Shared pointer for completing asynchronous calls * @param[in] service dbus service for memory Information * @param[in] path dbus path for Memory * @param[in] DBUS properties for memory @@ -252,7 +251,7 @@ inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp, * @return None. */ inline void - processMemoryProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + processMemoryProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, [[maybe_unused]] const std::string& service, [[maybe_unused]] const std::string& path, const dbus::utility::DBusPropertiesMap& properties) @@ -268,13 +267,14 @@ inline void "xyz.openbmc_project.State." "Decorator.OperationalStatus", "Functional", - [aResp](const boost::system::error_code& ec3, bool dimmState) { + [asyncResp](const boost::system::error_code& ec3, + bool dimmState) { if (ec3) { BMCWEB_LOG_ERROR << "DBUS response error " << ec3; return; } - updateDimmProperties(aResp, dimmState); + updateDimmProperties(asyncResp, dimmState); }); } return; @@ -288,28 +288,28 @@ inline void if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (memorySizeInKB != nullptr) { nlohmann::json& totalMemory = - aResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"]; + asyncResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"]; const uint64_t* preValue = totalMemory.get_ptr<const uint64_t*>(); if (preValue == nullptr) { - aResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"] = + asyncResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"] = *memorySizeInKB / static_cast<size_t>(1024 * 1024); } else { - aResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"] = + asyncResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"] = *memorySizeInKB / static_cast<size_t>(1024 * 1024) + *preValue; } if constexpr (bmcwebEnableProcMemStatus) { - aResp->res.jsonValue["MemorySummary"]["Status"]["State"] = + asyncResp->res.jsonValue["MemorySummary"]["Status"]["State"] = "Enabled"; } } @@ -318,42 +318,42 @@ inline void /* * @brief Get getMemorySummary fields * - * @param[in] aResp Shared pointer for completing asynchronous calls + * @param[in] asyncResp Shared pointer for completing asynchronous calls * @param[in] service dbus service for memory Information * @param[in] path dbus path for memory * * @return None. */ -inline void getMemorySummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& service, - const std::string& path) +inline void + getMemorySummary(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& service, const std::string& path) { sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, path, "xyz.openbmc_project.Inventory.Item.Dimm", - [aResp, service, + [asyncResp, service, path](const boost::system::error_code& ec2, const dbus::utility::DBusPropertiesMap& properties) { if (ec2) { BMCWEB_LOG_ERROR << "DBUS response error " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - processMemoryProperties(aResp, service, path, properties); + processMemoryProperties(asyncResp, service, path, properties); }); } /* * @brief Retrieves computer system properties over dbus * - * @param[in] aResp Shared pointer for completing asynchronous calls + * @param[in] asyncResp Shared pointer for completing asynchronous calls * @param[in] systemHealth Shared HealthPopulate pointer * * @return None. */ inline void - getComputerSystem(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + getComputerSystem(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::shared_ptr<HealthPopulate>& systemHealth) { BMCWEB_LOG_DEBUG << "Get available system components."; @@ -366,13 +366,13 @@ inline void }; dbus::utility::getSubTree( "/xyz/openbmc_project/inventory", 0, interfaces, - [aResp, + [asyncResp, systemHealth](const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreeResponse& subtree) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } // Iterate over all retrieved ObjectPaths. @@ -396,13 +396,13 @@ inline void if constexpr (bmcwebEnableProcMemStatus) { memoryHealth = std::make_shared<HealthPopulate>( - aResp, "/MemorySummary/Status"_json_pointer); + asyncResp, "/MemorySummary/Status"_json_pointer); systemHealth->children.emplace_back(memoryHealth); if constexpr (bmcwebEnableHealthPopulate) { cpuHealth = std::make_shared<HealthPopulate>( - aResp, "/ProcessorSummary/Status"_json_pointer); + asyncResp, "/ProcessorSummary/Status"_json_pointer); systemHealth->children.emplace_back(cpuHealth); } @@ -420,7 +420,7 @@ inline void BMCWEB_LOG_DEBUG << "Found Dimm, now get its properties."; - getMemorySummary(aResp, connection.first, path); + getMemorySummary(asyncResp, connection.first, path); if constexpr (bmcwebEnableProcMemStatus) { @@ -433,7 +433,7 @@ inline void BMCWEB_LOG_DEBUG << "Found Cpu, now get its properties."; - getProcessorSummary(aResp, connection.first, path); + getProcessorSummary(asyncResp, connection.first, path); if constexpr (bmcwebEnableProcMemStatus) { @@ -448,14 +448,14 @@ inline void sdbusplus::asio::getAllProperties( *crow::connections::systemBus, connection.first, path, "xyz.openbmc_project.Common.UUID", - [aResp](const boost::system::error_code& ec3, - const dbus::utility::DBusPropertiesMap& - properties) { + [asyncResp](const boost::system::error_code& ec3, + const dbus::utility::DBusPropertiesMap& + properties) { if (ec3) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec3; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } BMCWEB_LOG_DEBUG << "Got " << properties.size() @@ -470,7 +470,7 @@ inline void if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -485,7 +485,7 @@ inline void valueStr.insert(23, 1, '-'); } BMCWEB_LOG_DEBUG << "UUID = " << valueStr; - aResp->res.jsonValue["UUID"] = valueStr; + asyncResp->res.jsonValue["UUID"] = valueStr; } }); } @@ -496,9 +496,9 @@ inline void *crow::connections::systemBus, connection.first, path, "xyz.openbmc_project.Inventory.Decorator.Asset", - [aResp](const boost::system::error_code& ec2, - const dbus::utility::DBusPropertiesMap& - propertiesList) { + [asyncResp](const boost::system::error_code& ec2, + const dbus::utility::DBusPropertiesMap& + propertiesList) { if (ec2) { // doesn't have to include this @@ -524,41 +524,42 @@ inline void if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (partNumber != nullptr) { - aResp->res.jsonValue["PartNumber"] = + asyncResp->res.jsonValue["PartNumber"] = *partNumber; } if (serialNumber != nullptr) { - aResp->res.jsonValue["SerialNumber"] = + asyncResp->res.jsonValue["SerialNumber"] = *serialNumber; } if (manufacturer != nullptr) { - aResp->res.jsonValue["Manufacturer"] = + asyncResp->res.jsonValue["Manufacturer"] = *manufacturer; } if (model != nullptr) { - aResp->res.jsonValue["Model"] = *model; + asyncResp->res.jsonValue["Model"] = *model; } if (subModel != nullptr) { - aResp->res.jsonValue["SubModel"] = *subModel; + asyncResp->res.jsonValue["SubModel"] = + *subModel; } // Grab the bios version sw_util::populateSoftwareInformation( - aResp, sw_util::biosPurpose, "BiosVersion", + asyncResp, sw_util::biosPurpose, "BiosVersion", false); }); @@ -568,8 +569,8 @@ inline void "xyz.openbmc_project.Inventory.Decorator." "AssetTag", "AssetTag", - [aResp](const boost::system::error_code& ec2, - const std::string& value) { + [asyncResp](const boost::system::error_code& ec2, + const std::string& value) { if (ec2) { // doesn't have to include this @@ -577,7 +578,7 @@ inline void return; } - aResp->res.jsonValue["AssetTag"] = value; + asyncResp->res.jsonValue["AssetTag"] = value; }); } } @@ -589,19 +590,19 @@ inline void /** * @brief Retrieves host state properties over dbus * - * @param[in] aResp Shared pointer for completing asynchronous calls. + * @param[in] asyncResp Shared pointer for completing asynchronous calls. * * @return None. */ -inline void getHostState(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void getHostState(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get host information."; sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, "xyz.openbmc_project.State.Host", "/xyz/openbmc_project/state/host0", "xyz.openbmc_project.State.Host", "CurrentHostState", - [aResp](const boost::system::error_code& ec, - const std::string& hostState) { + [asyncResp](const boost::system::error_code& ec, + const std::string& hostState) { if (ec) { if (ec == boost::system::errc::host_unreachable) @@ -612,7 +613,7 @@ inline void getHostState(const std::shared_ptr<bmcweb::AsyncResp>& aResp) return; } BMCWEB_LOG_ERROR << "DBUS response error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -620,38 +621,38 @@ inline void getHostState(const std::shared_ptr<bmcweb::AsyncResp>& aResp) // Verify Host State if (hostState == "xyz.openbmc_project.State.Host.HostState.Running") { - aResp->res.jsonValue["PowerState"] = "On"; - aResp->res.jsonValue["Status"]["State"] = "Enabled"; + asyncResp->res.jsonValue["PowerState"] = "On"; + asyncResp->res.jsonValue["Status"]["State"] = "Enabled"; } else if (hostState == "xyz.openbmc_project.State.Host.HostState.Quiesced") { - aResp->res.jsonValue["PowerState"] = "On"; - aResp->res.jsonValue["Status"]["State"] = "Quiesced"; + asyncResp->res.jsonValue["PowerState"] = "On"; + asyncResp->res.jsonValue["Status"]["State"] = "Quiesced"; } else if (hostState == "xyz.openbmc_project.State.Host.HostState.DiagnosticMode") { - aResp->res.jsonValue["PowerState"] = "On"; - aResp->res.jsonValue["Status"]["State"] = "InTest"; + asyncResp->res.jsonValue["PowerState"] = "On"; + asyncResp->res.jsonValue["Status"]["State"] = "InTest"; } else if ( hostState == "xyz.openbmc_project.State.Host.HostState.TransitioningToRunning") { - aResp->res.jsonValue["PowerState"] = "PoweringOn"; - aResp->res.jsonValue["Status"]["State"] = "Starting"; + asyncResp->res.jsonValue["PowerState"] = "PoweringOn"; + asyncResp->res.jsonValue["Status"]["State"] = "Starting"; } else if (hostState == "xyz.openbmc_project.State.Host.HostState.TransitioningToOff") { - aResp->res.jsonValue["PowerState"] = "PoweringOff"; - aResp->res.jsonValue["Status"]["State"] = "Disabled"; + asyncResp->res.jsonValue["PowerState"] = "PoweringOff"; + asyncResp->res.jsonValue["Status"]["State"] = "Disabled"; } else { - aResp->res.jsonValue["PowerState"] = "Off"; - aResp->res.jsonValue["Status"]["State"] = "Disabled"; + asyncResp->res.jsonValue["PowerState"] = "Off"; + asyncResp->res.jsonValue["Status"]["State"] = "Disabled"; } }); } @@ -827,9 +828,10 @@ inline std::string dbusToRfBootProgress(const std::string& dbusBootProgress) * * @return Integer error code. */ -inline int assignBootParameters(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& rfSource, - std::string& bootSource, std::string& bootMode) +inline int + assignBootParameters(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& rfSource, std::string& bootSource, + std::string& bootMode) { bootSource = "xyz.openbmc_project.Control.Boot.Source.Sources.Default"; bootMode = "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular"; @@ -869,7 +871,7 @@ inline int assignBootParameters(const std::shared_ptr<bmcweb::AsyncResp>& aResp, BMCWEB_LOG_DEBUG << "Invalid property value for BootSourceOverrideTarget: " << bootSource; - messages::propertyValueNotInList(aResp->res, rfSource, + messages::propertyValueNotInList(asyncResp->res, rfSource, "BootSourceTargetOverride"); return -1; } @@ -879,18 +881,18 @@ inline int assignBootParameters(const std::shared_ptr<bmcweb::AsyncResp>& aResp, /** * @brief Retrieves boot progress of the system * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ -inline void getBootProgress(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void getBootProgress(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, "xyz.openbmc_project.State.Host", "/xyz/openbmc_project/state/host0", "xyz.openbmc_project.State.Boot.Progress", "BootProgress", - [aResp](const boost::system::error_code& ec, - const std::string& bootProgressStr) { + [asyncResp](const boost::system::error_code& ec, + const std::string& bootProgressStr) { if (ec) { // BootProgress is an optional object so just do nothing if @@ -900,7 +902,7 @@ inline void getBootProgress(const std::shared_ptr<bmcweb::AsyncResp>& aResp) BMCWEB_LOG_DEBUG << "Boot Progress: " << bootProgressStr; - aResp->res.jsonValue["BootProgress"]["LastState"] = + asyncResp->res.jsonValue["BootProgress"]["LastState"] = dbusToRfBootProgress(bootProgressStr); }); } @@ -908,19 +910,19 @@ inline void getBootProgress(const std::shared_ptr<bmcweb::AsyncResp>& aResp) /** * @brief Retrieves boot progress Last Update of the system * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ inline void getBootProgressLastStateTime( - const std::shared_ptr<bmcweb::AsyncResp>& aResp) + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { sdbusplus::asio::getProperty<uint64_t>( *crow::connections::systemBus, "xyz.openbmc_project.State.Host", "/xyz/openbmc_project/state/host0", "xyz.openbmc_project.State.Boot.Progress", "BootProgressLastUpdate", - [aResp](const boost::system::error_code& ec, - const uint64_t lastStateTime) { + [asyncResp](const boost::system::error_code& ec, + const uint64_t lastStateTime) { if (ec) { BMCWEB_LOG_DEBUG << "D-BUS response error " << ec; @@ -934,7 +936,7 @@ inline void getBootProgressLastStateTime( // yaml/xyz/openbmc_project/State/Boot/Progress.interface.yaml#L11 // Convert to ISO 8601 standard - aResp->res.jsonValue["BootProgress"]["LastStateTime"] = + asyncResp->res.jsonValue["BootProgress"]["LastStateTime"] = redfish::time_utils::getDateTimeUintUs(lastStateTime); }); } @@ -942,19 +944,20 @@ inline void getBootProgressLastStateTime( /** * @brief Retrieves boot override type over DBUS and fills out the response * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ -inline void getBootOverrideType(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void + getBootOverrideType(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, "xyz.openbmc_project.Settings", "/xyz/openbmc_project/control/host0/boot", "xyz.openbmc_project.Control.Boot.Type", "BootType", - [aResp](const boost::system::error_code& ec, - const std::string& bootType) { + [asyncResp](const boost::system::error_code& ec, + const std::string& bootType) { if (ec) { // not an error, don't have to have the interface @@ -963,47 +966,49 @@ inline void getBootOverrideType(const std::shared_ptr<bmcweb::AsyncResp>& aResp) BMCWEB_LOG_DEBUG << "Boot type: " << bootType; - aResp->res.jsonValue["Boot"] - ["BootSourceOverrideMode@Redfish.AllowableValues"] = + asyncResp->res + .jsonValue["Boot"] + ["BootSourceOverrideMode@Redfish.AllowableValues"] = nlohmann::json::array_t({"Legacy", "UEFI"}); auto rfType = dbusToRfBootType(bootType); if (rfType.empty()) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - aResp->res.jsonValue["Boot"]["BootSourceOverrideMode"] = rfType; + asyncResp->res.jsonValue["Boot"]["BootSourceOverrideMode"] = rfType; }); } /** * @brief Retrieves boot override mode over DBUS and fills out the response * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ -inline void getBootOverrideMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void + getBootOverrideMode(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, "xyz.openbmc_project.Settings", "/xyz/openbmc_project/control/host0/boot", "xyz.openbmc_project.Control.Boot.Mode", "BootMode", - [aResp](const boost::system::error_code& ec, - const std::string& bootModeStr) { + [asyncResp](const boost::system::error_code& ec, + const std::string& bootModeStr) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } BMCWEB_LOG_DEBUG << "Boot mode: " << bootModeStr; - aResp->res + asyncResp->res .jsonValue["Boot"] ["BootSourceOverrideTarget@Redfish.AllowableValues"] = { "None", "Pxe", "Hdd", "Cd", "Diags", "BiosSetup", "Usb"}; @@ -1014,7 +1019,7 @@ inline void getBootOverrideMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp) auto rfMode = dbusToRfBootMode(bootModeStr); if (!rfMode.empty()) { - aResp->res.jsonValue["Boot"]["BootSourceOverrideTarget"] = + asyncResp->res.jsonValue["Boot"]["BootSourceOverrideTarget"] = rfMode; } } @@ -1024,20 +1029,20 @@ inline void getBootOverrideMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp) /** * @brief Retrieves boot override source over DBUS * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ inline void - getBootOverrideSource(const std::shared_ptr<bmcweb::AsyncResp>& aResp) + getBootOverrideSource(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, "xyz.openbmc_project.Settings", "/xyz/openbmc_project/control/host0/boot", "xyz.openbmc_project.Control.Boot.Source", "BootSource", - [aResp](const boost::system::error_code& ec, - const std::string& bootSourceStr) { + [asyncResp](const boost::system::error_code& ec, + const std::string& bootSourceStr) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; @@ -1045,7 +1050,7 @@ inline void { return; } - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -1054,12 +1059,13 @@ inline void auto rfSource = dbusToRfBootSource(bootSourceStr); if (!rfSource.empty()) { - aResp->res.jsonValue["Boot"]["BootSourceOverrideTarget"] = rfSource; + asyncResp->res.jsonValue["Boot"]["BootSourceOverrideTarget"] = + rfSource; } // Get BootMode as BootSourceOverrideTarget is constructed // from both BootSource and BootMode - getBootOverrideMode(aResp); + getBootOverrideMode(asyncResp); }); } @@ -1068,18 +1074,19 @@ inline void * "BootSourceOverrideEnabled" property from an overall boot override enable * state * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ -inline void - processBootOverrideEnable(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const bool bootOverrideEnableSetting) +inline void processBootOverrideEnable( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const bool bootOverrideEnableSetting) { if (!bootOverrideEnableSetting) { - aResp->res.jsonValue["Boot"]["BootSourceOverrideEnabled"] = "Disabled"; + asyncResp->res.jsonValue["Boot"]["BootSourceOverrideEnabled"] = + "Disabled"; return; } @@ -1089,21 +1096,22 @@ inline void *crow::connections::systemBus, "xyz.openbmc_project.Settings", "/xyz/openbmc_project/control/host0/boot/one_time", "xyz.openbmc_project.Object.Enable", "Enabled", - [aResp](const boost::system::error_code& ec, bool oneTimeSetting) { + [asyncResp](const boost::system::error_code& ec, bool oneTimeSetting) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (oneTimeSetting) { - aResp->res.jsonValue["Boot"]["BootSourceOverrideEnabled"] = "Once"; + asyncResp->res.jsonValue["Boot"]["BootSourceOverrideEnabled"] = + "Once"; } else { - aResp->res.jsonValue["Boot"]["BootSourceOverrideEnabled"] = + asyncResp->res.jsonValue["Boot"]["BootSourceOverrideEnabled"] = "Continuous"; } }); @@ -1112,20 +1120,20 @@ inline void /** * @brief Retrieves boot override enable over DBUS * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ inline void - getBootOverrideEnable(const std::shared_ptr<bmcweb::AsyncResp>& aResp) + getBootOverrideEnable(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { sdbusplus::asio::getProperty<bool>( *crow::connections::systemBus, "xyz.openbmc_project.Settings", "/xyz/openbmc_project/control/host0/boot", "xyz.openbmc_project.Object.Enable", "Enabled", - [aResp](const boost::system::error_code& ec, - const bool bootOverrideEnable) { + [asyncResp](const boost::system::error_code& ec, + const bool bootOverrideEnable) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; @@ -1133,28 +1141,29 @@ inline void { return; } - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - processBootOverrideEnable(aResp, bootOverrideEnable); + processBootOverrideEnable(asyncResp, bootOverrideEnable); }); } /** * @brief Retrieves boot source override properties * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ -inline void getBootProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void + getBootProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get boot information."; - getBootOverrideSource(aResp); - getBootOverrideType(aResp); - getBootOverrideEnable(aResp); + getBootOverrideSource(asyncResp); + getBootOverrideType(asyncResp); + getBootOverrideEnable(asyncResp); } /** @@ -1165,11 +1174,12 @@ inline void getBootProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp) * chassis D-Bus interface for the LastStateChangeTime since this has the * last power operation time. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ -inline void getLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void + getLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Getting System Last Reset Time"; @@ -1177,7 +1187,8 @@ inline void getLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& aResp) *crow::connections::systemBus, "xyz.openbmc_project.State.Chassis", "/xyz/openbmc_project/state/chassis0", "xyz.openbmc_project.State.Chassis", "LastStateChangeTime", - [aResp](const boost::system::error_code& ec, uint64_t lastResetTime) { + [asyncResp](const boost::system::error_code& ec, + uint64_t lastResetTime) { if (ec) { BMCWEB_LOG_DEBUG << "D-BUS response error " << ec; @@ -1189,7 +1200,7 @@ inline void getLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& aResp) uint64_t lastResetTimeStamp = lastResetTime / 1000; // Convert to ISO 8601 standard - aResp->res.jsonValue["LastResetTime"] = + asyncResp->res.jsonValue["LastResetTime"] = redfish::time_utils::getDateTimeUint(lastResetTimeStamp); }); } @@ -1202,12 +1213,12 @@ inline void getLastResetTime(const std::shared_ptr<bmcweb::AsyncResp>& aResp) * automatic retry attempts left are hosted in phosphor-state-manager through * dbus. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ -inline void - getAutomaticRebootAttempts(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void getAutomaticRebootAttempts( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get Automatic Retry policy"; @@ -1215,14 +1226,15 @@ inline void *crow::connections::systemBus, "xyz.openbmc_project.State.Host", "/xyz/openbmc_project/state/host0", "xyz.openbmc_project.Control.Boot.RebootAttempts", - [aResp{aResp}](const boost::system::error_code& ec, - const dbus::utility::DBusPropertiesMap& propertiesList) { + [asyncResp{asyncResp}]( + const boost::system::error_code& ec, + const dbus::utility::DBusPropertiesMap& propertiesList) { if (ec) { if (ec.value() != EBADR) { BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); } return; } @@ -1236,19 +1248,20 @@ inline void if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (attemptsLeft != nullptr) { - aResp->res.jsonValue["Boot"]["RemainingAutomaticRetryAttempts"] = + asyncResp->res + .jsonValue["Boot"]["RemainingAutomaticRetryAttempts"] = *attemptsLeft; } if (retryAttempts != nullptr) { - aResp->res.jsonValue["Boot"]["AutomaticRetryAttempts"] = + asyncResp->res.jsonValue["Boot"]["AutomaticRetryAttempts"] = *retryAttempts; } }); @@ -1257,12 +1270,12 @@ inline void /** * @brief Retrieves Automatic Retry properties. Known on D-Bus as AutoReboot. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ inline void - getAutomaticRetryPolicy(const std::shared_ptr<bmcweb::AsyncResp>& aResp) + getAutomaticRetryPolicy(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get Automatic Retry policy"; @@ -1270,13 +1283,14 @@ inline void *crow::connections::systemBus, "xyz.openbmc_project.Settings", "/xyz/openbmc_project/control/host0/auto_reboot", "xyz.openbmc_project.Control.Boot.RebootPolicy", "AutoReboot", - [aResp](const boost::system::error_code& ec, bool autoRebootEnabled) { + [asyncResp](const boost::system::error_code& ec, + bool autoRebootEnabled) { if (ec) { if (ec.value() != EBADR) { BMCWEB_LOG_ERROR << "D-Bus responses error: " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); } return; } @@ -1284,45 +1298,46 @@ inline void BMCWEB_LOG_DEBUG << "Auto Reboot: " << autoRebootEnabled; if (autoRebootEnabled) { - aResp->res.jsonValue["Boot"]["AutomaticRetryConfig"] = + asyncResp->res.jsonValue["Boot"]["AutomaticRetryConfig"] = "RetryAttempts"; } else { - aResp->res.jsonValue["Boot"]["AutomaticRetryConfig"] = "Disabled"; + asyncResp->res.jsonValue["Boot"]["AutomaticRetryConfig"] = + "Disabled"; } - getAutomaticRebootAttempts(aResp); + getAutomaticRebootAttempts(asyncResp); // "AutomaticRetryConfig" can be 3 values, Disabled, RetryAlways, // and RetryAttempts. OpenBMC only supports Disabled and // RetryAttempts. - aResp->res.jsonValue["Boot"] - ["AutomaticRetryConfig@Redfish.AllowableValues"] = { - "Disabled", "RetryAttempts"}; + asyncResp->res + .jsonValue["Boot"]["AutomaticRetryConfig@Redfish.AllowableValues"] = + {"Disabled", "RetryAttempts"}; }); } /** * @brief Sets RetryAttempts * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] retryAttempts "AutomaticRetryAttempts" from request. * *@return None. */ -inline void - setAutomaticRetryAttempts(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const uint32_t retryAttempts) +inline void setAutomaticRetryAttempts( + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const uint32_t retryAttempts) { BMCWEB_LOG_DEBUG << "Set Automatic Retry Attempts."; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { BMCWEB_LOG_ERROR << "DBUS response error: Set setAutomaticRetryAttempts" << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, @@ -1335,12 +1350,12 @@ inline void /** * @brief Retrieves power restore policy over DBUS. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ inline void - getPowerRestorePolicy(const std::shared_ptr<bmcweb::AsyncResp>& aResp) + getPowerRestorePolicy(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get power restore policy"; @@ -1348,8 +1363,8 @@ inline void *crow::connections::systemBus, "xyz.openbmc_project.Settings", "/xyz/openbmc_project/control/host0/power_restore_policy", "xyz.openbmc_project.Control.Power.RestorePolicy", "PowerRestorePolicy", - [aResp](const boost::system::error_code& ec, - const std::string& policy) { + [asyncResp](const boost::system::error_code& ec, + const std::string& policy) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; @@ -1370,11 +1385,11 @@ inline void auto policyMapsIt = policyMaps.find(policy); if (policyMapsIt == policyMaps.end()) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - aResp->res.jsonValue["PowerRestorePolicy"] = policyMapsIt->second; + asyncResp->res.jsonValue["PowerRestorePolicy"] = policyMapsIt->second; }); } @@ -1382,20 +1397,20 @@ inline void * @brief Get TrustedModuleRequiredToBoot property. Determines whether or not * TPM is required for booting the host. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ inline void getTrustedModuleRequiredToBoot( - const std::shared_ptr<bmcweb::AsyncResp>& aResp) + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get TPM required to boot."; constexpr std::array<std::string_view, 1> interfaces = { "xyz.openbmc_project.Control.TPM.Policy"}; dbus::utility::getSubTree( "/", 0, interfaces, - [aResp](const boost::system::error_code& ec, - const dbus::utility::MapperGetSubTreeResponse& subtree) { + [asyncResp](const boost::system::error_code& ec, + const dbus::utility::MapperGetSubTreeResponse& subtree) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error on TPM.Policy GetSubTree" @@ -1418,7 +1433,7 @@ inline void getTrustedModuleRequiredToBoot( << "DBUS response has more than 1 TPM Enable object:" << subtree.size(); // Throw an internal Error and return - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -1427,7 +1442,7 @@ inline void getTrustedModuleRequiredToBoot( if (subtree[0].first.empty() || subtree[0].second.size() != 1) { BMCWEB_LOG_DEBUG << "TPM.Policy mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -1438,23 +1453,26 @@ inline void getTrustedModuleRequiredToBoot( sdbusplus::asio::getProperty<bool>( *crow::connections::systemBus, serv, path, "xyz.openbmc_project.Control.TPM.Policy", "TPMEnable", - [aResp](const boost::system::error_code& ec2, bool tpmRequired) { + [asyncResp](const boost::system::error_code& ec2, + bool tpmRequired) { if (ec2) { BMCWEB_LOG_DEBUG << "D-BUS response error on TPM.Policy Get" << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (tpmRequired) { - aResp->res.jsonValue["Boot"]["TrustedModuleRequiredToBoot"] = + asyncResp->res + .jsonValue["Boot"]["TrustedModuleRequiredToBoot"] = "Required"; } else { - aResp->res.jsonValue["Boot"]["TrustedModuleRequiredToBoot"] = + asyncResp->res + .jsonValue["Boot"]["TrustedModuleRequiredToBoot"] = "Disabled"; } }); @@ -1465,32 +1483,32 @@ inline void getTrustedModuleRequiredToBoot( * @brief Set TrustedModuleRequiredToBoot property. Determines whether or not * TPM is required for booting the host. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] tpmRequired Value to set TPM Required To Boot property to. * * @return None. */ inline void setTrustedModuleRequiredToBoot( - const std::shared_ptr<bmcweb::AsyncResp>& aResp, const bool tpmRequired) + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const bool tpmRequired) { BMCWEB_LOG_DEBUG << "Set TrustedModuleRequiredToBoot."; constexpr std::array<std::string_view, 1> interfaces = { "xyz.openbmc_project.Control.TPM.Policy"}; dbus::utility::getSubTree( "/", 0, interfaces, - [aResp, + [asyncResp, tpmRequired](const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreeResponse& subtree) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error on TPM.Policy GetSubTree" << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (subtree.empty()) { - messages::propertyValueNotInList(aResp->res, "ComputerSystem", + messages::propertyValueNotInList(asyncResp->res, "ComputerSystem", "TrustedModuleRequiredToBoot"); return; } @@ -1502,7 +1520,7 @@ inline void setTrustedModuleRequiredToBoot( << "DBUS response has more than 1 TPM Enable object:" << subtree.size(); // Throw an internal Error and return - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -1511,7 +1529,7 @@ inline void setTrustedModuleRequiredToBoot( if (subtree[0].first.empty() || subtree[0].second.size() != 1) { BMCWEB_LOG_DEBUG << "TPM.Policy mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -1521,19 +1539,19 @@ inline void setTrustedModuleRequiredToBoot( if (serv.empty()) { BMCWEB_LOG_DEBUG << "TPM.Policy service mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } // Valid TPM Enable object found, now setting the value crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error: Set TrustedModuleRequiredToBoot" << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } BMCWEB_LOG_DEBUG << "Set TrustedModuleRequiredToBoot done."; @@ -1547,11 +1565,11 @@ inline void setTrustedModuleRequiredToBoot( /** * @brief Sets boot properties into DBUS object(s). * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] bootType The boot type to set. * @return Integer error code. */ -inline void setBootType(const std::shared_ptr<bmcweb::AsyncResp>& aResp, +inline void setBootType(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::optional<std::string>& bootType) { std::string bootTypeStr; @@ -1577,7 +1595,7 @@ inline void setBootType(const std::shared_ptr<bmcweb::AsyncResp>& aResp, BMCWEB_LOG_DEBUG << "Invalid property value for " "BootSourceOverrideMode: " << *bootType; - messages::propertyValueNotInList(aResp->res, *bootType, + messages::propertyValueNotInList(asyncResp->res, *bootType, "BootSourceOverrideMode"); return; } @@ -1586,16 +1604,16 @@ inline void setBootType(const std::shared_ptr<bmcweb::AsyncResp>& aResp, BMCWEB_LOG_DEBUG << "DBUS boot type: " << bootTypeStr; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; if (ec.value() == boost::asio::error::host_unreachable) { - messages::resourceNotFound(aResp->res, "Set", "BootType"); + messages::resourceNotFound(asyncResp->res, "Set", "BootType"); return; } - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } BMCWEB_LOG_DEBUG << "Boot type update done."; @@ -1610,11 +1628,12 @@ inline void setBootType(const std::shared_ptr<bmcweb::AsyncResp>& aResp, /** * @brief Sets boot properties into DBUS object(s). * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response + * message. * @param[in] bootType The boot type to set. * @return Integer error code. */ -inline void setBootEnable(const std::shared_ptr<bmcweb::AsyncResp>& aResp, +inline void setBootEnable(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::optional<std::string>& bootEnable) { if (!bootEnable) @@ -1646,7 +1665,7 @@ inline void setBootEnable(const std::shared_ptr<bmcweb::AsyncResp>& aResp, BMCWEB_LOG_DEBUG << "Invalid property value for BootSourceOverrideEnabled: " << *bootEnable; - messages::propertyValueNotInList(aResp->res, *bootEnable, + messages::propertyValueNotInList(asyncResp->res, *bootEnable, "BootSourceOverrideEnabled"); return; } @@ -1655,11 +1674,11 @@ inline void setBootEnable(const std::shared_ptr<bmcweb::AsyncResp>& aResp, BMCWEB_LOG_DEBUG << "DBUS boot override enable: " << bootOverrideEnable; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } BMCWEB_LOG_DEBUG << "Boot override enable update done."; @@ -1681,11 +1700,11 @@ inline void setBootEnable(const std::shared_ptr<bmcweb::AsyncResp>& aResp, << bootOverridePersistent; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } BMCWEB_LOG_DEBUG << "Boot one_time update done."; @@ -1700,13 +1719,14 @@ inline void setBootEnable(const std::shared_ptr<bmcweb::AsyncResp>& aResp, /** * @brief Sets boot properties into DBUS object(s). * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] bootSource The boot source to set. * * @return Integer error code. */ -inline void setBootModeOrSource(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::optional<std::string>& bootSource) +inline void + setBootModeOrSource(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::optional<std::string>& bootSource) { std::string bootSourceStr; std::string bootModeStr; @@ -1719,13 +1739,13 @@ inline void setBootModeOrSource(const std::shared_ptr<bmcweb::AsyncResp>& aResp, // Source target specified BMCWEB_LOG_DEBUG << "Boot source: " << *bootSource; // Figure out which DBUS interface and property to use - if (assignBootParameters(aResp, *bootSource, bootSourceStr, bootModeStr) != - 0) + if (assignBootParameters(asyncResp, *bootSource, bootSourceStr, + bootModeStr) != 0) { BMCWEB_LOG_DEBUG << "Invalid property value for BootSourceOverrideTarget: " << *bootSource; - messages::propertyValueNotInList(aResp->res, *bootSource, + messages::propertyValueNotInList(asyncResp->res, *bootSource, "BootSourceTargetOverride"); return; } @@ -1735,11 +1755,11 @@ inline void setBootModeOrSource(const std::shared_ptr<bmcweb::AsyncResp>& aResp, BMCWEB_LOG_DEBUG << "DBUS boot mode: " << bootModeStr; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } BMCWEB_LOG_DEBUG << "Boot source update done."; @@ -1751,11 +1771,11 @@ inline void setBootModeOrSource(const std::shared_ptr<bmcweb::AsyncResp>& aResp, dbus::utility::DbusVariantType(bootSourceStr)); crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } BMCWEB_LOG_DEBUG << "Boot mode update done."; @@ -1770,7 +1790,7 @@ inline void setBootModeOrSource(const std::shared_ptr<bmcweb::AsyncResp>& aResp, /** * @brief Sets Boot source override properties. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] bootSource The boot source from incoming RF request. * @param[in] bootType The boot type from incoming RF request. * @param[in] bootEnable The boot override enable from incoming RF request. @@ -1778,46 +1798,47 @@ inline void setBootModeOrSource(const std::shared_ptr<bmcweb::AsyncResp>& aResp, * @return Integer error code. */ -inline void setBootProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::optional<std::string>& bootSource, - const std::optional<std::string>& bootType, - const std::optional<std::string>& bootEnable) +inline void + setBootProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::optional<std::string>& bootSource, + const std::optional<std::string>& bootType, + const std::optional<std::string>& bootEnable) { BMCWEB_LOG_DEBUG << "Set boot information."; - setBootModeOrSource(aResp, bootSource); - setBootType(aResp, bootType); - setBootEnable(aResp, bootEnable); + setBootModeOrSource(asyncResp, bootSource); + setBootType(asyncResp, bootType); + setBootEnable(asyncResp, bootEnable); } /** * @brief Sets AssetTag * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] assetTag "AssetTag" from request. * * @return None. */ -inline void setAssetTag(const std::shared_ptr<bmcweb::AsyncResp>& aResp, +inline void setAssetTag(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& assetTag) { constexpr std::array<std::string_view, 1> interfaces = { "xyz.openbmc_project.Inventory.Item.System"}; dbus::utility::getSubTree( "/xyz/openbmc_project/inventory", 0, interfaces, - [aResp, + [asyncResp, assetTag](const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreeResponse& subtree) { if (ec) { BMCWEB_LOG_DEBUG << "D-Bus response error on GetSubTree " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (subtree.empty()) { BMCWEB_LOG_DEBUG << "Can't find system D-Bus object!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } // Assume only 1 system D-Bus object @@ -1825,13 +1846,13 @@ inline void setAssetTag(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (subtree.size() > 1) { BMCWEB_LOG_DEBUG << "Found more than 1 system D-Bus object!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (subtree[0].first.empty() || subtree[0].second.size() != 1) { BMCWEB_LOG_DEBUG << "Asset Tag Set mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -1841,17 +1862,17 @@ inline void setAssetTag(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (service.empty()) { BMCWEB_LOG_DEBUG << "Asset Tag Set service mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "D-Bus response error on AssetTag Set " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, @@ -1864,13 +1885,14 @@ inline void setAssetTag(const std::shared_ptr<bmcweb::AsyncResp>& aResp, /** * @brief Sets automaticRetry (Auto Reboot) * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] automaticRetryConfig "AutomaticRetryConfig" from request. * * @return None. */ -inline void setAutomaticRetry(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& automaticRetryConfig) +inline void + setAutomaticRetry(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& automaticRetryConfig) { BMCWEB_LOG_DEBUG << "Set Automatic Retry."; @@ -1889,16 +1911,16 @@ inline void setAutomaticRetry(const std::shared_ptr<bmcweb::AsyncResp>& aResp, { BMCWEB_LOG_DEBUG << "Invalid property value for AutomaticRetryConfig: " << automaticRetryConfig; - messages::propertyValueNotInList(aResp->res, automaticRetryConfig, + messages::propertyValueNotInList(asyncResp->res, automaticRetryConfig, "AutomaticRetryConfig"); return; } crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, @@ -1912,13 +1934,13 @@ inline void setAutomaticRetry(const std::shared_ptr<bmcweb::AsyncResp>& aResp, /** * @brief Sets power restore policy properties. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] policy power restore policy properties from request. * * @return None. */ inline void - setPowerRestorePolicy(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + setPowerRestorePolicy(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& policy) { BMCWEB_LOG_DEBUG << "Set power restore policy."; @@ -1936,7 +1958,7 @@ inline void auto policyMapsIt = policyMaps.find(policy); if (policyMapsIt == policyMaps.end()) { - messages::propertyValueNotInList(aResp->res, policy, + messages::propertyValueNotInList(asyncResp->res, policy, "PowerRestorePolicy"); return; } @@ -1944,10 +1966,10 @@ inline void powerRestorPolicy = policyMapsIt->second; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, @@ -1962,21 +1984,21 @@ inline void /** * @brief Retrieves provisioning status * - * @param[in] aResp Shared pointer for completing asynchronous calls. + * @param[in] asyncResp Shared pointer for completing asynchronous calls. * * @return None. */ -inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> aResp) +inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> asyncResp) { BMCWEB_LOG_DEBUG << "Get OEM information."; sdbusplus::asio::getAllProperties( *crow::connections::systemBus, "xyz.openbmc_project.PFR.Manager", "/xyz/openbmc_project/pfr", "xyz.openbmc_project.PFR.Attributes", - [aResp](const boost::system::error_code& ec, - const dbus::utility::DBusPropertiesMap& propertiesList) { + [asyncResp](const boost::system::error_code& ec, + const dbus::utility::DBusPropertiesMap& propertiesList) { nlohmann::json& oemPFR = - aResp->res.jsonValue["Oem"]["OpenBmc"]["FirmwareProvisioning"]; - aResp->res.jsonValue["Oem"]["OpenBmc"]["@odata.type"] = + asyncResp->res.jsonValue["Oem"]["OpenBmc"]["FirmwareProvisioning"]; + asyncResp->res.jsonValue["Oem"]["OpenBmc"]["@odata.type"] = "#OemComputerSystem.OpenBmc"; oemPFR["@odata.type"] = "#OemComputerSystem.FirmwareProvisioning"; @@ -1997,14 +2019,14 @@ inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> aResp) if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if ((provState == nullptr) || (lockState == nullptr)) { BMCWEB_LOG_DEBUG << "Unable to get PFR attributes."; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -2030,50 +2052,51 @@ inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> aResp) /** * @brief Translate the PowerMode to a response message. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] modeValue PowerMode value to be translated * * @return None. */ -inline void translatePowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::string& modeValue) +inline void + translatePowerMode(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::string& modeValue) { if (modeValue == "xyz.openbmc_project.Control.Power.Mode.PowerMode.Static") { - aResp->res.jsonValue["PowerMode"] = "Static"; + asyncResp->res.jsonValue["PowerMode"] = "Static"; } else if ( modeValue == "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance") { - aResp->res.jsonValue["PowerMode"] = "MaximumPerformance"; + asyncResp->res.jsonValue["PowerMode"] = "MaximumPerformance"; } else if (modeValue == "xyz.openbmc_project.Control.Power.Mode.PowerMode.PowerSaving") { - aResp->res.jsonValue["PowerMode"] = "PowerSaving"; + asyncResp->res.jsonValue["PowerMode"] = "PowerSaving"; } else if (modeValue == "xyz.openbmc_project.Control.Power.Mode.PowerMode.OEM") { - aResp->res.jsonValue["PowerMode"] = "OEM"; + asyncResp->res.jsonValue["PowerMode"] = "OEM"; } else { // Any other values would be invalid BMCWEB_LOG_DEBUG << "PowerMode value was not valid: " << modeValue; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); } } /** * @brief Retrieves system power mode * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * * @return None. */ -inline void getPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void getPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get power mode."; @@ -2082,8 +2105,8 @@ inline void getPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp) "xyz.openbmc_project.Control.Power.Mode"}; dbus::utility::getSubTree( "/", 0, interfaces, - [aResp](const boost::system::error_code& ec, - const dbus::utility::MapperGetSubTreeResponse& subtree) { + [asyncResp](const boost::system::error_code& ec, + const dbus::utility::MapperGetSubTreeResponse& subtree) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error on Power.Mode GetSubTree " @@ -2105,13 +2128,13 @@ inline void getPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp) BMCWEB_LOG_DEBUG << "Found more than 1 system D-Bus Power.Mode objects: " << subtree.size(); - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1)) { BMCWEB_LOG_DEBUG << "Power.Mode mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } const std::string& path = subtree[0].first; @@ -2119,28 +2142,28 @@ inline void getPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp) if (service.empty()) { BMCWEB_LOG_DEBUG << "Power.Mode service mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } // Valid Power Mode object found, now read the current value sdbusplus::asio::getProperty<std::string>( *crow::connections::systemBus, service, path, "xyz.openbmc_project.Control.Power.Mode", "PowerMode", - [aResp](const boost::system::error_code& ec2, - const std::string& pmode) { + [asyncResp](const boost::system::error_code& ec2, + const std::string& pmode) { if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error on PowerMode Get: " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - aResp->res.jsonValue["PowerMode@Redfish.AllowableValues"] = { + asyncResp->res.jsonValue["PowerMode@Redfish.AllowableValues"] = { "Static", "MaximumPerformance", "PowerSaving"}; BMCWEB_LOG_DEBUG << "Current power mode: " << pmode; - translatePowerMode(aResp, pmode); + translatePowerMode(asyncResp, pmode); }); }); } @@ -2149,13 +2172,13 @@ inline void getPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp) * @brief Validate the specified mode is valid and return the PowerMode * name associated with that string * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] modeString String representing the desired PowerMode * * @return PowerMode value or empty string if mode is not valid */ inline std::string - validatePowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + validatePowerMode(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& modeString) { std::string mode; @@ -2175,7 +2198,8 @@ inline std::string } else { - messages::propertyValueNotInList(aResp->res, modeString, "PowerMode"); + messages::propertyValueNotInList(asyncResp->res, modeString, + "PowerMode"); } return mode; } @@ -2183,17 +2207,17 @@ inline std::string /** * @brief Sets system power mode. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] pmode System power mode from request. * * @return None. */ -inline void setPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, +inline void setPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& pmode) { BMCWEB_LOG_DEBUG << "Set power mode."; - std::string powerMode = validatePowerMode(aResp, pmode); + std::string powerMode = validatePowerMode(asyncResp, pmode); if (powerMode.empty()) { return; @@ -2204,7 +2228,7 @@ inline void setPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, "xyz.openbmc_project.Control.Power.Mode"}; dbus::utility::getSubTree( "/", 0, interfaces, - [aResp, + [asyncResp, powerMode](const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreeResponse& subtree) { if (ec) @@ -2212,13 +2236,13 @@ inline void setPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, BMCWEB_LOG_DEBUG << "DBUS response error on Power.Mode GetSubTree " << ec; // This is an optional D-Bus object, but user attempted to patch - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (subtree.empty()) { // This is an optional D-Bus object, but user attempted to patch - messages::resourceNotFound(aResp->res, "ComputerSystem", + messages::resourceNotFound(asyncResp->res, "ComputerSystem", "PowerMode"); return; } @@ -2229,13 +2253,13 @@ inline void setPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, BMCWEB_LOG_DEBUG << "Found more than 1 system D-Bus Power.Mode objects: " << subtree.size(); - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1)) { BMCWEB_LOG_DEBUG << "Power.Mode mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } const std::string& path = subtree[0].first; @@ -2243,7 +2267,7 @@ inline void setPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (service.empty()) { BMCWEB_LOG_DEBUG << "Power.Mode service mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -2252,10 +2276,10 @@ inline void setPowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp, // Set the Power Mode property crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, @@ -2329,20 +2353,20 @@ inline std::string rfToDbusWDTTimeOutAct(const std::string& rfAction) /** * @brief Retrieves host watchdog timer properties over DBUS * - * @param[in] aResp Shared pointer for completing asynchronous calls. + * @param[in] asyncResp Shared pointer for completing asynchronous calls. * * @return None. */ inline void - getHostWatchdogTimer(const std::shared_ptr<bmcweb::AsyncResp>& aResp) + getHostWatchdogTimer(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get host watchodg"; sdbusplus::asio::getAllProperties( *crow::connections::systemBus, "xyz.openbmc_project.Watchdog", "/xyz/openbmc_project/watchdog/host0", "xyz.openbmc_project.State.Watchdog", - [aResp](const boost::system::error_code& ec, - const dbus::utility::DBusPropertiesMap& properties) { + [asyncResp](const boost::system::error_code& ec, + const dbus::utility::DBusPropertiesMap& properties) { if (ec) { // watchdog service is stopped @@ -2353,7 +2377,7 @@ inline void BMCWEB_LOG_DEBUG << "Got " << properties.size() << " wdt prop."; nlohmann::json& hostWatchdogTimer = - aResp->res.jsonValue["HostWatchdogTimer"]; + asyncResp->res.jsonValue["HostWatchdogTimer"]; // watchdog service is running/enabled hostWatchdogTimer["Status"]["State"] = "Enabled"; @@ -2367,7 +2391,7 @@ inline void if (!success) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -2381,7 +2405,7 @@ inline void std::string action = dbusToRfWatchdogAction(*expireAction); if (action.empty()) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } hostWatchdogTimer["TimeoutAction"] = action; @@ -2392,16 +2416,17 @@ inline void /** * @brief Sets Host WatchDog Timer properties. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] wdtEnable The WDTimer Enable value (true/false) from incoming * RF request. * @param[in] wdtTimeOutAction The WDT Timeout action, from incoming RF request. * * @return None. */ -inline void setWDTProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::optional<bool> wdtEnable, - const std::optional<std::string>& wdtTimeOutAction) +inline void + setWDTProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::optional<bool> wdtEnable, + const std::optional<std::string>& wdtTimeOutAction) { BMCWEB_LOG_DEBUG << "Set host watchdog"; @@ -2413,17 +2438,17 @@ inline void setWDTProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp, { BMCWEB_LOG_DEBUG << "Unsupported value for TimeoutAction: " << *wdtTimeOutAction; - messages::propertyValueNotInList(aResp->res, *wdtTimeOutAction, + messages::propertyValueNotInList(asyncResp->res, *wdtTimeOutAction, "TimeoutAction"); return; } crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, @@ -2437,11 +2462,11 @@ inline void setWDTProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (wdtEnable) { crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec) { + [asyncResp](const boost::system::error_code& ec) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, @@ -2456,13 +2481,13 @@ inline void setWDTProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp, /** * @brief Parse the Idle Power Saver properties into json * - * @param[in] aResp Shared pointer for completing asynchronous calls. + * @param[in] asyncResp Shared pointer for completing asynchronous calls. * @param[in] properties IPS property data from DBus. * * @return true if successful */ inline bool - parseIpsProperties(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + parseIpsProperties(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const dbus::utility::DBusPropertiesMap& properties) { const bool* enabled = nullptr; @@ -2484,33 +2509,33 @@ inline bool if (enabled != nullptr) { - aResp->res.jsonValue["IdlePowerSaver"]["Enabled"] = *enabled; + asyncResp->res.jsonValue["IdlePowerSaver"]["Enabled"] = *enabled; } if (enterUtilizationPercent != nullptr) { - aResp->res.jsonValue["IdlePowerSaver"]["EnterUtilizationPercent"] = + asyncResp->res.jsonValue["IdlePowerSaver"]["EnterUtilizationPercent"] = *enterUtilizationPercent; } if (enterDwellTime != nullptr) { const std::chrono::duration<uint64_t, std::milli> ms(*enterDwellTime); - aResp->res.jsonValue["IdlePowerSaver"]["EnterDwellTimeSeconds"] = + asyncResp->res.jsonValue["IdlePowerSaver"]["EnterDwellTimeSeconds"] = std::chrono::duration_cast<std::chrono::duration<uint64_t>>(ms) .count(); } if (exitUtilizationPercent != nullptr) { - aResp->res.jsonValue["IdlePowerSaver"]["ExitUtilizationPercent"] = + asyncResp->res.jsonValue["IdlePowerSaver"]["ExitUtilizationPercent"] = *exitUtilizationPercent; } if (exitDwellTime != nullptr) { const std::chrono::duration<uint64_t, std::milli> ms(*exitDwellTime); - aResp->res.jsonValue["IdlePowerSaver"]["ExitDwellTimeSeconds"] = + asyncResp->res.jsonValue["IdlePowerSaver"]["ExitDwellTimeSeconds"] = std::chrono::duration_cast<std::chrono::duration<uint64_t>>(ms) .count(); } @@ -2521,11 +2546,12 @@ inline bool /** * @brief Retrieves host watchdog timer properties over DBUS * - * @param[in] aResp Shared pointer for completing asynchronous calls. + * @param[in] asyncResp Shared pointer for completing asynchronous calls. * * @return None. */ -inline void getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp) +inline void + getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { BMCWEB_LOG_DEBUG << "Get idle power saver parameters"; @@ -2534,14 +2560,14 @@ inline void getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp) "xyz.openbmc_project.Control.Power.IdlePowerSaver"}; dbus::utility::getSubTree( "/", 0, interfaces, - [aResp](const boost::system::error_code& ec, - const dbus::utility::MapperGetSubTreeResponse& subtree) { + [asyncResp](const boost::system::error_code& ec, + const dbus::utility::MapperGetSubTreeResponse& subtree) { if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error on Power.IdlePowerSaver GetSubTree " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (subtree.empty()) @@ -2558,13 +2584,13 @@ inline void getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp) BMCWEB_LOG_DEBUG << "Found more than 1 system D-Bus " "Power.IdlePowerSaver objects: " << subtree.size(); - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1)) { BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } const std::string& path = subtree[0].first; @@ -2572,7 +2598,7 @@ inline void getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp) if (service.empty()) { BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver service mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -2580,19 +2606,19 @@ inline void getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp) sdbusplus::asio::getAllProperties( *crow::connections::systemBus, service, path, "xyz.openbmc_project.Control.Power.IdlePowerSaver", - [aResp](const boost::system::error_code& ec2, - const dbus::utility::DBusPropertiesMap& properties) { + [asyncResp](const boost::system::error_code& ec2, + const dbus::utility::DBusPropertiesMap& properties) { if (ec2) { BMCWEB_LOG_ERROR << "DBUS response error on IdlePowerSaver GetAll: " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } - if (!parseIpsProperties(aResp, properties)) + if (!parseIpsProperties(asyncResp, properties)) { - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }); @@ -2604,7 +2630,7 @@ inline void getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp) /** * @brief Sets Idle Power Saver properties. * - * @param[in] aResp Shared pointer for generating response message. + * @param[in] asyncResp Shared pointer for generating response message. * @param[in] ipsEnable The IPS Enable value (true/false) from incoming * RF request. * @param[in] ipsEnterUtil The utilization limit to enter idle state. @@ -2616,12 +2642,13 @@ inline void getIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp) * * @return None. */ -inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, - const std::optional<bool> ipsEnable, - const std::optional<uint8_t> ipsEnterUtil, - const std::optional<uint64_t> ipsEnterTime, - const std::optional<uint8_t> ipsExitUtil, - const std::optional<uint64_t> ipsExitTime) +inline void + setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + const std::optional<bool> ipsEnable, + const std::optional<uint8_t> ipsEnterUtil, + const std::optional<uint64_t> ipsEnterTime, + const std::optional<uint8_t> ipsExitUtil, + const std::optional<uint64_t> ipsExitTime) { BMCWEB_LOG_DEBUG << "Set idle power saver properties"; @@ -2630,7 +2657,7 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, "xyz.openbmc_project.Control.Power.IdlePowerSaver"}; dbus::utility::getSubTree( "/", 0, interfaces, - [aResp, ipsEnable, ipsEnterUtil, ipsEnterTime, ipsExitUtil, + [asyncResp, ipsEnable, ipsEnterUtil, ipsEnterTime, ipsExitUtil, ipsExitTime](const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreeResponse& subtree) { if (ec) @@ -2638,13 +2665,13 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, BMCWEB_LOG_DEBUG << "DBUS response error on Power.IdlePowerSaver GetSubTree " << ec; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if (subtree.empty()) { // This is an optional D-Bus object, but user attempted to patch - messages::resourceNotFound(aResp->res, "ComputerSystem", + messages::resourceNotFound(asyncResp->res, "ComputerSystem", "IdlePowerSaver"); return; } @@ -2655,13 +2682,13 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, BMCWEB_LOG_DEBUG << "Found more than 1 system D-Bus Power.IdlePowerSaver objects: " << subtree.size(); - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } if ((subtree[0].first.empty()) || (subtree[0].second.size() != 1)) { BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } const std::string& path = subtree[0].first; @@ -2669,7 +2696,7 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (service.empty()) { BMCWEB_LOG_DEBUG << "Power.IdlePowerSaver service mapper error!"; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } @@ -2679,11 +2706,11 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (ipsEnable) { crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, @@ -2694,11 +2721,11 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (ipsEnterUtil) { crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, @@ -2712,11 +2739,11 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, // Convert from seconds into milliseconds for DBus const uint64_t timeMilliseconds = *ipsEnterTime * 1000; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, @@ -2728,11 +2755,11 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, if (ipsExitUtil) { crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, @@ -2746,11 +2773,11 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp, // Convert from seconds into milliseconds for DBus const uint64_t timeMilliseconds = *ipsExitTime * 1000; crow::connections::systemBus->async_method_call( - [aResp](const boost::system::error_code& ec2) { + [asyncResp](const boost::system::error_code& ec2) { if (ec2) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec2; - messages::internalError(aResp->res); + messages::internalError(asyncResp->res); return; } }, diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp index 3d58d0d6bf..9cd67cd0f2 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -854,24 +854,26 @@ inline void requestRoutesSoftwareInventoryCollection(App& app) } /* Fill related item links (i.e. bmc, bios) in for inventory */ inline static void - getRelatedItems(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + getRelatedItems(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& purpose) { if (purpose == sw_util::bmcPurpose) { - nlohmann::json& relatedItem = aResp->res.jsonValue["RelatedItem"]; + nlohmann::json& relatedItem = asyncResp->res.jsonValue["RelatedItem"]; nlohmann::json::object_t item; item["@odata.id"] = "/redfish/v1/Managers/bmc"; relatedItem.emplace_back(std::move(item)); - aResp->res.jsonValue["RelatedItem@odata.count"] = relatedItem.size(); + asyncResp->res.jsonValue["RelatedItem@odata.count"] = + relatedItem.size(); } else if (purpose == sw_util::biosPurpose) { - nlohmann::json& relatedItem = aResp->res.jsonValue["RelatedItem"]; + nlohmann::json& relatedItem = asyncResp->res.jsonValue["RelatedItem"]; nlohmann::json::object_t item; item["@odata.id"] = "/redfish/v1/Systems/system/Bios"; relatedItem.emplace_back(std::move(item)); - aResp->res.jsonValue["RelatedItem@odata.count"] = relatedItem.size(); + asyncResp->res.jsonValue["RelatedItem@odata.count"] = + relatedItem.size(); } else { diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp index 56e26793d4..5e177ab8c3 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp @@ -89,13 +89,13 @@ using CheckItemHandler = const std::pair<sdbusplus::message::object_path, dbus::utility::DBusInteracesMap>&)>; -inline void findAndParseObject(const std::string& service, - const std::string& resName, - const std::shared_ptr<bmcweb::AsyncResp>& aResp, - CheckItemHandler&& handler) +inline void + findAndParseObject(const std::string& service, const std::string& resName, + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, + CheckItemHandler&& handler) { crow::connections::systemBus->async_method_call( - [service, resName, aResp, + [service, resName, asyncResp, handler](const boost::system::error_code& ec, const dbus::utility::ManagedObjectType& subtree) { if (ec) @@ -110,13 +110,13 @@ inline void findAndParseObject(const std::string& service, VmMode mode = parseObjectPathAndGetMode(item.first, resName); if (mode != VmMode::Invalid) { - handler(service, resName, aResp, item); + handler(service, resName, asyncResp, item); return; } } BMCWEB_LOG_DEBUG << "Parent item not found"; - aResp->res.result(boost::beast::http::status::not_found); + asyncResp->res.result(boost::beast::http::status::not_found); }, service, "/xyz/openbmc_project/VirtualMedia", "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"); @@ -151,7 +151,7 @@ inline std::string getTransferProtocolTypeFromUri(const std::string& imageUri) */ inline void vmParseInterfaceObject(const dbus::utility::DBusInteracesMap& interfaces, - const std::shared_ptr<bmcweb::AsyncResp>& aResp) + const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { for (const auto& [interface, values] : interfaces) { @@ -170,10 +170,11 @@ inline void if (!endpointIdValue->empty()) { // Proxy mode - aResp->res + asyncResp->res .jsonValue["Oem"]["OpenBMC"]["WebSocketEndpoint"] = *endpointIdValue; - aResp->res.jsonValue["TransferProtocolType"] = "OEM"; + asyncResp->res.jsonValue["TransferProtocolType"] = + "OEM"; } } if (property == "ImageURL") @@ -187,19 +188,19 @@ inline void { // this will handle https share, which not // necessarily has to have filename given. - aResp->res.jsonValue["ImageName"] = ""; + asyncResp->res.jsonValue["ImageName"] = ""; } else { - aResp->res.jsonValue["ImageName"] = + asyncResp->res.jsonValue["ImageName"] = filePath.filename(); } - aResp->res.jsonValue["Image"] = *imageUrlValue; - aResp->res.jsonValue["TransferProtocolType"] = + asyncResp->res.jsonValue["Image"] = *imageUrlValue; + asyncResp->res.jsonValue["TransferProtocolType"] = getTransferProtocolTypeFromUri(*imageUrlValue); - aResp->res.jsonValue["ConnectedVia"] = + asyncResp->res.jsonValue["ConnectedVia"] = virtual_media::ConnectedVia::URI; } } @@ -208,7 +209,7 @@ inline void const bool* writeProtectedValue = std::get_if<bool>(&value); if (writeProtectedValue != nullptr) { - aResp->res.jsonValue["WriteProtected"] = + asyncResp->res.jsonValue["WriteProtected"] = *writeProtectedValue; } } @@ -226,11 +227,11 @@ inline void BMCWEB_LOG_DEBUG << "Value Active not found"; return; } - aResp->res.jsonValue["Inserted"] = *activeValue; + asyncResp->res.jsonValue["Inserted"] = *activeValue; if (*activeValue) { - aResp->res.jsonValue["ConnectedVia"] = + asyncResp->res.jsonValue["ConnectedVia"] = virtual_media::ConnectedVia::Applet; } } @@ -267,13 +268,13 @@ inline nlohmann::json vmItemTemplate(const std::string& name, /** * @brief Fills collection data */ -inline void getVmResourceList(std::shared_ptr<bmcweb::AsyncResp> aResp, +inline void getVmResourceList(std::shared_ptr<bmcweb::AsyncResp> asyncResp, const std::string& service, const std::string& name) { BMCWEB_LOG_DEBUG << "Get available Virtual Media resources."; crow::connections::systemBus->async_method_call( - [name, aResp{std::move(aResp)}]( + [name, asyncResp{std::move(asyncResp)}]( const boost::system::error_code& ec, const dbus::utility::ManagedObjectType& subtree) { if (ec) @@ -281,7 +282,7 @@ inline void getVmResourceList(std::shared_ptr<bmcweb::AsyncResp> aResp, BMCWEB_LOG_DEBUG << "DBUS response error"; return; } - nlohmann::json& members = aResp->res.jsonValue["Members"]; + nlohmann::json& members = asyncResp->res.jsonValue["Members"]; members = nlohmann::json::array(); for (const auto& object : subtree) @@ -297,7 +298,7 @@ inline void getVmResourceList(std::shared_ptr<bmcweb::AsyncResp> aResp, "/redfish/v1/Managers/{}/VirtualMedia/{}", name, path); members.emplace_back(std::move(item)); } - aResp->res.jsonValue["Members@odata.count"] = members.size(); + asyncResp->res.jsonValue["Members@odata.count"] = members.size(); }, service, "/xyz/openbmc_project/VirtualMedia", "org.freedesktop.DBus.ObjectManager", "GetManagedObjects"); @@ -338,13 +339,13 @@ inline void /** * @brief Fills data for specific resource */ -inline void getVmData(const std::shared_ptr<bmcweb::AsyncResp>& aResp, +inline void getVmData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& service, const std::string& name, const std::string& resName) { BMCWEB_LOG_DEBUG << "Get Virtual Media resource data."; - findAndParseObject(service, resName, aResp, + findAndParseObject(service, resName, asyncResp, std::bind_front(afterGetVmData, name)); } |