diff options
Diffstat (limited to 'redfish-core')
33 files changed, 147 insertions, 191 deletions
diff --git a/redfish-core/include/event_service_manager.hpp b/redfish-core/include/event_service_manager.hpp index 0b87555ec0..3fc4133e6b 100644 --- a/redfish-core/include/event_service_manager.hpp +++ b/redfish-core/include/event_service_manager.hpp @@ -245,8 +245,8 @@ inline int formatEventLogEntry(const std::string& logEntryID, return -1; } - std::string msg = - redfish::registries::fillMessageArgs(messageArgs, message->message); + std::string msg = redfish::registries::fillMessageArgs(messageArgs, + message->message); if (msg.empty()) { return -1; @@ -440,8 +440,8 @@ class Subscription : public persistent_data::UserSubscription msg["Name"] = "Event Log"; msg["Events"] = logEntryArray; - std::string strMsg = - msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + std::string strMsg = msg.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); return this->sendEvent(strMsg); } @@ -509,8 +509,8 @@ class Subscription : public persistent_data::UserSubscription msg["Name"] = "Event Log"; msg["Events"] = logEntryArray; - std::string strMsg = - msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + std::string strMsg = msg.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); this->sendEvent(strMsg); } #endif @@ -549,8 +549,8 @@ class Subscription : public persistent_data::UserSubscription msg["Context"] = customText; } - std::string strMsg = - msg.dump(2, ' ', true, nlohmann::json::error_handler_t::replace); + std::string strMsg = msg.dump(2, ' ', true, + nlohmann::json::error_handler_t::replace); this->sendEvent(strMsg); } @@ -883,7 +883,6 @@ class EventServiceManager std::string addSubscription(const std::shared_ptr<Subscription>& subValue, const bool updateFile = true) { - std::uniform_int_distribution<uint32_t> dist(0); bmcweb::OpenSSLGenerator gen; @@ -1317,8 +1316,8 @@ class EventServiceManager } // Watch redfish event log file for modifications. - fileWatchDesc = - inotify_add_watch(inotifyFd, redfishEventLogFile, IN_MODIFY); + fileWatchDesc = inotify_add_watch(inotifyFd, redfishEventLogFile, + IN_MODIFY); if (fileWatchDesc == -1) { BMCWEB_LOG_ERROR diff --git a/redfish-core/include/gzfile.hpp b/redfish-core/include/gzfile.hpp index 844932aa81..34bc151ef5 100644 --- a/redfish-core/include/gzfile.hpp +++ b/redfish-core/include/gzfile.hpp @@ -97,8 +97,8 @@ class GzFileReader while (pos != std::string::npos) { - std::string logEntry = - bufferStr.substr(initialPos, pos - initialPos); + std::string logEntry = bufferStr.substr(initialPos, + pos - initialPos); // Since there might be consecutive delimiters like "\r\n", we need // to filter empty strings. if (!logEntry.empty()) diff --git a/redfish-core/include/redfish_aggregator.hpp b/redfish-core/include/redfish_aggregator.hpp index 9168cc5ec5..896eb4aac5 100644 --- a/redfish-core/include/redfish_aggregator.hpp +++ b/redfish-core/include/redfish_aggregator.hpp @@ -815,8 +815,8 @@ class RedfishAggregator if (boost::iequals(contentType, "application/json") || boost::iequals(contentType, "application/json; charset=utf-8")) { - nlohmann::json jsonVal = - nlohmann::json::parse(resp.body(), nullptr, false); + nlohmann::json jsonVal = nlohmann::json::parse(resp.body(), nullptr, + false); if (jsonVal.is_discarded()) { BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON"; @@ -879,8 +879,8 @@ class RedfishAggregator if (boost::iequals(contentType, "application/json") || boost::iequals(contentType, "application/json; charset=utf-8")) { - nlohmann::json jsonVal = - nlohmann::json::parse(resp.body(), nullptr, false); + nlohmann::json jsonVal = nlohmann::json::parse(resp.body(), nullptr, + false); if (jsonVal.is_discarded()) { BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON"; @@ -1013,8 +1013,8 @@ class RedfishAggregator boost::iequals(contentType, "application/json; charset=utf-8")) { bool addedLinks = false; - nlohmann::json jsonVal = - nlohmann::json::parse(resp.body(), nullptr, false); + nlohmann::json jsonVal = nlohmann::json::parse(resp.body(), nullptr, + false); if (jsonVal.is_discarded()) { BMCWEB_LOG_ERROR << "Error parsing satellite response as JSON"; diff --git a/redfish-core/include/utils/json_utils.hpp b/redfish-core/include/utils/json_utils.hpp index 26b9a8a2e1..774ab7c5eb 100644 --- a/redfish-core/include/utils/json_utils.hpp +++ b/redfish-core/include/utils/json_utils.hpp @@ -505,8 +505,7 @@ inline bool readJsonHelper(nlohmann::json& jsonRequest, crow::Response& res, return result; } -inline void packVariant(std::span<PerUnpack> /*toPack*/) -{} +inline void packVariant(std::span<PerUnpack> /*toPack*/) {} template <typename FirstType, typename... UnpackTypes> void packVariant(std::span<PerUnpack> toPack, std::string_view key, diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp index 96885ebb20..e6ca9d313a 100644 --- a/redfish-core/include/utils/query_param.hpp +++ b/redfish-core/include/utils/query_param.hpp @@ -916,9 +916,9 @@ inline void recursiveSelect(nlohmann::json& currRoot, constexpr std::array<std::string_view, 5> reservedProperties = { "@odata.id", "@odata.type", "@odata.context", "@odata.etag", "error"}; - bool reserved = - std::find(reservedProperties.begin(), reservedProperties.end(), - it.key()) != reservedProperties.end(); + bool reserved = std::find(reservedProperties.begin(), + reservedProperties.end(), + it.key()) != reservedProperties.end(); if (reserved || (nextNode != nullptr && nextNode->isSelected())) { it = nextIt; diff --git a/redfish-core/include/utils/sw_utils.hpp b/redfish-core/include/utils/sw_utils.hpp index 90048dd1b5..7c746a0b1d 100644 --- a/redfish-core/include/utils/sw_utils.hpp +++ b/redfish-core/include/utils/sw_utils.hpp @@ -110,7 +110,6 @@ inline void std::string, std::vector<std::string>>>>& obj : subtree) { - sdbusplus::message::object_path path(obj.first); std::string swId = path.filename(); if (swId.empty()) diff --git a/redfish-core/include/utils/time_utils.hpp b/redfish-core/include/utils/time_utils.hpp index f4fb0c07d5..cb018eff20 100644 --- a/redfish-core/include/utils/time_utils.hpp +++ b/redfish-core/include/utils/time_utils.hpp @@ -261,8 +261,8 @@ constexpr std::tuple<IntType, unsigned, unsigned> z += 719468; IntType era = (z >= 0 ? z : z - 146096) / 146097; unsigned doe = static_cast<unsigned>(z - era * 146097); // [0, 146096] - unsigned yoe = - (doe - doe / 1460 + doe / 36524 - doe / 146096) / 365; // [0, 399] + unsigned yoe = (doe - doe / 1460 + doe / 36524 - doe / 146096) / + 365; // [0, 399] IntType y = static_cast<IntType>(yoe) + era * 400; unsigned doy = doe - (365 * yoe + yoe / 4 - yoe / 100); // [0, 365] unsigned mp = (5 * doy + 2) / 153; // [0, 11] diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp index a844b61aaf..c9d4eb840d 100644 --- a/redfish-core/lib/account_service.hpp +++ b/redfish-core/lib/account_service.hpp @@ -204,8 +204,8 @@ inline void parseLDAPConfigData(nlohmann::json& jsonResponse, const LDAPConfigData& confData, const std::string& ldapType) { - std::string service = - (ldapType == "LDAP") ? "LDAPService" : "ActiveDirectoryService"; + std::string service = (ldapType == "LDAP") ? "LDAPService" + : "ActiveDirectoryService"; nlohmann::json& ldap = jsonResponse[ldapType]; @@ -265,9 +265,8 @@ inline void handleRoleMapPatch( messages::internalError(asyncResp->res); return; } - asyncResp->res - .jsonValue[serverType]["RemoteRoleMapping"][index] = - nullptr; + asyncResp->res.jsonValue[serverType]["RemoteRoleMapping"] + [index] = nullptr; }, ldapDbusService, roleMapObjData[index].first, "xyz.openbmc_project.Object.Delete", "Delete"); @@ -361,8 +360,8 @@ inline void handleRoleMapPatch( { BMCWEB_LOG_DEBUG << "setRoleMappingProperties: Creating new Object"; - std::string pathString = - "RemoteRoleMapping/" + std::to_string(index); + std::string pathString = "RemoteRoleMapping/" + + std::to_string(index); if (!localRole) { @@ -423,7 +422,6 @@ template <typename CallbackFunc> inline void getLDAPConfigData(const std::string& ldapType, CallbackFunc&& callback) { - constexpr std::array<std::string_view, 2> interfaces = { ldapEnableInterface, ldapConfigInterface}; @@ -509,7 +507,6 @@ inline void getLDAPConfigData(const std::string& ldapType, } else if (interface.first == ldapConfigInterfaceStr) { - for (const auto& property : interface.second) { const std::string* strValue = @@ -712,9 +709,8 @@ inline void messages::internalError(asyncResp->res); return; } - asyncResp->res - .jsonValue[ldapServerElementName]["Authentication"]["Username"] = - username; + asyncResp->res.jsonValue[ldapServerElementName]["Authentication"] + ["Username"] = username; BMCWEB_LOG_DEBUG << "Updated the username"; }, ldapDbusService, ldapConfigObject, propertyInterface, "Set", @@ -745,9 +741,8 @@ inline void messages::internalError(asyncResp->res); return; } - asyncResp->res - .jsonValue[ldapServerElementName]["Authentication"]["Password"] = - ""; + asyncResp->res.jsonValue[ldapServerElementName]["Authentication"] + ["Password"] = ""; BMCWEB_LOG_DEBUG << "Updated the password"; }, ldapDbusService, ldapConfigObject, propertyInterface, "Set", @@ -1588,8 +1583,8 @@ inline void handleAccountCollectionGet( if (userCanSeeAllAccounts || (thisUser == user && userCanSeeSelf)) { nlohmann::json::object_t member; - member["@odata.id"] = - "/redfish/v1/AccountService/Accounts/" + user; + member["@odata.id"] = "/redfish/v1/AccountService/Accounts/" + + user; memberArray.push_back(std::move(member)); } } @@ -2016,7 +2011,6 @@ inline void inline void requestAccountServiceRoutes(App& app) { - BMCWEB_ROUTE(app, "/redfish/v1/AccountService/") .privileges(redfish::privileges::headAccountService) .methods(boost::beast::http::verb::head)( diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp index cdeb2103a8..3cb6a3fe03 100644 --- a/redfish-core/lib/certificate_service.hpp +++ b/redfish-core/lib/certificate_service.hpp @@ -24,23 +24,23 @@ namespace redfish { namespace certs { -constexpr char const* certInstallIntf = "xyz.openbmc_project.Certs.Install"; -constexpr char const* certReplaceIntf = "xyz.openbmc_project.Certs.Replace"; -constexpr char const* objDeleteIntf = "xyz.openbmc_project.Object.Delete"; -constexpr char const* certPropIntf = "xyz.openbmc_project.Certs.Certificate"; -constexpr char const* dbusPropIntf = "org.freedesktop.DBus.Properties"; -constexpr char const* dbusObjManagerIntf = "org.freedesktop.DBus.ObjectManager"; -constexpr char const* httpsServiceName = +constexpr const char* certInstallIntf = "xyz.openbmc_project.Certs.Install"; +constexpr const char* certReplaceIntf = "xyz.openbmc_project.Certs.Replace"; +constexpr const char* objDeleteIntf = "xyz.openbmc_project.Object.Delete"; +constexpr const char* certPropIntf = "xyz.openbmc_project.Certs.Certificate"; +constexpr const char* dbusPropIntf = "org.freedesktop.DBus.Properties"; +constexpr const char* dbusObjManagerIntf = "org.freedesktop.DBus.ObjectManager"; +constexpr const char* httpsServiceName = "xyz.openbmc_project.Certs.Manager.Server.Https"; -constexpr char const* ldapServiceName = +constexpr const char* ldapServiceName = "xyz.openbmc_project.Certs.Manager.Client.Ldap"; -constexpr char const* authorityServiceName = +constexpr const char* authorityServiceName = "xyz.openbmc_project.Certs.Manager.Authority.Ldap"; -constexpr char const* baseObjectPath = "/xyz/openbmc_project/certs"; -constexpr char const* httpsObjectPath = +constexpr const char* baseObjectPath = "/xyz/openbmc_project/certs"; +constexpr const char* httpsObjectPath = "/xyz/openbmc_project/certs/server/https"; -constexpr char const* ldapObjectPath = "/xyz/openbmc_project/certs/client/ldap"; -constexpr char const* authorityObjectPath = +constexpr const char* ldapObjectPath = "/xyz/openbmc_project/certs/client/ldap"; +constexpr const char* authorityObjectPath = "/xyz/openbmc_project/certs/authority/ldap"; } // namespace certs @@ -517,8 +517,8 @@ inline void handleReplaceCertificateAction( "bmc", "NetworkProtocol", "HTTPS", "Certificates", std::ref(id))) { - objectPath = - sdbusplus::message::object_path(certs::httpsObjectPath) / id; + objectPath = sdbusplus::message::object_path(certs::httpsObjectPath) / + id; name = "HTTPS certificate"; service = certs::httpsServiceName; } @@ -526,8 +526,8 @@ inline void handleReplaceCertificateAction( "AccountService", "LDAP", "Certificates", std::ref(id))) { - objectPath = - sdbusplus::message::object_path(certs::ldapObjectPath) / id; + objectPath = sdbusplus::message::object_path(certs::ldapObjectPath) / + id; name = "LDAP certificate"; service = certs::ldapServiceName; } diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp index 95632901af..e4e7b5af85 100644 --- a/redfish-core/lib/ethernet.hpp +++ b/redfish-core/lib/ethernet.hpp @@ -429,8 +429,8 @@ inline void const dbus::utility::ManagedObjectType& dbusData, boost::container::flat_set<IPv6AddressData>& ipv6Config) { - const std::string ipPathStart = - "/xyz/openbmc_project/network/" + ethifaceId; + const std::string ipPathStart = "/xyz/openbmc_project/network/" + + ethifaceId; // Since there might be several IPv6 configurations aligned with // single ethernet interface, loop over all of them @@ -527,8 +527,8 @@ inline void const dbus::utility::ManagedObjectType& dbusData, boost::container::flat_set<IPv4AddressData>& ipv4Config) { - const std::string ipPathStart = - "/xyz/openbmc_project/network/" + ethifaceId; + const std::string ipPathStart = "/xyz/openbmc_project/network/" + + ethifaceId; // Since there might be several IPv4 configurations aligned with // single ethernet interface, loop over all of them @@ -917,8 +917,8 @@ inline void handleMTUSizePatch(const std::string& ifaceId, const size_t mtuSize, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - sdbusplus::message::object_path objPath = - "/xyz/openbmc_project/network/" + ifaceId; + sdbusplus::message::object_path objPath = "/xyz/openbmc_project/network/" + + ifaceId; crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code& ec) { if (ec) @@ -1263,8 +1263,8 @@ inline void handleIPv4StaticPatch( for (nlohmann::json& thisJson : input) { - std::string pathString = - "IPv4StaticAddresses/" + std::to_string(entryIdx); + std::string pathString = "IPv4StaticAddresses/" + + std::to_string(entryIdx); if (!thisJson.is_null() && !thisJson.empty()) { @@ -1379,8 +1379,8 @@ inline void handleIPv4StaticPatch( deleteAndCreateIPAddress(IpVersion::IpV4, ifaceId, nicIpEntry->id, prefixLength, *gw, *addr, asyncResp); - nicIpEntry = - getNextStaticIpEntry(++nicIpEntry, ipv4Data.cend()); + nicIpEntry = getNextStaticIpEntry(++nicIpEntry, + ipv4Data.cend()); } else { @@ -1415,8 +1415,8 @@ inline void handleIPv4StaticPatch( } if (nicIpEntry != ipv4Data.cend()) { - nicIpEntry = - getNextStaticIpEntry(++nicIpEntry, ipv4Data.cend()); + nicIpEntry = getNextStaticIpEntry(++nicIpEntry, + ipv4Data.cend()); } entryIdx++; } @@ -1461,8 +1461,8 @@ inline void handleIPv6StaticAddressesPatch( getNextStaticIpEntry(ipv6Data.cbegin(), ipv6Data.cend()); for (const nlohmann::json& thisJson : input) { - std::string pathString = - "IPv6StaticAddresses/" + std::to_string(entryIdx); + std::string pathString = "IPv6StaticAddresses/" + + std::to_string(entryIdx); if (!thisJson.is_null() && !thisJson.empty()) { @@ -1522,8 +1522,8 @@ inline void handleIPv6StaticAddressesPatch( deleteAndCreateIPAddress(IpVersion::IpV6, ifaceId, nicIpEntry->id, prefix, "", *addr, asyncResp); - nicIpEntry = - getNextStaticIpEntry(++nicIpEntry, ipv6Data.cend()); + nicIpEntry = getNextStaticIpEntry(++nicIpEntry, + ipv6Data.cend()); } else { @@ -1557,8 +1557,8 @@ inline void handleIPv6StaticAddressesPatch( } if (nicIpEntry != ipv6Data.cend()) { - nicIpEntry = - getNextStaticIpEntry(++nicIpEntry, ipv6Data.cend()); + nicIpEntry = getNextStaticIpEntry(++nicIpEntry, + ipv6Data.cend()); } entryIdx++; } diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp index c418504ee3..82004e0960 100644 --- a/redfish-core/lib/event_service.hpp +++ b/redfish-core/lib/event_service.hpp @@ -162,7 +162,6 @@ inline void requestRoutesEventService(App& app) inline void requestRoutesSubmitTestEvent(App& app) { - BMCWEB_ROUTE( app, "/redfish/v1/EventService/Actions/EventService.SubmitTestEvent/") .privileges(redfish::privileges::postEventService) @@ -210,8 +209,8 @@ inline void requestRoutesEventDestinationCollection(App& app) for (const std::string& id : subscripIds) { nlohmann::json::object_t member; - member["@odata.id"] = - "/redfish/v1/EventService/Subscriptions/" + id; + member["@odata.id"] = "/redfish/v1/EventService/Subscriptions/" + + id; memberArray.push_back(std::move(member)); } }); diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp index 1799159baf..be89fbc3c2 100644 --- a/redfish-core/lib/fabric_adapters.hpp +++ b/redfish-core/lib/fabric_adapters.hpp @@ -25,7 +25,6 @@ inline void handleAdapterError(const boost::system::error_code& ec, crow::Response& res, const std::string& adapterId) { - if (ec.value() == boost::system::errc::io_error) { messages::resourceNotFound(res, "#FabricAdapter.v1_4_0.FabricAdapter", diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp index 643ce7ff60..ef858a1451 100644 --- a/redfish-core/lib/health.hpp +++ b/redfish-core/lib/health.hpp @@ -82,7 +82,6 @@ struct HealthPopulate : std::enable_shared_from_this<HealthPopulate> // managers inventory is all the inventory, don't skip any if (!isManagersHealth && !isSelf) { - // We only want to look at this association if either the path // of this association is an inventory item, or one of the // endpoints in this association is a child diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp index 1c27223d32..e524145ed8 100644 --- a/redfish-core/lib/hypervisor_system.hpp +++ b/redfish-core/lib/hypervisor_system.hpp @@ -327,8 +327,8 @@ void getHypervisorIfaceData(const std::string& ethIfaceId, return; } - bool found = - extractHypervisorInterfaceData(ethIfaceId, resp, ethData, ipv4Data); + bool found = extractHypervisorInterfaceData(ethIfaceId, resp, ethData, + ipv4Data); if (!found) { BMCWEB_LOG_INFO << "Hypervisor Interface not found"; diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp index 5159ae1a31..aeb1d191bf 100644 --- a/redfish-core/lib/log_services.hpp +++ b/redfish-core/lib/log_services.hpp @@ -56,14 +56,14 @@ namespace redfish { -constexpr char const* crashdumpObject = "com.intel.crashdump"; -constexpr char const* crashdumpPath = "/com/intel/crashdump"; -constexpr char const* crashdumpInterface = "com.intel.crashdump"; -constexpr char const* deleteAllInterface = +constexpr const char* crashdumpObject = "com.intel.crashdump"; +constexpr const char* crashdumpPath = "/com/intel/crashdump"; +constexpr const char* crashdumpInterface = "com.intel.crashdump"; +constexpr const char* deleteAllInterface = "xyz.openbmc_project.Collection.DeleteAll"; -constexpr char const* crashdumpOnDemandInterface = +constexpr const char* crashdumpOnDemandInterface = "com.intel.crashdump.OnDemand"; -constexpr char const* crashdumpTelemetryInterface = +constexpr const char* crashdumpTelemetryInterface = "com.intel.crashdump.Telemetry"; enum class DumpCreationProgress @@ -274,8 +274,8 @@ inline static bool } } // Timestamp has no index - auto [ptr, ec] = - std::from_chars(tsStr.data(), tsStr.data() + tsStr.size(), timestamp); + auto [ptr, ec] = std::from_chars(tsStr.data(), tsStr.data() + tsStr.size(), + timestamp); if (ec != std::errc()) { messages::resourceNotFound(asyncResp->res, "LogEntry", entryID); @@ -489,8 +489,8 @@ inline void "#LogEntryCollection.LogEntryCollection"; asyncResp->res.jsonValue["@odata.id"] = std::move(odataIdStr); asyncResp->res.jsonValue["Name"] = dumpType + " Dump Entries"; - asyncResp->res.jsonValue["Description"] = - "Collection of " + dumpType + " Dump Entries"; + asyncResp->res.jsonValue["Description"] = "Collection of " + dumpType + + " Dump Entries"; nlohmann::json& entriesArray = asyncResp->res.jsonValue["Members"]; entriesArray = nlohmann::json::array(); @@ -552,16 +552,16 @@ inline void if (dumpType == "BMC") { thisEntry["DiagnosticDataType"] = "Manager"; - thisEntry["AdditionalDataURI"] = - entriesPath + entryID + "/attachment"; + thisEntry["AdditionalDataURI"] = entriesPath + entryID + + "/attachment"; thisEntry["AdditionalDataSizeBytes"] = size; } else if (dumpType == "System") { thisEntry["DiagnosticDataType"] = "OEM"; thisEntry["OEMDiagnosticDataType"] = "System"; - thisEntry["AdditionalDataURI"] = - entriesPath + entryID + "/attachment"; + thisEntry["AdditionalDataURI"] = entriesPath + entryID + + "/attachment"; thisEntry["AdditionalDataSizeBytes"] = size; } entriesArray.push_back(std::move(thisEntry)); @@ -854,8 +854,8 @@ inline void createDumpTaskCallback( nlohmann::json retMessage = messages::success(); taskData->messages.emplace_back(retMessage); - std::string headerLoc = - "Location: " + dumpEntryPath + http_helpers::urlEncode(dumpId); + std::string headerLoc = "Location: " + dumpEntryPath + + http_helpers::urlEncode(dumpId); taskData->payload->httpHeaders.emplace_back(std::move(headerLoc)); BMCWEB_LOG_DEBUG << createdObjPath.str @@ -1424,8 +1424,8 @@ inline void requestRoutesJournalEventLogEntryCollection(App& app) firstEntry = false; nlohmann::json::object_t bmcLogEntry; - LogParseError status = - fillEventLogEntryJson(idStr, logEntry, bmcLogEntry); + LogParseError status = fillEventLogEntryJson(idStr, logEntry, + bmcLogEntry); if (status == LogParseError::messageIdNotInRegistry) { continue; @@ -3898,9 +3898,9 @@ static void getPostCodeForBoot(const std::shared_ptr<bmcweb::AsyncResp>& aResp, endCount = entryCount + postcode.size(); if (skip < endCount && (top + skip) > entryCount) { - uint64_t thisBootSkip = - std::max(static_cast<uint64_t>(skip), entryCount) - - entryCount; + uint64_t thisBootSkip = std::max(static_cast<uint64_t>(skip), + entryCount) - + entryCount; uint64_t thisBootTop = std::min(static_cast<uint64_t>(top + skip), endCount) - entryCount; diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp index 6e1427b344..134ecb65d8 100644 --- a/redfish-core/lib/managers.hpp +++ b/redfish-core/lib/managers.hpp @@ -163,7 +163,6 @@ inline void requestRoutesManagerResetAction(App& app) */ inline void requestRoutesManagerResetToDefaultsAction(App& app) { - /** * Function handles ResetToDefaults POST method request. * @@ -288,7 +287,6 @@ inline void const std::vector<std::string>& supportedProfiles, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - crow::connections::systemBus->async_method_call( [asyncResp, currentProfile, supportedProfiles]( const boost::system::error_code& ec, @@ -440,7 +438,6 @@ inline void // pid and fans are off the same configuration else if (intfPair.first == pidConfigurationIface) { - if (classPtr == nullptr) { BMCWEB_LOG_ERROR << "Pid Class Field illegal"; @@ -569,7 +566,6 @@ inline void if (intfPair.first == pidConfigurationIface || intfPair.first == stepwiseConfigurationIface) { - if (propertyPair.first == "Zones") { const std::vector<std::string>* inputs = @@ -782,7 +778,6 @@ inline CreatePIDRet createPidInterface( dbus::utility::DBusPropertiesMap& output, std::string& chassis, const std::string& profile) { - // common deleter if (it.value() == nullptr) { @@ -1027,7 +1022,6 @@ inline CreatePIDRet createPidInterface( if (chassisContainer) { - std::string chassisId; if (!redfish::json_util::readJson(*chassisContainer, response->res, "@odata.id", chassisId)) @@ -1116,7 +1110,6 @@ inline CreatePIDRet createPidInterface( { for (std::string& value : *inputs) { - std::replace(value.begin(), value.end(), '_', ' '); } output.emplace_back("Inputs", std::move(*inputs)); @@ -1328,12 +1321,10 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues> struct SetPIDValues : std::enable_shared_from_this<SetPIDValues> { - SetPIDValues(const std::shared_ptr<bmcweb::AsyncResp>& asyncRespIn, nlohmann::json& data) : asyncResp(asyncRespIn) { - std::optional<nlohmann::json> pidControllers; std::optional<nlohmann::json> fanControllers; std::optional<nlohmann::json> fanZones; @@ -1508,12 +1499,12 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues> std::replace(dbusObjName.begin(), dbusObjName.end(), ' ', '_'); BMCWEB_LOG_DEBUG << "looking for " << name; - auto pathItr = - std::find_if(managedObj.begin(), managedObj.end(), - [&dbusObjName](const auto& obj) { + auto pathItr = std::find_if(managedObj.begin(), + managedObj.end(), + [&dbusObjName](const auto& obj) { return boost::algorithm::ends_with(obj.first.str, "/" + dbusObjName); - }); + }); dbus::utility::DBusPropertiesMap output; output.reserve(16); // The pid interface length @@ -2107,7 +2098,6 @@ inline void requestRoutesManager(App& app) if (interfaceName == "xyz.openbmc_project.Inventory.Decorator.Asset") { - sdbusplus::asio::getAllProperties( *crow::connections::systemBus, connectionName, path, "xyz.openbmc_project.Inventory.Decorator.Asset", diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp index 44784726ef..c57d387390 100644 --- a/redfish-core/lib/memory.hpp +++ b/redfish-core/lib/memory.hpp @@ -243,15 +243,14 @@ inline void getPersistentMemoryProperties( if (volatileSizeInKiB != nullptr) { - aResp->res.jsonValue[jsonPtr]["VolatileSizeMiB"] = (*volatileSizeInKiB) >> 10; } if (pmSizeInKiB != nullptr) { - aResp->res.jsonValue[jsonPtr]["NonVolatileSizeMiB"] = - (*pmSizeInKiB) >> 10; + aResp->res.jsonValue[jsonPtr]["NonVolatileSizeMiB"] = (*pmSizeInKiB) >> + 10; } if (cacheSizeInKB != nullptr) @@ -364,30 +363,26 @@ inline void getPersistentMemoryProperties( if (dataLockCapable != nullptr) { - aResp->res - .jsonValue[jsonPtr]["SecurityCapabilities"]["DataLockCapable"] = - *dataLockCapable; + aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["DataLockCapable"] = *dataLockCapable; } if (passphraseCapable != nullptr) { - aResp->res - .jsonValue[jsonPtr]["SecurityCapabilities"]["PassphraseCapable"] = - *passphraseCapable; + aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["PassphraseCapable"] = *passphraseCapable; } if (maxPassphraseCount != nullptr) { - aResp->res - .jsonValue[jsonPtr]["SecurityCapabilities"]["MaxPassphraseCount"] = - *maxPassphraseCount; + aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["MaxPassphraseCount"] = *maxPassphraseCount; } if (passphraseLockLimit != nullptr) { - aResp->res - .jsonValue[jsonPtr]["SecurityCapabilities"]["PassphraseLockLimit"] = - *passphraseLockLimit; + aResp->res.jsonValue[jsonPtr]["SecurityCapabilities"] + ["PassphraseLockLimit"] = *passphraseLockLimit; } } @@ -593,9 +588,8 @@ inline void if (locationCode != nullptr) { - aResp->res - .jsonValue[jsonPtr]["Location"]["PartLocation"]["ServiceLabel"] = - *locationCode; + aResp->res.jsonValue[jsonPtr]["Location"]["PartLocation"] + ["ServiceLabel"] = *locationCode; } getPersistentMemoryProperties(aResp, properties, jsonPtr); diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp index 41464bc9e6..907f6cf93d 100644 --- a/redfish-core/lib/message_registries.hpp +++ b/redfish-core/lib/message_registries.hpp @@ -115,8 +115,8 @@ inline void handleMessageRoutesMessageRegistryFileGet( asyncResp->res.jsonValue["@odata.type"] = "#MessageRegistryFile.v1_1_0.MessageRegistryFile"; asyncResp->res.jsonValue["Name"] = registry + " Message Registry File"; - asyncResp->res.jsonValue["Description"] = - dmtf + registry + " Message Registry File Location"; + asyncResp->res.jsonValue["Description"] = dmtf + registry + + " Message Registry File Location"; asyncResp->res.jsonValue["Id"] = header->registryPrefix; asyncResp->res.jsonValue["Registry"] = header->id; nlohmann::json::array_t languages; diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp index 2e97fa08ca..b184889cc4 100644 --- a/redfish-core/lib/metric_report_definition.hpp +++ b/redfish-core/lib/metric_report_definition.hpp @@ -233,8 +233,8 @@ inline bool getChassisSensorNodeFromMetrics( { const std::vector<std::string>& uris = metric.second; - std::optional<IncorrectMetricUri> error = - getChassisSensorNode(uris, matched); + std::optional<IncorrectMetricUri> error = getChassisSensorNode(uris, + matched); if (error) { messages::propertyValueIncorrect(asyncResp->res, error->uri, diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp index 2621fd6030..d06e21a5a7 100644 --- a/redfish-core/lib/network_protocol.hpp +++ b/redfish-core/lib/network_protocol.hpp @@ -485,7 +485,6 @@ inline void handleManagersNetworkProtocolPatch( App& app, const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp index 631b5c1c36..f2aceccf61 100644 --- a/redfish-core/lib/pcie.hpp +++ b/redfish-core/lib/pcie.hpp @@ -31,7 +31,7 @@ namespace redfish { -static constexpr char const* inventoryPath = "/xyz/openbmc_project/inventory"; +static constexpr const char* inventoryPath = "/xyz/openbmc_project/inventory"; static constexpr std::array<std::string_view, 1> pcieDeviceInterface = { "xyz.openbmc_project.Inventory.Item.PCIeDevice"}; @@ -430,8 +430,8 @@ inline void addPCIeFunctionList( { // Check if this function exists by // looking for a device ID - std::string devIDProperty = - "Function" + std::to_string(functionNum) + "DeviceId"; + std::string devIDProperty = "Function" + std::to_string(functionNum) + + "DeviceId"; const std::string* property = nullptr; for (const auto& propEntry : pcieDevProperties) { diff --git a/redfish-core/lib/pcie_slots.hpp b/redfish-core/lib/pcie_slots.hpp index 2b9ef2b766..b588ac0021 100644 --- a/redfish-core/lib/pcie_slots.hpp +++ b/redfish-core/lib/pcie_slots.hpp @@ -124,7 +124,6 @@ inline void if (lanes != nullptr) { - slot["Lanes"] = *lanes; } diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp index 5d7bbb7d2d..a0eadf56f9 100644 --- a/redfish-core/lib/power.hpp +++ b/redfish-core/lib/power.hpp @@ -121,7 +121,6 @@ inline void setPowerCapOverride( } inline void requestRoutesPower(App& app) { - BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/Power/") .privileges(redfish::privileges::getPower) .methods(boost::beast::http::verb::get)( @@ -178,8 +177,8 @@ inline void requestRoutesPower(App& app) len = end - (lastPos + 1); } - std::string interfaceChassisName = - chassis.substr(lastPos + 1, len); + std::string interfaceChassisName = chassis.substr(lastPos + 1, + len); if (interfaceChassisName == sensorAsyncResp->chassisId) { found = true; diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp index 4566e4bd8f..205578c947 100644 --- a/redfish-core/lib/processor.hpp +++ b/redfish-core/lib/processor.hpp @@ -1058,7 +1058,6 @@ inline void handleProcessorCollectionHead( inline void requestRoutesOperatingConfigCollection(App& app) { - BMCWEB_ROUTE( app, "/redfish/v1/Systems/system/Processors/<str>/OperatingConfigs/") .privileges(redfish::privileges::getOperatingConfigCollection) diff --git a/redfish-core/lib/redfish_sessions.hpp b/redfish-core/lib/redfish_sessions.hpp index 35d5d5cff2..e55314a67f 100644 --- a/redfish-core/lib/redfish_sessions.hpp +++ b/redfish-core/lib/redfish_sessions.hpp @@ -48,7 +48,6 @@ inline void const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& /*sessionId*/) { - if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; @@ -138,7 +137,6 @@ inline void handleSessionCollectionHead( crow::App& app, const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; @@ -246,7 +244,6 @@ inline void handleSessionServiceHead( crow::App& app, const crow::Request& req, const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - if (!redfish::setUpRedfishRoute(app, req, asyncResp)) { return; diff --git a/redfish-core/lib/redfish_util.hpp b/redfish-core/lib/redfish_util.hpp index a742ca69bd..2e4c6e5a38 100644 --- a/redfish-core/lib/redfish_util.hpp +++ b/redfish-core/lib/redfish_util.hpp @@ -160,8 +160,8 @@ void getPortStatusAndPath( const std::string& unitState = std::get<NET_PROTO_UNIT_SUB_STATE>(unit); - bool isProtocolEnabled = - ((unitState == "running") || (unitState == "listening")); + bool isProtocolEnabled = ((unitState == "running") || + (unitState == "listening")); socketData.emplace_back(socketPath, std::string(kv.first), isProtocolEnabled); diff --git a/redfish-core/lib/redfish_v1.hpp b/redfish-core/lib/redfish_v1.hpp index 8ea46d81f6..a9b81e423b 100644 --- a/redfish-core/lib/redfish_v1.hpp +++ b/redfish-core/lib/redfish_v1.hpp @@ -110,8 +110,8 @@ inline void jsonSchemaGet(App& app, const crow::Request& req, } nlohmann::json& json = asyncResp->res.jsonValue; - json["@odata.id"] = - crow::utility::urlFromPieces("redfish", "v1", "JsonSchemas", schema); + json["@odata.id"] = crow::utility::urlFromPieces("redfish", "v1", + "JsonSchemas", schema); json["@odata.type"] = "#JsonSchemaFile.v1_0_2.JsonSchemaFile"; json["Name"] = schema + " Schema File"; json["Description"] = schema + " Schema File Location"; @@ -128,8 +128,8 @@ inline void jsonSchemaGet(App& app, const crow::Request& req, nlohmann::json::array_t locationArray; nlohmann::json::object_t locationEntry; locationEntry["Language"] = "en"; - locationEntry["PublicationUri"] = - "http://redfish.dmtf.org/schemas/v1/" + schema + ".json"; + locationEntry["PublicationUri"] = "http://redfish.dmtf.org/schemas/v1/" + + schema + ".json"; locationEntry["Uri"] = crow::utility::urlFromPieces( "redfish", "v1", "JsonSchemas", schema, std::string(schema) + ".json"); diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp index 0772da559f..e04eac671f 100644 --- a/redfish-core/lib/sensors.hpp +++ b/redfish-core/lib/sensors.hpp @@ -756,8 +756,8 @@ inline void objectPropertiesToJson( } sensorJson["Status"]["State"] = getState(inventoryItem); - sensorJson["Status"]["Health"] = - getHealth(sensorJson, propertiesDict, inventoryItem); + sensorJson["Status"]["Health"] = getHealth(sensorJson, propertiesDict, + inventoryItem); // Parameter to set to override the type we get from dbus, and force it to // int, regardless of what is available. This is used for schemas like fan, @@ -959,7 +959,6 @@ inline void objectInterfacesToJson( const dbus::utility::DBusInteracesMap& interfacesDict, nlohmann::json& sensorJson, InventoryItem* inventoryItem) { - for (const auto& [interface, valuesDict] : interfacesDict) { objectPropertiesToJson(sensorName, sensorType, chassisSubNode, @@ -1113,10 +1112,10 @@ inline void populateFanRedundancy( } } - size_t minNumNeeded = - collection->empty() - ? 0 - : collection->size() - *allowedFailures; + size_t minNumNeeded = collection->empty() + ? 0 + : collection->size() - + *allowedFailures; nlohmann::json& jResp = sensorsAsyncResp->asyncResp->res .jsonValue["Redundancy"]; @@ -1262,8 +1261,8 @@ inline void addInventoryItem( const std::string& invItemObjPath, const std::string& sensorObjPath) { // Look for inventory item in vector - InventoryItem* inventoryItem = - findInventoryItem(inventoryItems, invItemObjPath); + InventoryItem* inventoryItem = findInventoryItem(inventoryItems, + invItemObjPath); // If inventory item doesn't exist in vector, add it if (inventoryItem == nullptr) @@ -1456,8 +1455,8 @@ static void getInventoryItemsData( static_cast<const std::string&>(objDictEntry.first); // If this object path is one of the specified inventory items - InventoryItem* inventoryItem = - findInventoryItem(inventoryItems, objPath); + InventoryItem* inventoryItem = findInventoryItem(inventoryItems, + objPath); if (inventoryItem != nullptr) { // Store inventory data in InventoryItem diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp index 0388ccd69e..7182317540 100644 --- a/redfish-core/lib/storage.hpp +++ b/redfish-core/lib/storage.hpp @@ -737,7 +737,7 @@ inline void chassisDriveCollectionGet( asyncResp->res.jsonValue["Members@odata.count"] = resp.size(); }); // end association lambda - } // end Iterate over all retrieved ObjectPaths + } // end Iterate over all retrieved ObjectPaths }); } @@ -755,7 +755,6 @@ inline void buildDrive(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const boost::system::error_code& ec, const dbus::utility::MapperGetSubTreeResponse& subtree) { - if (ec) { BMCWEB_LOG_DEBUG << "DBUS response error " << ec; @@ -803,7 +802,6 @@ inline void const std::string& driveName, const std::vector<std::string>& resp) { - for (const std::string& drivePath : resp) { sdbusplus::message::object_path path(drivePath); diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp index c9d31d1764..19e5e648a5 100644 --- a/redfish-core/lib/systems.hpp +++ b/redfish-core/lib/systems.hpp @@ -139,7 +139,6 @@ inline void getProcessorProperties( const std::vector<std::pair<std::string, dbus::utility::DbusVariantType>>& properties) { - BMCWEB_LOG_DEBUG << "Got " << properties.size() << " Cpu properties."; // TODO: Get Model @@ -185,7 +184,6 @@ inline void getProcessorSummary(const std::shared_ptr<bmcweb::AsyncResp>& aResp, const std::string& service, const std::string& path) { - auto getCpuPresenceState = [aResp](const boost::system::error_code& ec3, const bool cpuPresenceCheck) { if (ec3) @@ -2792,11 +2790,11 @@ inline void requestRoutesSystemsCollection(App& app) */ inline void doNMI(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) { - constexpr char const* serviceName = "xyz.openbmc_project.Control.Host.NMI"; - constexpr char const* objectPath = "/xyz/openbmc_project/control/host0/nmi"; - constexpr char const* interfaceName = + constexpr const char* serviceName = "xyz.openbmc_project.Control.Host.NMI"; + constexpr const char* objectPath = "/xyz/openbmc_project/control/host0/nmi"; + constexpr const char* interfaceName = "xyz.openbmc_project.Control.Host.NMI"; - constexpr char const* method = "NMI"; + constexpr const char* method = "NMI"; crow::connections::systemBus->async_method_call( [asyncResp](const boost::system::error_code& ec) { @@ -2995,7 +2993,6 @@ inline void afterPortRequest( */ inline void requestRoutesSystems(App& app) { - BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/") .privileges(redfish::privileges::headComputerSystem) .methods(boost::beast::http::verb::head)( diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp index 4edfe182d6..167a0c7d40 100644 --- a/redfish-core/lib/task.hpp +++ b/redfish-core/lib/task.hpp @@ -198,8 +198,8 @@ struct TaskData : std::enable_shared_from_this<TaskData> static void sendTaskEvent(std::string_view state, size_t index) { - std::string origin = - "/redfish/v1/TaskService/Tasks/" + std::to_string(index); + std::string origin = "/redfish/v1/TaskService/Tasks/" + + std::to_string(index); std::string resType = "Task"; // TaskState enums which should send out an event are: // "Starting" = taskResumed diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp index 650ba95622..59b2b3b8b5 100644 --- a/redfish-core/lib/update_service.hpp +++ b/redfish-core/lib/update_service.hpp @@ -212,7 +212,6 @@ static void iface == "xyz.openbmc_project.Software.ActivationProgress") { - const uint8_t* progress = nullptr; for (const auto& property : values) { @@ -538,8 +537,8 @@ inline void uploadImageFile(crow::Response& res, std::string_view body) std::ofstream out(filepath, std::ofstream::out | std::ofstream::binary | std::ofstream::trunc); // set the permission of the file to 640 - std::filesystem::perms permission = - std::filesystem::perms::owner_read | std::filesystem::perms::group_read; + std::filesystem::perms permission = std::filesystem::perms::owner_read | + std::filesystem::perms::group_read; std::filesystem::permissions(filepath, permission); out << body; @@ -616,7 +615,7 @@ inline void continue; } - for (auto const& param : + for (const auto& param : boost::beast::http::param_list{it->value().substr(index)}) { if (param.first != "name" || param.second.empty()) diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp index 96fd03798e..373881e605 100644 --- a/redfish-core/lib/virtual_media.hpp +++ b/redfish-core/lib/virtual_media.hpp @@ -794,7 +794,6 @@ inline void doEjectAction(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& service, const std::string& name, bool legacy) { - // Legacy mount requires parameter with image if (legacy) { @@ -952,7 +951,6 @@ inline void handleManagersVirtualMediaActionEject( for (const auto& object : subtree) { - VmMode mode = parseObjectPathAndGetMode(object.first, resName); if (mode != VmMode::Invalid) { |