diff options
Diffstat (limited to 'redfish-core/lib')
-rw-r--r-- | redfish-core/lib/ethernet.hpp | 2 | ||||
-rw-r--r-- | redfish-core/lib/health.hpp | 2 | ||||
-rw-r--r-- | redfish-core/lib/log_services.hpp | 50 | ||||
-rw-r--r-- | redfish-core/lib/managers.hpp | 7 | ||||
-rw-r--r-- | redfish-core/lib/network_protocol.hpp | 2 | ||||
-rw-r--r-- | redfish-core/lib/sensors.hpp | 34 | ||||
-rw-r--r-- | redfish-core/lib/update_service.hpp | 3 |
7 files changed, 49 insertions, 51 deletions
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index 099aab83f9..390efbcc36 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -28,8 +28,6 @@ #include "utils/ip_utils.hpp" #include "utils/json_utils.hpp" -#include <boost/algorithm/string/classification.hpp> -#include <boost/algorithm/string/split.hpp> #include <boost/url/format.hpp> #include <array> diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp index 6e0d3349bd..20ea0f6236 100644 --- a/redfish-core/lib/health.hpp +++ b/redfish-core/lib/health.hpp @@ -73,7 +73,7 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate> bool isSelf = false; if (selfPath) { - if (boost::equals(path.str, *selfPath) || + if (path.str == *selfPath || path.str.starts_with(*selfPath + "/")) { isSelf = true; diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index e634191151..371ae44867 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -36,10 +36,6 @@ #include <tinyxml2.h> #include <unistd.h> -#include <boost/algorithm/string/case_conv.hpp> -#include <boost/algorithm/string/classification.hpp> -#include <boost/algorithm/string/replace.hpp> -#include <boost/algorithm/string/split.hpp> #include <boost/beast/http/verb.hpp> #include <boost/container/flat_map.hpp> #include <boost/system/linux_error.hpp> @@ -50,9 +46,11 @@ #include <array> #include <charconv> #include <filesystem> +#include <iterator> #include <optional> #include <ranges> #include <span> +#include <string> #include <string_view> #include <variant> @@ -115,6 +113,15 @@ inline std::optional<bool> getProviderNotifyAction(const std::string& notify) return notifyAction; } +inline std::string getDumpPath(std::string_view dumpType) +{ + std::string dbusDumpPath = "/xyz/openbmc_project/dump/"; + std::ranges::transform(dumpType, std::back_inserter(dbusDumpPath), + bmcweb::asciiToLower); + + return dbusDumpPath; +} + inline static int getJournalMetadata(sd_journal* journal, std::string_view field, std::string_view& contents) @@ -537,9 +544,7 @@ inline void " Dump Entries"; nlohmann::json::array_t entriesArray; - std::string dumpEntryPath = - "/xyz/openbmc_project/dump/" + - std::string(boost::algorithm::to_lower_copy(dumpType)) + "/entry/"; + std::string dumpEntryPath = getDumpPath(dumpType) + "/entry/"; dbus::utility::ManagedObjectType resp(objects); std::ranges::sort(resp, [](const auto& l, const auto& r) { @@ -640,9 +645,7 @@ inline void } bool foundDumpEntry = false; - std::string dumpEntryPath = - "/xyz/openbmc_project/dump/" + - std::string(boost::algorithm::to_lower_copy(dumpType)) + "/entry/"; + std::string dumpEntryPath = getDumpPath(dumpType) + "/entry/"; for (const auto& objectPath : resp) { @@ -736,11 +739,10 @@ inline void deleteDumpEntry(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, return; } }; + crow::connections::systemBus->async_method_call( respHandler, "xyz.openbmc_project.Dump.Manager", - "/xyz/openbmc_project/dump/" + - std::string(boost::algorithm::to_lower_copy(dumpType)) + "/entry/" + - entryID, + std::format("{}/entry/{}", getDumpPath(dumpType), entryID), "xyz.openbmc_project.Object.Delete", "Delete"); } @@ -847,10 +849,8 @@ inline void return; } - std::string dumpEntryPath = - sdbusplus::message::object_path("/xyz/openbmc_project/dump/") / - std::string(boost::algorithm::to_lower_copy(dumpType)) / "entry" / - entryID; + std::string dumpEntryPath = std::format("{}/entry/{}", + getDumpPath(dumpType), entryID); auto downloadDumpEntryHandler = [asyncResp, entryID, @@ -1212,18 +1212,13 @@ inline void createDump(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, BMCWEB_LOG_DEBUG("Dump Created. Path: {}", objPath.str); createDumpTaskCallback(std::move(payload), asyncResp, objPath); }, - "xyz.openbmc_project.Dump.Manager", - "/xyz/openbmc_project/dump/" + - std::string(boost::algorithm::to_lower_copy(dumpType)), + "xyz.openbmc_project.Dump.Manager", getDumpPath(dumpType), "xyz.openbmc_project.Dump.Create", "CreateDump", createDumpParamVec); } inline void clearDump(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& dumpType) { - std::string dumpTypeLowerCopy = - std::string(boost::algorithm::to_lower_copy(dumpType)); - crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code& ec) { if (ec) @@ -1233,8 +1228,7 @@ inline void clearDump(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, return; } }, - "xyz.openbmc_project.Dump.Manager", - "/xyz/openbmc_project/dump/" + dumpTypeLowerCopy, + "xyz.openbmc_project.Dump.Manager", getDumpPath(dumpType), "xyz.openbmc_project.Collection.DeleteAll", "DeleteAll"); } @@ -2836,11 +2830,7 @@ inline void // LogServices. Return without adding any error response. return; } - - const std::string dbusDumpPath = - "/xyz/openbmc_project/dump/" + - boost::algorithm::to_lower_copy(dumpType); - + std::string dbusDumpPath = getDumpPath(dumpType); for (const std::string& path : subTreePaths) { if (path == dbusDumpPath) diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp index 38add8be5b..c61132f215 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp @@ -743,7 +743,7 @@ inline const dbus::utility::ManagedObjectType::value_type* std::replace(escaped.begin(), escaped.end(), ' ', '_'); escaped = "/" + escaped; auto it = std::ranges::find_if(managedObj, [&escaped](const auto& obj) { - if (boost::algorithm::ends_with(obj.first.str, escaped)) + if (obj.first.str.ends_with(escaped)) { BMCWEB_LOG_DEBUG("Matched {}", obj.first.str); return true; @@ -1492,8 +1492,7 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues> auto pathItr = std::ranges::find_if( managedObj, [&dbusObjName](const auto& obj) { - return boost::algorithm::ends_with(obj.first.str, - "/" + dbusObjName); + return obj.first.parent_path() == dbusObjName; }); dbus::utility::DBusPropertiesMap output; @@ -1621,7 +1620,7 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues> bool foundChassis = false; for (const auto& obj : managedObj) { - if (boost::algorithm::ends_with(obj.first.str, chassis)) + if (obj.first.parent_path() == chassis) { chassis = obj.first.str; foundChassis = true; diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp index 151f993d61..c57343c3bd 100644 --- a/redfish-core/lib/network_protocol.hpp +++ b/redfish-core/lib/network_protocol.hpp @@ -404,7 +404,7 @@ inline void for (const auto& entry : subtree) { - if (boost::algorithm::starts_with(entry.first, netBasePath)) + if (entry.first.starts_with(netBasePath)) { sdbusplus::asio::setProperty( *crow::connections::systemBus, entry.second.begin()->first, diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 19e32cec7f..1935adc136 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -26,11 +26,6 @@ #include "utils/json_utils.hpp" #include "utils/query_param.hpp" -#include <boost/algorithm/string/classification.hpp> -#include <boost/algorithm/string/find.hpp> -#include <boost/algorithm/string/predicate.hpp> -#include <boost/algorithm/string/replace.hpp> -#include <boost/range/algorithm/replace_copy_if.hpp> #include <boost/system/error_code.hpp> #include <boost/url/format.hpp> #include <sdbusplus/asio/property.hpp> @@ -43,6 +38,7 @@ #include <map> #include <ranges> #include <set> +#include <string> #include <string_view> #include <utility> #include <variant> @@ -823,7 +819,10 @@ inline void objectPropertiesToJson( } else if (sensorType == "power") { - if (boost::iequals(sensorName, "total_power")) + std::string lower; + std::ranges::transform(sensorName, std::back_inserter(lower), + bmcweb::asciiToLower); + if (lower == "total_power") { sensorJson["@odata.type"] = "#Power.v1_0_0.PowerControl"; // Put multiple "sensors" into a single PowerControl, so have @@ -832,7 +831,7 @@ inline void objectPropertiesToJson( sensorJson["Name"] = "Chassis Power Control"; unit = "/PowerConsumedWatts"_json_pointer; } - else if (!(boost::ifind_first(sensorName, "input").empty())) + else if (lower.find("input") != std::string::npos) { unit = "/PowerInputWatts"_json_pointer; } @@ -1073,7 +1072,7 @@ inline void populateFanRedundancy( sensorsAsyncResp->asyncResp->res); return; } - std::replace(name.begin(), name.end(), '_', ' '); + std::ranges::replace(name, '_', ' '); std::string health; @@ -2186,11 +2185,22 @@ inline nlohmann::json& getPowerSupply(nlohmann::json& powerSupplyArray, const InventoryItem& inventoryItem, const std::string& chassisId) { + std::string nameS; + std::ranges::replace_copy(inventoryItem.name, nameS.begin(), '_', ' '); // Check if matching PowerSupply object already exists in JSON array for (nlohmann::json& powerSupply : powerSupplyArray) { - if (powerSupply["Name"] == - boost::replace_all_copy(inventoryItem.name, "_", " ")) + nlohmann::json::iterator nameIt = powerSupply.find("Name"); + if (nameIt == powerSupply.end()) + { + continue; + } + const std::string* name = nameIt->get_ptr<std::string*>(); + if (name == nullptr) + { + continue; + } + if (nameS == *name) { return powerSupply; } @@ -2203,7 +2213,9 @@ inline nlohmann::json& getPowerSupply(nlohmann::json& powerSupplyArray, chassisId); url.set_fragment(("/PowerSupplies"_json_pointer).to_string()); powerSupply["@odata.id"] = std::move(url); - powerSupply["Name"] = boost::replace_all_copy(inventoryItem.name, "_", " "); + std::string escaped; + std::ranges::replace_copy(inventoryItem.name, escaped.begin(), '_', ' '); + powerSupply["Name"] = std::move(escaped); powerSupply["Manufacturer"] = inventoryItem.manufacturer; powerSupply["Model"] = inventoryItem.model; powerSupply["PartNumber"] = inventoryItem.partNumber; diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp index 9a07d3c334..74e110170a 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -28,7 +28,6 @@ #include "utils/dbus_utils.hpp" #include "utils/sw_utils.hpp" -#include <boost/algorithm/string/case_conv.hpp> #include <boost/system/error_code.hpp> #include <boost/url/format.hpp> #include <sdbusplus/asio/property.hpp> @@ -731,7 +730,7 @@ inline void // Make sure that content type is application/octet-stream or // multipart/form-data - if (boost::iequals(contentType, "application/octet-stream")) + if (bmcweb::asciiIEquals(contentType, "application/octet-stream")) { // Setup callback for when new software detected monitorForSoftwareAvailable(asyncResp, req, |