clang-format: update to latest from docs repo
This is from openbmc/docs/style/cpp/.clang-format
Other OpenBMC repos are doing the same.
Tested: Built and validator passed.
Change-Id: Ief26c755c9ce012823e16a506342b0547a53517a
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index d41a419..8c67f36 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -20,6 +20,7 @@
#include <error_messages.hpp>
#include <openbmc_dbus_rest.hpp>
#include <utils/json_utils.hpp>
+
#include <variant>
namespace redfish
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index 94f1cb9..9e0a294 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -10,14 +10,14 @@
class BiosService : public Node
{
public:
- BiosService(CrowApp &app) : Node(app, "/redfish/v1/Systems/system/Bios/")
+ BiosService(CrowApp& app) : Node(app, "/redfish/v1/Systems/system/Bios/")
{
entityPrivileges = {{boost::beast::http::verb::get, {{"Login"}}}};
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -39,7 +39,7 @@
class BiosReset : public Node
{
public:
- BiosReset(CrowApp &app) :
+ BiosReset(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios/")
{
entityPrivileges = {
@@ -51,8 +51,8 @@
* Function handles POST method request.
* Analyzes POST body message before sends Reset request data to D-Bus.
*/
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 66ddab8..4831617 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -19,27 +19,28 @@
#include <boost/convert.hpp>
#include <boost/convert/strtol.hpp>
+
#include <variant>
namespace redfish
{
namespace certs
{
-constexpr char const *httpsObjectPath =
+constexpr char const* httpsObjectPath =
"/xyz/openbmc_project/certs/server/https";
-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 *ldapObjectPath = "/xyz/openbmc_project/certs/client/ldap";
-constexpr char const *httpsServiceName =
+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* ldapObjectPath = "/xyz/openbmc_project/certs/client/ldap";
+constexpr char const* httpsServiceName =
"xyz.openbmc_project.Certs.Manager.Server.Https";
-constexpr char const *ldapServiceName =
+constexpr char const* ldapServiceName =
"xyz.openbmc_project.Certs.Manager.Client.Ldap";
-constexpr char const *authorityServiceName =
+constexpr char const* authorityServiceName =
"xyz.openbmc_project.Certs.Manager.Authority.Ldap";
-constexpr char const *authorityObjectPath =
+constexpr char const* authorityObjectPath =
"/xyz/openbmc_project/certs/authority/ldap";
} // namespace certs
@@ -51,7 +52,7 @@
class CertificateService : public Node
{
public:
- CertificateService(CrowApp &app) :
+ CertificateService(CrowApp& app) :
Node(app, "/redfish/v1/CertificateService/")
{
// TODO: Issue#61 No entries are available for Certificate
@@ -68,8 +69,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue = {
{"@odata.type", "#CertificateService.v1_0_0.CertificateService"},
@@ -116,8 +117,8 @@
}
std::string
- getCertificateFromReqBody(const std::shared_ptr<AsyncResp> &asyncResp,
- const crow::Request &req)
+ getCertificateFromReqBody(const std::shared_ptr<AsyncResp>& asyncResp,
+ const crow::Request& req)
{
nlohmann::json reqJson = nlohmann::json::parse(req.body, nullptr, false);
@@ -155,14 +156,14 @@
{
public:
CertificateFile() = delete;
- CertificateFile(const CertificateFile &) = delete;
- CertificateFile &operator=(const CertificateFile &) = delete;
- CertificateFile(CertificateFile &&) = delete;
- CertificateFile &operator=(CertificateFile &&) = delete;
- CertificateFile(const std::string &certString)
+ CertificateFile(const CertificateFile&) = delete;
+ CertificateFile& operator=(const CertificateFile&) = delete;
+ CertificateFile(CertificateFile&&) = delete;
+ CertificateFile& operator=(CertificateFile&&) = delete;
+ CertificateFile(const std::string& certString)
{
char dirTemplate[] = "/tmp/Certs.XXXXXX";
- char *tempDirectory = mkdtemp(dirTemplate);
+ char* tempDirectory = mkdtemp(dirTemplate);
if (tempDirectory)
{
certDirectory = tempDirectory;
@@ -184,7 +185,7 @@
{
std::filesystem::remove_all(certDirectory);
}
- catch (const std::filesystem::filesystem_error &e)
+ catch (const std::filesystem::filesystem_error& e)
{
BMCWEB_LOG_ERROR << "Failed to remove temp directory"
<< certDirectory;
@@ -212,17 +213,17 @@
* @param[in] csrObjPath CSR D-Bus object path
* @return None
*/
-static void getCSR(const std::shared_ptr<AsyncResp> &asyncResp,
- const std::string &certURI, const std::string &service,
- const std::string &certObjPath,
- const std::string &csrObjPath)
+static void getCSR(const std::shared_ptr<AsyncResp>& asyncResp,
+ const std::string& certURI, const std::string& service,
+ const std::string& certObjPath,
+ const std::string& csrObjPath)
{
BMCWEB_LOG_DEBUG << "getCSR CertObjectPath" << certObjPath
<< " CSRObjectPath=" << csrObjPath
<< " service=" << service;
crow::connections::systemBus->async_method_call(
[asyncResp, certURI](const boost::system::error_code ec,
- const std::string &csr) {
+ const std::string& csr) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -248,7 +249,7 @@
class CertificateActionGenerateCSR : public Node
{
public:
- CertificateActionGenerateCSR(CrowApp &app) :
+ CertificateActionGenerateCSR(CrowApp& app) :
Node(app, "/redfish/v1/CertificateService/Actions/"
"CertificateService.GenerateCSR/")
{
@@ -262,8 +263,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
static const int RSA_KEY_BIT_LENGTH = 2048;
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -427,7 +428,7 @@
// Make this static so it survives outside this method
static boost::asio::steady_timer timeout(*req.ioService);
timeout.expires_after(std::chrono::seconds(TIME_OUT));
- timeout.async_wait([asyncResp](const boost::system::error_code &ec) {
+ timeout.async_wait([asyncResp](const boost::system::error_code& ec) {
csrMatcher = nullptr;
if (ec)
{
@@ -454,7 +455,7 @@
csrMatcher = std::make_unique<sdbusplus::bus::match::match>(
*crow::connections::systemBus, match,
[asyncResp, service, objectPath,
- certURI](sdbusplus::message::message &m) {
+ certURI](sdbusplus::message::message& m) {
timeout.cancel();
if (m.is_method_error())
{
@@ -469,7 +470,7 @@
sdbusplus::message::object_path csrObjectPath;
m.read(csrObjectPath, interfacesProperties);
BMCWEB_LOG_DEBUG << "CSR object added" << csrObjectPath.str;
- for (auto &interface : interfacesProperties)
+ for (auto& interface : interfacesProperties)
{
if (interface.first == "xyz.openbmc_project.Certs.CSR")
{
@@ -480,8 +481,8 @@
}
});
crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code &ec,
- const std::string &path) {
+ [asyncResp](const boost::system::error_code& ec,
+ const std::string& path) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec.message();
@@ -506,7 +507,7 @@
* @param[in] type Issuer/Subject
* @return None
*/
-static void updateCertIssuerOrSubject(nlohmann::json &out,
+static void updateCertIssuerOrSubject(nlohmann::json& out,
const std::string_view value)
{
// example: O=openbmc-project.xyz,CN=localhost
@@ -576,9 +577,9 @@
* @return None
*/
static void getCertificateProperties(
- const std::shared_ptr<AsyncResp> &asyncResp, const std::string &objectPath,
- const std::string &service, long certId, const std::string &certURL,
- const std::string &name)
+ const std::shared_ptr<AsyncResp>& asyncResp, const std::string& objectPath,
+ const std::string& service, long certId, const std::string& certURL,
+ const std::string& name)
{
using PropertyType =
std::variant<std::string, uint64_t, std::vector<std::string>>;
@@ -587,7 +588,7 @@
<< " certId=" << certId << " certURl=" << certURL;
crow::connections::systemBus->async_method_call(
[asyncResp, certURL, certId, name](const boost::system::error_code ec,
- const PropertiesMap &properties) {
+ const PropertiesMap& properties) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -601,12 +602,12 @@
{"Id", std::to_string(certId)},
{"Name", name},
{"Description", name}};
- for (const auto &property : properties)
+ for (const auto& property : properties)
{
if (property.first == "CertificateString")
{
asyncResp->res.jsonValue["CertificateString"] = "";
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value)
{
@@ -615,14 +616,14 @@
}
else if (property.first == "KeyUsage")
{
- nlohmann::json &keyUsage =
+ nlohmann::json& keyUsage =
asyncResp->res.jsonValue["KeyUsage"];
keyUsage = nlohmann::json::array();
- const std::vector<std::string> *value =
+ const std::vector<std::string>* value =
std::get_if<std::vector<std::string>>(&property.second);
if (value)
{
- for (const std::string &usage : *value)
+ for (const std::string& usage : *value)
{
keyUsage.push_back(usage);
}
@@ -630,7 +631,7 @@
}
else if (property.first == "Issuer")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value)
{
@@ -640,7 +641,7 @@
}
else if (property.first == "Subject")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value)
{
@@ -650,7 +651,7 @@
}
else if (property.first == "ValidNotAfter")
{
- const uint64_t *value =
+ const uint64_t* value =
std::get_if<uint64_t>(&property.second);
if (value)
{
@@ -661,7 +662,7 @@
}
else if (property.first == "ValidNotBefore")
{
- const uint64_t *value =
+ const uint64_t* value =
std::get_if<uint64_t>(&property.second);
if (value)
{
@@ -686,7 +687,7 @@
class CertificateActionsReplaceCertificate : public Node
{
public:
- CertificateActionsReplaceCertificate(CrowApp &app) :
+ CertificateActionsReplaceCertificate(CrowApp& app) :
Node(app, "/redfish/v1/CertificateService/Actions/"
"CertificateService.ReplaceCertificate/")
{
@@ -700,8 +701,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::string certificate;
nlohmann::json certificateUri;
@@ -812,7 +813,7 @@
{
public:
template <typename CrowApp>
- HTTPSCertificate(CrowApp &app) :
+ HTTPSCertificate(CrowApp& app) :
Node(app,
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/"
"<str>/",
@@ -827,8 +828,8 @@
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -858,7 +859,7 @@
{
public:
template <typename CrowApp>
- HTTPSCertificateCollection(CrowApp &app) :
+ HTTPSCertificateCollection(CrowApp& app) :
Node(app,
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/")
{
@@ -870,8 +871,8 @@
{boost::beast::http::verb::delete_, {{"ConfigureComponents"}}},
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue = {
{"@odata.id",
@@ -882,16 +883,16 @@
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const ManagedObjectType &certs) {
+ const ManagedObjectType& certs) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &members = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const auto &cert : certs)
+ for (const auto& cert : certs)
{
long id = getIDFromURL(cert.first.str);
if (id >= 0)
@@ -910,8 +911,8 @@
certs::dbusObjManagerIntf, "GetManagedObjects");
}
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "HTTPSCertificateCollection::doPost";
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -932,7 +933,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, certFile](const boost::system::error_code ec,
- const std::string &objectPath) {
+ const std::string& objectPath) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -970,7 +971,7 @@
{
public:
template <typename CrowApp>
- CertificateLocations(CrowApp &app) :
+ CertificateLocations(CrowApp& app) :
Node(app, "/redfish/v1/CertificateService/CertificateLocations/")
{
entityPrivileges = {
@@ -983,8 +984,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue = {
{"@odata.id",
@@ -997,7 +998,7 @@
"Defines a resource that an administrator can use in order to "
"locate all certificates installed on a given service"}};
auto asyncResp = std::make_shared<AsyncResp>(res);
- nlohmann::json &links =
+ nlohmann::json& links =
asyncResp->res.jsonValue["Links"]["Certificates"];
links = nlohmann::json::array();
getCertificateLocations(
@@ -1020,25 +1021,25 @@
* @param[in] path Path of the D-Bus service object
* @return None
*/
- void getCertificateLocations(std::shared_ptr<AsyncResp> &asyncResp,
- const std::string &certURL,
- const std::string &path,
- const std::string &service)
+ void getCertificateLocations(std::shared_ptr<AsyncResp>& asyncResp,
+ const std::string& certURL,
+ const std::string& path,
+ const std::string& service)
{
BMCWEB_LOG_DEBUG << "getCertificateLocations URI=" << certURL
<< " Path=" << path << " service= " << service;
crow::connections::systemBus->async_method_call(
[asyncResp, certURL](const boost::system::error_code ec,
- const ManagedObjectType &certs) {
+ const ManagedObjectType& certs) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &links =
+ nlohmann::json& links =
asyncResp->res.jsonValue["Links"]["Certificates"];
- for (auto &cert : certs)
+ for (auto& cert : certs)
{
long id = getIDFromURL(cert.first.str);
if (id >= 0)
@@ -1061,7 +1062,7 @@
{
public:
template <typename CrowApp>
- LDAPCertificateCollection(CrowApp &app) :
+ LDAPCertificateCollection(CrowApp& app) :
Node(app, "/redfish/v1/AccountService/LDAP/Certificates/")
{
entityPrivileges = {
@@ -1072,8 +1073,8 @@
{boost::beast::http::verb::delete_, {{"ConfigureComponents"}}},
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue = {
{"@odata.id", "/redfish/v1/AccountService/LDAP/Certificates"},
@@ -1083,16 +1084,16 @@
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const ManagedObjectType &certs) {
+ const ManagedObjectType& certs) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &members = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const auto &cert : certs)
+ for (const auto& cert : certs)
{
long id = getIDFromURL(cert.first.str);
if (id >= 0)
@@ -1110,8 +1111,8 @@
certs::dbusObjManagerIntf, "GetManagedObjects");
}
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
std::string certFileBody = getCertificateFromReqBody(asyncResp, req);
@@ -1128,7 +1129,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, certFile](const boost::system::error_code ec,
- const std::string &objectPath) {
+ const std::string& objectPath) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -1165,7 +1166,7 @@
{
public:
template <typename CrowApp>
- LDAPCertificate(CrowApp &app) :
+ LDAPCertificate(CrowApp& app) :
Node(app, "/redfish/v1/AccountService/LDAP/Certificates/<str>/",
std::string())
{
@@ -1178,8 +1179,8 @@
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
long id = getIDFromURL(req.url);
@@ -1206,7 +1207,7 @@
{
public:
template <typename CrowApp>
- TrustStoreCertificateCollection(CrowApp &app) :
+ TrustStoreCertificateCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/Truststore/Certificates/")
{
entityPrivileges = {
@@ -1217,8 +1218,8 @@
{boost::beast::http::verb::delete_, {{"ConfigureComponents"}}},
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue = {
{"@odata.id", "/redfish/v1/Managers/bmc/Truststore/Certificates/"},
@@ -1229,16 +1230,16 @@
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const ManagedObjectType &certs) {
+ const ManagedObjectType& certs) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &members = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const auto &cert : certs)
+ for (const auto& cert : certs)
{
long id = getIDFromURL(cert.first.str);
if (id >= 0)
@@ -1256,8 +1257,8 @@
certs::dbusObjManagerIntf, "GetManagedObjects");
}
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
std::string certFileBody = getCertificateFromReqBody(asyncResp, req);
@@ -1273,7 +1274,7 @@
std::make_shared<CertificateFile>(certFileBody);
crow::connections::systemBus->async_method_call(
[asyncResp, certFile](const boost::system::error_code ec,
- const std::string &objectPath) {
+ const std::string& objectPath) {
if (ec)
{
BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
@@ -1311,7 +1312,7 @@
{
public:
template <typename CrowApp>
- TrustStoreCertificate(CrowApp &app) :
+ TrustStoreCertificate(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/Truststore/Certificates/<str>/",
std::string())
{
@@ -1324,8 +1325,8 @@
{boost::beast::http::verb::post, {{"ConfigureComponents"}}}};
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
long id = getIDFromURL(req.url);
@@ -1348,8 +1349,8 @@
"TrustStore Certificate");
}
- void doDelete(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doDelete(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 69a48a7..2b098a9 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -20,6 +20,7 @@
#include "node.hpp"
#include <boost/container/flat_map.hpp>
+
#include <variant>
namespace redfish
@@ -37,7 +38,7 @@
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)}](
const boost::system::error_code ec,
- const std::variant<std::string> &chassisState) {
+ const std::variant<std::string>& chassisState) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -45,7 +46,7 @@
return;
}
- const std::string *s = std::get_if<std::string>(&chassisState);
+ const std::string* s = std::get_if<std::string>(&chassisState);
BMCWEB_LOG_DEBUG << "Chassis state: " << *s;
if (s != nullptr)
{
@@ -85,14 +86,14 @@
using PropertiesType = boost::container::flat_map<std::string, VariantType>;
void getIntrusionByService(std::shared_ptr<AsyncResp> aResp,
- const std::string &service,
- const std::string &objPath)
+ const std::string& service,
+ const std::string& objPath)
{
BMCWEB_LOG_DEBUG << "Get intrusion status by service \n";
crow::connections::systemBus->async_method_call(
[aResp{std::move(aResp)}](const boost::system::error_code ec,
- const std::variant<std::string> &value) {
+ const std::variant<std::string>& value) {
if (ec)
{
// do not add err msg in redfish response, becaues this is not
@@ -101,7 +102,7 @@
return;
}
- const std::string *status = std::get_if<std::string>(&value);
+ const std::string* status = std::get_if<std::string>(&value);
if (status == nullptr)
{
@@ -126,8 +127,8 @@
const boost::system::error_code ec,
const std::vector<std::pair<
std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>
- &subtree) {
+ std::vector<std::pair<std::string, std::vector<std::string>>>>>&
+ subtree) {
if (ec)
{
// do not add err msg in redfish response, becaues this is not
@@ -137,9 +138,9 @@
return;
}
// Iterate over all retrieved ObjectPaths.
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
- for (const auto &service : object.second)
+ for (const auto& service : object.second)
{
getIntrusionByService(aResp, service.first, object.first);
return;
@@ -150,7 +151,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/Intrusion", 1,
- std::array<const char *, 1>{"xyz.openbmc_project.Chassis.Intrusion"});
+ std::array<const char*, 1>{"xyz.openbmc_project.Chassis.Intrusion"});
}
/**
@@ -159,7 +160,7 @@
class ChassisCollection : public Node
{
public:
- ChassisCollection(CrowApp &app) : Node(app, "/redfish/v1/Chassis/")
+ ChassisCollection(CrowApp& app) : Node(app, "/redfish/v1/Chassis/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -174,30 +175,30 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] = "#ChassisCollection.ChassisCollection";
res.jsonValue["@odata.id"] = "/redfish/v1/Chassis";
res.jsonValue["Name"] = "Chassis Collection";
- const std::array<const char *, 2> interfaces = {
+ const std::array<const char*, 2> interfaces = {
"xyz.openbmc_project.Inventory.Item.Board",
"xyz.openbmc_project.Inventory.Item.Chassis"};
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::vector<std::string> &chassisList) {
+ const std::vector<std::string>& chassisList) {
if (ec)
{
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &chassisArray =
+ nlohmann::json& chassisArray =
asyncResp->res.jsonValue["Members"];
chassisArray = nlohmann::json::array();
- for (const std::string &objpath : chassisList)
+ for (const std::string& objpath : chassisList)
{
std::size_t lastPos = objpath.rfind("/");
if (lastPos == std::string::npos)
@@ -226,7 +227,7 @@
class Chassis : public Node
{
public:
- Chassis(CrowApp &app) :
+ Chassis(CrowApp& app) :
Node(app, "/redfish/v1/Chassis/<str>/", std::string())
{
entityPrivileges = {
@@ -242,10 +243,10 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
- const std::array<const char *, 2> interfaces = {
+ const std::array<const char*, 2> interfaces = {
"xyz.openbmc_project.Inventory.Item.Board",
"xyz.openbmc_project.Inventory.Item.Chassis"};
@@ -257,13 +258,13 @@
res.end();
return;
}
- const std::string &chassisId = params[0];
+ const std::string& chassisId = params[0];
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp, chassisId(std::string(chassisId))](
const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &subtree) {
+ const crow::openbmc_mapper::GetSubTreeType& subtree) {
if (ec)
{
messages::internalError(asyncResp->res);
@@ -273,13 +274,13 @@
for (const std::pair<
std::string,
std::vector<
- std::pair<std::string, std::vector<std::string>>>>
- &object : subtree)
+ std::pair<std::string, std::vector<std::string>>>>&
+ object : subtree)
{
- const std::string &path = object.first;
+ const std::string& path = object.first;
const std::vector<
- std::pair<std::string, std::vector<std::string>>>
- &connectionNames = object.second;
+ std::pair<std::string, std::vector<std::string>>>&
+ connectionNames = object.second;
if (!boost::ends_with(path, chassisId))
{
@@ -290,12 +291,12 @@
crow::connections::systemBus->async_method_call(
[health](const boost::system::error_code ec,
- std::variant<std::vector<std::string>> &resp) {
+ std::variant<std::vector<std::string>>& resp) {
if (ec)
{
return; // no sensors = no failures
}
- std::vector<std::string> *data =
+ std::vector<std::string>* data =
std::get_if<std::vector<std::string>>(&resp);
if (data == nullptr)
{
@@ -326,16 +327,16 @@
{"@odata.id",
"/redfish/v1/Systems/system/PCIeDevices"}};
- const std::string &connectionName =
+ const std::string& connectionName =
connectionNames[0].first;
- const std::vector<std::string> &interfaces =
+ const std::vector<std::string>& interfaces =
connectionNames[0].second;
- const std::array<const char *, 2> hasIndicatorLed = {
+ const std::array<const char*, 2> hasIndicatorLed = {
"xyz.openbmc_project.Inventory.Item.Panel",
"xyz.openbmc_project.Inventory.Item.Board.Motherboard"};
- for (const char *interface : hasIndicatorLed)
+ for (const char* interface : hasIndicatorLed)
{
if (std::find(interfaces.begin(), interfaces.end(),
interface) != interfaces.end())
@@ -349,20 +350,20 @@
[asyncResp, chassisId(std::string(chassisId))](
const boost::system::error_code ec,
const std::vector<std::pair<
- std::string, VariantType>> &propertiesList) {
- for (const std::pair<std::string, VariantType>
- &property : propertiesList)
+ std::string, VariantType>>& propertiesList) {
+ for (const std::pair<std::string, VariantType>&
+ property : propertiesList)
{
// Store DBus properties that are also Redfish
// properties with same name and a string value
- const std::string &propertyName =
+ const std::string& propertyName =
property.first;
if ((propertyName == "PartNumber") ||
(propertyName == "SerialNumber") ||
(propertyName == "Manufacturer") ||
(propertyName == "Model"))
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(
&property.second);
if (value != nullptr)
@@ -414,8 +415,8 @@
getPhysicalSecurityData(asyncResp);
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::optional<std::string> indicatorLed;
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -435,16 +436,16 @@
return; // delete this when we support more patch properties
}
- const std::array<const char *, 2> interfaces = {
+ const std::array<const char*, 2> interfaces = {
"xyz.openbmc_project.Inventory.Item.Board",
"xyz.openbmc_project.Inventory.Item.Chassis"};
- const std::string &chassisId = params[0];
+ const std::string& chassisId = params[0];
crow::connections::systemBus->async_method_call(
[asyncResp, chassisId, indicatorLed](
const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &subtree) {
+ const crow::openbmc_mapper::GetSubTreeType& subtree) {
if (ec)
{
messages::internalError(asyncResp->res);
@@ -455,13 +456,13 @@
for (const std::pair<
std::string,
std::vector<
- std::pair<std::string, std::vector<std::string>>>>
- &object : subtree)
+ std::pair<std::string, std::vector<std::string>>>>&
+ object : subtree)
{
- const std::string &path = object.first;
+ const std::string& path = object.first;
const std::vector<
- std::pair<std::string, std::vector<std::string>>>
- &connectionNames = object.second;
+ std::pair<std::string, std::vector<std::string>>>&
+ connectionNames = object.second;
if (!boost::ends_with(path, chassisId))
{
@@ -474,17 +475,17 @@
continue;
}
- const std::vector<std::string> &interfaces =
+ const std::vector<std::string>& interfaces =
connectionNames[0].second;
if (indicatorLed)
{
- const std::array<const char *, 2> hasIndicatorLed = {
+ const std::array<const char*, 2> hasIndicatorLed = {
"xyz.openbmc_project.Inventory.Item.Panel",
"xyz.openbmc_project.Inventory.Item.Board."
"Motherboard"};
bool indicatorChassis = false;
- for (const char *interface : hasIndicatorLed)
+ for (const char* interface : hasIndicatorLed)
{
if (std::find(interfaces.begin(), interfaces.end(),
interface) != interfaces.end())
diff --git a/redfish-core/lib/cpudimm.hpp b/redfish-core/lib/cpudimm.hpp
index 5f6baa3..2e49b99 100644
--- a/redfish-core/lib/cpudimm.hpp
+++ b/redfish-core/lib/cpudimm.hpp
@@ -29,8 +29,8 @@
boost::container::flat_map<std::string, dbus::utility::DbusVariantType>>;
void getResourceList(std::shared_ptr<AsyncResp> aResp,
- const std::string &subclass,
- const std::vector<const char *> &collectionName)
+ const std::string& subclass,
+ const std::vector<const char*>& collectionName)
{
BMCWEB_LOG_DEBUG << "Get available system cpu/mem resources.";
crow::connections::systemBus->async_method_call(
@@ -38,18 +38,18 @@
const boost::system::error_code ec,
const boost::container::flat_map<
std::string, boost::container::flat_map<
- std::string, std::vector<std::string>>>
- &subtree) {
+ std::string, std::vector<std::string>>>&
+ subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
messages::internalError(aResp->res);
return;
}
- nlohmann::json &members = aResp->res.jsonValue["Members"];
+ nlohmann::json& members = aResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
auto iter = object.first.rfind("/");
if ((iter != std::string::npos) && (iter < object.first.size()))
@@ -69,19 +69,19 @@
}
void getCpuDataByInterface(std::shared_ptr<AsyncResp> aResp,
- const InterfacesProperties &cpuInterfacesProperties)
+ const InterfacesProperties& cpuInterfacesProperties)
{
BMCWEB_LOG_DEBUG << "Get CPU resources by interface.";
- const bool *present = nullptr;
- const bool *functional = nullptr;
- for (const auto &interface : cpuInterfacesProperties)
+ const bool* present = nullptr;
+ const bool* functional = nullptr;
+ for (const auto& interface : cpuInterfacesProperties)
{
- for (const auto &property : interface.second)
+ for (const auto& property : interface.second)
{
if (property.first == "ProcessorCoreCount")
{
- const uint16_t *coresCount =
+ const uint16_t* coresCount =
std::get_if<uint16_t>(&property.second);
if (coresCount == nullptr)
{
@@ -106,7 +106,7 @@
}
else if (property.first == "Manufacturer")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -134,7 +134,7 @@
}
else if (property.first == "Model")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -193,15 +193,15 @@
}
void getCpuDataByService(std::shared_ptr<AsyncResp> aResp,
- const std::string &cpuId, const std::string &service,
- const std::string &objPath)
+ const std::string& cpuId, const std::string& service,
+ const std::string& objPath)
{
BMCWEB_LOG_DEBUG << "Get available system cpu resources by service.";
crow::connections::systemBus->async_method_call(
[cpuId, service, objPath, aResp{std::move(aResp)}](
const boost::system::error_code ec,
- const dbus::utility::ManagedObjectType &dbusData) {
+ const dbus::utility::ManagedObjectType& dbusData) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -214,7 +214,7 @@
std::string corePath = objPath + "/core";
size_t totalCores = 0;
- for (const auto &object : dbusData)
+ for (const auto& object : dbusData)
{
if (object.first.str == objPath)
{
@@ -222,16 +222,16 @@
}
else if (boost::starts_with(object.first.str, corePath))
{
- for (const auto &interface : object.second)
+ for (const auto& interface : object.second)
{
if (interface.first ==
"xyz.openbmc_project.Inventory.Item")
{
- for (const auto &property : interface.second)
+ for (const auto& property : interface.second)
{
if (property.first == "Present")
{
- const bool *present =
+ const bool* present =
std::get_if<bool>(&property.second);
if (present != nullptr)
{
@@ -263,9 +263,9 @@
}
void getAcceleratorDataByService(std::shared_ptr<AsyncResp> aResp,
- const std::string &acclrtrId,
- const std::string &service,
- const std::string &objPath)
+ const std::string& acclrtrId,
+ const std::string& service,
+ const std::string& objPath)
{
BMCWEB_LOG_DEBUG
<< "Get available system Accelerator resources by service.";
@@ -274,7 +274,7 @@
const boost::system::error_code ec,
const boost::container::flat_map<
std::string, std::variant<std::string, uint32_t, uint16_t,
- bool>> &properties) {
+ bool>>& properties) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -283,11 +283,11 @@
}
aResp->res.jsonValue["Id"] = acclrtrId;
aResp->res.jsonValue["Name"] = "Processor";
- const bool *accPresent = nullptr;
- const bool *accFunctional = nullptr;
+ const bool* accPresent = nullptr;
+ const bool* accFunctional = nullptr;
std::string state = "";
- for (const auto &property : properties)
+ for (const auto& property : properties)
{
if (property.first == "Functional")
{
@@ -326,8 +326,8 @@
service, objPath, "org.freedesktop.DBus.Properties", "GetAll", "");
}
-void getCpuData(std::shared_ptr<AsyncResp> aResp, const std::string &cpuId,
- const std::vector<const char *> inventoryItems)
+void getCpuData(std::shared_ptr<AsyncResp> aResp, const std::string& cpuId,
+ const std::vector<const char*> inventoryItems)
{
BMCWEB_LOG_DEBUG << "Get available system cpu resources.";
@@ -336,21 +336,21 @@
const boost::system::error_code ec,
const boost::container::flat_map<
std::string, boost::container::flat_map<
- std::string, std::vector<std::string>>>
- &subtree) {
+ std::string, std::vector<std::string>>>&
+ subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
messages::internalError(aResp->res);
return;
}
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
if (boost::ends_with(object.first, cpuId))
{
- for (const auto &service : object.second)
+ for (const auto& service : object.second)
{
- for (const auto &inventory : service.second)
+ for (const auto& inventory : service.second)
if (inventory ==
"xyz.openbmc_project.Inventory.Item.Cpu")
{
@@ -378,8 +378,8 @@
}
void getDimmDataByService(std::shared_ptr<AsyncResp> aResp,
- const std::string &dimmId, const std::string &service,
- const std::string &objPath)
+ const std::string& dimmId, const std::string& service,
+ const std::string& objPath)
{
auto health = std::make_shared<HealthPopulate>(aResp);
health->selfPath = objPath;
@@ -390,8 +390,8 @@
[dimmId, aResp{std::move(aResp)}](
const boost::system::error_code ec,
const boost::container::flat_map<
- std::string, std::variant<std::string, uint32_t, uint16_t>>
- &properties) {
+ std::string, std::variant<std::string, uint32_t, uint16_t>>&
+ properties) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -405,7 +405,7 @@
const auto memorySizeProperty = properties.find("MemorySizeInKB");
if (memorySizeProperty != properties.end())
{
- const uint32_t *memorySize =
+ const uint32_t* memorySize =
std::get_if<uint32_t>(&memorySizeProperty->second);
if (memorySize == nullptr)
{
@@ -427,7 +427,7 @@
aResp->res.jsonValue["Status"]["State"] = "Enabled";
aResp->res.jsonValue["Status"]["Health"] = "OK";
- for (const auto &property : properties)
+ for (const auto& property : properties)
{
if (property.first == "MemoryDataWidth")
{
@@ -447,7 +447,7 @@
}
else if (property.first == "MemoryType")
{
- const auto *value =
+ const auto* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -463,7 +463,7 @@
service, objPath, "org.freedesktop.DBus.Properties", "GetAll", "");
}
-void getDimmData(std::shared_ptr<AsyncResp> aResp, const std::string &dimmId)
+void getDimmData(std::shared_ptr<AsyncResp> aResp, const std::string& dimmId)
{
BMCWEB_LOG_DEBUG << "Get available system dimm resources.";
crow::connections::systemBus->async_method_call(
@@ -471,8 +471,8 @@
const boost::system::error_code ec,
const boost::container::flat_map<
std::string, boost::container::flat_map<
- std::string, std::vector<std::string>>>
- &subtree) {
+ std::string, std::vector<std::string>>>&
+ subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -480,11 +480,11 @@
return;
}
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
if (boost::ends_with(object.first, dimmId))
{
- for (const auto &service : object.second)
+ for (const auto& service : object.second)
{
getDimmDataByService(aResp, dimmId, service.first,
object.first);
@@ -500,7 +500,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/inventory", 0,
- std::array<const char *, 1>{"xyz.openbmc_project.Inventory.Item.Dimm"});
+ std::array<const char*, 1>{"xyz.openbmc_project.Inventory.Item.Dimm"});
}
class ProcessorCollection : public Node
@@ -509,7 +509,7 @@
/*
* Default Constructor
*/
- ProcessorCollection(CrowApp &app) :
+ ProcessorCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Processors/")
{
entityPrivileges = {
@@ -525,8 +525,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] =
"#ProcessorCollection.ProcessorCollection";
@@ -547,7 +547,7 @@
/*
* Default Constructor
*/
- Processor(CrowApp &app) :
+ Processor(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Processors/<str>/", std::string())
{
entityPrivileges = {
@@ -563,8 +563,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
// Check if there is required param, truly entering this shall be
// impossible
@@ -575,7 +575,7 @@
res.end();
return;
}
- const std::string &processorId = params[0];
+ const std::string& processorId = params[0];
res.jsonValue["@odata.type"] = "#Processor.v1_7_0.Processor";
res.jsonValue["@odata.id"] =
"/redfish/v1/Systems/system/Processors/" + processorId;
@@ -594,7 +594,7 @@
/*
* Default Constructor
*/
- MemoryCollection(CrowApp &app) :
+ MemoryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Memory/")
{
entityPrivileges = {
@@ -610,8 +610,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] = "#MemoryCollection.MemoryCollection";
res.jsonValue["Name"] = "Memory Module Collection";
@@ -629,7 +629,7 @@
/*
* Default Constructor
*/
- Memory(CrowApp &app) :
+ Memory(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Memory/<str>/", std::string())
{
entityPrivileges = {
@@ -645,8 +645,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
// Check if there is required param, truly entering this shall be
// impossible
@@ -656,7 +656,7 @@
res.end();
return;
}
- const std::string &dimmId = params[0];
+ const std::string& dimmId = params[0];
res.jsonValue["@odata.type"] = "#Memory.v1_6_0.Memory";
res.jsonValue["@odata.id"] =
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 1f65254..a76b01b 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -20,9 +20,10 @@
#include <dbus_singleton.hpp>
#include <error_messages.hpp>
#include <node.hpp>
+#include <utils/json_utils.hpp>
+
#include <optional>
#include <regex>
-#include <utils/json_utils.hpp>
#include <variant>
namespace redfish
@@ -65,7 +66,7 @@
std::string origin;
LinkType linktype;
- bool operator<(const IPv4AddressData &obj) const
+ bool operator<(const IPv4AddressData& obj) const
{
return id < obj.id;
}
@@ -81,7 +82,7 @@
std::string origin;
uint8_t prefixLength;
- bool operator<(const IPv6AddressData &obj) const
+ bool operator<(const IPv6AddressData& obj) const
{
return id < obj.id;
}
@@ -133,7 +134,7 @@
return netmask;
}
-inline bool translateDHCPEnabledToBool(const std::string &inputDHCP,
+inline bool translateDHCPEnabledToBool(const std::string& inputDHCP,
bool isIPv4)
{
if (isIPv4)
@@ -168,7 +169,7 @@
}
inline std::string
- translateAddressOriginDbusToRedfish(const std::string &inputOrigin,
+ translateAddressOriginDbusToRedfish(const std::string& inputOrigin,
bool isIPv4)
{
if (inputOrigin == "xyz.openbmc_project.Network.IP.AddressOrigin.Static")
@@ -204,25 +205,25 @@
return "";
}
-inline bool extractEthernetInterfaceData(const std::string ðiface_id,
- const GetManagedObjects &dbus_data,
- EthernetInterfaceData ðData)
+inline bool extractEthernetInterfaceData(const std::string& ethiface_id,
+ const GetManagedObjects& dbus_data,
+ EthernetInterfaceData& ethData)
{
bool idFound = false;
- for (const auto &objpath : dbus_data)
+ for (const auto& objpath : dbus_data)
{
- for (const auto &ifacePair : objpath.second)
+ for (const auto& ifacePair : objpath.second)
{
if (objpath.first == "/xyz/openbmc_project/network/" + ethiface_id)
{
idFound = true;
if (ifacePair.first == "xyz.openbmc_project.Network.MACAddress")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "MACAddress")
{
- const std::string *mac =
+ const std::string* mac =
std::get_if<std::string>(&propertyPair.second);
if (mac != nullptr)
{
@@ -233,11 +234,11 @@
}
else if (ifacePair.first == "xyz.openbmc_project.Network.VLAN")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "Id")
{
- const uint32_t *id =
+ const uint32_t* id =
std::get_if<uint32_t>(&propertyPair.second);
if (id != nullptr)
{
@@ -249,11 +250,11 @@
else if (ifacePair.first ==
"xyz.openbmc_project.Network.EthernetInterface")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "AutoNeg")
{
- const bool *auto_neg =
+ const bool* auto_neg =
std::get_if<bool>(&propertyPair.second);
if (auto_neg != nullptr)
{
@@ -262,7 +263,7 @@
}
else if (propertyPair.first == "Speed")
{
- const uint32_t *speed =
+ const uint32_t* speed =
std::get_if<uint32_t>(&propertyPair.second);
if (speed != nullptr)
{
@@ -271,7 +272,7 @@
}
else if (propertyPair.first == "LinkUp")
{
- const bool *linkUp =
+ const bool* linkUp =
std::get_if<bool>(&propertyPair.second);
if (linkUp != nullptr)
{
@@ -280,7 +281,7 @@
}
else if (propertyPair.first == "NICEnabled")
{
- const bool *nicEnabled =
+ const bool* nicEnabled =
std::get_if<bool>(&propertyPair.second);
if (nicEnabled != nullptr)
{
@@ -289,7 +290,7 @@
}
else if (propertyPair.first == "Nameservers")
{
- const std::vector<std::string> *nameservers =
+ const std::vector<std::string>* nameservers =
std::get_if<std::vector<std::string>>(
&propertyPair.second);
if (nameservers != nullptr)
@@ -299,7 +300,7 @@
}
else if (propertyPair.first == "StaticNameServers")
{
- const std::vector<std::string> *staticNameServers =
+ const std::vector<std::string>* staticNameServers =
std::get_if<std::vector<std::string>>(
&propertyPair.second);
if (staticNameServers != nullptr)
@@ -310,7 +311,7 @@
}
else if (propertyPair.first == "DHCPEnabled")
{
- const std::string *DHCPEnabled =
+ const std::string* DHCPEnabled =
std::get_if<std::string>(&propertyPair.second);
if (DHCPEnabled != nullptr)
{
@@ -319,7 +320,7 @@
}
else if (propertyPair.first == "DomainName")
{
- const std::vector<std::string> *domainNames =
+ const std::vector<std::string>* domainNames =
std::get_if<std::vector<std::string>>(
&propertyPair.second);
if (domainNames != nullptr)
@@ -336,11 +337,11 @@
if (ifacePair.first ==
"xyz.openbmc_project.Network.DHCPConfiguration")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "DNSEnabled")
{
- const bool *DNSEnabled =
+ const bool* DNSEnabled =
std::get_if<bool>(&propertyPair.second);
if (DNSEnabled != nullptr)
{
@@ -349,7 +350,7 @@
}
else if (propertyPair.first == "NTPEnabled")
{
- const bool *NTPEnabled =
+ const bool* NTPEnabled =
std::get_if<bool>(&propertyPair.second);
if (NTPEnabled != nullptr)
{
@@ -358,7 +359,7 @@
}
else if (propertyPair.first == "HostNameEnabled")
{
- const bool *HostNameEnabled =
+ const bool* HostNameEnabled =
std::get_if<bool>(&propertyPair.second);
if (HostNameEnabled != nullptr)
{
@@ -367,7 +368,7 @@
}
else if (propertyPair.first == "SendHostNameEnabled")
{
- const bool *SendHostNameEnabled =
+ const bool* SendHostNameEnabled =
std::get_if<bool>(&propertyPair.second);
if (SendHostNameEnabled != nullptr)
{
@@ -383,11 +384,11 @@
if (ifacePair.first ==
"xyz.openbmc_project.Network.SystemConfiguration")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "HostName")
{
- const std::string *hostname =
+ const std::string* hostname =
std::get_if<std::string>(&propertyPair.second);
if (hostname != nullptr)
{
@@ -396,7 +397,7 @@
}
else if (propertyPair.first == "DefaultGateway")
{
- const std::string *defaultGateway =
+ const std::string* defaultGateway =
std::get_if<std::string>(&propertyPair.second);
if (defaultGateway != nullptr)
{
@@ -405,7 +406,7 @@
}
else if (propertyPair.first == "DefaultGateway6")
{
- const std::string *defaultGateway6 =
+ const std::string* defaultGateway6 =
std::get_if<std::string>(&propertyPair.second);
if (defaultGateway6 != nullptr)
{
@@ -421,21 +422,21 @@
// Helper function that extracts data for single ethernet ipv6 address
inline void
- extractIPV6Data(const std::string ðiface_id,
- const GetManagedObjects &dbus_data,
- boost::container::flat_set<IPv6AddressData> &ipv6_config)
+ extractIPV6Data(const std::string& ethiface_id,
+ const GetManagedObjects& dbus_data,
+ boost::container::flat_set<IPv6AddressData>& ipv6_config)
{
const std::string ipv6PathStart =
"/xyz/openbmc_project/network/" + ethiface_id + "/ipv6/";
// Since there might be several IPv6 configurations aligned with
// single ethernet interface, loop over all of them
- for (const auto &objpath : dbus_data)
+ for (const auto& objpath : dbus_data)
{
// Check if proper pattern for object path appears
if (boost::starts_with(objpath.first.str, ipv6PathStart))
{
- for (auto &interface : objpath.second)
+ for (auto& interface : objpath.second)
{
if (interface.first == "xyz.openbmc_project.Network.IP")
{
@@ -445,14 +446,14 @@
boost::container::flat_set<IPv6AddressData>::iterator,
bool>
it = ipv6_config.insert(IPv6AddressData{});
- IPv6AddressData &ipv6_address = *it.first;
+ IPv6AddressData& ipv6_address = *it.first;
ipv6_address.id =
objpath.first.str.substr(ipv6PathStart.size());
- for (auto &property : interface.second)
+ for (auto& property : interface.second)
{
if (property.first == "Address")
{
- const std::string *address =
+ const std::string* address =
std::get_if<std::string>(&property.second);
if (address != nullptr)
{
@@ -461,7 +462,7 @@
}
else if (property.first == "Origin")
{
- const std::string *origin =
+ const std::string* origin =
std::get_if<std::string>(&property.second);
if (origin != nullptr)
{
@@ -472,7 +473,7 @@
}
else if (property.first == "PrefixLength")
{
- const uint8_t *prefix =
+ const uint8_t* prefix =
std::get_if<uint8_t>(&property.second);
if (prefix != nullptr)
{
@@ -494,21 +495,21 @@
// Helper function that extracts data for single ethernet ipv4 address
inline void
- extractIPData(const std::string ðiface_id,
- const GetManagedObjects &dbus_data,
- boost::container::flat_set<IPv4AddressData> &ipv4_config)
+ extractIPData(const std::string& ethiface_id,
+ const GetManagedObjects& dbus_data,
+ boost::container::flat_set<IPv4AddressData>& ipv4_config)
{
const std::string ipv4PathStart =
"/xyz/openbmc_project/network/" + ethiface_id + "/ipv4/";
// Since there might be several IPv4 configurations aligned with
// single ethernet interface, loop over all of them
- for (const auto &objpath : dbus_data)
+ for (const auto& objpath : dbus_data)
{
// Check if proper pattern for object path appears
if (boost::starts_with(objpath.first.str, ipv4PathStart))
{
- for (auto &interface : objpath.second)
+ for (auto& interface : objpath.second)
{
if (interface.first == "xyz.openbmc_project.Network.IP")
{
@@ -518,14 +519,14 @@
boost::container::flat_set<IPv4AddressData>::iterator,
bool>
it = ipv4_config.insert(IPv4AddressData{});
- IPv4AddressData &ipv4_address = *it.first;
+ IPv4AddressData& ipv4_address = *it.first;
ipv4_address.id =
objpath.first.str.substr(ipv4PathStart.size());
- for (auto &property : interface.second)
+ for (auto& property : interface.second)
{
if (property.first == "Address")
{
- const std::string *address =
+ const std::string* address =
std::get_if<std::string>(&property.second);
if (address != nullptr)
{
@@ -534,7 +535,7 @@
}
else if (property.first == "Gateway")
{
- const std::string *gateway =
+ const std::string* gateway =
std::get_if<std::string>(&property.second);
if (gateway != nullptr)
{
@@ -543,7 +544,7 @@
}
else if (property.first == "Origin")
{
- const std::string *origin =
+ const std::string* origin =
std::get_if<std::string>(&property.second);
if (origin != nullptr)
{
@@ -554,7 +555,7 @@
}
else if (property.first == "PrefixLength")
{
- const uint8_t *mask =
+ const uint8_t* mask =
std::get_if<uint8_t>(&property.second);
if (mask != nullptr)
{
@@ -590,8 +591,8 @@
* @return None.
*/
template <typename CallbackFunc>
-void changeVlanId(const std::string &ifaceId, const uint32_t &inputVlanId,
- CallbackFunc &&callback)
+void changeVlanId(const std::string& ifaceId, const uint32_t& inputVlanId,
+ CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
callback, "xyz.openbmc_project.Network",
@@ -611,8 +612,8 @@
*
* @return true in case of success, false otherwise
*/
-inline bool ipv4VerifyIpAndGetBitcount(const std::string &ip,
- uint8_t *bits = nullptr)
+inline bool ipv4VerifyIpAndGetBitcount(const std::string& ip,
+ uint8_t* bits = nullptr)
{
std::vector<std::string> bytesInMask;
@@ -629,10 +630,10 @@
*bits = 0;
}
- char *endPtr;
+ char* endPtr;
long previousValue = 255;
bool firstZeroInByteHit;
- for (const std::string &byte : bytesInMask)
+ for (const std::string& byte : bytesInMask)
{
if (byte.empty())
{
@@ -703,7 +704,7 @@
*
* @return None
*/
-inline void deleteIPv4(const std::string &ifaceId, const std::string &ipHash,
+inline void deleteIPv4(const std::string& ifaceId, const std::string& ipHash,
const std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -729,9 +730,9 @@
*
* @return None
*/
-inline void createIPv4(const std::string &ifaceId, unsigned int ipIdx,
- uint8_t prefixLength, const std::string &gateway,
- const std::string &address,
+inline void createIPv4(const std::string& ifaceId, unsigned int ipIdx,
+ uint8_t prefixLength, const std::string& gateway,
+ const std::string& address,
std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -761,10 +762,10 @@
*
* @return None
*/
-inline void deleteAndCreateIPv4(const std::string &ifaceId,
- const std::string &id, uint8_t prefixLength,
- const std::string &gateway,
- const std::string &address,
+inline void deleteAndCreateIPv4(const std::string& ifaceId,
+ const std::string& id, uint8_t prefixLength,
+ const std::string& gateway,
+ const std::string& address,
std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -801,7 +802,7 @@
*
* @return None
*/
-inline void deleteIPv6(const std::string &ifaceId, const std::string &ipHash,
+inline void deleteIPv6(const std::string& ifaceId, const std::string& ipHash,
const std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -828,9 +829,9 @@
*
* @return None
*/
-inline void deleteAndCreateIPv6(const std::string &ifaceId,
- const std::string &id, uint8_t prefixLength,
- const std::string &address,
+inline void deleteAndCreateIPv6(const std::string& ifaceId,
+ const std::string& id, uint8_t prefixLength,
+ const std::string& address,
std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
@@ -868,8 +869,8 @@
*
* @return None
*/
-inline void createIPv6(const std::string &ifaceId, uint8_t prefixLength,
- const std::string &address,
+inline void createIPv6(const std::string& ifaceId, uint8_t prefixLength,
+ const std::string& address,
std::shared_ptr<AsyncResp> asyncResp)
{
auto createIpHandler = [asyncResp](const boost::system::error_code ec) {
@@ -897,13 +898,13 @@
* into JSON
*/
template <typename CallbackFunc>
-void getEthernetIfaceData(const std::string ðiface_id,
- CallbackFunc &&callback)
+void getEthernetIfaceData(const std::string& ethiface_id,
+ CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
[ethiface_id{std::string{ethiface_id}}, callback{std::move(callback)}](
const boost::system::error_code error_code,
- const GetManagedObjects &resp) {
+ const GetManagedObjects& resp) {
EthernetInterfaceData ethData{};
boost::container::flat_set<IPv4AddressData> ipv4Data;
boost::container::flat_set<IPv6AddressData> ipv6Data;
@@ -924,7 +925,7 @@
extractIPData(ethiface_id, resp, ipv4Data);
// Fix global GW
- for (IPv4AddressData &ipv4 : ipv4Data)
+ for (IPv4AddressData& ipv4 : ipv4Data)
{
if (((ipv4.linktype == LinkType::Global) &&
(ipv4.gateway == "0.0.0.0")) ||
@@ -949,12 +950,12 @@
* into JSON.
*/
template <typename CallbackFunc>
-void getEthernetIfaceList(CallbackFunc &&callback)
+void getEthernetIfaceList(CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
[callback{std::move(callback)}](
const boost::system::error_code error_code,
- GetManagedObjects &resp) {
+ GetManagedObjects& resp) {
// Callback requires vector<string> to retrieve all available
// ethernet interfaces
boost::container::flat_set<std::string> iface_list;
@@ -966,10 +967,10 @@
}
// Iterate over all retrieved ObjectPaths.
- for (const auto &objpath : resp)
+ for (const auto& objpath : resp)
{
// And all interfaces available for certain ObjectPath.
- for (const auto &interface : objpath.second)
+ for (const auto& interface : objpath.second)
{
// If interface is
// xyz.openbmc_project.Network.EthernetInterface, this is
@@ -978,7 +979,7 @@
"xyz.openbmc_project.Network.EthernetInterface")
{
// Cut out everyting until last "/", ...
- const std::string &iface_id = objpath.first.str;
+ const std::string& iface_id = objpath.first.str;
std::size_t last_pos = iface_id.rfind("/");
if (last_pos != std::string::npos)
{
@@ -1002,7 +1003,7 @@
{
public:
template <typename CrowApp>
- EthernetCollection(CrowApp &app) :
+ EthernetCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/EthernetInterfaces/")
{
entityPrivileges = {
@@ -1018,8 +1019,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] =
"#EthernetInterfaceCollection.EthernetInterfaceCollection";
@@ -1033,19 +1034,19 @@
// preparation
getEthernetIfaceList(
[asyncResp](
- const bool &success,
- const boost::container::flat_set<std::string> &iface_list) {
+ const bool& success,
+ const boost::container::flat_set<std::string>& iface_list) {
if (!success)
{
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &iface_array =
+ nlohmann::json& iface_array =
asyncResp->res.jsonValue["Members"];
iface_array = nlohmann::json::array();
std::string tag = "_";
- for (const std::string &iface_item : iface_list)
+ for (const std::string& iface_item : iface_list)
{
std::size_t found = iface_item.find(tag);
if (found == std::string::npos)
@@ -1075,7 +1076,7 @@
* Default Constructor
*/
template <typename CrowApp>
- EthernetInterface(CrowApp &app) :
+ EthernetInterface(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/EthernetInterfaces/<str>/",
std::string())
{
@@ -1089,7 +1090,7 @@
}
private:
- void handleHostnamePatch(const std::string &hostname,
+ void handleHostnamePatch(const std::string& hostname,
const std::shared_ptr<AsyncResp> asyncResp)
{
// SHOULD handle host names of up to 255 characters(RFC 1123)
@@ -1113,8 +1114,8 @@
std::variant<std::string>(hostname));
}
- void handleDomainnamePatch(const std::string &ifaceId,
- const std::string &domainname,
+ void handleDomainnamePatch(const std::string& ifaceId,
+ const std::string& domainname,
const std::shared_ptr<AsyncResp> asyncResp)
{
std::vector<std::string> vectorDomainname = {domainname};
@@ -1132,7 +1133,7 @@
std::variant<std::vector<std::string>>(vectorDomainname));
}
- void handleFqdnPatch(const std::string &ifaceId, const std::string &fqdn,
+ void handleFqdnPatch(const std::string& ifaceId, const std::string& fqdn,
const std::shared_ptr<AsyncResp> asyncResp)
{
// Total length of FQDN must not exceed 255 characters(RFC 1035)
@@ -1164,7 +1165,7 @@
handleDomainnamePatch(ifaceId, domainname, asyncResp);
}
- bool isHostnameValid(const std::string &hostname)
+ bool isHostnameValid(const std::string& hostname)
{
// A valid host name can never have the dotted-decimal form (RFC 1123)
if (std::all_of(hostname.begin(), hostname.end(), ::isdigit))
@@ -1181,7 +1182,7 @@
return std::regex_match(hostname, pattern);
}
- bool isDomainnameValid(const std::string &domainname)
+ bool isDomainnameValid(const std::string& domainname)
{
// Can have multiple subdomains
// Top Level Domain's min length is 2 character
@@ -1191,9 +1192,9 @@
return std::regex_match(domainname, pattern);
}
- void handleMACAddressPatch(const std::string &ifaceId,
- const std::string &macAddress,
- const std::shared_ptr<AsyncResp> &asyncResp)
+ void handleMACAddressPatch(const std::string& ifaceId,
+ const std::string& macAddress,
+ const std::shared_ptr<AsyncResp>& asyncResp)
{
crow::connections::systemBus->async_method_call(
[asyncResp, macAddress](const boost::system::error_code ec) {
@@ -1210,8 +1211,8 @@
std::variant<std::string>(macAddress));
}
- void setDHCPEnabled(const std::string &ifaceId,
- const std::string &propertyName, const bool v4Value,
+ void setDHCPEnabled(const std::string& ifaceId,
+ const std::string& propertyName, const bool v4Value,
const bool v6Value,
const std::shared_ptr<AsyncResp> asyncResp)
{
@@ -1233,8 +1234,8 @@
}
void setEthernetInterfaceBoolProperty(
- const std::string &ifaceId, const std::string &propertyName,
- const bool &value, const std::shared_ptr<AsyncResp> asyncResp)
+ const std::string& ifaceId, const std::string& propertyName,
+ const bool& value, const std::shared_ptr<AsyncResp> asyncResp)
{
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec) {
@@ -1252,7 +1253,7 @@
std::variant<bool>{value});
}
- void setDHCPv4Config(const std::string &propertyName, const bool &value,
+ void setDHCPv4Config(const std::string& propertyName, const bool& value,
const std::shared_ptr<AsyncResp> asyncResp)
{
BMCWEB_LOG_DEBUG << propertyName << " = " << value;
@@ -1272,8 +1273,8 @@
std::variant<bool>{value});
}
- void handleDHCPPatch(const std::string &ifaceId,
- const EthernetInterfaceData ðData,
+ void handleDHCPPatch(const std::string& ifaceId,
+ const EthernetInterfaceData& ethData,
DHCPParameters v4dhcpParms, DHCPParameters v6dhcpParms,
const std::shared_ptr<AsyncResp> asyncResp)
{
@@ -1414,8 +1415,8 @@
}
void handleIPv4StaticPatch(
- const std::string &ifaceId, nlohmann::json &input,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
+ const std::string& ifaceId, nlohmann::json& input,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
const std::shared_ptr<AsyncResp> asyncResp)
{
if ((!input.is_array()) || input.empty())
@@ -1433,7 +1434,7 @@
boost::container::flat_set<IPv4AddressData>::const_iterator NICIPentry =
GetNextStaticIPEntry(ipv4Data.cbegin(), ipv4Data.cend());
- for (nlohmann::json &thisJson : input)
+ for (nlohmann::json& thisJson : input)
{
std::string pathString =
"IPv4StaticAddresses/" + std::to_string(entryIdx);
@@ -1457,8 +1458,8 @@
// not explicitly provided are assumed to be unmodified from the
// current state of the interface. Merge existing state into the
// current request.
- const std::string *addr = nullptr;
- const std::string *gw = nullptr;
+ const std::string* addr = nullptr;
+ const std::string* gw = nullptr;
uint8_t prefixLength = 0;
bool errorInEntry = false;
if (address)
@@ -1591,9 +1592,9 @@
}
void handleStaticNameServersPatch(
- const std::string &ifaceId,
- const std::vector<std::string> &updatedStaticNameServers,
- const std::shared_ptr<AsyncResp> &asyncResp)
+ const std::string& ifaceId,
+ const std::vector<std::string>& updatedStaticNameServers,
+ const std::shared_ptr<AsyncResp>& asyncResp)
{
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec) {
@@ -1612,8 +1613,8 @@
}
void handleIPv6StaticAddressesPatch(
- const std::string &ifaceId, nlohmann::json &input,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data,
+ const std::string& ifaceId, nlohmann::json& input,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data,
const std::shared_ptr<AsyncResp> asyncResp)
{
if (!input.is_array() || input.empty())
@@ -1625,7 +1626,7 @@
size_t entryIdx = 1;
boost::container::flat_set<IPv6AddressData>::const_iterator NICIPentry =
GetNextStaticIPEntry(ipv6Data.cbegin(), ipv6Data.cend());
- for (nlohmann::json &thisJson : input)
+ for (nlohmann::json& thisJson : input)
{
std::string pathString =
"IPv6StaticAddresses/" + std::to_string(entryIdx);
@@ -1643,7 +1644,7 @@
return;
}
- const std::string *addr;
+ const std::string* addr;
uint8_t prefix;
// Find the address and prefixLength values. Any values that are
@@ -1728,15 +1729,15 @@
}
void parseInterfaceData(
- std::shared_ptr<AsyncResp> asyncResp, const std::string &iface_id,
- const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data)
+ std::shared_ptr<AsyncResp> asyncResp, const std::string& iface_id,
+ const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data)
{
- constexpr const std::array<const char *, 1> inventoryForEthernet = {
+ constexpr const std::array<const char*, 1> inventoryForEthernet = {
"xyz.openbmc_project.Inventory.Item.Ethernet"};
- nlohmann::json &json_response = asyncResp->res.jsonValue;
+ nlohmann::json& json_response = asyncResp->res.jsonValue;
json_response["Id"] = iface_id;
json_response["@odata.id"] =
"/redfish/v1/Managers/bmc/EthernetInterfaces/" + iface_id;
@@ -1746,7 +1747,7 @@
crow::connections::systemBus->async_method_call(
[health](const boost::system::error_code ec,
- std::vector<std::string> &resp) {
+ std::vector<std::string>& resp) {
if (ec)
{
return;
@@ -1810,12 +1811,12 @@
json_response["NameServers"] = ethData.nameServers;
json_response["StaticNameServers"] = ethData.staticNameServers;
- nlohmann::json &ipv4_array = json_response["IPv4Addresses"];
- nlohmann::json &ipv4_static_array =
+ nlohmann::json& ipv4_array = json_response["IPv4Addresses"];
+ nlohmann::json& ipv4_static_array =
json_response["IPv4StaticAddresses"];
ipv4_array = nlohmann::json::array();
ipv4_static_array = nlohmann::json::array();
- for (auto &ipv4_config : ipv4Data)
+ for (auto& ipv4_config : ipv4Data)
{
std::string gatewayStr = ipv4_config.gateway;
@@ -1840,15 +1841,15 @@
json_response["IPv6DefaultGateway"] = ethData.ipv6_default_gateway;
- nlohmann::json &ipv6_array = json_response["IPv6Addresses"];
- nlohmann::json &ipv6_static_array =
+ nlohmann::json& ipv6_array = json_response["IPv6Addresses"];
+ nlohmann::json& ipv6_static_array =
json_response["IPv6StaticAddresses"];
ipv6_array = nlohmann::json::array();
ipv6_static_array = nlohmann::json::array();
- nlohmann::json &ipv6AddrPolicyTable =
+ nlohmann::json& ipv6AddrPolicyTable =
json_response["IPv6AddressPolicyTable"];
ipv6AddrPolicyTable = nlohmann::json::array();
- for (auto &ipv6_config : ipv6Data)
+ for (auto& ipv6_config : ipv6Data)
{
ipv6_array.push_back({{"Address", ipv6_config.address},
{"PrefixLength", ipv6_config.prefixLength},
@@ -1868,8 +1869,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -1881,9 +1882,9 @@
getEthernetIfaceData(
params[0],
[this, asyncResp, iface_id{std::string(params[0])}](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data) {
if (!success)
{
// TODO(Pawel)consider distinguish between non existing
@@ -1904,8 +1905,8 @@
});
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -1914,7 +1915,7 @@
return;
}
- const std::string &iface_id = params[0];
+ const std::string& iface_id = params[0];
std::optional<std::string> hostname;
std::optional<std::string> fqdn;
@@ -1978,9 +1979,9 @@
v4dhcpParms = std::move(v4dhcpParms),
v6dhcpParms = std::move(v6dhcpParms),
interfaceEnabled = std::move(interfaceEnabled)](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data) {
if (!success)
{
// ... otherwise return error
@@ -2065,7 +2066,7 @@
* Default Constructor
*/
template <typename CrowApp>
- VlanNetworkInterface(CrowApp &app) :
+ VlanNetworkInterface(CrowApp& app) :
Node(app,
"/redfish/v1/Managers/bmc/EthernetInterfaces/<str>/VLANs/<str>/",
std::string(), std::string())
@@ -2081,10 +2082,10 @@
private:
void parseInterfaceData(
- nlohmann::json &json_response, const std::string &parent_iface_id,
- const std::string &iface_id, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data)
+ nlohmann::json& json_response, const std::string& parent_iface_id,
+ const std::string& iface_id, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data)
{
// Fill out obvious data...
json_response["Id"] = iface_id;
@@ -2099,7 +2100,7 @@
}
}
- bool verifyNames(const std::string &parent, const std::string &iface)
+ bool verifyNames(const std::string& parent, const std::string& iface)
{
if (!boost::starts_with(iface, parent + "_"))
{
@@ -2114,8 +2115,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
// TODO(Pawel) this shall be parameterized call (two params) to get
@@ -2129,8 +2130,8 @@
return;
}
- const std::string &parent_iface_id = params[0];
- const std::string &iface_id = params[1];
+ const std::string& parent_iface_id = params[0];
+ const std::string& iface_id = params[1];
res.jsonValue["@odata.type"] =
"#VLanNetworkInterface.v1_1_0.VLanNetworkInterface";
res.jsonValue["Name"] = "VLAN Network Interface";
@@ -2146,9 +2147,9 @@
params[1],
[this, asyncResp, parent_iface_id{std::string(params[0])},
iface_id{std::string(params[1])}](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data) {
if (success && ethData.vlan_id.size() != 0)
{
parseInterfaceData(asyncResp->res.jsonValue,
@@ -2166,8 +2167,8 @@
});
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 2)
@@ -2176,8 +2177,8 @@
return;
}
- const std::string &parentIfaceId = params[0];
- const std::string &ifaceId = params[1];
+ const std::string& parentIfaceId = params[0];
+ const std::string& ifaceId = params[1];
if (!verifyNames(parentIfaceId, ifaceId))
{
@@ -2201,9 +2202,9 @@
params[1],
[asyncResp, parentIfaceId{std::string(params[0])},
ifaceId{std::string(params[1])}, &vlanEnable, &vlanId](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data) {
if (success && !ethData.vlan_id.empty())
{
auto callback =
@@ -2245,8 +2246,8 @@
});
}
- void doDelete(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doDelete(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 2)
@@ -2255,8 +2256,8 @@
return;
}
- const std::string &parentIfaceId = params[0];
- const std::string &ifaceId = params[1];
+ const std::string& parentIfaceId = params[0];
+ const std::string& ifaceId = params[1];
if (!verifyNames(parentIfaceId, ifaceId))
{
@@ -2271,9 +2272,9 @@
params[1],
[asyncResp, parentIfaceId{std::string(params[0])},
ifaceId{std::string(params[1])}](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data,
- const boost::container::flat_set<IPv6AddressData> &ipv6Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data,
+ const boost::container::flat_set<IPv6AddressData>& ipv6Data) {
if (success && !ethData.vlan_id.empty())
{
auto callback =
@@ -2308,7 +2309,7 @@
{
public:
template <typename CrowApp>
- VlanNetworkInterfaceCollection(CrowApp &app) :
+ VlanNetworkInterfaceCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/EthernetInterfaces/<str>/VLANs/",
std::string())
{
@@ -2325,8 +2326,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -2336,14 +2337,14 @@
return;
}
- const std::string &rootInterfaceName = params[0];
+ const std::string& rootInterfaceName = params[0];
// Get eth interface list, and call the below callback for JSON
// preparation
getEthernetIfaceList(
[asyncResp, rootInterfaceName{std::string(rootInterfaceName)}](
- const bool &success,
- const boost::container::flat_set<std::string> &iface_list) {
+ const bool& success,
+ const boost::container::flat_set<std::string>& iface_list) {
if (!success)
{
messages::internalError(asyncResp->res);
@@ -2366,7 +2367,7 @@
nlohmann::json iface_array = nlohmann::json::array();
- for (const std::string &iface_item : iface_list)
+ for (const std::string& iface_item : iface_list)
{
if (boost::starts_with(iface_item, rootInterfaceName + "_"))
{
@@ -2386,8 +2387,8 @@
});
}
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -2416,7 +2417,7 @@
return;
}
- const std::string &rootInterfaceName = params[0];
+ const std::string& rootInterfaceName = params[0];
auto callback = [asyncResp](const boost::system::error_code ec) {
if (ec)
{
diff --git a/redfish-core/lib/health.hpp b/redfish-core/lib/health.hpp
index b9f2e38..59c8a27 100644
--- a/redfish-core/lib/health.hpp
+++ b/redfish-core/lib/health.hpp
@@ -20,6 +20,7 @@
#include <boost/algorithm/string/predicate.hpp>
#include <boost/container/flat_set.hpp>
#include <dbus_singleton.hpp>
+
#include <variant>
namespace redfish
@@ -27,33 +28,31 @@
struct HealthPopulate : std::enable_shared_from_this<HealthPopulate>
{
- HealthPopulate(const std::shared_ptr<AsyncResp> &asyncResp) :
+ HealthPopulate(const std::shared_ptr<AsyncResp>& asyncResp) :
asyncResp(asyncResp), jsonStatus(asyncResp->res.jsonValue["Status"])
- {
- }
+ {}
- HealthPopulate(const std::shared_ptr<AsyncResp> &asyncResp,
- nlohmann::json &status) :
+ HealthPopulate(const std::shared_ptr<AsyncResp>& asyncResp,
+ nlohmann::json& status) :
asyncResp(asyncResp),
jsonStatus(status)
- {
- }
+ {}
~HealthPopulate()
{
- nlohmann::json &health = jsonStatus["Health"];
- nlohmann::json &rollup = jsonStatus["HealthRollup"];
+ nlohmann::json& health = jsonStatus["Health"];
+ nlohmann::json& rollup = jsonStatus["HealthRollup"];
health = "OK";
rollup = "OK";
- for (const std::shared_ptr<HealthPopulate> &health : children)
+ for (const std::shared_ptr<HealthPopulate>& health : children)
{
health->globalInventoryPath = globalInventoryPath;
health->statuses = statuses;
}
- for (const auto &[path, interfaces] : statuses)
+ for (const auto& [path, interfaces] : statuses)
{
bool isChild = false;
bool isSelf =
@@ -67,7 +66,7 @@
// of this association is an inventory item, or one of the
// endpoints in this association is a child
- for (const std::string &child : inventory)
+ for (const std::string& child : inventory)
{
if (boost::starts_with(path.str, child))
{
@@ -90,7 +89,7 @@
<< path.str;
continue;
}
- const std::vector<std::string> *endpoints =
+ const std::vector<std::string>* endpoints =
std::get_if<std::vector<std::string>>(
&endpointsIt->second);
if (endpoints == nullptr)
@@ -100,7 +99,7 @@
continue;
}
bool containsChild = false;
- for (const std::string &endpoint : *endpoints)
+ for (const std::string& endpoint : *endpoints)
{
if (std::find(inventory.begin(), inventory.end(),
endpoint) != inventory.end())
@@ -174,7 +173,7 @@
std::shared_ptr<HealthPopulate> self = shared_from_this();
crow::connections::systemBus->async_method_call(
[self](const boost::system::error_code ec,
- std::vector<std::string> &resp) {
+ std::vector<std::string>& resp) {
if (ec || resp.size() != 1)
{
// no global item, or too many
@@ -185,7 +184,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", "/", 0,
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Inventory.Item.Global"});
}
@@ -194,7 +193,7 @@
std::shared_ptr<HealthPopulate> self = shared_from_this();
crow::connections::systemBus->async_method_call(
[self](const boost::system::error_code ec,
- dbus::utility::ManagedObjectType &resp) {
+ dbus::utility::ManagedObjectType& resp) {
if (ec)
{
return;
@@ -216,7 +215,7 @@
}
std::shared_ptr<AsyncResp> asyncResp;
- nlohmann::json &jsonStatus;
+ nlohmann::json& jsonStatus;
// we store pointers to other HealthPopulate items so we can update their
// members and reduce dbus calls. As we hold a shared_ptr to them, they get
diff --git a/redfish-core/lib/hypervisor_ethernet.hpp b/redfish-core/lib/hypervisor_ethernet.hpp
index 910d33b..38759a1 100644
--- a/redfish-core/lib/hypervisor_ethernet.hpp
+++ b/redfish-core/lib/hypervisor_ethernet.hpp
@@ -5,8 +5,9 @@
#include <dbus_singleton.hpp>
#include <error_messages.hpp>
#include <node.hpp>
-#include <optional>
#include <utils/json_utils.hpp>
+
+#include <optional>
#include <variant>
namespace redfish
@@ -21,7 +22,7 @@
/*
* Default Constructor
*/
- HypervisorSystem(CrowApp &app) :
+ HypervisorSystem(CrowApp& app) :
Node(app, "/redfish/v1/Systems/hypervisor/")
{
entityPrivileges = {
@@ -34,13 +35,13 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::variant<std::string> &hostName) {
+ const std::variant<std::string>& hostName) {
if (ec)
{
messages::resourceNotFound(asyncResp->res, "System",
@@ -77,7 +78,7 @@
{
public:
template <typename CrowApp>
- HypervisorInterfaceCollection(CrowApp &app) :
+ HypervisorInterfaceCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/hypervisor/EthernetInterfaces/")
{
entityPrivileges = {
@@ -90,16 +91,16 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
- const std::array<const char *, 1> interfaces = {
+ const std::array<const char*, 1> interfaces = {
"xyz.openbmc_project.Network.EthernetInterface"};
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code error,
- const std::vector<std::string> &ifaceList) {
+ const std::vector<std::string>& ifaceList) {
if (error)
{
messages::resourceNotFound(asyncResp->res, "System",
@@ -118,10 +119,10 @@
"Collection of Virtual Management "
"Interfaces for the hypervisor";
- nlohmann::json &ifaceArray =
+ nlohmann::json& ifaceArray =
asyncResp->res.jsonValue["Members"];
ifaceArray = nlohmann::json::array();
- for (const std::string &iface : ifaceList)
+ for (const std::string& iface : ifaceList)
{
std::size_t last_pos = iface.rfind("/");
if (last_pos != std::string::npos)
@@ -143,14 +144,14 @@
};
inline bool extractHypervisorInterfaceData(
- const std::string ðifaceId, const GetManagedObjects &dbusData,
- EthernetInterfaceData ðData,
- boost::container::flat_set<IPv4AddressData> &ipv4Config)
+ const std::string& ethifaceId, const GetManagedObjects& dbusData,
+ EthernetInterfaceData& ethData,
+ boost::container::flat_set<IPv4AddressData>& ipv4Config)
{
bool idFound = false;
- for (const auto &objpath : dbusData)
+ for (const auto& objpath : dbusData)
{
- for (const auto &ifacePair : objpath.second)
+ for (const auto& ifacePair : objpath.second)
{
if (objpath.first ==
"/xyz/openbmc_project/network/vmi/" + ethifaceId)
@@ -158,11 +159,11 @@
idFound = true;
if (ifacePair.first == "xyz.openbmc_project.Network.MACAddress")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "MACAddress")
{
- const std::string *mac =
+ const std::string* mac =
std::get_if<std::string>(&propertyPair.second);
if (mac != nullptr)
{
@@ -181,12 +182,12 @@
boost::container::flat_set<IPv4AddressData>::iterator,
bool>
it = ipv4Config.insert(IPv4AddressData{});
- IPv4AddressData &ipv4Address = *it.first;
- for (auto &property : ifacePair.second)
+ IPv4AddressData& ipv4Address = *it.first;
+ for (auto& property : ifacePair.second)
{
if (property.first == "Address")
{
- const std::string *address =
+ const std::string* address =
std::get_if<std::string>(&property.second);
if (address != nullptr)
{
@@ -195,7 +196,7 @@
}
else if (property.first == "Origin")
{
- const std::string *origin =
+ const std::string* origin =
std::get_if<std::string>(&property.second);
if (origin != nullptr)
{
@@ -206,7 +207,7 @@
}
else if (property.first == "PrefixLength")
{
- const uint8_t *mask =
+ const uint8_t* mask =
std::get_if<uint8_t>(&property.second);
if (mask != nullptr)
{
@@ -230,11 +231,11 @@
if (ifacePair.first ==
"xyz.openbmc_project.Network.SystemConfiguration")
{
- for (const auto &propertyPair : ifacePair.second)
+ for (const auto& propertyPair : ifacePair.second)
{
if (propertyPair.first == "HostName")
{
- const std::string *hostName =
+ const std::string* hostName =
std::get_if<std::string>(&propertyPair.second);
if (hostName != nullptr)
{
@@ -243,7 +244,7 @@
}
else if (propertyPair.first == "DefaultGateway")
{
- const std::string *defaultGateway =
+ const std::string* defaultGateway =
std::get_if<std::string>(&propertyPair.second);
if (defaultGateway != nullptr)
{
@@ -265,13 +266,13 @@
* into JSON
*/
template <typename CallbackFunc>
-void getHypervisorIfaceData(const std::string ðifaceId,
- CallbackFunc &&callback)
+void getHypervisorIfaceData(const std::string& ethifaceId,
+ CallbackFunc&& callback)
{
crow::connections::systemBus->async_method_call(
[ethifaceId{std::string{ethifaceId}},
callback{std::move(callback)}](const boost::system::error_code error,
- const GetManagedObjects &resp) {
+ const GetManagedObjects& resp) {
EthernetInterfaceData ethData{};
boost::container::flat_set<IPv4AddressData> ipv4Data;
if (error)
@@ -302,14 +303,14 @@
* @return None.
*/
inline void setHypervisorIPv4Address(std::shared_ptr<AsyncResp> aResp,
- const std::string ðifaceId,
- const std::string &ipv4Aaddress)
+ const std::string& ethifaceId,
+ const std::string& ipv4Aaddress)
{
BMCWEB_LOG_DEBUG << "Setting the Hypervisor IPaddress : " << ipv4Aaddress
<< " on Iface: " << ethifaceId;
std::string path =
"/xyz/openbmc_project/network/vmi/" + ethifaceId + "/ipv4/addr0";
- const char *vmiObj = path.c_str();
+ const char* vmiObj = path.c_str();
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec) {
@@ -337,14 +338,14 @@
* @return None.
*/
inline void setHypervisorIPv4Subnet(std::shared_ptr<AsyncResp> aResp,
- const std::string ðifaceId,
+ const std::string& ethifaceId,
const uint8_t subnet)
{
BMCWEB_LOG_DEBUG << "Setting the Hypervisor subnet : " << subnet
<< " on Iface: " << ethifaceId;
std::string path =
"/xyz/openbmc_project/network/vmi/" + ethifaceId + "/ipv4/addr0";
- const char *vmiObj = path.c_str();
+ const char* vmiObj = path.c_str();
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec) {
@@ -372,8 +373,8 @@
* @return None.
*/
inline void setHypervisorIPv4Gateway(std::shared_ptr<AsyncResp> aResp,
- const std::string ðifaceId,
- const std::string &gateway)
+ const std::string& ethifaceId,
+ const std::string& gateway)
{
BMCWEB_LOG_DEBUG
<< "Setting the DefaultGateway to the last configured gateway";
@@ -405,10 +406,10 @@
*
* @return None
*/
-inline void createHypervisorIPv4(const std::string &ifaceId,
+inline void createHypervisorIPv4(const std::string& ifaceId,
uint8_t prefixLength,
- const std::string &gateway,
- const std::string &address,
+ const std::string& gateway,
+ const std::string& address,
std::shared_ptr<AsyncResp> asyncResp)
{
setHypervisorIPv4Address(asyncResp, ifaceId, address);
@@ -424,7 +425,7 @@
*
* @return None
*/
-inline void deleteHypervisorIPv4(const std::string &ifaceId,
+inline void deleteHypervisorIPv4(const std::string& ifaceId,
const std::shared_ptr<AsyncResp> asyncResp)
{
std::string address = "0.0.0.0";
@@ -445,7 +446,7 @@
* Default Constructor
*/
template <typename CrowApp>
- HypervisorInterface(CrowApp &app) :
+ HypervisorInterface(CrowApp& app) :
Node(app, "/redfish/v1/Systems/hypervisor/EthernetInterfaces/<str>/",
std::string())
{
@@ -457,9 +458,9 @@
private:
void parseInterfaceData(
- nlohmann::json &jsonResponse, const std::string &ifaceId,
- const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data)
+ nlohmann::json& jsonResponse, const std::string& ifaceId,
+ const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data)
{
jsonResponse["Id"] = ifaceId;
jsonResponse["@odata.id"] =
@@ -469,11 +470,11 @@
jsonResponse["HostName"] = ethData.hostname;
- nlohmann::json &ipv4Array = jsonResponse["IPv4Addresses"];
- nlohmann::json &ipv4StaticArray = jsonResponse["IPv4StaticAddresses"];
+ nlohmann::json& ipv4Array = jsonResponse["IPv4Addresses"];
+ nlohmann::json& ipv4StaticArray = jsonResponse["IPv4StaticAddresses"];
ipv4Array = nlohmann::json::array();
ipv4StaticArray = nlohmann::json::array();
- for (auto &ipv4Config : ipv4Data)
+ for (auto& ipv4Config : ipv4Data)
{
ipv4Array.push_back({{"AddressOrigin", ipv4Config.origin},
{"SubnetMask", ipv4Config.netmask},
@@ -491,7 +492,7 @@
}
void handleHypervisorIPv4StaticPatch(
- const std::string &ifaceId, nlohmann::json &&input,
+ const std::string& ifaceId, nlohmann::json&& input,
const std::shared_ptr<AsyncResp> asyncResp)
{
if ((!input.is_array()) || input.empty())
@@ -504,7 +505,7 @@
// Hypervisor considers the first IP address in the array list
// as the Hypervisor's virtual management interface supports single IPv4
// address
- nlohmann::json &thisJson = input[0];
+ nlohmann::json& thisJson = input[0];
// For the error string
std::string pathString = "IPv4StaticAddresses/1";
@@ -594,7 +595,7 @@
}
}
- bool isHostnameValid(const std::string &hostName)
+ bool isHostnameValid(const std::string& hostName)
{
// As per RFC 1123
// Allow up to 255 characters
@@ -609,7 +610,7 @@
return std::regex_match(hostName, pattern);
}
- void handleHostnamePatch(const std::string &hostName,
+ void handleHostnamePatch(const std::string& hostName,
const std::shared_ptr<AsyncResp> asyncResp)
{
if (!isHostnameValid(hostName))
@@ -636,8 +637,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -649,8 +650,8 @@
getHypervisorIfaceData(
params[0],
[this, asyncResp, ifaceId{std::string(params[0])}](
- const bool &success, const EthernetInterfaceData ðData,
- const boost::container::flat_set<IPv4AddressData> &ipv4Data) {
+ const bool& success, const EthernetInterfaceData& ethData,
+ const boost::container::flat_set<IPv4AddressData>& ipv4Data) {
if (!success)
{
messages::resourceNotFound(
@@ -668,8 +669,8 @@
});
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -678,7 +679,7 @@
return;
}
- const std::string &ifaceId = params[0];
+ const std::string& ifaceId = params[0];
std::optional<std::string> hostName;
std::optional<nlohmann::json> ipv4StaticAddresses;
diff --git a/redfish-core/lib/led.hpp b/redfish-core/lib/led.hpp
index 43e1b5c..25248f8 100644
--- a/redfish-core/lib/led.hpp
+++ b/redfish-core/lib/led.hpp
@@ -40,7 +40,7 @@
// proceed to get enclosure_identify state.
if (!ec)
{
- const bool *blinking = std::get_if<bool>(&asserted);
+ const bool* blinking = std::get_if<bool>(&asserted);
if (!blinking)
{
BMCWEB_LOG_DEBUG << "Get identity blinking LED failed";
@@ -59,7 +59,7 @@
const std::variant<bool> asserted) {
if (!ec)
{
- const bool *ledOn = std::get_if<bool>(&asserted);
+ const bool* ledOn = std::get_if<bool>(&asserted);
if (!ledOn)
{
BMCWEB_LOG_DEBUG
@@ -99,7 +99,7 @@
* @return None.
*/
void setIndicatorLedState(std::shared_ptr<AsyncResp> aResp,
- const std::string &ledState)
+ const std::string& ledState)
{
BMCWEB_LOG_DEBUG << "Set led groups";
bool ledOn = false;
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 3f10725..753334e 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -29,6 +29,7 @@
#include <boost/system/linux_error.hpp>
#include <dump_offload.hpp>
#include <error_messages.hpp>
+
#include <filesystem>
#include <string_view>
#include <variant>
@@ -36,26 +37,26 @@
namespace redfish
{
-constexpr char const *crashdumpObject = "com.intel.crashdump";
-constexpr char const *crashdumpPath = "/com/intel/crashdump";
-constexpr char const *crashdumpOnDemandPath = "/com/intel/crashdump/OnDemand";
-constexpr char const *crashdumpInterface = "com.intel.crashdump";
-constexpr char const *deleteAllInterface =
+constexpr char const* crashdumpObject = "com.intel.crashdump";
+constexpr char const* crashdumpPath = "/com/intel/crashdump";
+constexpr char const* crashdumpOnDemandPath = "/com/intel/crashdump/OnDemand";
+constexpr char const* crashdumpInterface = "com.intel.crashdump";
+constexpr char const* deleteAllInterface =
"xyz.openbmc_project.Collection.DeleteAll";
-constexpr char const *crashdumpOnDemandInterface =
+constexpr char const* crashdumpOnDemandInterface =
"com.intel.crashdump.OnDemand";
-constexpr char const *crashdumpRawPECIInterface =
+constexpr char const* crashdumpRawPECIInterface =
"com.intel.crashdump.SendRawPeci";
namespace message_registries
{
-static const Message *getMessageFromRegistry(
- const std::string &messageKey,
+static const Message* getMessageFromRegistry(
+ const std::string& messageKey,
const boost::beast::span<const MessageEntry> registry)
{
boost::beast::span<const MessageEntry>::const_iterator messageIt =
std::find_if(registry.cbegin(), registry.cend(),
- [&messageKey](const MessageEntry &messageEntry) {
+ [&messageKey](const MessageEntry& messageEntry) {
return !std::strcmp(messageEntry.first,
messageKey.c_str());
});
@@ -67,7 +68,7 @@
return nullptr;
}
-static const Message *getMessage(const std::string_view &messageID)
+static const Message* getMessage(const std::string_view& messageID)
{
// Redfish MessageIds are in the form
// RegistryName.MajorVersion.MinorVersion.MessageKey, so parse it to find
@@ -75,8 +76,8 @@
std::vector<std::string> fields;
fields.reserve(4);
boost::split(fields, messageID, boost::is_any_of("."));
- std::string ®istryName = fields[0];
- std::string &messageKey = fields[3];
+ std::string& registryName = fields[0];
+ std::string& messageKey = fields[3];
// Find the right registry and check it for the MessageKey
if (std::string(base::header.registryPrefix) == registryName)
@@ -104,7 +105,7 @@
sdbusplus::message::object_path,
boost::container::flat_map<std::string, GetManagedPropertyType>>;
-inline std::string translateSeverityDbusToRedfish(const std::string &s)
+inline std::string translateSeverityDbusToRedfish(const std::string& s)
{
if (s == "xyz.openbmc_project.Logging.Entry.Level.Alert")
{
@@ -141,8 +142,8 @@
return "";
}
-inline void deleteSystemDumpEntry(crow::Response &res,
- const std::string &entryID)
+inline void deleteSystemDumpEntry(crow::Response& res,
+ const std::string& entryID)
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -163,16 +164,16 @@
"xyz.openbmc_project.Object.Delete", "Delete");
}
-static int getJournalMetadata(sd_journal *journal,
- const std::string_view &field,
- std::string_view &contents)
+static int getJournalMetadata(sd_journal* journal,
+ const std::string_view& field,
+ std::string_view& contents)
{
- const char *data = nullptr;
+ const char* data = nullptr;
size_t length = 0;
int ret = 0;
// Get the metadata from the requested field of the journal entry
ret = sd_journal_get_data(journal, field.data(),
- reinterpret_cast<const void **>(&data), &length);
+ reinterpret_cast<const void**>(&data), &length);
if (ret < 0)
{
return ret;
@@ -183,9 +184,9 @@
return ret;
}
-static int getJournalMetadata(sd_journal *journal,
- const std::string_view &field, const int &base,
- long int &contents)
+static int getJournalMetadata(sd_journal* journal,
+ const std::string_view& field, const int& base,
+ long int& contents)
{
int ret = 0;
std::string_view metadata;
@@ -200,10 +201,10 @@
}
static bool getTimestampStr(const uint64_t usecSinceEpoch,
- std::string &entryTimestamp)
+ std::string& entryTimestamp)
{
time_t t = static_cast<time_t>(usecSinceEpoch / 1000 / 1000);
- struct tm *loctime = localtime(&t);
+ struct tm* loctime = localtime(&t);
char entryTime[64] = {};
if (nullptr != loctime)
{
@@ -221,7 +222,7 @@
return true;
}
-static bool getEntryTimestamp(sd_journal *journal, std::string &entryTimestamp)
+static bool getEntryTimestamp(sd_journal* journal, std::string& entryTimestamp)
{
int ret = 0;
uint64_t timestamp = 0;
@@ -235,13 +236,13 @@
return getTimestampStr(timestamp, entryTimestamp);
}
-static bool getSkipParam(crow::Response &res, const crow::Request &req,
- uint64_t &skip)
+static bool getSkipParam(crow::Response& res, const crow::Request& req,
+ uint64_t& skip)
{
- char *skipParam = req.urlParams.get("$skip");
+ char* skipParam = req.urlParams.get("$skip");
if (skipParam != nullptr)
{
- char *ptr = nullptr;
+ char* ptr = nullptr;
skip = std::strtoul(skipParam, &ptr, 10);
if (*skipParam == '\0' || *ptr != '\0')
{
@@ -255,13 +256,13 @@
}
static constexpr const uint64_t maxEntriesPerPage = 1000;
-static bool getTopParam(crow::Response &res, const crow::Request &req,
- uint64_t &top)
+static bool getTopParam(crow::Response& res, const crow::Request& req,
+ uint64_t& top)
{
- char *topParam = req.urlParams.get("$top");
+ char* topParam = req.urlParams.get("$top");
if (topParam != nullptr)
{
- char *ptr = nullptr;
+ char* ptr = nullptr;
top = std::strtoul(topParam, &ptr, 10);
if (*topParam == '\0' || *ptr != '\0')
{
@@ -281,7 +282,7 @@
return true;
}
-static bool getUniqueEntryID(sd_journal *journal, std::string &entryID,
+static bool getUniqueEntryID(sd_journal* journal, std::string& entryID,
const bool firstEntry = true)
{
int ret = 0;
@@ -322,7 +323,7 @@
return true;
}
-static bool getUniqueEntryID(const std::string &logEntry, std::string &entryID,
+static bool getUniqueEntryID(const std::string& logEntry, std::string& entryID,
const bool firstEntry = true)
{
static time_t prevTs = 0;
@@ -361,8 +362,8 @@
return true;
}
-static bool getTimestampFromID(crow::Response &res, const std::string &entryID,
- uint64_t ×tamp, uint64_t &index)
+static bool getTimestampFromID(crow::Response& res, const std::string& entryID,
+ uint64_t& timestamp, uint64_t& index)
{
if (entryID.empty())
{
@@ -383,12 +384,12 @@
{
index = std::stoul(std::string(indexStr), &pos);
}
- catch (std::invalid_argument &)
+ catch (std::invalid_argument&)
{
messages::resourceMissingAtURI(res, entryID);
return false;
}
- catch (std::out_of_range &)
+ catch (std::out_of_range&)
{
messages::resourceMissingAtURI(res, entryID);
return false;
@@ -405,12 +406,12 @@
{
timestamp = std::stoull(std::string(tsStr), &pos);
}
- catch (std::invalid_argument &)
+ catch (std::invalid_argument&)
{
messages::resourceMissingAtURI(res, entryID);
return false;
}
- catch (std::out_of_range &)
+ catch (std::out_of_range&)
{
messages::resourceMissingAtURI(res, entryID);
return false;
@@ -424,13 +425,13 @@
}
static bool
- getRedfishLogFiles(std::vector<std::filesystem::path> &redfishLogFiles)
+ getRedfishLogFiles(std::vector<std::filesystem::path>& redfishLogFiles)
{
static const std::filesystem::path redfishLogDir = "/var/log";
static const std::string redfishLogFilename = "redfish";
// Loop through the directory looking for redfish log files
- for (const std::filesystem::directory_entry &dirEnt :
+ for (const std::filesystem::directory_entry& dirEnt :
std::filesystem::directory_iterator(redfishLogDir))
{
// If we find a redfish log file, save the path
@@ -449,14 +450,14 @@
}
static void ParseCrashdumpParameters(
- const std::vector<std::pair<std::string, VariantType>> ¶ms,
- std::string &filename, std::string ×tamp, std::string &logfile)
+ const std::vector<std::pair<std::string, VariantType>>& params,
+ std::string& filename, std::string& timestamp, std::string& logfile)
{
for (auto property : params)
{
if (property.first == "Timestamp")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -465,7 +466,7 @@
}
else if (property.first == "Filename")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -474,7 +475,7 @@
}
else if (property.first == "Log")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value != nullptr)
{
@@ -484,12 +485,12 @@
}
}
-constexpr char const *postCodeIface = "xyz.openbmc_project.State.Boot.PostCode";
+constexpr char const* postCodeIface = "xyz.openbmc_project.State.Boot.PostCode";
class SystemLogServiceCollection : public Node
{
public:
template <typename CrowApp>
- SystemLogServiceCollection(CrowApp &app) :
+ SystemLogServiceCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/")
{
entityPrivileges = {
@@ -505,8 +506,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
// Collections don't include the static data added by SubRoute because
@@ -518,7 +519,7 @@
asyncResp->res.jsonValue["Name"] = "System Log Services Collection";
asyncResp->res.jsonValue["Description"] =
"Collection of LogServices for this Computer System";
- nlohmann::json &logServiceArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logServiceArray = asyncResp->res.jsonValue["Members"];
logServiceArray = nlohmann::json::array();
logServiceArray.push_back(
{{"@odata.id", "/redfish/v1/Systems/system/LogServices/EventLog"}});
@@ -537,18 +538,18 @@
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::vector<std::string> &subtreePath) {
+ const std::vector<std::string>& subtreePath) {
if (ec)
{
BMCWEB_LOG_ERROR << ec;
return;
}
- for (auto &pathStr : subtreePath)
+ for (auto& pathStr : subtreePath)
{
if (pathStr.find("PostCode") != std::string::npos)
{
- nlohmann::json &logServiceArray =
+ nlohmann::json& logServiceArray =
asyncResp->res.jsonValue["Members"];
logServiceArray.push_back(
{{"@odata.id", "/redfish/v1/Systems/system/"
@@ -562,7 +563,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", "/", 0,
- std::array<const char *, 1>{postCodeIface});
+ std::array<const char*, 1>{postCodeIface});
}
};
@@ -570,7 +571,7 @@
{
public:
template <typename CrowApp>
- EventLogService(CrowApp &app) :
+ EventLogService(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/EventLog/")
{
entityPrivileges = {
@@ -583,8 +584,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -609,7 +610,7 @@
class JournalEventLogClear : public Node
{
public:
- JournalEventLogClear(CrowApp &app) :
+ JournalEventLogClear(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/EventLog/Actions/"
"LogService.ClearLog/")
{
@@ -623,8 +624,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -632,7 +633,7 @@
std::vector<std::filesystem::path> redfishLogFiles;
if (getRedfishLogFiles(redfishLogFiles))
{
- for (const std::filesystem::path &file : redfishLogFiles)
+ for (const std::filesystem::path& file : redfishLogFiles)
{
std::error_code ec;
std::filesystem::remove(file, ec);
@@ -657,9 +658,9 @@
}
};
-static int fillEventLogEntryJson(const std::string &logEntryID,
+static int fillEventLogEntryJson(const std::string& logEntryID,
const std::string logEntry,
- nlohmann::json &logEntryJson)
+ nlohmann::json& logEntryJson)
{
// The redfish log format is "<Timestamp> <MessageId>,<MessageArgs>"
// First get the Timestamp
@@ -686,10 +687,10 @@
{
return 1;
}
- std::string &messageID = logEntryFields[0];
+ std::string& messageID = logEntryFields[0];
// Get the Message from the MessageRegistry
- const message_registries::Message *message =
+ const message_registries::Message* message =
message_registries::getMessage(messageID);
std::string msg;
@@ -704,7 +705,7 @@
boost::beast::span<std::string> messageArgs;
if (logEntryFields.size() > 1)
{
- std::string &messageArgsStart = logEntryFields[1];
+ std::string& messageArgsStart = logEntryFields[1];
// If the first string is empty, assume there are no MessageArgs
std::size_t messageArgsSize = 0;
if (!messageArgsStart.empty())
@@ -716,7 +717,7 @@
// Fill the MessageArgs into the Message
int i = 0;
- for (const std::string &messageArg : messageArgs)
+ for (const std::string& messageArg : messageArgs)
{
std::string argStr = "%" + std::to_string(++i);
size_t argPos = msg.find(argStr);
@@ -758,7 +759,7 @@
{
public:
template <typename CrowApp>
- JournalEventLogEntryCollection(CrowApp &app) :
+ JournalEventLogEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/EventLog/Entries/")
{
entityPrivileges = {
@@ -771,8 +772,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
uint64_t skip = 0;
@@ -795,7 +796,7 @@
asyncResp->res.jsonValue["Description"] =
"Collection of System Event Log Entries";
- nlohmann::json &logEntryArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logEntryArray = asyncResp->res.jsonValue["Members"];
logEntryArray = nlohmann::json::array();
// Go through the log files and create a unique ID for each entry
std::vector<std::filesystem::path> redfishLogFiles;
@@ -837,7 +838,7 @@
}
logEntryArray.push_back({});
- nlohmann::json &bmcLogEntry = logEntryArray.back();
+ nlohmann::json& bmcLogEntry = logEntryArray.back();
if (fillEventLogEntryJson(idStr, logEntry, bmcLogEntry) != 0)
{
messages::internalError(asyncResp->res);
@@ -859,7 +860,7 @@
class JournalEventLogEntry : public Node
{
public:
- JournalEventLogEntry(CrowApp &app) :
+ JournalEventLogEntry(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/",
std::string())
@@ -874,8 +875,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -883,7 +884,7 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &targetID = params[0];
+ const std::string& targetID = params[0];
// Go through the log files and check the unique ID for each entry to
// find the target entry
@@ -937,7 +938,7 @@
{
public:
template <typename CrowApp>
- DBusEventLogEntryCollection(CrowApp &app) :
+ DBusEventLogEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/EventLog/Entries/")
{
entityPrivileges = {
@@ -950,8 +951,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -969,7 +970,7 @@
// Make call to Logging Service to find all log entry objects
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- GetManagedObjectsType &resp) {
+ GetManagedObjectsType& resp) {
if (ec)
{
// TODO Handle for specific error code
@@ -979,12 +980,12 @@
messages::internalError(asyncResp->res);
return;
}
- nlohmann::json &entriesArray =
+ nlohmann::json& entriesArray =
asyncResp->res.jsonValue["Members"];
entriesArray = nlohmann::json::array();
- for (auto &objectPath : resp)
+ for (auto& objectPath : resp)
{
- for (auto &interfaceMap : objectPath.second)
+ for (auto& interfaceMap : objectPath.second)
{
if (interfaceMap.first !=
"xyz.openbmc_project.Logging.Entry")
@@ -994,12 +995,12 @@
continue;
}
entriesArray.push_back({});
- nlohmann::json &thisEntry = entriesArray.back();
- uint32_t *id = nullptr;
+ nlohmann::json& thisEntry = entriesArray.back();
+ uint32_t* id = nullptr;
std::time_t timestamp{};
- std::string *severity = nullptr;
- std::string *message = nullptr;
- for (auto &propertyMap : interfaceMap.second)
+ std::string* severity = nullptr;
+ std::string* message = nullptr;
+ for (auto& propertyMap : interfaceMap.second)
{
if (propertyMap.first == "Id")
{
@@ -1012,7 +1013,7 @@
}
else if (propertyMap.first == "Timestamp")
{
- const uint64_t *millisTimeStamp =
+ const uint64_t* millisTimeStamp =
std::get_if<uint64_t>(&propertyMap.second);
if (millisTimeStamp == nullptr)
{
@@ -1066,8 +1067,8 @@
}
}
std::sort(entriesArray.begin(), entriesArray.end(),
- [](const nlohmann::json &left,
- const nlohmann::json &right) {
+ [](const nlohmann::json& left,
+ const nlohmann::json& right) {
return (left["Id"] <= right["Id"]);
});
asyncResp->res.jsonValue["Members@odata.count"] =
@@ -1081,7 +1082,7 @@
class DBusEventLogEntry : public Node
{
public:
- DBusEventLogEntry(CrowApp &app) :
+ DBusEventLogEntry(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/",
std::string())
@@ -1096,8 +1097,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -1105,13 +1106,13 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &entryID = params[0];
+ const std::string& entryID = params[0];
// DBus implementation of EventLog/Entries
// Make call to Logging Service to find all log entry objects
crow::connections::systemBus->async_method_call(
[asyncResp, entryID](const boost::system::error_code ec,
- GetManagedPropertyType &resp) {
+ GetManagedPropertyType& resp) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -1119,11 +1120,11 @@
messages::internalError(asyncResp->res);
return;
}
- uint32_t *id = nullptr;
+ uint32_t* id = nullptr;
std::time_t timestamp{};
- std::string *severity = nullptr;
- std::string *message = nullptr;
- for (auto &propertyMap : resp)
+ std::string* severity = nullptr;
+ std::string* message = nullptr;
+ for (auto& propertyMap : resp)
{
if (propertyMap.first == "Id")
{
@@ -1135,7 +1136,7 @@
}
else if (propertyMap.first == "Timestamp")
{
- const uint64_t *millisTimeStamp =
+ const uint64_t* millisTimeStamp =
std::get_if<uint64_t>(&propertyMap.second);
if (millisTimeStamp == nullptr)
{
@@ -1195,8 +1196,8 @@
"xyz.openbmc_project.Logging.Entry");
}
- void doDelete(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doDelete(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "Do delete single event entries.";
@@ -1241,7 +1242,7 @@
{
public:
template <typename CrowApp>
- BMCLogServiceCollection(CrowApp &app) :
+ BMCLogServiceCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/LogServices/")
{
entityPrivileges = {
@@ -1257,8 +1258,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
// Collections don't include the static data added by SubRoute because
@@ -1270,7 +1271,7 @@
asyncResp->res.jsonValue["Name"] = "Open BMC Log Services Collection";
asyncResp->res.jsonValue["Description"] =
"Collection of LogServices for this Manager";
- nlohmann::json &logServiceArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logServiceArray = asyncResp->res.jsonValue["Members"];
logServiceArray = nlohmann::json::array();
#ifdef BMCWEB_ENABLE_REDFISH_BMC_JOURNAL
logServiceArray.push_back(
@@ -1285,7 +1286,7 @@
{
public:
template <typename CrowApp>
- BMCJournalLogService(CrowApp &app) :
+ BMCJournalLogService(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/LogServices/Journal/")
{
entityPrivileges = {
@@ -1298,8 +1299,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
asyncResp->res.jsonValue["@odata.type"] =
@@ -1316,9 +1317,9 @@
}
};
-static int fillBMCJournalLogEntryJson(const std::string &bmcJournalLogEntryID,
- sd_journal *journal,
- nlohmann::json &bmcJournalLogEntryJson)
+static int fillBMCJournalLogEntryJson(const std::string& bmcJournalLogEntryID,
+ sd_journal* journal,
+ nlohmann::json& bmcJournalLogEntryJson)
{
// Get the Log Entry contents
int ret = 0;
@@ -1366,7 +1367,7 @@
{
public:
template <typename CrowApp>
- BMCJournalLogEntryCollection(CrowApp &app) :
+ BMCJournalLogEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/")
{
entityPrivileges = {
@@ -1379,8 +1380,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
static constexpr const long maxEntriesPerPage = 1000;
@@ -1407,12 +1408,12 @@
"Collection of BMC Journal Entries";
asyncResp->res.jsonValue["@odata.id"] =
"/redfish/v1/Managers/bmc/LogServices/BmcLog/Entries";
- nlohmann::json &logEntryArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logEntryArray = asyncResp->res.jsonValue["Members"];
logEntryArray = nlohmann::json::array();
// Go through the journal and use the timestamp to create a unique ID
// for each entry
- sd_journal *journalTmp = nullptr;
+ sd_journal* journalTmp = nullptr;
int ret = sd_journal_open(&journalTmp, SD_JOURNAL_LOCAL_ONLY);
if (ret < 0)
{
@@ -1448,7 +1449,7 @@
}
logEntryArray.push_back({});
- nlohmann::json &bmcJournalLogEntry = logEntryArray.back();
+ nlohmann::json& bmcJournalLogEntry = logEntryArray.back();
if (fillBMCJournalLogEntryJson(idStr, journal.get(),
bmcJournalLogEntry) != 0)
{
@@ -1469,7 +1470,7 @@
class BMCJournalLogEntry : public Node
{
public:
- BMCJournalLogEntry(CrowApp &app) :
+ BMCJournalLogEntry(CrowApp& app) :
Node(app, "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/<str>/",
std::string())
{
@@ -1483,8 +1484,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -1492,7 +1493,7 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &entryID = params[0];
+ const std::string& entryID = params[0];
// Convert the unique ID back to a timestamp to find the entry
uint64_t ts = 0;
uint64_t index = 0;
@@ -1501,7 +1502,7 @@
return;
}
- sd_journal *journalTmp = nullptr;
+ sd_journal* journalTmp = nullptr;
int ret = sd_journal_open(&journalTmp, SD_JOURNAL_LOCAL_ONLY);
if (ret < 0)
{
@@ -1557,7 +1558,7 @@
{
public:
template <typename CrowApp>
- SystemDumpService(CrowApp &app) :
+ SystemDumpService(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/System/")
{
entityPrivileges = {
@@ -1570,8 +1571,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -1602,7 +1603,7 @@
{
public:
template <typename CrowApp>
- SystemDumpEntryCollection(CrowApp &app) :
+ SystemDumpEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/System/Entries/")
{
entityPrivileges = {
@@ -1618,8 +1619,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -1633,7 +1634,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &resp) {
+ const crow::openbmc_mapper::GetSubTreeType& resp) {
if (ec)
{
BMCWEB_LOG_ERROR << " resp_handler got error " << ec;
@@ -1641,12 +1642,12 @@
return;
}
- nlohmann::json &logArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logArray = asyncResp->res.jsonValue["Members"];
logArray = nlohmann::json::array();
- for (auto &object : resp)
+ for (auto& object : resp)
{
- const std::string &path =
- static_cast<const std::string &>(object.first);
+ const std::string& path =
+ static_cast<const std::string&>(object.first);
std::size_t lastPos = path.rfind("/");
if (lastPos == std::string::npos)
{
@@ -1665,7 +1666,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/dump", 0,
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Dump.Entry.System"});
}
};
@@ -1673,7 +1674,7 @@
class SystemDumpEntry : public Node
{
public:
- SystemDumpEntry(CrowApp &app) :
+ SystemDumpEntry(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/System/Entries/<str>/",
std::string())
@@ -1688,8 +1689,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -1697,10 +1698,10 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &entryID = params[0];
+ const std::string& entryID = params[0];
crow::connections::systemBus->async_method_call(
[asyncResp, entryID](const boost::system::error_code ec,
- GetManagedObjectsType &resp) {
+ GetManagedObjectsType& resp) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -1709,7 +1710,7 @@
return;
}
- for (auto &objectPath : resp)
+ for (auto& objectPath : resp)
{
if (objectPath.first.str.find(
"/xyz/openbmc_project/dump/entry/" + entryID) ==
@@ -1719,7 +1720,7 @@
}
bool foundSystemDumpEntry = false;
- for (auto &interfaceMap : objectPath.second)
+ for (auto& interfaceMap : objectPath.second)
{
if (interfaceMap.first ==
"xyz.openbmc_project.Dump.Entry.System")
@@ -1738,12 +1739,12 @@
std::string timestamp{};
uint64_t size = 0;
- for (auto &interfaceMap : objectPath.second)
+ for (auto& interfaceMap : objectPath.second)
{
if (interfaceMap.first ==
"xyz.openbmc_project.Dump.Entry")
{
- for (auto &propertyMap : interfaceMap.second)
+ for (auto& propertyMap : interfaceMap.second)
{
if (propertyMap.first == "Size")
{
@@ -1763,11 +1764,11 @@
else if (interfaceMap.first ==
"xyz.openbmc_project.Time.EpochTime")
{
- for (auto &propertyMap : interfaceMap.second)
+ for (auto& propertyMap : interfaceMap.second)
{
if (propertyMap.first == "Elapsed")
{
- const uint64_t *usecsTimeStamp =
+ const uint64_t* usecsTimeStamp =
std::get_if<uint64_t>(
&propertyMap.second);
if (usecsTimeStamp == nullptr)
@@ -1807,8 +1808,8 @@
"org.freedesktop.DBus.ObjectManager", "GetManagedObjects");
}
- void doDelete(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doDelete(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "Do delete single dump entry";
@@ -1824,7 +1825,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp,
entryID](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &resp) {
+ const crow::openbmc_mapper::GetSubTreeType& resp) {
if (ec)
{
BMCWEB_LOG_ERROR << " resp_handler got error " << ec;
@@ -1832,10 +1833,10 @@
return;
}
- for (auto &object : resp)
+ for (auto& object : resp)
{
- const std::string &path =
- static_cast<const std::string &>(object.first);
+ const std::string& path =
+ static_cast<const std::string&>(object.first);
std::size_t pos = path.rfind(
"/xyz/openbmc_project/dump/entry/" + entryID);
@@ -1850,7 +1851,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/dump", 0,
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Dump.Entry.System"});
}
};
@@ -1858,7 +1859,7 @@
class SystemDumpEntryDownload : public Node
{
public:
- SystemDumpEntryDownload(CrowApp &app) :
+ SystemDumpEntryDownload(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/System/Entries/<str>/"
"Actions/"
@@ -1872,15 +1873,15 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
if (params.size() != 1)
{
messages::internalError(res);
return;
}
- const std::string &entryID = params[0];
+ const std::string& entryID = params[0];
crow::obmc_dump::handleDumpOffloadUrl(req, res, entryID);
}
};
@@ -1888,7 +1889,7 @@
class SystemDumpClear : public Node
{
public:
- SystemDumpClear(CrowApp &app) :
+ SystemDumpClear(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/System/"
"Actions/"
"LogService.ClearLog/")
@@ -1900,21 +1901,21 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::vector<std::string> &dumpList) {
+ const std::vector<std::string>& dumpList) {
if (ec)
{
messages::internalError(asyncResp->res);
return;
}
- for (const std::string &objectPath : dumpList)
+ for (const std::string& objectPath : dumpList)
{
std::size_t pos = objectPath.rfind("/");
if (pos != std::string::npos)
@@ -1928,7 +1929,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
"/xyz/openbmc_project/dump", 0,
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Dump.Entry.System"});
}
};
@@ -1937,7 +1938,7 @@
{
public:
template <typename CrowApp>
- CrashdumpService(CrowApp &app) :
+ CrashdumpService(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/Crashdump/")
{
// Note: Deviated from redfish privilege registry for GET & HEAD
@@ -1955,8 +1956,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
// Copy over the static data to include the entries added by SubRoute
@@ -1993,7 +1994,7 @@
class CrashdumpClear : public Node
{
public:
- CrashdumpClear(CrowApp &app) :
+ CrashdumpClear(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/"
"LogService.ClearLog/")
{
@@ -2009,14 +2010,14 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::string &resp) {
+ const std::string& resp) {
if (ec)
{
messages::internalError(asyncResp->res);
@@ -2029,13 +2030,13 @@
};
static void logCrashdumpEntry(std::shared_ptr<AsyncResp> asyncResp,
- const std::string &logID,
- nlohmann::json &logEntryJson)
+ const std::string& logID,
+ nlohmann::json& logEntryJson)
{
auto getStoredLogCallback =
[asyncResp, logID, &logEntryJson](
const boost::system::error_code ec,
- const std::vector<std::pair<std::string, VariantType>> ¶ms) {
+ const std::vector<std::pair<std::string, VariantType>>& params) {
if (ec)
{
BMCWEB_LOG_DEBUG << "failed to get log ec: " << ec.message();
@@ -2087,7 +2088,7 @@
{
public:
template <typename CrowApp>
- CrashdumpEntryCollection(CrowApp &app) :
+ CrashdumpEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/")
{
// Note: Deviated from redfish privilege registry for GET & HEAD
@@ -2105,15 +2106,15 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
// Collections don't include the static data added by SubRoute because
// it has a duplicate entry for members
auto getLogEntriesCallback = [asyncResp](
const boost::system::error_code ec,
- const std::vector<std::string> &resp) {
+ const std::vector<std::string>& resp) {
if (ec)
{
if (ec.value() !=
@@ -2132,12 +2133,12 @@
asyncResp->res.jsonValue["Name"] = "Open BMC Crashdump Entries";
asyncResp->res.jsonValue["Description"] =
"Collection of Crashdump Entries";
- nlohmann::json &logEntryArray = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& logEntryArray = asyncResp->res.jsonValue["Members"];
logEntryArray = nlohmann::json::array();
std::vector<std::string> logIDs;
// Get the list of log entries and build up an empty array big
// enough to hold them
- for (const std::string &objpath : resp)
+ for (const std::string& objpath : resp)
{
// Get the log ID
std::size_t lastPos = objpath.rfind("/");
@@ -2152,7 +2153,7 @@
}
// Now go through and set up async calls to fill in the entries
size_t index = 0;
- for (const std::string &logID : logIDs)
+ for (const std::string& logID : logIDs)
{
// Add the log entry to the array
logCrashdumpEntry(asyncResp, logID, logEntryArray[index++]);
@@ -2165,14 +2166,14 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", "", 0,
- std::array<const char *, 1>{crashdumpInterface});
+ std::array<const char*, 1>{crashdumpInterface});
}
};
class CrashdumpEntry : public Node
{
public:
- CrashdumpEntry(CrowApp &app) :
+ CrashdumpEntry(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/Crashdump/Entries/<str>/",
std::string())
@@ -2189,8 +2190,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -2198,7 +2199,7 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &logID = params[0];
+ const std::string& logID = params[0];
logCrashdumpEntry(asyncResp, logID, asyncResp->res.jsonValue);
}
};
@@ -2206,7 +2207,7 @@
class CrashdumpFile : public Node
{
public:
- CrashdumpFile(CrowApp &app) :
+ CrashdumpFile(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/Crashdump/Entries/<str>/"
"<str>/",
@@ -2224,8 +2225,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 2)
@@ -2233,13 +2234,13 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &logID = params[0];
- const std::string &fileName = params[1];
+ const std::string& logID = params[0];
+ const std::string& fileName = params[1];
auto getStoredLogCallback =
[asyncResp, logID, fileName](
const boost::system::error_code ec,
- const std::vector<std::pair<std::string, VariantType>> &resp) {
+ const std::vector<std::pair<std::string, VariantType>>& resp) {
if (ec)
{
BMCWEB_LOG_DEBUG << "failed to get log ec: "
@@ -2309,7 +2310,7 @@
class OnDemandCrashdump : public Node
{
public:
- OnDemandCrashdump(CrowApp &app) :
+ OnDemandCrashdump(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/Crashdump/Actions/Oem/"
"Crashdump.OnDemand/")
@@ -2326,15 +2327,15 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
auto generateonDemandLogCallback = [asyncResp,
req](const boost::system::error_code
ec,
- const std::string &resp) {
+ const std::string& resp) {
if (ec)
{
if (ec.value() == boost::system::errc::operation_not_supported)
@@ -2354,8 +2355,8 @@
return;
}
std::shared_ptr<task::TaskData> task = task::TaskData::createTask(
- [](boost::system::error_code err, sdbusplus::message::message &,
- const std::shared_ptr<task::TaskData> &taskData) {
+ [](boost::system::error_code err, sdbusplus::message::message&,
+ const std::shared_ptr<task::TaskData>& taskData) {
if (!err)
{
taskData->messages.emplace_back(
@@ -2381,7 +2382,7 @@
class SendRawPECI : public Node
{
public:
- SendRawPECI(CrowApp &app) :
+ SendRawPECI(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/Crashdump/Actions/Oem/"
"Crashdump.SendRawPeci/")
@@ -2398,8 +2399,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
std::vector<std::vector<uint8_t>> peciCommands;
@@ -2413,12 +2414,12 @@
return;
}
uint32_t idx = 0;
- for (auto const &cmd : peciCommands)
+ for (auto const& cmd : peciCommands)
{
if (cmd.size() < 3)
{
std::string s("[");
- for (auto const &val : cmd)
+ for (auto const& val : cmd)
{
if (val != *cmd.begin())
{
@@ -2454,7 +2455,7 @@
// Callback to return the Raw PECI response
auto sendRawPECICallback =
[asyncResp](const boost::system::error_code ec,
- const std::vector<std::vector<uint8_t>> &resp) {
+ const std::vector<std::vector<uint8_t>>& resp) {
if (ec)
{
BMCWEB_LOG_DEBUG << "failed to process PECI commands ec: "
@@ -2478,7 +2479,7 @@
class DBusLogServiceActionsClear : public Node
{
public:
- DBusLogServiceActionsClear(CrowApp &app) :
+ DBusLogServiceActionsClear(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/EventLog/Actions/"
"LogService.ClearLog/")
{
@@ -2497,8 +2498,8 @@
* The Clear Log actions does not require any parameter.The action deletes
* all entries found in the Entries collection for this Log Service.
*/
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "Do delete all entries.";
@@ -2533,7 +2534,7 @@
class PostCodesLogService : public Node
{
public:
- PostCodesLogService(CrowApp &app) :
+ PostCodesLogService(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/PostCodes/")
{
entityPrivileges = {
@@ -2546,8 +2547,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -2571,7 +2572,7 @@
class PostCodesClear : public Node
{
public:
- PostCodesClear(CrowApp &app) :
+ PostCodesClear(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/PostCodes/Actions/"
"LogService.ClearLog/")
{
@@ -2585,8 +2586,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "Do delete all postcodes entries.";
@@ -2613,19 +2614,19 @@
static void fillPostCodeEntry(
std::shared_ptr<AsyncResp> aResp,
- const boost::container::flat_map<uint64_t, uint64_t> &postcode,
+ const boost::container::flat_map<uint64_t, uint64_t>& postcode,
const uint16_t bootIndex, const uint64_t codeIndex = 0,
const uint64_t skip = 0, const uint64_t top = 0)
{
// Get the Message from the MessageRegistry
- const message_registries::Message *message =
+ const message_registries::Message* message =
message_registries::getMessage("OpenBMC.0.1.BIOSPOSTCode");
uint64_t currentCodeIndex = 0;
- nlohmann::json &logEntryArray = aResp->res.jsonValue["Members"];
+ nlohmann::json& logEntryArray = aResp->res.jsonValue["Members"];
uint64_t firstCodeTimeUs = 0;
- for (const std::pair<uint64_t, uint64_t> &code : postcode)
+ for (const std::pair<uint64_t, uint64_t>& code : postcode)
{
currentCodeIndex++;
std::string postcodeEntryID =
@@ -2694,7 +2695,7 @@
// fill in this post code value
int i = 0;
- for (const std::string &messageArg : messageArgs)
+ for (const std::string& messageArg : messageArgs)
{
std::string argStr = "%" + std::to_string(++i);
size_t argPos = msg.find(argStr);
@@ -2714,7 +2715,7 @@
// add to AsyncResp
logEntryArray.push_back({});
- nlohmann::json &bmcLogEntry = logEntryArray.back();
+ nlohmann::json& bmcLogEntry = logEntryArray.back();
bmcLogEntry = {
{"@odata.type", "#LogEntry.v1_4_0.LogEntry"},
{"@odata.context", "/redfish/v1/$metadata#LogEntry.LogEntry"},
@@ -2739,7 +2740,7 @@
crow::connections::systemBus->async_method_call(
[aResp, bootIndex, codeIndex](
const boost::system::error_code ec,
- const boost::container::flat_map<uint64_t, uint64_t> &postcode) {
+ const boost::container::flat_map<uint64_t, uint64_t>& postcode) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS POST CODE PostCode response error";
@@ -2773,7 +2774,7 @@
crow::connections::systemBus->async_method_call(
[aResp, bootIndex, bootCount, entryCount, skip,
top](const boost::system::error_code ec,
- const boost::container::flat_map<uint64_t, uint64_t> &postcode) {
+ const boost::container::flat_map<uint64_t, uint64_t>& postcode) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS POST CODE PostCode response error";
@@ -2826,7 +2827,7 @@
crow::connections::systemBus->async_method_call(
[aResp, entryCount, skip,
top](const boost::system::error_code ec,
- const std::variant<uint16_t> &bootCount) {
+ const std::variant<uint16_t>& bootCount) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -2853,7 +2854,7 @@
{
public:
template <typename CrowApp>
- PostCodesEntryCollection(CrowApp &app) :
+ PostCodesEntryCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/")
{
entityPrivileges = {
@@ -2866,8 +2867,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -2901,7 +2902,7 @@
class PostCodesEntry : public Node
{
public:
- PostCodesEntry(CrowApp &app) :
+ PostCodesEntry(CrowApp& app) :
Node(app,
"/redfish/v1/Systems/system/LogServices/PostCodes/Entries/<str>/",
std::string())
@@ -2916,8 +2917,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -2926,7 +2927,7 @@
return;
}
- const std::string &targetID = params[0];
+ const std::string& targetID = params[0];
size_t bootPos = targetID.find('B');
if (bootPos == std::string::npos)
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 8a74ed2..756c75f 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -22,10 +22,11 @@
#include <boost/algorithm/string/replace.hpp>
#include <boost/date_time.hpp>
#include <dbus_utility.hpp>
-#include <memory>
-#include <sstream>
#include <utils/fw_utils.hpp>
#include <utils/systemd_utils.hpp>
+
+#include <memory>
+#include <sstream>
#include <variant>
namespace redfish
@@ -1067,8 +1068,7 @@
GetPIDValues(const std::shared_ptr<AsyncResp>& asyncResp) :
asyncResp(asyncResp)
- {
- }
+ {}
void run()
{
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
index 7c957e9..1878070 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -28,7 +28,7 @@
{
public:
template <typename CrowApp>
- MessageRegistryFileCollection(CrowApp &app) :
+ MessageRegistryFileCollection(CrowApp& app) :
Node(app, "/redfish/v1/Registries/")
{
entityPrivileges = {
@@ -44,8 +44,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
// Collections don't include the static data added by SubRoute because
// it has a duplicate entry for members
@@ -70,7 +70,7 @@
{
public:
template <typename CrowApp>
- MessageRegistryFile(CrowApp &app) :
+ MessageRegistryFile(CrowApp& app) :
Node(app, "/redfish/v1/Registries/<str>/", std::string())
{
entityPrivileges = {
@@ -83,8 +83,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
if (params.size() != 1)
{
@@ -93,10 +93,10 @@
return;
}
- const std::string ®istry = params[0];
- const message_registries::Header *header;
+ const std::string& registry = params[0];
+ const message_registries::Header* header;
std::string dmtf = "DMTF ";
- const char *url = nullptr;
+ const char* url = nullptr;
if (registry == "Base")
{
@@ -151,7 +151,7 @@
{
public:
template <typename CrowApp>
- MessageRegistry(CrowApp &app) :
+ MessageRegistry(CrowApp& app) :
Node(app, "/redfish/v1/Registries/<str>/<str>/", std::string(),
std::string())
{
@@ -165,8 +165,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
if (params.size() != 2)
{
@@ -175,15 +175,15 @@
return;
}
- const std::string ®istry = params[0];
- const std::string ®istry1 = params[1];
+ const std::string& registry = params[0];
+ const std::string& registry1 = params[1];
- const message_registries::Header *header;
- std::vector<const message_registries::MessageEntry *> registryEntries;
+ const message_registries::Header* header;
+ std::vector<const message_registries::MessageEntry*> registryEntries;
if (registry == "Base")
{
header = &message_registries::base::header;
- for (const message_registries::MessageEntry &entry :
+ for (const message_registries::MessageEntry& entry :
message_registries::base::registry)
{
registryEntries.emplace_back(&entry);
@@ -192,7 +192,7 @@
else if (registry == "TaskEvent")
{
header = &message_registries::task_event::header;
- for (const message_registries::MessageEntry &entry :
+ for (const message_registries::MessageEntry& entry :
message_registries::task_event::registry)
{
registryEntries.emplace_back(&entry);
@@ -201,7 +201,7 @@
else if (registry == "OpenBMC")
{
header = &message_registries::openbmc::header;
- for (const message_registries::MessageEntry &entry :
+ for (const message_registries::MessageEntry& entry :
message_registries::openbmc::registry)
{
registryEntries.emplace_back(&entry);
@@ -233,12 +233,12 @@
{"RegistryVersion", header->registryVersion},
{"OwningEntity", header->owningEntity}};
- nlohmann::json &messageObj = res.jsonValue["Messages"];
+ nlohmann::json& messageObj = res.jsonValue["Messages"];
// Go through the Message Registry and populate each Message
- for (const message_registries::MessageEntry *message : registryEntries)
+ for (const message_registries::MessageEntry* message : registryEntries)
{
- nlohmann::json &obj = messageObj[message->first];
+ nlohmann::json& obj = messageObj[message->first];
obj = {{"Description", message->second.description},
{"Message", message->second.message},
{"Severity", message->second.severity},
@@ -246,8 +246,8 @@
{"Resolution", message->second.resolution}};
if (message->second.numberOfArgs > 0)
{
- nlohmann::json &messageParamArray = obj["ParamTypes"];
- for (const char *str : message->second.paramTypes)
+ nlohmann::json& messageParamArray = obj["ParamTypes"];
+ for (const char* str : message->second.paramTypes)
{
if (str == nullptr)
{
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 2ce952d..60735d0 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -18,8 +18,9 @@
#include "error_messages.hpp"
#include "node.hpp"
-#include <optional>
#include <utils/json_utils.hpp>
+
+#include <optional>
#include <variant>
namespace redfish
{
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index f8a5e29..ac2a2f9 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -23,17 +23,17 @@
namespace redfish
{
-static constexpr char const *pcieService = "xyz.openbmc_project.PCIe";
-static constexpr char const *pciePath = "/xyz/openbmc_project/PCIe";
-static constexpr char const *pcieDeviceInterface =
+static constexpr char const* pcieService = "xyz.openbmc_project.PCIe";
+static constexpr char const* pciePath = "/xyz/openbmc_project/PCIe";
+static constexpr char const* pcieDeviceInterface =
"xyz.openbmc_project.PCIe.Device";
static inline void getPCIeDeviceList(std::shared_ptr<AsyncResp> asyncResp,
- const std::string &name)
+ const std::string& name)
{
auto getPCIeMapCallback = [asyncResp, name](
const boost::system::error_code ec,
- std::vector<std::string> &pcieDevicePaths) {
+ std::vector<std::string>& pcieDevicePaths) {
if (ec)
{
BMCWEB_LOG_DEBUG << "no PCIe device paths found ec: "
@@ -41,9 +41,9 @@
// Not an error, system just doesn't have PCIe info
return;
}
- nlohmann::json &pcieDeviceList = asyncResp->res.jsonValue[name];
+ nlohmann::json& pcieDeviceList = asyncResp->res.jsonValue[name];
pcieDeviceList = nlohmann::json::array();
- for (const std::string &pcieDevicePath : pcieDevicePaths)
+ for (const std::string& pcieDevicePath : pcieDevicePaths)
{
size_t devStart = pcieDevicePath.rfind("/");
if (devStart == std::string::npos)
@@ -73,7 +73,7 @@
{
public:
template <typename CrowApp>
- SystemPCIeDeviceCollection(CrowApp &app) :
+ SystemPCIeDeviceCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/PCIeDevices/")
{
entityPrivileges = {
@@ -89,8 +89,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
asyncResp->res.jsonValue = {
@@ -107,7 +107,7 @@
class SystemPCIeDevice : public Node
{
public:
- SystemPCIeDevice(CrowApp &app) :
+ SystemPCIeDevice(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/PCIeDevices/<str>/",
std::string())
{
@@ -121,8 +121,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -130,14 +130,14 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &device = params[0];
+ const std::string& device = params[0];
auto getPCIeDeviceCallback =
[asyncResp,
device](const boost::system::error_code ec,
boost::container::flat_map<std::string,
- std::variant<std::string>>
- &pcieDevProperties) {
+ std::variant<std::string>>&
+ pcieDevProperties) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -163,14 +163,14 @@
{"Name", "PCIe Device"},
{"Id", device}};
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Manufacturer"]);
property)
{
asyncResp->res.jsonValue["Manufacturer"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["DeviceType"]);
property)
{
@@ -193,7 +193,7 @@
{
public:
template <typename CrowApp>
- SystemPCIeFunctionCollection(CrowApp &app) :
+ SystemPCIeFunctionCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/PCIeDevices/<str>/PCIeFunctions/",
std::string())
{
@@ -210,8 +210,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -219,7 +219,7 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &device = params[0];
+ const std::string& device = params[0];
asyncResp->res.jsonValue = {
{"@odata.type", "#PCIeFunctionCollection.PCIeFunctionCollection"},
{"@odata.id", "/redfish/v1/Systems/system/PCIeDevices/" + device +
@@ -232,8 +232,8 @@
[asyncResp,
device](const boost::system::error_code ec,
boost::container::flat_map<std::string,
- std::variant<std::string>>
- &pcieDevProperties) {
+ std::variant<std::string>>&
+ pcieDevProperties) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -252,7 +252,7 @@
return;
}
- nlohmann::json &pcieFunctionList =
+ nlohmann::json& pcieFunctionList =
asyncResp->res.jsonValue["Members"];
pcieFunctionList = nlohmann::json::array();
static constexpr const int maxPciFunctionNum = 8;
@@ -262,7 +262,7 @@
// Check if this function exists by looking for a device ID
std::string devIDProperty =
"Function" + std::to_string(functionNum) + "DeviceId";
- std::string *property = std::get_if<std::string>(
+ std::string* property = std::get_if<std::string>(
&pcieDevProperties[devIDProperty]);
if (property && !property->empty())
{
@@ -287,7 +287,7 @@
class SystemPCIeFunction : public Node
{
public:
- SystemPCIeFunction(CrowApp &app) :
+ SystemPCIeFunction(CrowApp& app) :
Node(
app,
"/redfish/v1/Systems/system/PCIeDevices/<str>/PCIeFunctions/<str>/",
@@ -303,8 +303,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 2)
@@ -312,15 +312,15 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &device = params[0];
- const std::string &function = params[1];
+ const std::string& device = params[0];
+ const std::string& function = params[1];
auto getPCIeDeviceCallback = [asyncResp, device, function](
const boost::system::error_code ec,
boost::container::flat_map<
std::string,
- std::variant<std::string>>
- &pcieDevProperties) {
+ std::variant<std::string>>&
+ pcieDevProperties) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -341,7 +341,7 @@
// Check if this function exists by looking for a device ID
std::string devIDProperty = "Function" + function + "DeviceId";
- if (std::string *property =
+ if (std::string* property =
std::get_if<std::string>(&pcieDevProperties[devIDProperty]);
property && property->empty())
{
@@ -362,56 +362,56 @@
{{"@odata.id",
"/redfish/v1/Systems/system/PCIeDevices/" + device}}}}}};
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "DeviceId"]);
property)
{
asyncResp->res.jsonValue["DeviceId"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "VendorId"]);
property)
{
asyncResp->res.jsonValue["VendorId"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "FunctionType"]);
property)
{
asyncResp->res.jsonValue["FunctionType"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "DeviceClass"]);
property)
{
asyncResp->res.jsonValue["DeviceClass"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "ClassCode"]);
property)
{
asyncResp->res.jsonValue["ClassCode"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "RevisionId"]);
property)
{
asyncResp->res.jsonValue["RevisionId"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function + "SubsystemId"]);
property)
{
asyncResp->res.jsonValue["SubsystemId"] = *property;
}
- if (std::string *property = std::get_if<std::string>(
+ if (std::string* property = std::get_if<std::string>(
&pcieDevProperties["Function" + function +
"SubsystemVendorId"]);
property)
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 35b3127..f5ad839 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -21,9 +21,10 @@
#include <boost/algorithm/string/split.hpp>
#include <boost/container/flat_map.hpp>
#include <boost/range/algorithm/replace_copy_if.hpp>
-#include <cmath>
#include <dbus_singleton.hpp>
#include <utils/json_utils.hpp>
+
+#include <cmath>
#include <variant>
namespace redfish
@@ -53,8 +54,7 @@
const std::string& subNode) :
res(response),
chassisId(chassisIdIn), types(typesIn), chassisSubNode(subNode)
- {
- }
+ {}
~SensorsAsyncResp()
{
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index cfbcb6f..922d323 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -25,7 +25,7 @@
class StorageCollection : public Node
{
public:
- StorageCollection(CrowApp &app) :
+ StorageCollection(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Storage/")
{
entityPrivileges = {
@@ -38,8 +38,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] = "#StorageCollection.StorageCollection";
res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/Storage";
@@ -54,7 +54,7 @@
class Storage : public Node
{
public:
- Storage(CrowApp &app) : Node(app, "/redfish/v1/Systems/system/Storage/1/")
+ Storage(CrowApp& app) : Node(app, "/redfish/v1/Systems/system/Storage/1/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -66,8 +66,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] = "#Storage.v1_7_1.Storage";
res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/Storage/1";
@@ -81,11 +81,11 @@
crow::connections::systemBus->async_method_call(
[asyncResp, health](const boost::system::error_code ec,
- const std::vector<std::string> &storageList) {
- nlohmann::json &storageArray =
+ const std::vector<std::string>& storageList) {
+ nlohmann::json& storageArray =
asyncResp->res.jsonValue["Drives"];
storageArray = nlohmann::json::array();
- auto &count = asyncResp->res.jsonValue["Drives@odata.count"];
+ auto& count = asyncResp->res.jsonValue["Drives@odata.count"];
count = 0;
if (ec)
@@ -99,7 +99,7 @@
storageList.begin(),
storageList.end());
- for (const std::string &objpath : storageList)
+ for (const std::string& objpath : storageList)
{
std::size_t lastPos = objpath.rfind("/");
if (lastPos == std::string::npos ||
@@ -121,23 +121,23 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
"/xyz/openbmc_project/inventory", int32_t(0),
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Inventory.Item.Drive"});
crow::connections::systemBus->async_method_call(
[asyncResp,
health](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &subtree) {
+ const crow::openbmc_mapper::GetSubTreeType& subtree) {
if (ec || !subtree.size())
{
// doesn't have to be there
return;
}
- nlohmann::json &root =
+ nlohmann::json& root =
asyncResp->res.jsonValue["StorageControllers"];
root = nlohmann::json::array();
- for (const auto &[path, interfaceDict] : subtree)
+ for (const auto& [path, interfaceDict] : subtree)
{
std::size_t lastPos = path.rfind("/");
if (lastPos == std::string::npos ||
@@ -156,11 +156,11 @@
return;
}
- const std::string &connectionName =
+ const std::string& connectionName =
interfaceDict.front().first;
size_t index = root.size();
- nlohmann::json &storageController =
+ nlohmann::json& storageController =
root.emplace_back(nlohmann::json::object());
std::string id = path.substr(lastPos + 1);
@@ -184,7 +184,7 @@
{
return;
}
- const bool *enabled = std::get_if<bool>(&present);
+ const bool* enabled = std::get_if<bool>(&present);
if (enabled == nullptr)
{
BMCWEB_LOG_DEBUG << "Illegal property present";
@@ -206,8 +206,8 @@
index](const boost::system::error_code ec,
const std::vector<std::pair<
std::string,
- std::variant<bool, std::string, uint64_t>>>
- &propertiesList) {
+ std::variant<bool, std::string, uint64_t>>>&
+ propertiesList) {
if (ec)
{
// this interface isn't necessary
@@ -215,15 +215,15 @@
}
for (const std::pair<
std::string,
- std::variant<bool, std::string, uint64_t>>
- &property : propertiesList)
+ std::variant<bool, std::string, uint64_t>>&
+ property : propertiesList)
{
// Store DBus properties that are also
// Redfish properties with same name and a
// string value
- const std::string &propertyName =
+ const std::string& propertyName =
property.first;
- nlohmann::json &object =
+ nlohmann::json& object =
asyncResp->res
.jsonValue["StorageControllers"][index];
if ((propertyName == "PartNumber") ||
@@ -231,7 +231,7 @@
(propertyName == "Manufacturer") ||
(propertyName == "Model"))
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(
&property.second);
if (value == nullptr)
@@ -253,7 +253,7 @@
// resized, as json::array uses vector underneath and we need
// references to its members that won't change
size_t count = 0;
- for (const auto &[path, interfaceDict] : subtree)
+ for (const auto& [path, interfaceDict] : subtree)
{
auto subHealth = std::make_shared<HealthPopulate>(
asyncResp, root[count]["Status"]);
@@ -267,7 +267,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/inventory", int32_t(0),
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Inventory.Item.StorageController"});
}
};
@@ -275,7 +275,7 @@
class Drive : public Node
{
public:
- Drive(CrowApp &app) :
+ Drive(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Storage/1/Drives/<str>/",
std::string())
{
@@ -289,8 +289,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -298,12 +298,12 @@
messages::internalError(asyncResp->res);
return;
}
- const std::string &driveId = params[0];
+ const std::string& driveId = params[0];
crow::connections::systemBus->async_method_call(
[asyncResp,
driveId](const boost::system::error_code ec,
- const crow::openbmc_mapper::GetSubTreeType &subtree) {
+ const crow::openbmc_mapper::GetSubTreeType& subtree) {
if (ec)
{
BMCWEB_LOG_ERROR << "Drive mapper call error";
@@ -312,8 +312,8 @@
}
auto object = std::find_if(
- subtree.begin(), subtree.end(), [&driveId](auto &object) {
- const std::string &path = object.first;
+ subtree.begin(), subtree.end(), [&driveId](auto& object) {
+ const std::string& path = object.first;
return boost::ends_with(path, "/" + driveId);
});
@@ -324,10 +324,10 @@
return;
}
- const std::string &path = object->first;
+ const std::string& path = object->first;
const std::vector<
- std::pair<std::string, std::vector<std::string>>>
- &connectionNames = object->second;
+ std::pair<std::string, std::vector<std::string>>>&
+ connectionNames = object->second;
asyncResp->res.jsonValue["@odata.type"] = "#Drive.v1_7_0.Drive";
asyncResp->res.jsonValue["@odata.id"] =
@@ -345,19 +345,19 @@
}
getMainChassisId(
- asyncResp, [](const std::string &chassisId,
+ asyncResp, [](const std::string& chassisId,
std::shared_ptr<AsyncResp> aRsp) {
aRsp->res.jsonValue["Links"]["Chassis"] = {
{"@odata.id", "/redfish/v1/Chassis/" + chassisId}};
});
- const std::string &connectionName = connectionNames[0].first;
+ const std::string& connectionName = connectionNames[0].first;
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
const std::vector<std::pair<
std::string,
- std::variant<bool, std::string, uint64_t>>>
- &propertiesList) {
+ std::variant<bool, std::string, uint64_t>>>&
+ propertiesList) {
if (ec)
{
// this interface isn't necessary
@@ -365,19 +365,19 @@
}
for (const std::pair<std::string,
std::variant<bool, std::string,
- uint64_t>> &property :
+ uint64_t>>& property :
propertiesList)
{
// Store DBus properties that are also
// Redfish properties with same name and a
// string value
- const std::string &propertyName = property.first;
+ const std::string& propertyName = property.first;
if ((propertyName == "PartNumber") ||
(propertyName == "SerialNumber") ||
(propertyName == "Manufacturer") ||
(propertyName == "Model"))
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property.second);
if (value == nullptr)
{
@@ -408,7 +408,7 @@
{
return;
}
- const bool *enabled = std::get_if<bool>(&present);
+ const bool* enabled = std::get_if<bool>(&present);
if (enabled == nullptr)
{
BMCWEB_LOG_DEBUG << "Illegal property present";
@@ -433,7 +433,7 @@
{
return;
}
- const bool *updating = std::get_if<bool>(&rebuilding);
+ const bool* updating = std::get_if<bool>(&rebuilding);
if (updating == nullptr)
{
BMCWEB_LOG_DEBUG << "Illegal property present";
@@ -457,7 +457,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/inventory", int32_t(0),
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Inventory.Item.Drive"});
}
};
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 338bdc3..a68e8de 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -24,6 +24,7 @@
#include <node.hpp>
#include <utils/fw_utils.hpp>
#include <utils/json_utils.hpp>
+
#include <variant>
namespace redfish
@@ -38,9 +39,9 @@
* @return None.
*/
void updateDimmProperties(std::shared_ptr<AsyncResp> aResp,
- const std::variant<bool> &dimmState)
+ const std::variant<bool>& dimmState)
{
- const bool *isDimmFunctional = std::get_if<bool>(&dimmState);
+ const bool* isDimmFunctional = std::get_if<bool>(&dimmState);
if (isDimmFunctional == nullptr)
{
messages::internalError(aResp->res);
@@ -51,7 +52,7 @@
// Set it as Enabled if atleast one DIMM is functional
// Update STATE only if previous State was DISABLED and current Dimm is
// ENABLED.
- nlohmann::json &prevMemSummary =
+ nlohmann::json& prevMemSummary =
aResp->res.jsonValue["MemorySummary"]["Status"]["State"];
if (prevMemSummary == "Disabled")
{
@@ -72,9 +73,9 @@
* @return None.
*/
void modifyCpuPresenceState(std::shared_ptr<AsyncResp> aResp,
- const std::variant<bool> &cpuPresenceState)
+ const std::variant<bool>& cpuPresenceState)
{
- const bool *isCpuPresent = std::get_if<bool>(&cpuPresenceState);
+ const bool* isCpuPresent = std::get_if<bool>(&cpuPresenceState);
if (isCpuPresent == nullptr)
{
@@ -85,10 +86,10 @@
if (*isCpuPresent == true)
{
- nlohmann::json &procCount =
+ nlohmann::json& procCount =
aResp->res.jsonValue["ProcessorSummary"]["Count"];
auto procCountPtr =
- procCount.get_ptr<nlohmann::json::number_integer_t *>();
+ procCount.get_ptr<nlohmann::json::number_integer_t*>();
if (procCountPtr != nullptr)
{
// shouldn't be possible to be nullptr
@@ -107,9 +108,9 @@
* @return None.
*/
void modifyCpuFunctionalState(std::shared_ptr<AsyncResp> aResp,
- const std::variant<bool> &cpuFunctionalState)
+ const std::variant<bool>& cpuFunctionalState)
{
- const bool *isCpuFunctional = std::get_if<bool>(&cpuFunctionalState);
+ const bool* isCpuFunctional = std::get_if<bool>(&cpuFunctionalState);
if (isCpuFunctional == nullptr)
{
@@ -118,7 +119,7 @@
}
BMCWEB_LOG_DEBUG << "Cpu Functional: " << *isCpuFunctional;
- nlohmann::json &prevProcState =
+ nlohmann::json& prevProcState =
aResp->res.jsonValue["ProcessorSummary"]["Status"]["State"];
// Set it as Enabled if atleast one CPU is functional
@@ -152,8 +153,8 @@
const boost::system::error_code ec,
const std::vector<std::pair<
std::string,
- std::vector<std::pair<std::string, std::vector<std::string>>>>>
- &subtree) {
+ std::vector<std::pair<std::string, std::vector<std::string>>>>>&
+ subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -163,14 +164,14 @@
// Iterate over all retrieved ObjectPaths.
for (const std::pair<std::string,
std::vector<std::pair<
- std::string, std::vector<std::string>>>>
- &object : subtree)
+ std::string, std::vector<std::string>>>>&
+ object : subtree)
{
- const std::string &path = object.first;
+ const std::string& path = object.first;
BMCWEB_LOG_DEBUG << "Got path: " << path;
const std::vector<
- std::pair<std::string, std::vector<std::string>>>
- &connectionNames = object.second;
+ std::pair<std::string, std::vector<std::string>>>&
+ connectionNames = object.second;
if (connectionNames.size() < 1)
{
continue;
@@ -187,9 +188,9 @@
// This is not system, so check if it's cpu, dimm, UUID or
// BiosVer
- for (const auto &connection : connectionNames)
+ for (const auto& connection : connectionNames)
{
- for (const auto &interfaceName : connection.second)
+ for (const auto& interfaceName : connection.second)
{
if (interfaceName ==
"xyz.openbmc_project.Inventory.Item.Dimm")
@@ -202,8 +203,8 @@
path(std::move(path))](
const boost::system::error_code ec,
const std::vector<
- std::pair<std::string, VariantType>>
- &properties) {
+ std::pair<std::string, VariantType>>&
+ properties) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -218,15 +219,15 @@
if (properties.size() > 0)
{
for (const std::pair<std::string,
- VariantType>
- &property : properties)
+ VariantType>&
+ property : properties)
{
if (property.first !=
"MemorySizeInKB")
{
continue;
}
- const uint32_t *value =
+ const uint32_t* value =
std::get_if<uint32_t>(
&property.second);
if (value == nullptr)
@@ -236,15 +237,15 @@
"MemorySize";
continue;
}
- nlohmann::json &totalMemory =
+ nlohmann::json& totalMemory =
aResp->res
.jsonValue["MemorySummar"
"y"]
["TotalSystemMe"
"moryGiB"];
- uint64_t *preValue =
+ uint64_t* preValue =
totalMemory
- .get_ptr<uint64_t *>();
+ .get_ptr<uint64_t*>();
if (preValue == nullptr)
{
continue;
@@ -267,8 +268,8 @@
[aResp](
const boost::system::error_code
ec,
- const std::variant<bool>
- &dimmState) {
+ const std::variant<bool>&
+ dimmState) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -309,8 +310,8 @@
path(std::move(path))](
const boost::system::error_code ec,
const std::vector<
- std::pair<std::string, VariantType>>
- &properties) {
+ std::pair<std::string, VariantType>>&
+ properties) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -324,29 +325,28 @@
if (properties.size() > 0)
{
- for (const auto &property : properties)
+ for (const auto& property : properties)
{
if (property.first ==
"ProcessorFamily")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(
&property.second);
if (value != nullptr)
{
- nlohmann::json
- &procSummary =
+ nlohmann::json&
+ procSummary =
aResp->res.jsonValue
["ProcessorSumm"
"ary"];
- nlohmann::json &procCount =
+ nlohmann::json& procCount =
procSummary["Count"];
auto procCountPtr =
procCount.get_ptr<
nlohmann::json::
- number_integer_t
- *>();
+ number_integer_t*>();
if (procCountPtr != nullptr)
{
// shouldn't be possible
@@ -368,8 +368,8 @@
[aResp](
const boost::system::error_code
ec,
- const std::variant<bool>
- &cpuPresenceCheck) {
+ const std::variant<bool>&
+ cpuPresenceCheck) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -386,8 +386,8 @@
[aResp](
const boost::system::error_code
ec,
- const std::variant<bool>
- &cpuFunctionalCheck) {
+ const std::variant<bool>&
+ cpuFunctionalCheck) {
if (ec)
{
BMCWEB_LOG_ERROR
@@ -443,10 +443,11 @@
BMCWEB_LOG_DEBUG
<< "Found UUID, now get its properties.";
crow::connections::systemBus->async_method_call(
- [aResp](const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string, VariantType>>
- &properties) {
+ [aResp](
+ const boost::system::error_code ec,
+ const std::vector<
+ std::pair<std::string, VariantType>>&
+ properties) {
if (ec)
{
BMCWEB_LOG_DEBUG
@@ -458,12 +459,12 @@
<< properties.size()
<< " UUID properties.";
for (const std::pair<std::string,
- VariantType>
- &property : properties)
+ VariantType>&
+ property : properties)
{
if (property.first == "UUID")
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(
&property.second);
@@ -493,10 +494,11 @@
"xyz.openbmc_project.Inventory.Item.System")
{
crow::connections::systemBus->async_method_call(
- [aResp](const boost::system::error_code ec,
- const std::vector<
- std::pair<std::string, VariantType>>
- &propertiesList) {
+ [aResp](
+ const boost::system::error_code ec,
+ const std::vector<
+ std::pair<std::string, VariantType>>&
+ propertiesList) {
if (ec)
{
// doesn't have to include this
@@ -507,17 +509,17 @@
<< "Got " << propertiesList.size()
<< " properties for system";
for (const std::pair<std::string,
- VariantType>
- &property : propertiesList)
+ VariantType>&
+ property : propertiesList)
{
- const std::string &propertyName =
+ const std::string& propertyName =
property.first;
if ((propertyName == "PartNumber") ||
(propertyName == "SerialNumber") ||
(propertyName == "Manufacturer") ||
(propertyName == "Model"))
{
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(
&property.second);
if (value != nullptr)
@@ -542,7 +544,7 @@
crow::connections::systemBus->async_method_call(
[aResp](
const boost::system::error_code ec,
- const std::variant<std::string> &property) {
+ const std::variant<std::string>& property) {
if (ec)
{
// doesn't have to include this
@@ -550,7 +552,7 @@
return;
}
- const std::string *value =
+ const std::string* value =
std::get_if<std::string>(&property);
if (value != nullptr)
{
@@ -572,7 +574,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/inventory", int32_t(0),
- std::array<const char *, 5>{
+ std::array<const char*, 5>{
"xyz.openbmc_project.Inventory.Decorator.Asset",
"xyz.openbmc_project.Inventory.Item.Cpu",
"xyz.openbmc_project.Inventory.Item.Dimm",
@@ -593,7 +595,7 @@
BMCWEB_LOG_DEBUG << "Get host information.";
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const std::variant<std::string> &hostState) {
+ const std::variant<std::string>& hostState) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -601,7 +603,7 @@
return;
}
- const std::string *s = std::get_if<std::string>(&hostState);
+ const std::string* s = std::get_if<std::string>(&hostState);
BMCWEB_LOG_DEBUG << "Host state: " << *s;
if (s != nullptr)
{
@@ -643,7 +645,7 @@
* @return Returns as a string, the boot source in Redfish terms. If translation
* cannot be done, returns an empty string.
*/
-static std::string dbusToRfBootSource(const std::string &dbusSource)
+static std::string dbusToRfBootSource(const std::string& dbusSource)
{
if (dbusSource == "xyz.openbmc_project.Control.Boot.Source.Sources.Default")
{
@@ -683,7 +685,7 @@
* @return Returns as a string, the boot mode in Redfish terms. If translation
* cannot be done, returns an empty string.
*/
-static std::string dbusToRfBootMode(const std::string &dbusMode)
+static std::string dbusToRfBootMode(const std::string& dbusMode)
{
if (dbusMode == "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular")
{
@@ -713,8 +715,8 @@
* @return Integer error code.
*/
static int assignBootParameters(std::shared_ptr<AsyncResp> aResp,
- const std::string &rfSource,
- std::string &bootSource, std::string &bootMode)
+ const std::string& rfSource,
+ std::string& bootSource, std::string& bootMode)
{
// The caller has initialized the bootSource and bootMode to:
// bootMode = "xyz.openbmc_project.Control.Boot.Mode.Modes.Regular";
@@ -777,7 +779,7 @@
{
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const std::variant<std::string> &bootMode) {
+ const std::variant<std::string>& bootMode) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -785,7 +787,7 @@
return;
}
- const std::string *bootModeStr =
+ const std::string* bootModeStr =
std::get_if<std::string>(&bootMode);
if (!bootModeStr)
@@ -848,7 +850,7 @@
crow::connections::systemBus->async_method_call(
[aResp, bootDbusObj](const boost::system::error_code ec,
- const std::variant<std::string> &bootSource) {
+ const std::variant<std::string>& bootSource) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -856,7 +858,7 @@
return;
}
- const std::string *bootSourceStr =
+ const std::string* bootSourceStr =
std::get_if<std::string>(&bootSource);
if (!bootSourceStr)
@@ -893,7 +895,7 @@
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const std::variant<bool> &oneTime) {
+ const std::variant<bool>& oneTime) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -901,7 +903,7 @@
return;
}
- const bool *oneTimePtr = std::get_if<bool>(&oneTime);
+ const bool* oneTimePtr = std::get_if<bool>(&oneTime);
if (!oneTimePtr)
{
@@ -929,14 +931,14 @@
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- std::variant<bool> &autoRebootEnabled) {
+ std::variant<bool>& autoRebootEnabled) {
if (ec)
{
BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
return;
}
- const bool *autoRebootEnabledPtr =
+ const bool* autoRebootEnabledPtr =
std::get_if<bool>(&autoRebootEnabled);
if (!autoRebootEnabledPtr)
@@ -954,14 +956,14 @@
// attempts are left
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- std::variant<uint32_t> &autoRebootAttemptsLeft) {
+ std::variant<uint32_t>& autoRebootAttemptsLeft) {
if (ec)
{
BMCWEB_LOG_DEBUG << "D-BUS response error " << ec;
return;
}
- const uint32_t *autoRebootAttemptsLeftPtr =
+ const uint32_t* autoRebootAttemptsLeftPtr =
std::get_if<uint32_t>(&autoRebootAttemptsLeft);
if (!autoRebootAttemptsLeftPtr)
@@ -1020,7 +1022,7 @@
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- std::variant<std::string> &policy) {
+ std::variant<std::string>& policy) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1039,7 +1041,7 @@
"LastState",
"LastState"}};
- const std::string *policyPtr = std::get_if<std::string>(&policy);
+ const std::string* policyPtr = std::get_if<std::string>(&policy);
if (!policyPtr)
{
@@ -1133,7 +1135,7 @@
// Act on validated parameters
BMCWEB_LOG_DEBUG << "DBUS boot source: " << bootSourceStr;
BMCWEB_LOG_DEBUG << "DBUS boot mode: " << bootModeStr;
- const char *bootObj =
+ const char* bootObj =
oneTimeSetting ? "/xyz/openbmc_project/control/host0/boot/one_time"
: "/xyz/openbmc_project/control/host0/boot";
@@ -1203,7 +1205,7 @@
crow::connections::systemBus->async_method_call(
[aResp, bootSource{std::move(bootSource)},
bootEnable{std::move(bootEnable)}](const boost::system::error_code ec,
- const std::variant<bool> &oneTime) {
+ const std::variant<bool>& oneTime) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1211,7 +1213,7 @@
return;
}
- const bool *oneTimePtr = std::get_if<bool>(&oneTime);
+ const bool* oneTimePtr = std::get_if<bool>(&oneTime);
if (!oneTimePtr)
{
@@ -1239,7 +1241,7 @@
* @return None.
*/
static void setAutomaticRetry(std::shared_ptr<AsyncResp> aResp,
- const std::string &&automaticRetryConfig)
+ const std::string&& automaticRetryConfig)
{
BMCWEB_LOG_DEBUG << "Set Automatic Retry.";
@@ -1339,8 +1341,8 @@
BMCWEB_LOG_DEBUG << "Get OEM information.";
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const std::vector<std::pair<std::string, VariantType>>
- &propertiesList) {
+ const std::vector<std::pair<std::string, VariantType>>&
+ propertiesList) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -1348,9 +1350,9 @@
return;
}
- const bool *provState = nullptr;
- const bool *lockState = nullptr;
- for (const std::pair<std::string, VariantType> &property :
+ const bool* provState = nullptr;
+ const bool* lockState = nullptr;
+ for (const std::pair<std::string, VariantType>& property :
propertiesList)
{
if (property.first == "UfmProvisioned")
@@ -1370,7 +1372,7 @@
return;
}
- nlohmann::json &oemPFR =
+ nlohmann::json& oemPFR =
aResp->res.jsonValue["Oem"]["OpenBmc"]["FirmwareProvisioning"];
if (*provState == true)
{
@@ -1402,7 +1404,7 @@
* @return Returns as a string, the timeout action in Redfish terms. If
* translation cannot be done, returns an empty string.
*/
-static std::string dbusToRfWatchdogAction(const std::string &dbusAction)
+static std::string dbusToRfWatchdogAction(const std::string& dbusAction)
{
if (dbusAction == "xyz.openbmc_project.State.Watchdog.Action.None")
{
@@ -1435,7 +1437,7 @@
*If translation cannot be done, returns an empty string.
*/
-static std::string rfToDbusWDTTimeOutAct(const std::string &rfAction)
+static std::string rfToDbusWDTTimeOutAct(const std::string& rfAction)
{
if (rfAction == "None")
{
@@ -1469,7 +1471,7 @@
BMCWEB_LOG_DEBUG << "Get host watchodg";
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- PropertiesType &properties) {
+ PropertiesType& properties) {
if (ec)
{
// watchdog service is stopped
@@ -1479,18 +1481,18 @@
BMCWEB_LOG_DEBUG << "Got " << properties.size() << " wdt prop.";
- nlohmann::json &hostWatchdogTimer =
+ nlohmann::json& hostWatchdogTimer =
aResp->res.jsonValue["HostWatchdogTimer"];
// watchdog service is running/enabled
hostWatchdogTimer["Status"]["State"] = "Enabled";
- for (const auto &property : properties)
+ for (const auto& property : properties)
{
BMCWEB_LOG_DEBUG << "prop=" << property.first;
if (property.first == "Enabled")
{
- const bool *state = std::get_if<bool>(&property.second);
+ const bool* state = std::get_if<bool>(&property.second);
if (!state)
{
@@ -1502,7 +1504,7 @@
}
else if (property.first == "ExpireAction")
{
- const std::string *s =
+ const std::string* s =
std::get_if<std::string>(&property.second);
if (!s)
{
@@ -1537,7 +1539,7 @@
*/
static void setWDTProperties(std::shared_ptr<AsyncResp> aResp,
const std::optional<bool> wdtEnable,
- const std::optional<std::string> &wdtTimeOutAction)
+ const std::optional<std::string>& wdtTimeOutAction)
{
BMCWEB_LOG_DEBUG << "Set host watchdog";
@@ -1596,7 +1598,7 @@
class SystemsCollection : public Node
{
public:
- SystemsCollection(CrowApp &app) : Node(app, "/redfish/v1/Systems/")
+ SystemsCollection(CrowApp& app) : Node(app, "/redfish/v1/Systems/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -1608,8 +1610,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
res.jsonValue["@odata.type"] =
@@ -1619,11 +1621,11 @@
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
- const std::variant<std::string> &hostName) {
- nlohmann::json &iface_array =
+ const std::variant<std::string>& hostName) {
+ nlohmann::json& iface_array =
asyncResp->res.jsonValue["Members"];
iface_array = nlohmann::json::array();
- auto &count = asyncResp->res.jsonValue["Members@odata.count"];
+ auto& count = asyncResp->res.jsonValue["Members@odata.count"];
count = 0;
if (ec)
{
@@ -1652,7 +1654,7 @@
class SystemActionsReset : public Node
{
public:
- SystemActionsReset(CrowApp &app) :
+ SystemActionsReset(CrowApp& app) :
Node(app, "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset/")
{
entityPrivileges = {
@@ -1664,8 +1666,8 @@
* Function handles POST method request.
* Analyzes POST body message before sends Reset request data to D-Bus.
*/
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -1782,15 +1784,15 @@
/**
* Function transceives data with dbus directly.
*/
- void doNMI(const std::shared_ptr<AsyncResp> &asyncResp)
+ void doNMI(const std::shared_ptr<AsyncResp>& asyncResp)
{
- constexpr char const *serviceName =
+ constexpr char const* serviceName =
"xyz.openbmc_project.Control.Host.NMI";
- constexpr char const *objectPath =
+ constexpr char const* objectPath =
"/xyz/openbmc_project/control/host0/nmi";
- constexpr char const *interfaceName =
+ constexpr char const* interfaceName =
"xyz.openbmc_project.Control.Host.NMI";
- constexpr char const *method = "NMI";
+ constexpr char const* method = "NMI";
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec) {
@@ -1815,7 +1817,7 @@
/*
* Default Constructor
*/
- Systems(CrowApp &app) : Node(app, "/redfish/v1/Systems/system/")
+ Systems(CrowApp& app) : Node(app, "/redfish/v1/Systems/system/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -1830,8 +1832,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
res.jsonValue["@odata.type"] = "#ComputerSystem.v1_11_0.ComputerSystem";
res.jsonValue["Name"] = "system";
@@ -1874,7 +1876,7 @@
};
auto asyncResp = std::make_shared<AsyncResp>(res);
- constexpr const std::array<const char *, 4> inventoryForSystems = {
+ constexpr const std::array<const char*, 4> inventoryForSystems = {
"xyz.openbmc_project.Inventory.Item.Dimm",
"xyz.openbmc_project.Inventory.Item.Cpu",
"xyz.openbmc_project.Inventory.Item.Drive",
@@ -1883,7 +1885,7 @@
auto health = std::make_shared<HealthPopulate>(asyncResp);
crow::connections::systemBus->async_method_call(
[health](const boost::system::error_code ec,
- std::vector<std::string> &resp) {
+ std::vector<std::string>& resp) {
if (ec)
{
// no inventory
@@ -1899,7 +1901,7 @@
health->populate();
- getMainChassisId(asyncResp, [](const std::string &chassisId,
+ getMainChassisId(asyncResp, [](const std::string& chassisId,
std::shared_ptr<AsyncResp> aRsp) {
aRsp->res.jsonValue["Links"]["Chassis"] = {
{{"@odata.id", "/redfish/v1/Chassis/" + chassisId}}};
@@ -1918,8 +1920,8 @@
#endif
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::optional<std::string> indicatorLed;
std::optional<nlohmann::json> bootProps;
diff --git a/redfish-core/lib/task.hpp b/redfish-core/lib/task.hpp
index a746239..fe1468f 100644
--- a/redfish-core/lib/task.hpp
+++ b/redfish-core/lib/task.hpp
@@ -19,8 +19,9 @@
#include <boost/asio.hpp>
#include <boost/container/flat_map.hpp>
-#include <chrono>
#include <task_messages.hpp>
+
+#include <chrono>
#include <variant>
namespace redfish
@@ -36,7 +37,7 @@
struct Payload
{
- Payload(const crow::Request &req) :
+ Payload(const crow::Request& req) :
targetUri(req.url), httpOperation(req.methodString()),
httpHeaders(nlohmann::json::array())
@@ -54,7 +55,7 @@
jsonBody = nullptr;
}
- for (const auto &field : req.fields)
+ for (const auto& field : req.fields)
{
if (std::find(headerWhitelist.begin(), headerWhitelist.end(),
field.name()) == headerWhitelist.end())
@@ -78,7 +79,7 @@
nlohmann::json jsonBody;
};
-inline void to_json(nlohmann::json &j, const Payload &p)
+inline void to_json(nlohmann::json& j, const Payload& p)
{
j = {{"TargetUri", p.targetUri},
{"HttpOperation", p.httpOperation},
@@ -90,9 +91,9 @@
{
private:
TaskData(std::function<bool(boost::system::error_code,
- sdbusplus::message::message &,
- const std::shared_ptr<TaskData> &)> &&handler,
- const std::string &match, size_t idx) :
+ sdbusplus::message::message&,
+ const std::shared_ptr<TaskData>&)>&& handler,
+ const std::string& match, size_t idx) :
callback(std::move(handler)),
matchStr(match), index(idx),
startTime(std::chrono::system_clock::to_time_t(
@@ -100,33 +101,31 @@
status("OK"), state("Running"), messages(nlohmann::json::array()),
timer(crow::connections::systemBus->get_io_context())
- {
- }
+ {}
TaskData() = delete;
public:
- static std::shared_ptr<TaskData> &createTask(
+ static std::shared_ptr<TaskData>& createTask(
std::function<bool(boost::system::error_code,
- sdbusplus::message::message &,
- const std::shared_ptr<TaskData> &)> &&handler,
- const std::string &match)
+ sdbusplus::message::message&,
+ const std::shared_ptr<TaskData>&)>&& handler,
+ const std::string& match)
{
static size_t lastTask = 0;
struct MakeSharedHelper : public TaskData
{
MakeSharedHelper(
- std::function<bool(
- boost::system::error_code, sdbusplus::message::message &,
- const std::shared_ptr<TaskData> &)> &&handler,
- const std::string &match, size_t idx) :
+ std::function<bool(boost::system::error_code,
+ sdbusplus::message::message&,
+ const std::shared_ptr<TaskData>&)>&& handler,
+ const std::string& match, size_t idx) :
TaskData(std::move(handler), match, idx)
- {
- }
+ {}
};
if (tasks.size() >= maxTaskCount)
{
- auto &last = tasks.front();
+ auto& last = tasks.front();
// destroy all references
last->timer.cancel();
@@ -138,7 +137,7 @@
std::move(handler), match, lastTask++));
}
- void populateResp(crow::Response &res, size_t retryAfterSeconds = 30)
+ void populateResp(crow::Response& res, size_t retryAfterSeconds = 30)
{
if (!endTime)
{
@@ -168,7 +167,7 @@
std::chrono::system_clock::now());
}
- void extendTimer(const std::chrono::seconds &timeout)
+ void extendTimer(const std::chrono::seconds& timeout)
{
timer.expires_after(timeout);
timer.async_wait(
@@ -193,16 +192,16 @@
});
}
- void startTimer(const std::chrono::seconds &timeout)
+ void startTimer(const std::chrono::seconds& timeout)
{
if (match)
{
return;
}
match = std::make_unique<sdbusplus::bus::match::match>(
- static_cast<sdbusplus::bus::bus &>(*crow::connections::systemBus),
+ static_cast<sdbusplus::bus::bus&>(*crow::connections::systemBus),
matchStr,
- [self = shared_from_this()](sdbusplus::message::message &message) {
+ [self = shared_from_this()](sdbusplus::message::message& message) {
boost::system::error_code ec;
// callback to return True if callback is done, callback needs
@@ -224,8 +223,8 @@
messages.emplace_back(messages::taskStarted(std::to_string(index)));
}
- std::function<bool(boost::system::error_code, sdbusplus::message::message &,
- const std::shared_ptr<TaskData> &)>
+ std::function<bool(boost::system::error_code, sdbusplus::message::message&,
+ const std::shared_ptr<TaskData>&)>
callback;
std::string matchStr;
size_t index;
@@ -245,7 +244,7 @@
class TaskMonitor : public Node
{
public:
- TaskMonitor(CrowApp &app) :
+ TaskMonitor(CrowApp& app) :
Node((app), "/redfish/v1/TaskService/Tasks/<str>/Monitor/",
std::string())
{
@@ -259,8 +258,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -269,10 +268,10 @@
return;
}
- const std::string &strParam = params[0];
+ const std::string& strParam = params[0];
auto find = std::find_if(
task::tasks.begin(), task::tasks.end(),
- [&strParam](const std::shared_ptr<task::TaskData> &task) {
+ [&strParam](const std::shared_ptr<task::TaskData>& task) {
if (!task)
{
return false;
@@ -288,7 +287,7 @@
messages::resourceNotFound(asyncResp->res, "Monitor", strParam);
return;
}
- std::shared_ptr<task::TaskData> &ptr = *find;
+ std::shared_ptr<task::TaskData>& ptr = *find;
// monitor expires after 204
if (ptr->gave204)
{
@@ -302,7 +301,7 @@
class Task : public Node
{
public:
- Task(CrowApp &app) :
+ Task(CrowApp& app) :
Node((app), "/redfish/v1/TaskService/Tasks/<str>/", std::string())
{
entityPrivileges = {
@@ -315,8 +314,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
if (params.size() != 1)
@@ -325,10 +324,10 @@
return;
}
- const std::string &strParam = params[0];
+ const std::string& strParam = params[0];
auto find = std::find_if(
task::tasks.begin(), task::tasks.end(),
- [&strParam](const std::shared_ptr<task::TaskData> &task) {
+ [&strParam](const std::shared_ptr<task::TaskData>& task) {
if (!task)
{
return false;
@@ -345,7 +344,7 @@
return;
}
- std::shared_ptr<task::TaskData> &ptr = *find;
+ std::shared_ptr<task::TaskData>& ptr = *find;
asyncResp->res.jsonValue["@odata.type"] = "#Task.v1_4_3.Task";
asyncResp->res.jsonValue["Id"] = strParam;
@@ -377,7 +376,7 @@
class TaskCollection : public Node
{
public:
- TaskCollection(CrowApp &app) : Node(app, "/redfish/v1/TaskService/Tasks/")
+ TaskCollection(CrowApp& app) : Node(app, "/redfish/v1/TaskService/Tasks/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -389,8 +388,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
asyncResp->res.jsonValue["@odata.type"] =
@@ -398,10 +397,10 @@
asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/TaskService/Tasks";
asyncResp->res.jsonValue["Name"] = "Task Collection";
asyncResp->res.jsonValue["Members@odata.count"] = task::tasks.size();
- nlohmann::json &members = asyncResp->res.jsonValue["Members"];
+ nlohmann::json& members = asyncResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const std::shared_ptr<task::TaskData> &task : task::tasks)
+ for (const std::shared_ptr<task::TaskData>& task : task::tasks)
{
if (task == nullptr)
{
@@ -417,7 +416,7 @@
class TaskService : public Node
{
public:
- TaskService(CrowApp &app) : Node(app, "/redfish/v1/TaskService/")
+ TaskService(CrowApp& app) : Node(app, "/redfish/v1/TaskService/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -429,8 +428,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
asyncResp->res.jsonValue["@odata.type"] =
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 9dacbcd..fcb880e 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -19,6 +19,7 @@
#include <boost/container/flat_map.hpp>
#include <utils/fw_utils.hpp>
+
#include <variant>
namespace redfish
@@ -36,8 +37,8 @@
fwUpdateInProgress = false;
fwUpdateMatcher = nullptr;
}
-static void activateImage(const std::string &objPath,
- const std::string &service)
+static void activateImage(const std::string& objPath,
+ const std::string& service)
{
BMCWEB_LOG_DEBUG << "Activate image for " << objPath << " " << service;
crow::connections::systemBus->async_method_call(
@@ -58,8 +59,8 @@
// Note that asyncResp can be either a valid pointer or nullptr. If nullptr
// then no asyncResp updates will occur
static void softwareInterfaceAdded(std::shared_ptr<AsyncResp> asyncResp,
- sdbusplus::message::message &m,
- const crow::Request &req)
+ sdbusplus::message::message& m,
+ const crow::Request& req)
{
std::vector<std::pair<
std::string,
@@ -71,7 +72,7 @@
m.read(objPath, interfacesProperties);
BMCWEB_LOG_DEBUG << "obj path = " << objPath.str;
- for (auto &interface : interfacesProperties)
+ for (auto& interface : interfacesProperties)
{
BMCWEB_LOG_DEBUG << "interface = " << interface.first;
@@ -85,7 +86,7 @@
[objPath, asyncResp,
req](const boost::system::error_code error_code,
const std::vector<std::pair<
- std::string, std::vector<std::string>>> &objInfo) {
+ std::string, std::vector<std::string>>>& objInfo) {
if (error_code)
{
BMCWEB_LOG_DEBUG << "error_code = " << error_code;
@@ -121,9 +122,9 @@
std::shared_ptr<task::TaskData> task =
task::TaskData::createTask(
[](boost::system::error_code ec,
- sdbusplus::message::message &msg,
- const std::shared_ptr<task::TaskData>
- &taskData) {
+ sdbusplus::message::message& msg,
+ const std::shared_ptr<task::TaskData>&
+ taskData) {
if (ec)
{
return task::completed;
@@ -148,7 +149,7 @@
{
return !task::completed;
}
- std::string *state =
+ std::string* state =
std::get_if<std::string>(
&(findActivation->second));
@@ -205,7 +206,7 @@
{
return !task::completed;
}
- uint8_t *progress =
+ uint8_t* progress =
std::get_if<uint8_t>(
&(findProgress->second));
@@ -245,7 +246,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject", objPath.str,
- std::array<const char *, 1>{
+ std::array<const char*, 1>{
"xyz.openbmc_project.Software.Activation"});
}
}
@@ -254,7 +255,7 @@
// Note that asyncResp can be either a valid pointer or nullptr. If nullptr
// then no asyncResp updates will occur
static void monitorForSoftwareAvailable(std::shared_ptr<AsyncResp> asyncResp,
- const crow::Request &req,
+ const crow::Request& req,
int timeoutTimeSeconds = 5)
{
// Only allow one FW update at a time
@@ -273,7 +274,7 @@
fwAvailableTimer->expires_after(std::chrono::seconds(timeoutTimeSeconds));
fwAvailableTimer->async_wait(
- [asyncResp](const boost::system::error_code &ec) {
+ [asyncResp](const boost::system::error_code& ec) {
cleanUp();
if (ec == boost::asio::error::operation_aborted)
{
@@ -295,7 +296,7 @@
}
});
- auto callback = [asyncResp, req](sdbusplus::message::message &m) {
+ auto callback = [asyncResp, req](sdbusplus::message::message& m) {
BMCWEB_LOG_DEBUG << "Match fired";
softwareInterfaceAdded(asyncResp, m, req);
};
@@ -316,7 +317,7 @@
class UpdateServiceActionsSimpleUpdate : public Node
{
public:
- UpdateServiceActionsSimpleUpdate(CrowApp &app) :
+ UpdateServiceActionsSimpleUpdate(CrowApp& app) :
Node(app,
"/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate/")
{
@@ -330,8 +331,8 @@
}
private:
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::optional<std::string> transferProtocol;
std::string imageURI;
@@ -443,7 +444,7 @@
class UpdateService : public Node
{
public:
- UpdateService(CrowApp &app) : Node(app, "/redfish/v1/UpdateService/")
+ UpdateService(CrowApp& app) : Node(app, "/redfish/v1/UpdateService/")
{
entityPrivileges = {
{boost::beast::http::verb::get, {{"Login"}}},
@@ -455,8 +456,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> aResp = std::make_shared<AsyncResp>(res);
res.jsonValue["@odata.type"] = "#UpdateService.v1_4_0.UpdateService";
@@ -471,7 +472,7 @@
{"@odata.id", "/redfish/v1/UpdateService/FirmwareInventory"}};
#ifdef BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE
// Update Actions object.
- nlohmann::json &updateSvcSimpleUpdate =
+ nlohmann::json& updateSvcSimpleUpdate =
res.jsonValue["Actions"]["#UpdateService.SimpleUpdate"];
updateSvcSimpleUpdate["target"] =
"/redfish/v1/UpdateService/Actions/UpdateService.SimpleUpdate";
@@ -481,7 +482,7 @@
// Get the current ApplyTime value
crow::connections::systemBus->async_method_call(
[aResp](const boost::system::error_code ec,
- const std::variant<std::string> &applyTime) {
+ const std::variant<std::string>& applyTime) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error " << ec;
@@ -489,7 +490,7 @@
return;
}
- const std::string *s = std::get_if<std::string>(&applyTime);
+ const std::string* s = std::get_if<std::string>(&applyTime);
if (s == nullptr)
{
return;
@@ -516,8 +517,8 @@
"xyz.openbmc_project.Software.ApplyTime", "RequestedApplyTime");
}
- void doPatch(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPatch(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "doPatch...";
@@ -596,8 +597,8 @@
}
}
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
BMCWEB_LOG_DEBUG << "doPost...";
@@ -622,7 +623,7 @@
{
public:
template <typename CrowApp>
- SoftwareInventoryCollection(CrowApp &app) :
+ SoftwareInventoryCollection(CrowApp& app) :
Node(app, "/redfish/v1/UpdateService/FirmwareInventory/")
{
entityPrivileges = {
@@ -635,8 +636,8 @@
}
private:
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
res.jsonValue["@odata.type"] =
@@ -650,8 +651,8 @@
const boost::system::error_code ec,
const std::vector<std::pair<
std::string, std::vector<std::pair<
- std::string, std::vector<std::string>>>>>
- &subtree) {
+ std::string, std::vector<std::string>>>>>&
+ subtree) {
if (ec)
{
messages::internalError(asyncResp->res);
@@ -660,7 +661,7 @@
asyncResp->res.jsonValue["Members"] = nlohmann::json::array();
asyncResp->res.jsonValue["Members@odata.count"] = 0;
- for (auto &obj : subtree)
+ for (auto& obj : subtree)
{
// if can't parse fw id then return
std::size_t idPos;
@@ -672,7 +673,7 @@
}
std::string swId = obj.first.substr(idPos + 1);
- nlohmann::json &members =
+ nlohmann::json& members =
asyncResp->res.jsonValue["Members"];
members.push_back(
{{"@odata.id", "/redfish/v1/UpdateService/"
@@ -690,8 +691,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree",
"/xyz/openbmc_project/software", static_cast<int32_t>(0),
- std::array<const char *, 1>{
- "xyz.openbmc_project.Software.Version"});
+ std::array<const char*, 1>{"xyz.openbmc_project.Software.Version"});
}
};
@@ -699,7 +699,7 @@
{
public:
template <typename CrowApp>
- SoftwareInventory(CrowApp &app) :
+ SoftwareInventory(CrowApp& app) :
Node(app, "/redfish/v1/UpdateService/FirmwareInventory/<str>/",
std::string())
{
@@ -715,17 +715,17 @@
private:
/* Fill related item links (i.e. bmc, bios) in for inventory */
static void getRelatedItems(std::shared_ptr<AsyncResp> aResp,
- const std::string &purpose)
+ const std::string& purpose)
{
if (purpose == fw_util::bmcPurpose)
{
- nlohmann::json &members = aResp->res.jsonValue["RelatedItem"];
+ nlohmann::json& members = aResp->res.jsonValue["RelatedItem"];
members.push_back({{"@odata.id", "/redfish/v1/Managers/bmc"}});
aResp->res.jsonValue["Members@odata.count"] = members.size();
}
else if (purpose == fw_util::biosPurpose)
{
- nlohmann::json &members = aResp->res.jsonValue["RelatedItem"];
+ nlohmann::json& members = aResp->res.jsonValue["RelatedItem"];
members.push_back(
{{"@odata.id", "/redfish/v1/Systems/system/Bios"}});
aResp->res.jsonValue["Members@odata.count"] = members.size();
@@ -736,8 +736,8 @@
}
}
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
@@ -759,8 +759,8 @@
const boost::system::error_code ec,
const std::vector<std::pair<
std::string, std::vector<std::pair<
- std::string, std::vector<std::string>>>>>
- &subtree) {
+ std::string, std::vector<std::string>>>>>&
+ subtree) {
BMCWEB_LOG_DEBUG << "doGet callback...";
if (ec)
{
@@ -773,8 +773,8 @@
for (const std::pair<
std::string,
std::vector<
- std::pair<std::string, std::vector<std::string>>>>
- &obj : subtree)
+ std::pair<std::string, std::vector<std::string>>>>&
+ obj : subtree)
{
if (boost::ends_with(obj.first, *swId) != true)
{
@@ -793,7 +793,7 @@
[asyncResp,
swId](const boost::system::error_code error_code,
const boost::container::flat_map<
- std::string, VariantType> &propertiesList) {
+ std::string, VariantType>& propertiesList) {
if (error_code)
{
messages::internalError(asyncResp->res);
@@ -810,7 +810,7 @@
"Purpose");
return;
}
- const std::string *swInvPurpose =
+ const std::string* swInvPurpose =
std::get_if<std::string>(&it->second);
if (swInvPurpose == nullptr)
{
@@ -835,7 +835,7 @@
BMCWEB_LOG_DEBUG << "Version found!";
- const std::string *version =
+ const std::string* version =
std::get_if<std::string>(&it->second);
if (version == nullptr)
@@ -896,8 +896,7 @@
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetSubTree", "/",
static_cast<int32_t>(0),
- std::array<const char *, 1>{
- "xyz.openbmc_project.Software.Version"});
+ std::array<const char*, 1>{"xyz.openbmc_project.Software.Version"});
}
};
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 408113f..552e255 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -30,7 +30,7 @@
/**
* @brief Read all known properties from VM object interfaces
*/
-static void vmParseInterfaceObject(const DbusInterfaceType &interface,
+static void vmParseInterfaceObject(const DbusInterfaceType& interface,
std::shared_ptr<AsyncResp> aResp)
{
const auto mountPointIface =
@@ -63,14 +63,14 @@
return;
}
- const bool *activeValue = std::get_if<bool>(&activeProperty->second);
+ const bool* activeValue = std::get_if<bool>(&activeProperty->second);
if (!activeValue)
{
BMCWEB_LOG_DEBUG << "Value Active not found";
return;
}
- const std::string *endpointIdValue =
+ const std::string* endpointIdValue =
std::get_if<std::string>(&endpointIdProperty->second);
if (endpointIdValue)
{
@@ -93,7 +93,7 @@
mountPointIface->second.find("ImageURL");
if (imageUrlProperty != processIface->second.cend())
{
- const std::string *imageUrlValue =
+ const std::string* imageUrlValue =
std::get_if<std::string>(&imageUrlProperty->second);
if (imageUrlValue && !imageUrlValue->empty())
{
@@ -112,8 +112,8 @@
/**
* @brief Fill template for Virtual Media Item.
*/
-static nlohmann::json vmItemTemplate(const std::string &name,
- const std::string &resName)
+static nlohmann::json vmItemTemplate(const std::string& name,
+ const std::string& resName)
{
nlohmann::json item;
item["@odata.id"] =
@@ -140,26 +140,26 @@
* @brief Fills collection data
*/
static void getVmResourceList(std::shared_ptr<AsyncResp> aResp,
- const std::string &service,
- const std::string &name)
+ 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)}](const boost::system::error_code ec,
- ManagedObjectType &subtree) {
+ ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
return;
}
- nlohmann::json &members = aResp->res.jsonValue["Members"];
+ nlohmann::json& members = aResp->res.jsonValue["Members"];
members = nlohmann::json::array();
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
nlohmann::json item;
- const std::string &path =
- static_cast<const std::string &>(object.first);
+ const std::string& path =
+ static_cast<const std::string&>(object.first);
std::size_t lastIndex = path.rfind("/");
if (lastIndex == std::string::npos)
{
@@ -183,14 +183,14 @@
* @brief Fills data for specific resource
*/
static void getVmData(std::shared_ptr<AsyncResp> aResp,
- const std::string &service, const std::string &name,
- const std::string &resName)
+ const std::string& service, const std::string& name,
+ const std::string& resName)
{
BMCWEB_LOG_DEBUG << "Get Virtual Media resource data.";
crow::connections::systemBus->async_method_call(
[resName, name, aResp](const boost::system::error_code ec,
- ManagedObjectType &subtree) {
+ ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -198,10 +198,10 @@
return;
}
- for (auto &item : subtree)
+ for (auto& item : subtree)
{
- const std::string &path =
- static_cast<const std::string &>(item.first);
+ const std::string& path =
+ static_cast<const std::string&>(item.first);
std::size_t lastItem = path.rfind("/");
if (lastItem == std::string::npos)
@@ -248,7 +248,7 @@
class VirtualMediaActionInsertMedia : public Node
{
public:
- VirtualMediaActionInsertMedia(CrowApp &app) :
+ VirtualMediaActionInsertMedia(CrowApp& app) :
Node(app,
"/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/"
"VirtualMedia.InsertMedia",
@@ -280,7 +280,7 @@
*
*/
std::optional<TransferProtocol>
- getTransferProtocolFromUri(const std::string &imageUri)
+ getTransferProtocolFromUri(const std::string& imageUri)
{
if (imageUri.find("smb://") != std::string::npos)
{
@@ -305,7 +305,7 @@
*
*/
std::optional<TransferProtocol> getTransferProtocolFromParam(
- const std::optional<std::string> &transferProtocolType)
+ const std::optional<std::string>& transferProtocolType)
{
if (transferProtocolType == std::nullopt)
{
@@ -330,8 +330,8 @@
*
*/
const std::string
- getUriWithTransferProtocol(const std::string &imageUri,
- const TransferProtocol &transferProtocol)
+ getUriWithTransferProtocol(const std::string& imageUri,
+ const TransferProtocol& transferProtocol)
{
if (transferProtocol == TransferProtocol::smb)
{
@@ -350,10 +350,10 @@
* @brief Function validate parameters of insert media request.
*
*/
- bool validateParams(crow::Response &res, std::string &imageUrl,
- const std::optional<bool> &inserted,
- const std::optional<std::string> &transferMethod,
- const std::optional<std::string> &transferProtocolType)
+ bool validateParams(crow::Response& res, std::string& imageUrl,
+ const std::optional<bool>& inserted,
+ const std::optional<std::string>& transferMethod,
+ const std::optional<std::string>& transferProtocolType)
{
BMCWEB_LOG_DEBUG << "Validation started";
// required param imageUrl must not be empty
@@ -469,8 +469,8 @@
*
* Analyzes POST body message before sends Reset request data to dbus.
*/
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto aResp = std::make_shared<AsyncResp>(res);
@@ -481,7 +481,7 @@
}
// take resource name from URL
- const std::string &resName = params[1];
+ const std::string& resName = params[1];
if (params[0] != "bmc")
{
@@ -493,7 +493,7 @@
crow::connections::systemBus->async_method_call(
[this, aResp{std::move(aResp)}, req,
resName](const boost::system::error_code ec,
- const GetObjectType &getObjectType) {
+ const GetObjectType& getObjectType) {
if (ec)
{
BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
@@ -508,7 +508,7 @@
crow::connections::systemBus->async_method_call(
[this, service, resName, req, aResp{std::move(aResp)}](
const boost::system::error_code ec,
- ManagedObjectType &subtree) {
+ ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -516,10 +516,10 @@
return;
}
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
- const std::string &path =
- static_cast<const std::string &>(object.first);
+ const std::string& path =
+ static_cast<const std::string&>(object.first);
std::size_t lastIndex = path.rfind("/");
if (lastIndex == std::string::npos)
@@ -602,22 +602,22 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject",
- "/xyz/openbmc_project/VirtualMedia", std::array<const char *, 0>());
+ "/xyz/openbmc_project/VirtualMedia", std::array<const char*, 0>());
}
- template <typename T> static void secureCleanup(T &value)
+ template <typename T>
+ static void secureCleanup(T& value)
{
- auto raw = const_cast<typename T::value_type *>(value.data());
+ auto raw = const_cast<typename T::value_type*>(value.data());
explicit_bzero(raw, value.size() * sizeof(*raw));
}
class Credentials
{
public:
- Credentials(std::string &&user, std::string &&password) :
+ Credentials(std::string&& user, std::string&& password) :
userBuf(std::move(user)), passBuf(std::move(password))
- {
- }
+ {}
~Credentials()
{
@@ -625,20 +625,20 @@
secureCleanup(passBuf);
}
- const std::string &user()
+ const std::string& user()
{
return userBuf;
}
- const std::string &password()
+ const std::string& password()
{
return passBuf;
}
private:
Credentials() = delete;
- Credentials(const Credentials &) = delete;
- Credentials &operator=(const Credentials &) = delete;
+ Credentials(const Credentials&) = delete;
+ Credentials& operator=(const Credentials&) = delete;
std::string userBuf;
std::string passBuf;
@@ -647,9 +647,10 @@
class CredentialsProvider
{
public:
- template <typename T> struct Deleter
+ template <typename T>
+ struct Deleter
{
- void operator()(T *buff) const
+ void operator()(T* buff) const
{
if (buff)
{
@@ -663,20 +664,19 @@
using SecureBuffer = std::unique_ptr<Buffer, Deleter<Buffer>>;
// Using explicit definition instead of std::function to avoid implicit
// conversions eg. stack copy instead of reference
- using FormatterFunc = void(const std::string &username,
- const std::string &password, Buffer &dest);
+ using FormatterFunc = void(const std::string& username,
+ const std::string& password, Buffer& dest);
- CredentialsProvider(std::string &&user, std::string &&password) :
+ CredentialsProvider(std::string&& user, std::string&& password) :
credentials(std::move(user), std::move(password))
- {
- }
+ {}
- const std::string &user()
+ const std::string& user()
{
return credentials.user();
}
- const std::string &password()
+ const std::string& password()
{
return credentials.password();
}
@@ -697,15 +697,15 @@
};
// Wrapper for boost::async_pipe ensuring proper pipe cleanup
- template <typename Buffer> class Pipe
+ template <typename Buffer>
+ class Pipe
{
public:
using unix_fd = sdbusplus::message::unix_fd;
- Pipe(boost::asio::io_context &io, Buffer &&buffer) :
+ Pipe(boost::asio::io_context& io, Buffer&& buffer) :
impl(io), buffer{std::move(buffer)}
- {
- }
+ {}
~Pipe()
{
@@ -719,7 +719,7 @@
}
template <typename WriteHandler>
- void async_write(WriteHandler &&handler)
+ void async_write(WriteHandler&& handler)
{
impl.async_write_some(data(), std::forward<WriteHandler>(handler));
}
@@ -753,9 +753,9 @@
* All BMC state properties will be retrieved before sending reset request.
*/
void doMountVmLegacy(std::shared_ptr<AsyncResp> asyncResp,
- const std::string &service, const std::string &name,
- const std::string &imageUrl, const bool rw,
- std::string &&userName, std::string &&password)
+ const std::string& service, const std::string& name,
+ const std::string& imageUrl, const bool rw,
+ std::string&& userName, std::string&& password)
{
using SecurePipe = Pipe<CredentialsProvider::SecureBuffer>;
constexpr const size_t secretLimit = 1024;
@@ -779,8 +779,8 @@
}
// Pack secret
- auto secret = credentials.pack([](const auto &user,
- const auto &pass, auto &buff) {
+ auto secret = credentials.pack([](const auto& user,
+ const auto& pass, auto& buff) {
std::copy(user.begin(), user.end(), std::back_inserter(buff));
buff.push_back('\0');
std::copy(pass.begin(), pass.end(), std::back_inserter(buff));
@@ -795,7 +795,7 @@
// Pass secret over pipe
secretPipe->async_write(
- [asyncResp](const boost::system::error_code &ec,
+ [asyncResp](const boost::system::error_code& ec,
std::size_t size) {
if (ec)
{
@@ -831,7 +831,7 @@
class VirtualMediaActionEjectMedia : public Node
{
public:
- VirtualMediaActionEjectMedia(CrowApp &app) :
+ VirtualMediaActionEjectMedia(CrowApp& app) :
Node(app,
"/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/"
"VirtualMedia.EjectMedia",
@@ -852,8 +852,8 @@
*
* Analyzes POST body message before sends Reset request data to dbus.
*/
- void doPost(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doPost(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto aResp = std::make_shared<AsyncResp>(res);
@@ -864,7 +864,7 @@
}
// take resource name from URL
- const std::string &resName = params[1];
+ const std::string& resName = params[1];
if (params[0] != "bmc")
{
@@ -876,7 +876,7 @@
crow::connections::systemBus->async_method_call(
[this, aResp{std::move(aResp)}, req,
resName](const boost::system::error_code ec,
- const GetObjectType &getObjectType) {
+ const GetObjectType& getObjectType) {
if (ec)
{
BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
@@ -891,7 +891,7 @@
crow::connections::systemBus->async_method_call(
[this, resName, service, req, aResp{std::move(aResp)}](
const boost::system::error_code ec,
- ManagedObjectType &subtree) {
+ ManagedObjectType& subtree) {
if (ec)
{
BMCWEB_LOG_DEBUG << "DBUS response error";
@@ -899,10 +899,10 @@
return;
}
- for (const auto &object : subtree)
+ for (const auto& object : subtree)
{
- const std::string &path =
- static_cast<const std::string &>(object.first);
+ const std::string& path =
+ static_cast<const std::string&>(object.first);
std::size_t lastIndex = path.rfind("/");
if (lastIndex == std::string::npos)
@@ -943,7 +943,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject",
- "/xyz/openbmc_project/VirtualMedia", std::array<const char *, 0>());
+ "/xyz/openbmc_project/VirtualMedia", std::array<const char*, 0>());
}
/**
@@ -952,7 +952,7 @@
* All BMC state properties will be retrieved before sending reset request.
*/
void doVmAction(std::shared_ptr<AsyncResp> asyncResp,
- const std::string &service, const std::string &name,
+ const std::string& service, const std::string& name,
bool legacy)
{
@@ -996,7 +996,7 @@
/*
* Default Constructor
*/
- VirtualMediaCollection(CrowApp &app) :
+ VirtualMediaCollection(CrowApp& app) :
Node(app, "/redfish/v1/Managers/<str>/VirtualMedia/", std::string())
{
entityPrivileges = {
@@ -1012,8 +1012,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -1026,7 +1026,7 @@
return;
}
- const std::string &name = params[0];
+ const std::string& name = params[0];
if (name != "bmc")
{
@@ -1043,7 +1043,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, name](const boost::system::error_code ec,
- const GetObjectType &getObjectType) {
+ const GetObjectType& getObjectType) {
if (ec)
{
BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
@@ -1060,7 +1060,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject",
- "/xyz/openbmc_project/VirtualMedia", std::array<const char *, 0>());
+ "/xyz/openbmc_project/VirtualMedia", std::array<const char*, 0>());
}
};
@@ -1070,7 +1070,7 @@
/*
* Default Constructor
*/
- VirtualMedia(CrowApp &app) :
+ VirtualMedia(CrowApp& app) :
Node(app, "/redfish/v1/Managers/<str>/VirtualMedia/<str>/",
std::string(), std::string())
{
@@ -1087,8 +1087,8 @@
/**
* Functions triggers appropriate requests on DBus
*/
- void doGet(crow::Response &res, const crow::Request &req,
- const std::vector<std::string> ¶ms) override
+ void doGet(crow::Response& res, const crow::Request& req,
+ const std::vector<std::string>& params) override
{
// Check if there is required param, truly entering this shall be
// impossible
@@ -1099,8 +1099,8 @@
res.end();
return;
}
- const std::string &name = params[0];
- const std::string &resName = params[1];
+ const std::string& name = params[0];
+ const std::string& resName = params[1];
auto asyncResp = std::make_shared<AsyncResp>(res);
@@ -1113,7 +1113,7 @@
crow::connections::systemBus->async_method_call(
[asyncResp, name, resName](const boost::system::error_code ec,
- const GetObjectType &getObjectType) {
+ const GetObjectType& getObjectType) {
if (ec)
{
BMCWEB_LOG_ERROR << "ObjectMapper::GetObject call failed: "
@@ -1130,7 +1130,7 @@
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
"xyz.openbmc_project.ObjectMapper", "GetObject",
- "/xyz/openbmc_project/VirtualMedia", std::array<const char *, 0>());
+ "/xyz/openbmc_project/VirtualMedia", std::array<const char*, 0>());
}
};