Update clang-format
refer: https://github.com/openbmc/docs/blob/master/style/cpp/.clang-format
`Don't break long string literals`
Tested: built bmcweb successfully and RedfishValidator Passed.
Signed-off-by: George Liu <liuxiwei@inspur.com>
Change-Id: Ib58f7c942fd3838592e043c57e0b6ffcdc3d963b
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 2ab0a1e..8890ae1 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -146,8 +146,10 @@
else if ((strcmp(errorMessage,
"xyz.openbmc_project.Common.Error.InvalidArgument") ==
0) ||
- (strcmp(errorMessage, "xyz.openbmc_project.User.Common.Error."
- "UserNameGroupFail") == 0))
+ (strcmp(
+ errorMessage,
+ "xyz.openbmc_project.User.Common.Error.UserNameGroupFail") ==
+ 0))
{
messages::propertyValueFormatError(asyncResp->res, newUser, "UserName");
}
@@ -395,9 +397,9 @@
const GetObjectType& resp) {
if (ec || resp.empty())
{
- BMCWEB_LOG_ERROR << "DBUS response error during getting of "
- "service name: "
- << ec;
+ BMCWEB_LOG_ERROR
+ << "DBUS response error during getting of service name: "
+ << ec;
LDAPConfigData empty{};
callback(false, empty, ldapType);
return;
@@ -420,15 +422,14 @@
if (ldapType == "LDAP")
{
- ldapDbusType = "xyz.openbmc_project.User.Ldap.Config."
- "Type.OpenLdap";
+ ldapDbusType =
+ "xyz.openbmc_project.User.Ldap.Config.Type.OpenLdap";
searchString = "openldap";
}
else if (ldapType == "ActiveDirectory")
{
ldapDbusType =
- "xyz.openbmc_project.User.Ldap.Config.Type."
- "ActiveDirectory";
+ "xyz.openbmc_project.User.Ldap.Config.Type.ActiveDirectory";
searchString = "active_directory";
}
else
@@ -518,9 +519,9 @@
}
}
}
- else if (interface.first ==
- "xyz.openbmc_project.User."
- "PrivilegeMapperEntry")
+ else if (
+ interface.first ==
+ "xyz.openbmc_project.User.PrivilegeMapperEntry")
{
LDAPRoleMapData roleMapData{};
for (const auto& property : interface.second)
@@ -901,8 +902,8 @@
{
#ifndef BMCWEB_ENABLE_BASIC_AUTHENTICATION
messages::actionNotSupported(
- asyncResp->res, "Setting BasicAuth when basic-auth feature "
- "is disabled");
+ asyncResp->res,
+ "Setting BasicAuth when basic-auth feature is disabled");
return;
#endif
authMethodsConfig.basic = *basicAuth;
@@ -911,9 +912,9 @@
if (cookie)
{
#ifndef BMCWEB_ENABLE_COOKIE_AUTHENTICATION
- messages::actionNotSupported(asyncResp->res,
- "Setting Cookie when cookie-auth feature "
- "is disabled");
+ messages::actionNotSupported(
+ asyncResp->res,
+ "Setting Cookie when cookie-auth feature is disabled");
return;
#endif
authMethodsConfig.cookie = *cookie;
@@ -923,8 +924,8 @@
{
#ifndef BMCWEB_ENABLE_SESSION_AUTHENTICATION
messages::actionNotSupported(
- asyncResp->res, "Setting SessionToken when session-auth feature "
- "is disabled");
+ asyncResp->res,
+ "Setting SessionToken when session-auth feature is disabled");
return;
#endif
authMethodsConfig.sessionToken = *sessionToken;
@@ -933,9 +934,9 @@
if (xToken)
{
#ifndef BMCWEB_ENABLE_XTOKEN_AUTHENTICATION
- messages::actionNotSupported(asyncResp->res,
- "Setting XToken when xtoken-auth feature "
- "is disabled");
+ messages::actionNotSupported(
+ asyncResp->res,
+ "Setting XToken when xtoken-auth feature is disabled");
return;
#endif
authMethodsConfig.xtoken = *xToken;
@@ -944,9 +945,9 @@
if (tls)
{
#ifndef BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION
- messages::actionNotSupported(asyncResp->res,
- "Setting TLS when mutual-tls-auth feature "
- "is disabled");
+ messages::actionNotSupported(
+ asyncResp->res,
+ "Setting TLS when mutual-tls-auth feature is disabled");
return;
#endif
authMethodsConfig.tls = *tls;
@@ -1798,8 +1799,7 @@
asyncResp->res.jsonValue["Links"]["Role"] =
{{"@odata.id",
- "/redfish/v1/AccountService/"
- "Roles/" +
+ "/redfish/v1/AccountService/Roles/" +
role}};
}
else if (property.first ==
@@ -1809,9 +1809,8 @@
std::get_if<bool>(&property.second);
if (userPasswordExpired == nullptr)
{
- BMCWEB_LOG_ERROR << "UserPassword"
- "Expired "
- "wasn't a bool";
+ BMCWEB_LOG_ERROR
+ << "UserPasswordExpired wasn't a bool";
messages::internalError(asyncResp->res);
return;
}
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index a316cc5..045426e 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -67,15 +67,16 @@
{"@odata.id",
"/redfish/v1/CertificateService/CertificateLocations"}};
}
- asyncResp->res.jsonValue["Actions"]
- ["#CertificateService.ReplaceCertificate"] =
- {{"target", "/redfish/v1/CertificateService/Actions/"
- "CertificateService.ReplaceCertificate"},
- {"CertificateType@Redfish.AllowableValues", {"PEM"}}};
+ asyncResp->res
+ .jsonValue["Actions"]
+ ["#CertificateService.ReplaceCertificate"] = {
+ {"target",
+ "/redfish/v1/CertificateService/Actions/CertificateService.ReplaceCertificate"},
+ {"CertificateType@Redfish.AllowableValues", {"PEM"}}};
asyncResp->res
.jsonValue["Actions"]["#CertificateService.GenerateCSR"] = {
- {"target", "/redfish/v1/CertificateService/Actions/"
- "CertificateService.GenerateCSR"}};
+ {"target",
+ "/redfish/v1/CertificateService/Actions/CertificateService.GenerateCSR"}};
});
} // requestRoutesCertificateService
@@ -235,184 +236,185 @@
*/
inline void requestRoutesCertificateActionGenerateCSR(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/CertificateService/Actions/"
- "CertificateService.GenerateCSR/")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/CertificateService/Actions/CertificateService.GenerateCSR/")
// Incorrect Privilege; Should be ConfigureManager
//.privileges(redfish::privileges::postCertificateService)
.privileges({{"ConfigureComponents"}})
- .methods(boost::beast::http::verb::post)(
- [](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- static const int rsaKeyBitLength = 2048;
+ .methods(
+ boost::beast::http::verb::
+ post)([](const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ static const int rsaKeyBitLength = 2048;
- // Required parameters
- std::string city;
- std::string commonName;
- std::string country;
- std::string organization;
- std::string organizationalUnit;
- std::string state;
- nlohmann::json certificateCollection;
+ // Required parameters
+ std::string city;
+ std::string commonName;
+ std::string country;
+ std::string organization;
+ std::string organizationalUnit;
+ std::string state;
+ nlohmann::json certificateCollection;
- // Optional parameters
- std::optional<std::vector<std::string>> optAlternativeNames =
- std::vector<std::string>();
- std::optional<std::string> optContactPerson = "";
- std::optional<std::string> optChallengePassword = "";
- std::optional<std::string> optEmail = "";
- std::optional<std::string> optGivenName = "";
- std::optional<std::string> optInitials = "";
- std::optional<int64_t> optKeyBitLength = rsaKeyBitLength;
- std::optional<std::string> optKeyCurveId = "secp384r1";
- std::optional<std::string> optKeyPairAlgorithm = "EC";
- std::optional<std::vector<std::string>> optKeyUsage =
- std::vector<std::string>();
- std::optional<std::string> optSurname = "";
- std::optional<std::string> optUnstructuredName = "";
- if (!json_util::readJson(
- req, asyncResp->res, "City", city, "CommonName",
- commonName, "ContactPerson", optContactPerson,
- "Country", country, "Organization", organization,
- "OrganizationalUnit", organizationalUnit, "State",
- state, "CertificateCollection", certificateCollection,
- "AlternativeNames", optAlternativeNames,
- "ChallengePassword", optChallengePassword, "Email",
- optEmail, "GivenName", optGivenName, "Initials",
- optInitials, "KeyBitLength", optKeyBitLength,
- "KeyCurveId", optKeyCurveId, "KeyPairAlgorithm",
- optKeyPairAlgorithm, "KeyUsage", optKeyUsage, "Surname",
- optSurname, "UnstructuredName", optUnstructuredName))
+ // Optional parameters
+ std::optional<std::vector<std::string>> optAlternativeNames =
+ std::vector<std::string>();
+ std::optional<std::string> optContactPerson = "";
+ std::optional<std::string> optChallengePassword = "";
+ std::optional<std::string> optEmail = "";
+ std::optional<std::string> optGivenName = "";
+ std::optional<std::string> optInitials = "";
+ std::optional<int64_t> optKeyBitLength = rsaKeyBitLength;
+ std::optional<std::string> optKeyCurveId = "secp384r1";
+ std::optional<std::string> optKeyPairAlgorithm = "EC";
+ std::optional<std::vector<std::string>> optKeyUsage =
+ std::vector<std::string>();
+ std::optional<std::string> optSurname = "";
+ std::optional<std::string> optUnstructuredName = "";
+ if (!json_util::readJson(
+ req, asyncResp->res, "City", city, "CommonName", commonName,
+ "ContactPerson", optContactPerson, "Country", country,
+ "Organization", organization, "OrganizationalUnit",
+ organizationalUnit, "State", state, "CertificateCollection",
+ certificateCollection, "AlternativeNames",
+ optAlternativeNames, "ChallengePassword",
+ optChallengePassword, "Email", optEmail, "GivenName",
+ optGivenName, "Initials", optInitials, "KeyBitLength",
+ optKeyBitLength, "KeyCurveId", optKeyCurveId,
+ "KeyPairAlgorithm", optKeyPairAlgorithm, "KeyUsage",
+ optKeyUsage, "Surname", optSurname, "UnstructuredName",
+ optUnstructuredName))
+ {
+ return;
+ }
+
+ // bmcweb has no way to store or decode a private key challenge
+ // password, which will likely cause bmcweb to crash on startup
+ // if this is not set on a post so not allowing the user to set
+ // value
+ if (*optChallengePassword != "")
+ {
+ messages::actionParameterNotSupported(
+ asyncResp->res, "GenerateCSR", "ChallengePassword");
+ return;
+ }
+
+ std::string certURI;
+ if (!redfish::json_util::readJson(certificateCollection,
+ asyncResp->res, "@odata.id",
+ certURI))
+ {
+ return;
+ }
+
+ std::string objectPath;
+ std::string service;
+ if (boost::starts_with(
+ certURI,
+ "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates"))
+ {
+ objectPath = certs::httpsObjectPath;
+ service = certs::httpsServiceName;
+ }
+ else if (boost::starts_with(
+ certURI,
+ "/redfish/v1/AccountService/LDAP/Certificates"))
+ {
+ objectPath = certs::ldapObjectPath;
+ service = certs::ldapServiceName;
+ }
+ else
+ {
+ messages::actionParameterNotSupported(
+ asyncResp->res, "CertificateCollection", "GenerateCSR");
+ return;
+ }
+
+ // supporting only EC and RSA algorithm
+ if (*optKeyPairAlgorithm != "EC" && *optKeyPairAlgorithm != "RSA")
+ {
+ messages::actionParameterNotSupported(
+ asyncResp->res, "KeyPairAlgorithm", "GenerateCSR");
+ return;
+ }
+
+ // supporting only 2048 key bit length for RSA algorithm due to
+ // time consumed in generating private key
+ if (*optKeyPairAlgorithm == "RSA" &&
+ *optKeyBitLength != rsaKeyBitLength)
+ {
+ messages::propertyValueNotInList(
+ asyncResp->res, std::to_string(*optKeyBitLength),
+ "KeyBitLength");
+ return;
+ }
+
+ // validate KeyUsage supporting only 1 type based on URL
+ if (boost::starts_with(
+ certURI,
+ "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates"))
+ {
+ if (optKeyUsage->size() == 0)
{
- return;
+ optKeyUsage->push_back("ServerAuthentication");
}
-
- // bmcweb has no way to store or decode a private key challenge
- // password, which will likely cause bmcweb to crash on startup
- // if this is not set on a post so not allowing the user to set
- // value
- if (*optChallengePassword != "")
+ else if (optKeyUsage->size() == 1)
{
- messages::actionParameterNotSupported(
- asyncResp->res, "GenerateCSR", "ChallengePassword");
- return;
- }
-
- std::string certURI;
- if (!redfish::json_util::readJson(certificateCollection,
- asyncResp->res, "@odata.id",
- certURI))
- {
- return;
- }
-
- std::string objectPath;
- std::string service;
- if (boost::starts_with(certURI,
- "/redfish/v1/Managers/bmc/"
- "NetworkProtocol/HTTPS/Certificates"))
- {
- objectPath = certs::httpsObjectPath;
- service = certs::httpsServiceName;
- }
- else if (boost::starts_with(
- certURI,
- "/redfish/v1/AccountService/LDAP/Certificates"))
- {
- objectPath = certs::ldapObjectPath;
- service = certs::ldapServiceName;
+ if ((*optKeyUsage)[0] != "ServerAuthentication")
+ {
+ messages::propertyValueNotInList(
+ asyncResp->res, (*optKeyUsage)[0], "KeyUsage");
+ return;
+ }
}
else
{
messages::actionParameterNotSupported(
- asyncResp->res, "CertificateCollection", "GenerateCSR");
+ asyncResp->res, "KeyUsage", "GenerateCSR");
return;
}
-
- // supporting only EC and RSA algorithm
- if (*optKeyPairAlgorithm != "EC" &&
- *optKeyPairAlgorithm != "RSA")
+ }
+ else if (boost::starts_with(
+ certURI,
+ "/redfish/v1/AccountService/LDAP/Certificates"))
+ {
+ if (optKeyUsage->size() == 0)
+ {
+ optKeyUsage->push_back("ClientAuthentication");
+ }
+ else if (optKeyUsage->size() == 1)
+ {
+ if ((*optKeyUsage)[0] != "ClientAuthentication")
+ {
+ messages::propertyValueNotInList(
+ asyncResp->res, (*optKeyUsage)[0], "KeyUsage");
+ return;
+ }
+ }
+ else
{
messages::actionParameterNotSupported(
- asyncResp->res, "KeyPairAlgorithm", "GenerateCSR");
+ asyncResp->res, "KeyUsage", "GenerateCSR");
return;
}
+ }
- // supporting only 2048 key bit length for RSA algorithm due to
- // time consumed in generating private key
- if (*optKeyPairAlgorithm == "RSA" &&
- *optKeyBitLength != rsaKeyBitLength)
- {
- messages::propertyValueNotInList(
- asyncResp->res, std::to_string(*optKeyBitLength),
- "KeyBitLength");
- return;
- }
+ // Only allow one CSR matcher at a time so setting retry
+ // time-out and timer expiry to 10 seconds for now.
+ static const int timeOut = 10;
+ if (csrMatcher)
+ {
+ messages::serviceTemporarilyUnavailable(
+ asyncResp->res, std::to_string(timeOut));
+ return;
+ }
- // validate KeyUsage supporting only 1 type based on URL
- if (boost::starts_with(certURI,
- "/redfish/v1/Managers/bmc/"
- "NetworkProtocol/HTTPS/Certificates"))
- {
- if (optKeyUsage->size() == 0)
- {
- optKeyUsage->push_back("ServerAuthentication");
- }
- else if (optKeyUsage->size() == 1)
- {
- if ((*optKeyUsage)[0] != "ServerAuthentication")
- {
- messages::propertyValueNotInList(
- asyncResp->res, (*optKeyUsage)[0], "KeyUsage");
- return;
- }
- }
- else
- {
- messages::actionParameterNotSupported(
- asyncResp->res, "KeyUsage", "GenerateCSR");
- return;
- }
- }
- else if (boost::starts_with(
- certURI,
- "/redfish/v1/AccountService/LDAP/Certificates"))
- {
- if (optKeyUsage->size() == 0)
- {
- optKeyUsage->push_back("ClientAuthentication");
- }
- else if (optKeyUsage->size() == 1)
- {
- if ((*optKeyUsage)[0] != "ClientAuthentication")
- {
- messages::propertyValueNotInList(
- asyncResp->res, (*optKeyUsage)[0], "KeyUsage");
- return;
- }
- }
- else
- {
- messages::actionParameterNotSupported(
- asyncResp->res, "KeyUsage", "GenerateCSR");
- return;
- }
- }
-
- // Only allow one CSR matcher at a time so setting retry
- // time-out and timer expiry to 10 seconds for now.
- static const int timeOut = 10;
- if (csrMatcher)
- {
- messages::serviceTemporarilyUnavailable(
- asyncResp->res, std::to_string(timeOut));
- return;
- }
-
- // Make this static so it survives outside this method
- static boost::asio::steady_timer timeout(*req.ioService);
- timeout.expires_after(std::chrono::seconds(timeOut));
- timeout.async_wait([asyncResp](
- const boost::system::error_code& ec) {
+ // Make this static so it survives outside this method
+ static boost::asio::steady_timer timeout(*req.ioService);
+ timeout.expires_after(std::chrono::seconds(timeOut));
+ timeout.async_wait(
+ [asyncResp](const boost::system::error_code& ec) {
csrMatcher = nullptr;
if (ec)
{
@@ -428,65 +430,61 @@
messages::internalError(asyncResp->res);
});
- // create a matcher to wait on CSR object
- BMCWEB_LOG_DEBUG << "create matcher with path " << objectPath;
- std::string match(
- "type='signal',"
- "interface='org.freedesktop.DBus.ObjectManager',"
- "path='" +
- objectPath +
- "',"
- "member='InterfacesAdded'");
- csrMatcher = std::make_unique<sdbusplus::bus::match::match>(
- *crow::connections::systemBus, match,
- [asyncResp, service, objectPath,
- certURI](sdbusplus::message::message& m) {
- timeout.cancel();
- if (m.is_method_error())
+ // create a matcher to wait on CSR object
+ BMCWEB_LOG_DEBUG << "create matcher with path " << objectPath;
+ std::string match("type='signal',"
+ "interface='org.freedesktop.DBus.ObjectManager',"
+ "path='" +
+ objectPath +
+ "',"
+ "member='InterfacesAdded'");
+ csrMatcher = std::make_unique<sdbusplus::bus::match::match>(
+ *crow::connections::systemBus, match,
+ [asyncResp, service, objectPath,
+ certURI](sdbusplus::message::message& m) {
+ timeout.cancel();
+ if (m.is_method_error())
+ {
+ BMCWEB_LOG_ERROR << "Dbus method error!!!";
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ std::vector<
+ std::pair<std::string,
+ std::vector<std::pair<
+ std::string, std::variant<std::string>>>>>
+ interfacesProperties;
+ sdbusplus::message::object_path csrObjectPath;
+ m.read(csrObjectPath, interfacesProperties);
+ BMCWEB_LOG_DEBUG << "CSR object added" << csrObjectPath.str;
+ for (auto& interface : interfacesProperties)
+ {
+ if (interface.first == "xyz.openbmc_project.Certs.CSR")
{
- BMCWEB_LOG_ERROR << "Dbus method error!!!";
- messages::internalError(asyncResp->res);
- return;
+ getCSR(asyncResp, certURI, service, objectPath,
+ csrObjectPath.str);
+ break;
}
- std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string,
- std::variant<std::string>>>>>
- interfacesProperties;
- sdbusplus::message::object_path csrObjectPath;
- m.read(csrObjectPath, interfacesProperties);
- BMCWEB_LOG_DEBUG << "CSR object added"
- << csrObjectPath.str;
- for (auto& interface : interfacesProperties)
- {
- if (interface.first ==
- "xyz.openbmc_project.Certs.CSR")
- {
- getCSR(asyncResp, certURI, service, objectPath,
- csrObjectPath.str);
- break;
- }
- }
- });
- crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code& ec,
- const std::string&) {
- if (ec)
- {
- BMCWEB_LOG_ERROR << "DBUS response error: "
- << ec.message();
- messages::internalError(asyncResp->res);
- return;
- }
- },
- service, objectPath, "xyz.openbmc_project.Certs.CSR.Create",
- "GenerateCSR", *optAlternativeNames, *optChallengePassword,
- city, commonName, *optContactPerson, country, *optEmail,
- *optGivenName, *optInitials, *optKeyBitLength,
- *optKeyCurveId, *optKeyPairAlgorithm, *optKeyUsage,
- organization, organizationalUnit, state, *optSurname,
- *optUnstructuredName);
- });
+ }
+ });
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code& ec,
+ const std::string&) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR << "DBUS response error: "
+ << ec.message();
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ },
+ service, objectPath, "xyz.openbmc_project.Certs.CSR.Create",
+ "GenerateCSR", *optAlternativeNames, *optChallengePassword,
+ city, commonName, *optContactPerson, country, *optEmail,
+ *optGivenName, *optInitials, *optKeyBitLength, *optKeyCurveId,
+ *optKeyPairAlgorithm, *optKeyUsage, organization,
+ organizationalUnit, state, *optSurname, *optUnstructuredName);
+ });
} // requestRoutesCertificateActionGenerateCSR
/**
@@ -676,8 +674,9 @@
*/
inline void requestRoutesCertificateActionsReplaceCertificate(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/CertificateService/Actions/"
- "CertificateService.ReplaceCertificate/")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/CertificateService/Actions/CertificateService.ReplaceCertificate/")
.privileges(redfish::privileges::postCertificateService)
.methods(
boost::beast::http::verb::
@@ -730,9 +729,9 @@
std::string objectPath;
std::string name;
std::string service;
- if (boost::starts_with(certURI,
- "/redfish/v1/Managers/bmc/NetworkProtocol/"
- "HTTPS/Certificates/"))
+ if (boost::starts_with(
+ certURI,
+ "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/"))
{
objectPath = std::string(certs::httpsObjectPath) + "/" +
std::to_string(id);
@@ -861,8 +860,7 @@
{
members.push_back(
{{"@odata.id",
- "/redfish/v1/Managers/bmc/"
- "NetworkProtocol/HTTPS/Certificates/" +
+ "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/" +
std::to_string(id)}});
}
}
@@ -876,60 +874,57 @@
BMCWEB_ROUTE(app,
"/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/")
.privileges(redfish::privileges::postCertificateCollection)
- .methods(boost::beast::http::verb::post)(
- [](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- BMCWEB_LOG_DEBUG << "HTTPSCertificateCollection::doPost";
+ .methods(
+ boost::beast::http::verb::
+ post)([](const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ BMCWEB_LOG_DEBUG << "HTTPSCertificateCollection::doPost";
- asyncResp->res.jsonValue = {
- {"Name", "HTTPS Certificate"},
- {"Description", "HTTPS Certificate"}};
+ asyncResp->res.jsonValue = {{"Name", "HTTPS Certificate"},
+ {"Description", "HTTPS Certificate"}};
- std::string certFileBody =
- getCertificateFromReqBody(asyncResp, req);
+ std::string certFileBody =
+ getCertificateFromReqBody(asyncResp, req);
- if (certFileBody.empty())
- {
- BMCWEB_LOG_ERROR
- << "Cannot get certificate from request body.";
- messages::unrecognizedRequestBody(asyncResp->res);
- return;
- }
+ if (certFileBody.empty())
+ {
+ BMCWEB_LOG_ERROR << "Cannot get certificate from request body.";
+ messages::unrecognizedRequestBody(asyncResp->res);
+ return;
+ }
- std::shared_ptr<CertificateFile> certFile =
- std::make_shared<CertificateFile>(certFileBody);
+ std::shared_ptr<CertificateFile> certFile =
+ std::make_shared<CertificateFile>(certFileBody);
- crow::connections::systemBus->async_method_call(
- [asyncResp, certFile](const boost::system::error_code ec,
- const std::string& objectPath) {
- if (ec)
- {
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
- messages::internalError(asyncResp->res);
- return;
- }
- long certId = getIDFromURL(objectPath);
- if (certId < 0)
- {
- BMCWEB_LOG_ERROR << "Invalid objectPath value"
- << objectPath;
- messages::internalError(asyncResp->res);
- return;
- }
- std::string certURL =
- "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/"
- "Certificates/" +
- std::to_string(certId);
- getCertificateProperties(
- asyncResp, objectPath, certs::httpsServiceName,
- certId, certURL, "HTTPS Certificate");
- BMCWEB_LOG_DEBUG << "HTTPS certificate install file="
- << certFile->getCertFilePath();
- },
- certs::httpsServiceName, certs::httpsObjectPath,
- certs::certInstallIntf, "Install",
- certFile->getCertFilePath());
- });
+ crow::connections::systemBus->async_method_call(
+ [asyncResp, certFile](const boost::system::error_code ec,
+ const std::string& objectPath) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ long certId = getIDFromURL(objectPath);
+ if (certId < 0)
+ {
+ BMCWEB_LOG_ERROR << "Invalid objectPath value"
+ << objectPath;
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ std::string certURL =
+ "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/" +
+ std::to_string(certId);
+ getCertificateProperties(asyncResp, objectPath,
+ certs::httpsServiceName, certId,
+ certURL, "HTTPS Certificate");
+ BMCWEB_LOG_DEBUG << "HTTPS certificate install file="
+ << certFile->getCertFilePath();
+ },
+ certs::httpsServiceName, certs::httpsObjectPath,
+ certs::certInstallIntf, "Install", certFile->getCertFilePath());
+ });
} // requestRoutesHTTPSCertificateCollection
/**
@@ -1022,49 +1017,47 @@
{
BMCWEB_ROUTE(app, "/redfish/v1/AccountService/LDAP/Certificates/")
.privileges(redfish::privileges::getCertificateCollection)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request&,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- asyncResp->res.jsonValue = {
- {"@odata.id",
- "/redfish/v1/AccountService/LDAP/Certificates"},
- {"@odata.type",
- "#CertificateCollection.CertificateCollection"},
- {"Name", "LDAP Certificates Collection"},
- {"Description",
- "A Collection of LDAP certificate instances"}};
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ asyncResp->res.jsonValue = {
+ {"@odata.id", "/redfish/v1/AccountService/LDAP/Certificates"},
+ {"@odata.type", "#CertificateCollection.CertificateCollection"},
+ {"Name", "LDAP Certificates Collection"},
+ {"Description", "A Collection of LDAP certificate instances"}};
- crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec,
- const ManagedObjectType& certs) {
- nlohmann::json& members =
- asyncResp->res.jsonValue["Members"];
- nlohmann::json& count =
- asyncResp->res.jsonValue["Members@odata.count"];
- members = nlohmann::json::array();
- count = 0;
- if (ec)
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
+ const ManagedObjectType& certs) {
+ nlohmann::json& members =
+ asyncResp->res.jsonValue["Members"];
+ nlohmann::json& count =
+ asyncResp->res.jsonValue["Members@odata.count"];
+ members = nlohmann::json::array();
+ count = 0;
+ if (ec)
+ {
+ BMCWEB_LOG_WARNING << "LDAP certificate query failed: "
+ << ec;
+ return;
+ }
+ for (const auto& cert : certs)
+ {
+ long id = getIDFromURL(cert.first.str);
+ if (id >= 0)
{
- BMCWEB_LOG_WARNING
- << "LDAP certificate query failed: " << ec;
- return;
+ members.push_back(
+ {{"@odata.id",
+ "/redfish/v1/AccountService/LDAP/Certificates/" +
+ std::to_string(id)}});
}
- for (const auto& cert : certs)
- {
- long id = getIDFromURL(cert.first.str);
- if (id >= 0)
- {
- members.push_back(
- {{"@odata.id", "/redfish/v1/AccountService/"
- "LDAP/Certificates/" +
- std::to_string(id)}});
- }
- }
- count = members.size();
- },
- certs::ldapServiceName, certs::ldapObjectPath,
- certs::dbusObjManagerIntf, "GetManagedObjects");
- });
+ }
+ count = members.size();
+ },
+ certs::ldapServiceName, certs::ldapObjectPath,
+ certs::dbusObjManagerIntf, "GetManagedObjects");
+ });
BMCWEB_ROUTE(app, "/redfish/v1/AccountService/LDAP/Certificates/")
.privileges(redfish::privileges::postCertificateCollection)
@@ -1156,98 +1149,96 @@
{
BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/Truststore/Certificates/")
.privileges(redfish::privileges::getCertificate)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request&,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- asyncResp->res.jsonValue = {
- {"@odata.id",
- "/redfish/v1/Managers/bmc/Truststore/Certificates/"},
- {"@odata.type",
- "#CertificateCollection.CertificateCollection"},
- {"Name", "TrustStore Certificates Collection"},
- {"Description",
- "A Collection of TrustStore certificate instances"}};
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ asyncResp->res.jsonValue = {
+ {"@odata.id",
+ "/redfish/v1/Managers/bmc/Truststore/Certificates/"},
+ {"@odata.type", "#CertificateCollection.CertificateCollection"},
+ {"Name", "TrustStore Certificates Collection"},
+ {"Description",
+ "A Collection of TrustStore certificate instances"}};
- crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec,
- const ManagedObjectType& certs) {
- if (ec)
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
+ const ManagedObjectType& certs) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ nlohmann::json& members =
+ asyncResp->res.jsonValue["Members"];
+ members = nlohmann::json::array();
+ for (const auto& cert : certs)
+ {
+ long id = getIDFromURL(cert.first.str);
+ if (id >= 0)
{
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
- messages::internalError(asyncResp->res);
- return;
+ members.push_back(
+ {{"@odata.id",
+ "/redfish/v1/Managers/bmc/Truststore/Certificates/" +
+ std::to_string(id)}});
}
- nlohmann::json& members =
- asyncResp->res.jsonValue["Members"];
- members = nlohmann::json::array();
- for (const auto& cert : certs)
- {
- long id = getIDFromURL(cert.first.str);
- if (id >= 0)
- {
- members.push_back(
- {{"@odata.id", "/redfish/v1/Managers/bmc/"
- "Truststore/Certificates/" +
- std::to_string(id)}});
- }
- }
- asyncResp->res.jsonValue["Members@odata.count"] =
- members.size();
- },
- certs::authorityServiceName, certs::authorityObjectPath,
- certs::dbusObjManagerIntf, "GetManagedObjects");
- });
+ }
+ asyncResp->res.jsonValue["Members@odata.count"] =
+ members.size();
+ },
+ certs::authorityServiceName, certs::authorityObjectPath,
+ certs::dbusObjManagerIntf, "GetManagedObjects");
+ });
BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/Truststore/Certificates/")
.privileges(redfish::privileges::postCertificateCollection)
- .methods(boost::beast::http::verb::post)(
- [](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- std::string certFileBody =
- getCertificateFromReqBody(asyncResp, req);
+ .methods(
+ boost::beast::http::verb::
+ post)([](const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ std::string certFileBody =
+ getCertificateFromReqBody(asyncResp, req);
- if (certFileBody.empty())
- {
- BMCWEB_LOG_ERROR
- << "Cannot get certificate from request body.";
- messages::unrecognizedRequestBody(asyncResp->res);
- return;
- }
+ if (certFileBody.empty())
+ {
+ BMCWEB_LOG_ERROR << "Cannot get certificate from request body.";
+ messages::unrecognizedRequestBody(asyncResp->res);
+ return;
+ }
- std::shared_ptr<CertificateFile> certFile =
- std::make_shared<CertificateFile>(certFileBody);
- crow::connections::systemBus->async_method_call(
- [asyncResp, certFile](const boost::system::error_code ec,
- const std::string& objectPath) {
- if (ec)
- {
- BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
- messages::internalError(asyncResp->res);
- return;
- }
- long certId = getIDFromURL(objectPath);
- if (certId < 0)
- {
- BMCWEB_LOG_ERROR << "Invalid objectPath value"
- << objectPath;
- messages::internalError(asyncResp->res);
- return;
- }
- std::string certURL = "/redfish/v1/Managers/bmc/"
- "Truststore/Certificates/" +
- std::to_string(certId);
+ std::shared_ptr<CertificateFile> certFile =
+ std::make_shared<CertificateFile>(certFileBody);
+ crow::connections::systemBus->async_method_call(
+ [asyncResp, certFile](const boost::system::error_code ec,
+ const std::string& objectPath) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR << "DBUS response error: " << ec;
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ long certId = getIDFromURL(objectPath);
+ if (certId < 0)
+ {
+ BMCWEB_LOG_ERROR << "Invalid objectPath value"
+ << objectPath;
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ std::string certURL =
+ "/redfish/v1/Managers/bmc/Truststore/Certificates/" +
+ std::to_string(certId);
- getCertificateProperties(
- asyncResp, objectPath, certs::authorityServiceName,
- certId, certURL, "TrustStore Certificate");
- BMCWEB_LOG_DEBUG
- << "TrustStore certificate install file="
- << certFile->getCertFilePath();
- },
- certs::authorityServiceName, certs::authorityObjectPath,
- certs::certInstallIntf, "Install",
- certFile->getCertFilePath());
- });
+ getCertificateProperties(
+ asyncResp, objectPath, certs::authorityServiceName,
+ certId, certURL, "TrustStore Certificate");
+ BMCWEB_LOG_DEBUG << "TrustStore certificate install file="
+ << certFile->getCertFilePath();
+ },
+ certs::authorityServiceName, certs::authorityObjectPath,
+ certs::certInstallIntf, "Install", certFile->getCertFilePath());
+ });
} // requestRoutesTrustStoreCertificateCollection
/**
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 745f5af..8fc9129 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -189,8 +189,7 @@
const std::variant<std::string>& property) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error for "
- "Location";
+ BMCWEB_LOG_DEBUG << "DBUS response error for Location";
messages::internalError(asyncResp->res);
return;
}
@@ -198,8 +197,7 @@
const std::string* value = std::get_if<std::string>(&property);
if (value == nullptr)
{
- BMCWEB_LOG_DEBUG << "Null value returned "
- "for locaton code";
+ BMCWEB_LOG_DEBUG << "Null value returned for locaton code";
messages::internalError(asyncResp->res);
return;
}
@@ -219,16 +217,14 @@
const std::variant<std::string>& chassisUUID) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error for "
- "UUID";
+ BMCWEB_LOG_DEBUG << "DBUS response error for UUID";
messages::internalError(asyncResp->res);
return;
}
const std::string* value = std::get_if<std::string>(&chassisUUID);
if (value == nullptr)
{
- BMCWEB_LOG_DEBUG << "Null value returned "
- "for UUID";
+ BMCWEB_LOG_DEBUG << "Null value returned for UUID";
messages::internalError(asyncResp->res);
return;
}
@@ -338,12 +334,10 @@
connectionNames[0].second;
const std::array<const char*, 2> hasIndicatorLed = {
"xyz.openbmc_project.Inventory.Item.Panel",
- "xyz.openbmc_project.Inventory.Item.Board."
- "Motherboard"};
+ "xyz.openbmc_project.Inventory.Item.Board.Motherboard"};
const std::string assetTagInterface =
- "xyz.openbmc_project.Inventory.Decorator."
- "AssetTag";
+ "xyz.openbmc_project.Inventory.Decorator.AssetTag";
if (std::find(interfaces2.begin(), interfaces2.end(),
assetTagInterface) != interfaces2.end())
{
@@ -354,8 +348,7 @@
if (ec)
{
BMCWEB_LOG_DEBUG
- << "DBus response error for "
- "AssetTag";
+ << "DBus response error for AssetTag";
messages::internalError(asyncResp->res);
return;
}
@@ -365,8 +358,7 @@
if (assetTag == nullptr)
{
BMCWEB_LOG_DEBUG
- << "Null value returned "
- "for Chassis AssetTag";
+ << "Null value returned for Chassis AssetTag";
messages::internalError(asyncResp->res);
return;
}
@@ -458,9 +450,9 @@
{
getChassisUUID(asyncResp, connectionName, path);
}
- else if (interface ==
- "xyz.openbmc_project.Inventory."
- "Decorator.LocationCode")
+ else if (
+ interface ==
+ "xyz.openbmc_project.Inventory.Decorator.LocationCode")
{
getChassisLocationCode(asyncResp,
connectionName, path);
@@ -513,8 +505,7 @@
{
asyncResp->res.addHeader(
boost::beast::http::field::warning,
- "299 - \"IndicatorLED is deprecated. Use "
- "LocationIndicatorActive instead.\"");
+ "299 - \"IndicatorLED is deprecated. Use LocationIndicatorActive instead.\"");
}
const std::array<const char*, 2> interfaces = {
@@ -562,8 +553,7 @@
const std::array<const char*, 2> hasIndicatorLed = {
"xyz.openbmc_project.Inventory.Item.Panel",
- "xyz.openbmc_project.Inventory.Item.Board."
- "Motherboard"};
+ "xyz.openbmc_project.Inventory.Item.Board.Motherboard"};
bool indicatorChassis = false;
for (const char* interface : hasIndicatorLed)
{
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 82d44ae..6723d5b 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1089,8 +1089,8 @@
{
// Can have multiple subdomains
// Top Level Domain's min length is 2 character
- const std::regex pattern("^([A-Za-z0-9][a-zA-Z0-9\\-]{1,61}|[a-zA-Z0-9]"
- "{1,30}\\.)*[a-zA-Z]{2,}$");
+ const std::regex pattern(
+ "^([A-Za-z0-9][a-zA-Z0-9\\-]{1,61}|[a-zA-Z0-9]{1,30}\\.)*[a-zA-Z]{2,}$");
return std::regex_match(domainname, pattern);
}
diff --git a/redfish-core/lib/event_service.hpp b/redfish-core/lib/event_service.hpp
index b802280..d273aea 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -44,48 +44,47 @@
{
BMCWEB_ROUTE(app, "/redfish/v1/EventService/")
.privileges(redfish::privileges::getEventService)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request&,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- asyncResp->res.jsonValue = {
- {"@odata.type", "#EventService.v1_5_0.EventService"},
- {"Id", "EventService"},
- {"Name", "Event Service"},
- {"Subscriptions",
- {{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}},
- {"Actions",
- {{"#EventService.SubmitTestEvent",
- {{"target", "/redfish/v1/EventService/Actions/"
- "EventService.SubmitTestEvent"}}}}},
- {"@odata.id", "/redfish/v1/EventService"}};
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ asyncResp->res.jsonValue = {
+ {"@odata.type", "#EventService.v1_5_0.EventService"},
+ {"Id", "EventService"},
+ {"Name", "Event Service"},
+ {"Subscriptions",
+ {{"@odata.id", "/redfish/v1/EventService/Subscriptions"}}},
+ {"Actions",
+ {{"#EventService.SubmitTestEvent",
+ {{"target",
+ "/redfish/v1/EventService/Actions/EventService.SubmitTestEvent"}}}}},
+ {"@odata.id", "/redfish/v1/EventService"}};
- const persistent_data::EventServiceConfig eventServiceConfig =
- persistent_data::EventServiceStore::getInstance()
- .getEventServiceConfig();
+ const persistent_data::EventServiceConfig eventServiceConfig =
+ persistent_data::EventServiceStore::getInstance()
+ .getEventServiceConfig();
- asyncResp->res.jsonValue["Status"]["State"] =
- (eventServiceConfig.enabled ? "Enabled" : "Disabled");
- asyncResp->res.jsonValue["ServiceEnabled"] =
- eventServiceConfig.enabled;
- asyncResp->res.jsonValue["DeliveryRetryAttempts"] =
- eventServiceConfig.retryAttempts;
- asyncResp->res.jsonValue["DeliveryRetryIntervalSeconds"] =
- eventServiceConfig.retryTimeoutInterval;
- asyncResp->res.jsonValue["EventFormatTypes"] =
- supportedEvtFormatTypes;
- asyncResp->res.jsonValue["RegistryPrefixes"] =
- supportedRegPrefixes;
- asyncResp->res.jsonValue["ResourceTypes"] =
- supportedResourceTypes;
+ asyncResp->res.jsonValue["Status"]["State"] =
+ (eventServiceConfig.enabled ? "Enabled" : "Disabled");
+ asyncResp->res.jsonValue["ServiceEnabled"] =
+ eventServiceConfig.enabled;
+ asyncResp->res.jsonValue["DeliveryRetryAttempts"] =
+ eventServiceConfig.retryAttempts;
+ asyncResp->res.jsonValue["DeliveryRetryIntervalSeconds"] =
+ eventServiceConfig.retryTimeoutInterval;
+ asyncResp->res.jsonValue["EventFormatTypes"] =
+ supportedEvtFormatTypes;
+ asyncResp->res.jsonValue["RegistryPrefixes"] = supportedRegPrefixes;
+ asyncResp->res.jsonValue["ResourceTypes"] = supportedResourceTypes;
- nlohmann::json supportedSSEFilters = {
- {"EventFormatType", true}, {"MessageId", true},
- {"MetricReportDefinition", true}, {"RegistryPrefix", true},
- {"OriginResource", false}, {"ResourceType", false}};
+ nlohmann::json supportedSSEFilters = {
+ {"EventFormatType", true}, {"MessageId", true},
+ {"MetricReportDefinition", true}, {"RegistryPrefix", true},
+ {"OriginResource", false}, {"ResourceType", false}};
- asyncResp->res.jsonValue["SSEFilterPropertiesSupported"] =
- supportedSSEFilters;
- });
+ asyncResp->res.jsonValue["SSEFilterPropertiesSupported"] =
+ supportedSSEFilters;
+ });
BMCWEB_ROUTE(app, "/redfish/v1/EventService/")
.privileges(redfish::privileges::patchEventService)
diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp
index 107a5fa..54166a7 100644
--- a/redfish-core/lib/hypervisor_system.hpp
+++ b/redfish-core/lib/hypervisor_system.hpp
@@ -58,26 +58,26 @@
aResp->res.jsonValue["PowerState"] = "On";
aResp->res.jsonValue["Status"]["State"] = "Enabled";
}
- else if (*s == "xyz.openbmc_project.State.Host.HostState."
- "Quiesced")
+ else if (*s == "xyz.openbmc_project.State.Host.HostState.Quiesced")
{
aResp->res.jsonValue["PowerState"] = "On";
aResp->res.jsonValue["Status"]["State"] = "Quiesced";
}
- else if (*s == "xyz.openbmc_project.State.Host.HostState."
- "Standby")
+ else if (*s == "xyz.openbmc_project.State.Host.HostState.Standby")
{
aResp->res.jsonValue["PowerState"] = "On";
aResp->res.jsonValue["Status"]["State"] = "StandbyOffline";
}
- else if (*s == "xyz.openbmc_project.State.Host.HostState."
- "TransitioningToRunning")
+ else if (
+ *s ==
+ "xyz.openbmc_project.State.Host.HostState.TransitioningToRunning")
{
aResp->res.jsonValue["PowerState"] = "PoweringOn";
aResp->res.jsonValue["Status"]["State"] = "Starting";
}
- else if (*s == "xyz.openbmc_project.State.Host.HostState."
- "TransitioningToOff")
+ else if (
+ *s ==
+ "xyz.openbmc_project.State.Host.HostState.TransitioningToOff")
{
aResp->res.jsonValue["PowerState"] = "PoweringOff";
aResp->res.jsonValue["Status"]["State"] = "Enabled";
@@ -727,43 +727,43 @@
BMCWEB_ROUTE(app, "/redfish/v1/Systems/hypervisor/")
.privileges(redfish::privileges::getComputerSystem)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request&,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code ec,
- const std::variant<std::string>& /*hostName*/) {
- if (ec)
- {
- messages::resourceNotFound(asyncResp->res, "System",
- "hypervisor");
- return;
- }
- BMCWEB_LOG_DEBUG << "Hypervisor is available";
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec,
+ const std::variant<std::string>& /*hostName*/) {
+ if (ec)
+ {
+ messages::resourceNotFound(asyncResp->res, "System",
+ "hypervisor");
+ return;
+ }
+ BMCWEB_LOG_DEBUG << "Hypervisor is available";
- asyncResp->res.jsonValue["@odata.type"] =
- "#ComputerSystem.v1_6_0.ComputerSystem";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/hypervisor";
- asyncResp->res.jsonValue["Description"] = "Hypervisor";
- asyncResp->res.jsonValue["Name"] = "Hypervisor";
- asyncResp->res.jsonValue["Id"] = "hypervisor";
- asyncResp->res.jsonValue["SystemType"] = "OS";
- asyncResp->res.jsonValue["Links"]["ManagedBy"] = {
- {{"@odata.id", "/redfish/v1/Managers/bmc"}}};
- asyncResp->res.jsonValue["EthernetInterfaces"] = {
- {"@odata.id", "/redfish/v1/Systems/hypervisor/"
- "EthernetInterfaces"}};
- getHypervisorState(asyncResp);
- getHypervisorActions(asyncResp);
- // TODO: Add "SystemType" : "hypervisor"
- },
- "xyz.openbmc_project.Settings",
- "/xyz/openbmc_project/network/hypervisor",
- "org.freedesktop.DBus.Properties", "Get",
- "xyz.openbmc_project.Network.SystemConfiguration",
- "HostName");
- });
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#ComputerSystem.v1_6_0.ComputerSystem";
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Systems/hypervisor";
+ asyncResp->res.jsonValue["Description"] = "Hypervisor";
+ asyncResp->res.jsonValue["Name"] = "Hypervisor";
+ asyncResp->res.jsonValue["Id"] = "hypervisor";
+ asyncResp->res.jsonValue["SystemType"] = "OS";
+ asyncResp->res.jsonValue["Links"]["ManagedBy"] = {
+ {{"@odata.id", "/redfish/v1/Managers/bmc"}}};
+ asyncResp->res.jsonValue["EthernetInterfaces"] = {
+ {"@odata.id",
+ "/redfish/v1/Systems/hypervisor/EthernetInterfaces"}};
+ getHypervisorState(asyncResp);
+ getHypervisorActions(asyncResp);
+ // TODO: Add "SystemType" : "hypervisor"
+ },
+ "xyz.openbmc_project.Settings",
+ "/xyz/openbmc_project/network/hypervisor",
+ "org.freedesktop.DBus.Properties", "Get",
+ "xyz.openbmc_project.Network.SystemConfiguration", "HostName");
+ });
/**
* HypervisorInterfaceCollection class to handle the GET and PATCH on
@@ -772,58 +772,58 @@
BMCWEB_ROUTE(app, "/redfish/v1/Systems/hypervisor/EthernetInterfaces/")
.privileges(redfish::privileges::getEthernetInterfaceCollection)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request&,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- const std::array<const char*, 1> interfaces = {
- "xyz.openbmc_project.Network.EthernetInterface"};
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ 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) {
- if (error)
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code error,
+ const std::vector<std::string>& ifaceList) {
+ if (error)
+ {
+ messages::resourceNotFound(asyncResp->res, "System",
+ "hypervisor");
+ return;
+ }
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#EthernetInterfaceCollection."
+ "EthernetInterfaceCollection";
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Systems/hypervisor/EthernetInterfaces";
+ asyncResp->res.jsonValue["Name"] = "Hypervisor Ethernet "
+ "Interface Collection";
+ asyncResp->res.jsonValue["Description"] =
+ "Collection of Virtual Management "
+ "Interfaces for the hypervisor";
+
+ nlohmann::json& ifaceArray =
+ asyncResp->res.jsonValue["Members"];
+ ifaceArray = nlohmann::json::array();
+ for (const std::string& iface : ifaceList)
+ {
+ sdbusplus::message::object_path path(iface);
+ std::string name = path.filename();
+ if (name.empty())
{
- messages::resourceNotFound(asyncResp->res, "System",
- "hypervisor");
- return;
+ continue;
}
- asyncResp->res.jsonValue["@odata.type"] =
- "#EthernetInterfaceCollection."
- "EthernetInterfaceCollection";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/hypervisor/EthernetInterfaces";
- asyncResp->res.jsonValue["Name"] =
- "Hypervisor Ethernet "
- "Interface Collection";
- asyncResp->res.jsonValue["Description"] =
- "Collection of Virtual Management "
- "Interfaces for the hypervisor";
- nlohmann::json& ifaceArray =
- asyncResp->res.jsonValue["Members"];
- ifaceArray = nlohmann::json::array();
- for (const std::string& iface : ifaceList)
- {
- sdbusplus::message::object_path path(iface);
- std::string name = path.filename();
- if (name.empty())
- {
- continue;
- }
-
- ifaceArray.push_back(
- {{"@odata.id", "/redfish/v1/Systems/hypervisor/"
- "EthernetInterfaces/" +
- name}});
- }
- asyncResp->res.jsonValue["Members@odata.count"] =
- ifaceArray.size();
- },
- "xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
- "/xyz/openbmc_project/network/hypervisor", 0, interfaces);
- });
+ ifaceArray.push_back(
+ {{"@odata.id",
+ "/redfish/v1/Systems/hypervisor/EthernetInterfaces/" +
+ name}});
+ }
+ asyncResp->res.jsonValue["Members@odata.count"] =
+ ifaceArray.size();
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
+ "/xyz/openbmc_project/network/hypervisor", 0, interfaces);
+ });
BMCWEB_ROUTE(app,
"/redfish/v1/Systems/hypervisor/EthernetInterfaces/<str>/")
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 92caac9..65b12f3 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -495,8 +495,8 @@
}
}
- if (dumpStatus != "xyz.openbmc_project.Common.Progress."
- "OperationStatus.Completed" &&
+ if (dumpStatus !=
+ "xyz.openbmc_project.Common.Progress.OperationStatus.Completed" &&
!dumpStatus.empty())
{
// Dump status is not Complete, no need to enumerate
@@ -645,8 +645,8 @@
}
}
- if (dumpStatus != "xyz.openbmc_project.Common.Progress."
- "OperationStatus.Completed" &&
+ if (dumpStatus !=
+ "xyz.openbmc_project.Common.Progress.OperationStatus.Completed" &&
!dumpStatus.empty())
{
// Dump status is not Complete
@@ -831,8 +831,8 @@
{
if (!diagnosticDataType)
{
- BMCWEB_LOG_ERROR << "CreateDump action parameter "
- "'DiagnosticDataType' not found!";
+ BMCWEB_LOG_ERROR
+ << "CreateDump action parameter 'DiagnosticDataType' not found!";
messages::actionParameterMissing(
asyncResp->res, "CollectDiagnosticData", "DiagnosticDataType");
return;
@@ -1002,8 +1002,8 @@
nlohmann::json& logServiceArrayLocal =
asyncResp->res.jsonValue["Members"];
logServiceArrayLocal.push_back(
- {{"@odata.id", "/redfish/v1/Systems/system/"
- "LogServices/PostCodes"}});
+ {{"@odata.id",
+ "/redfish/v1/Systems/system/LogServices/PostCodes"}});
asyncResp->res
.jsonValue["Members@odata.count"] =
logServiceArrayLocal.size();
@@ -1048,8 +1048,8 @@
"/redfish/v1/Systems/system/LogServices/EventLog/Entries"}};
asyncResp->res.jsonValue["Actions"]["#LogService.ClearLog"] = {
- {"target", "/redfish/v1/Systems/system/LogServices/EventLog/"
- "Actions/LogService.ClearLog"}};
+ {"target",
+ "/redfish/v1/Systems/system/LogServices/EventLog/Actions/LogService.ClearLog"}};
});
}
@@ -1480,8 +1480,7 @@
nlohmann::json& thisEntry = entriesArray.back();
thisEntry["@odata.type"] = "#LogEntry.v1_8_0.LogEntry";
thisEntry["@odata.id"] =
- "/redfish/v1/Systems/system/"
- "LogServices/EventLog/Entries/" +
+ "/redfish/v1/Systems/system/LogServices/EventLog/Entries/" +
std::to_string(*id);
thisEntry["Name"] = "System Event Log Entry";
thisEntry["Id"] = std::to_string(*id);
@@ -1497,9 +1496,7 @@
if (filePath != nullptr)
{
thisEntry["AdditionalDataURI"] =
- "/redfish/v1/Systems/system/LogServices/"
- "EventLog/"
- "Entries/" +
+ "/redfish/v1/Systems/system/LogServices/EventLog/Entries/" +
std::to_string(*id) + "/attachment";
}
}
@@ -1543,9 +1540,9 @@
}
if (ec)
{
- BMCWEB_LOG_ERROR << "EventLogEntry (DBus) "
- "resp_handler got error "
- << ec;
+ BMCWEB_LOG_ERROR
+ << "EventLogEntry (DBus) resp_handler got error "
+ << ec;
messages::internalError(asyncResp->res);
return;
}
@@ -1620,8 +1617,7 @@
asyncResp->res.jsonValue["@odata.type"] =
"#LogEntry.v1_8_0.LogEntry";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/EventLog/"
- "Entries/" +
+ "/redfish/v1/Systems/system/LogServices/EventLog/Entries/" +
std::to_string(*id);
asyncResp->res.jsonValue["Name"] =
"System Event Log Entry";
@@ -1638,9 +1634,7 @@
if (filePath != nullptr)
{
asyncResp->res.jsonValue["AdditionalDataURI"] =
- "/redfish/v1/Systems/system/LogServices/"
- "EventLog/"
- "attachment/" +
+ "/redfish/v1/Systems/system/LogServices/EventLog/attachment/" +
std::to_string(*id);
}
},
@@ -1711,9 +1705,9 @@
return;
}
// TODO Handle for specific error code
- BMCWEB_LOG_ERROR << "EventLogEntry (DBus) doDelete "
- "respHandler got error "
- << ec;
+ BMCWEB_LOG_ERROR
+ << "EventLogEntry (DBus) doDelete respHandler got error "
+ << ec;
asyncResp->res.result(
boost::beast::http::status::internal_server_error);
return;
@@ -1732,8 +1726,9 @@
inline void requestRoutesDBusEventLogEntryDownload(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/EventLog/Entries/"
- "<str>/attachment")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/attachment")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(
[](const crow::Request& req,
@@ -1908,20 +1903,21 @@
{
BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/HostLogger/")
.privileges(redfish::privileges::getLogService)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request&,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/HostLogger";
- asyncResp->res.jsonValue["@odata.type"] =
- "#LogService.v1_1_0.LogService";
- asyncResp->res.jsonValue["Name"] = "Host Logger Service";
- asyncResp->res.jsonValue["Description"] = "Host Logger Service";
- asyncResp->res.jsonValue["Id"] = "HostLogger";
- asyncResp->res.jsonValue["Entries"] = {
- {"@odata.id", "/redfish/v1/Systems/system/LogServices/"
- "HostLogger/Entries"}};
- });
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Systems/system/LogServices/HostLogger";
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#LogService.v1_1_0.LogService";
+ asyncResp->res.jsonValue["Name"] = "Host Logger Service";
+ asyncResp->res.jsonValue["Description"] = "Host Logger Service";
+ asyncResp->res.jsonValue["Id"] = "HostLogger";
+ asyncResp->res.jsonValue["Entries"] = {
+ {"@odata.id",
+ "/redfish/v1/Systems/system/LogServices/HostLogger/Entries"}};
+ });
}
inline void requestRoutesSystemHostLoggerCollection(App& app)
@@ -1929,77 +1925,76 @@
BMCWEB_ROUTE(app,
"/redfish/v1/Systems/system/LogServices/HostLogger/Entries/")
.privileges(redfish::privileges::getLogEntry)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- uint64_t skip = 0;
- uint64_t top = maxEntriesPerPage; // Show max 1000 entries by
- // default, allow range 1 to
- // 1000 entries per page.
- if (!getSkipParam(asyncResp, req, skip))
- {
- return;
- }
- if (!getTopParam(asyncResp, req, top))
- {
- return;
- }
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/HostLogger/Entries";
- asyncResp->res.jsonValue["@odata.type"] =
- "#LogEntryCollection.LogEntryCollection";
- asyncResp->res.jsonValue["Name"] = "HostLogger Entries";
- asyncResp->res.jsonValue["Description"] =
- "Collection of HostLogger Entries";
- nlohmann::json& logEntryArray =
- asyncResp->res.jsonValue["Members"];
- logEntryArray = nlohmann::json::array();
- asyncResp->res.jsonValue["Members@odata.count"] = 0;
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ uint64_t skip = 0;
+ uint64_t top = maxEntriesPerPage; // Show max 1000 entries by
+ // default, allow range 1 to
+ // 1000 entries per page.
+ if (!getSkipParam(asyncResp, req, skip))
+ {
+ return;
+ }
+ if (!getTopParam(asyncResp, req, top))
+ {
+ return;
+ }
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Systems/system/LogServices/HostLogger/Entries";
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#LogEntryCollection.LogEntryCollection";
+ asyncResp->res.jsonValue["Name"] = "HostLogger Entries";
+ asyncResp->res.jsonValue["Description"] =
+ "Collection of HostLogger Entries";
+ nlohmann::json& logEntryArray = asyncResp->res.jsonValue["Members"];
+ logEntryArray = nlohmann::json::array();
+ asyncResp->res.jsonValue["Members@odata.count"] = 0;
- std::vector<std::filesystem::path> hostLoggerFiles;
- if (!getHostLoggerFiles(hostLoggerFolderPath, hostLoggerFiles))
+ std::vector<std::filesystem::path> hostLoggerFiles;
+ if (!getHostLoggerFiles(hostLoggerFolderPath, hostLoggerFiles))
+ {
+ BMCWEB_LOG_ERROR << "fail to get host log file path";
+ return;
+ }
+
+ size_t logCount = 0;
+ // This vector only store the entries we want to expose that
+ // control by skip and top.
+ std::vector<std::string> logEntries;
+ if (!getHostLoggerEntries(hostLoggerFiles, skip, top, logEntries,
+ logCount))
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ // If vector is empty, that means skip value larger than total
+ // log count
+ if (logEntries.size() == 0)
+ {
+ asyncResp->res.jsonValue["Members@odata.count"] = logCount;
+ return;
+ }
+ if (logEntries.size() > 0)
+ {
+ for (size_t i = 0; i < logEntries.size(); i++)
{
- BMCWEB_LOG_ERROR << "fail to get host log file path";
- return;
+ logEntryArray.push_back({});
+ nlohmann::json& hostLogEntry = logEntryArray.back();
+ fillHostLoggerEntryJson(std::to_string(skip + i),
+ logEntries[i], hostLogEntry);
}
- size_t logCount = 0;
- // This vector only store the entries we want to expose that
- // control by skip and top.
- std::vector<std::string> logEntries;
- if (!getHostLoggerEntries(hostLoggerFiles, skip, top,
- logEntries, logCount))
+ asyncResp->res.jsonValue["Members@odata.count"] = logCount;
+ if (skip + top < logCount)
{
- messages::internalError(asyncResp->res);
- return;
+ asyncResp->res.jsonValue["Members@odata.nextLink"] =
+ "/redfish/v1/Systems/system/LogServices/HostLogger/Entries?$skip=" +
+ std::to_string(skip + top);
}
- // If vector is empty, that means skip value larger than total
- // log count
- if (logEntries.size() == 0)
- {
- asyncResp->res.jsonValue["Members@odata.count"] = logCount;
- return;
- }
- if (logEntries.size() > 0)
- {
- for (size_t i = 0; i < logEntries.size(); i++)
- {
- logEntryArray.push_back({});
- nlohmann::json& hostLogEntry = logEntryArray.back();
- fillHostLoggerEntryJson(std::to_string(skip + i),
- logEntries[i], hostLogEntry);
- }
-
- asyncResp->res.jsonValue["Members@odata.count"] = logCount;
- if (skip + top < logCount)
- {
- asyncResp->res.jsonValue["Members@odata.nextLink"] =
- "/redfish/v1/Systems/system/LogServices/HostLogger/"
- "Entries?$skip=" +
- std::to_string(skip + top);
- }
- }
- });
+ }
+ });
}
inline void requestRoutesSystemHostLoggerLogEntry(App& app)
@@ -2192,89 +2187,88 @@
{
BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/")
.privileges(redfish::privileges::getLogEntryCollection)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- static constexpr const long maxEntriesPerPage = 1000;
- uint64_t skip = 0;
- uint64_t top = maxEntriesPerPage; // Show max entries by default
- if (!getSkipParam(asyncResp, req, skip))
- {
- return;
- }
- if (!getTopParam(asyncResp, req, top))
- {
- return;
- }
- // Collections don't include the static data added by SubRoute
- // because it has a duplicate entry for members
- asyncResp->res.jsonValue["@odata.type"] =
- "#LogEntryCollection.LogEntryCollection";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/LogServices/Journal/Entries";
- asyncResp->res.jsonValue["Name"] = "Open BMC Journal Entries";
- asyncResp->res.jsonValue["Description"] =
- "Collection of BMC Journal Entries";
- nlohmann::json& logEntryArray =
- asyncResp->res.jsonValue["Members"];
- logEntryArray = nlohmann::json::array();
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ static constexpr const long maxEntriesPerPage = 1000;
+ uint64_t skip = 0;
+ uint64_t top = maxEntriesPerPage; // Show max entries by default
+ if (!getSkipParam(asyncResp, req, skip))
+ {
+ return;
+ }
+ if (!getTopParam(asyncResp, req, top))
+ {
+ return;
+ }
+ // Collections don't include the static data added by SubRoute
+ // because it has a duplicate entry for members
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#LogEntryCollection.LogEntryCollection";
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Managers/bmc/LogServices/Journal/Entries";
+ asyncResp->res.jsonValue["Name"] = "Open BMC Journal Entries";
+ asyncResp->res.jsonValue["Description"] =
+ "Collection of BMC Journal Entries";
+ 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;
- int ret = sd_journal_open(&journalTmp, SD_JOURNAL_LOCAL_ONLY);
- if (ret < 0)
+ // Go through the journal and use the timestamp to create a
+ // unique ID for each entry
+ sd_journal* journalTmp = nullptr;
+ int ret = sd_journal_open(&journalTmp, SD_JOURNAL_LOCAL_ONLY);
+ if (ret < 0)
+ {
+ BMCWEB_LOG_ERROR << "failed to open journal: "
+ << strerror(-ret);
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ std::unique_ptr<sd_journal, decltype(&sd_journal_close)> journal(
+ journalTmp, sd_journal_close);
+ journalTmp = nullptr;
+ uint64_t entryCount = 0;
+ // Reset the unique ID on the first entry
+ bool firstEntry = true;
+ SD_JOURNAL_FOREACH(journal.get())
+ {
+ entryCount++;
+ // Handle paging using skip (number of entries to skip from
+ // the start) and top (number of entries to display)
+ if (entryCount <= skip || entryCount > skip + top)
{
- BMCWEB_LOG_ERROR << "failed to open journal: "
- << strerror(-ret);
+ continue;
+ }
+
+ std::string idStr;
+ if (!getUniqueEntryID(journal.get(), idStr, firstEntry))
+ {
+ continue;
+ }
+
+ if (firstEntry)
+ {
+ firstEntry = false;
+ }
+
+ logEntryArray.push_back({});
+ nlohmann::json& bmcJournalLogEntry = logEntryArray.back();
+ if (fillBMCJournalLogEntryJson(idStr, journal.get(),
+ bmcJournalLogEntry) != 0)
+ {
messages::internalError(asyncResp->res);
return;
}
- std::unique_ptr<sd_journal, decltype(&sd_journal_close)>
- journal(journalTmp, sd_journal_close);
- journalTmp = nullptr;
- uint64_t entryCount = 0;
- // Reset the unique ID on the first entry
- bool firstEntry = true;
- SD_JOURNAL_FOREACH(journal.get())
- {
- entryCount++;
- // Handle paging using skip (number of entries to skip from
- // the start) and top (number of entries to display)
- if (entryCount <= skip || entryCount > skip + top)
- {
- continue;
- }
-
- std::string idStr;
- if (!getUniqueEntryID(journal.get(), idStr, firstEntry))
- {
- continue;
- }
-
- if (firstEntry)
- {
- firstEntry = false;
- }
-
- logEntryArray.push_back({});
- nlohmann::json& bmcJournalLogEntry = logEntryArray.back();
- if (fillBMCJournalLogEntryJson(idStr, journal.get(),
- bmcJournalLogEntry) != 0)
- {
- messages::internalError(asyncResp->res);
- return;
- }
- }
- asyncResp->res.jsonValue["Members@odata.count"] = entryCount;
- if (skip + top < entryCount)
- {
- asyncResp->res.jsonValue["Members@odata.nextLink"] =
- "/redfish/v1/Managers/bmc/LogServices/Journal/"
- "Entries?$skip=" +
- std::to_string(skip + top);
- }
- });
+ }
+ asyncResp->res.jsonValue["Members@odata.count"] = entryCount;
+ if (skip + top < entryCount)
+ {
+ asyncResp->res.jsonValue["Members@odata.nextLink"] =
+ "/redfish/v1/Managers/bmc/LogServices/Journal/Entries?$skip=" +
+ std::to_string(skip + top);
+ }
+ });
}
inline void requestRoutesBMCJournalLogEntry(App& app)
@@ -2351,36 +2345,36 @@
{
BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/Dump/")
.privileges(redfish::privileges::getLogService)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request&,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/LogServices/Dump";
- asyncResp->res.jsonValue["@odata.type"] =
- "#LogService.v1_2_0.LogService";
- asyncResp->res.jsonValue["Name"] = "Dump LogService";
- asyncResp->res.jsonValue["Description"] = "BMC Dump LogService";
- asyncResp->res.jsonValue["Id"] = "Dump";
- asyncResp->res.jsonValue["OverWritePolicy"] = "WrapsWhenFull";
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/Managers/bmc/LogServices/Dump";
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#LogService.v1_2_0.LogService";
+ asyncResp->res.jsonValue["Name"] = "Dump LogService";
+ asyncResp->res.jsonValue["Description"] = "BMC Dump LogService";
+ asyncResp->res.jsonValue["Id"] = "Dump";
+ asyncResp->res.jsonValue["OverWritePolicy"] = "WrapsWhenFull";
- std::pair<std::string, std::string> redfishDateTimeOffset =
- crow::utility::getDateTimeOffsetNow();
- asyncResp->res.jsonValue["DateTime"] =
- redfishDateTimeOffset.first;
- asyncResp->res.jsonValue["DateTimeLocalOffset"] =
- redfishDateTimeOffset.second;
+ std::pair<std::string, std::string> redfishDateTimeOffset =
+ crow::utility::getDateTimeOffsetNow();
+ asyncResp->res.jsonValue["DateTime"] = redfishDateTimeOffset.first;
+ asyncResp->res.jsonValue["DateTimeLocalOffset"] =
+ redfishDateTimeOffset.second;
- asyncResp->res.jsonValue["Entries"] = {
- {"@odata.id",
- "/redfish/v1/Managers/bmc/LogServices/Dump/Entries"}};
- asyncResp->res.jsonValue["Actions"] = {
- {"#LogService.ClearLog",
- {{"target", "/redfish/v1/Managers/bmc/LogServices/Dump/"
- "Actions/LogService.ClearLog"}}},
- {"#LogService.CollectDiagnosticData",
- {{"target", "/redfish/v1/Managers/bmc/LogServices/Dump/"
- "Actions/LogService.CollectDiagnosticData"}}}};
- });
+ asyncResp->res.jsonValue["Entries"] = {
+ {"@odata.id",
+ "/redfish/v1/Managers/bmc/LogServices/Dump/Entries"}};
+ asyncResp->res.jsonValue["Actions"] = {
+ {"#LogService.ClearLog",
+ {{"target",
+ "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.ClearLog"}}},
+ {"#LogService.CollectDiagnosticData",
+ {{"target",
+ "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData"}}}};
+ });
}
inline void requestRoutesBMCDumpEntryCollection(App& app)
@@ -2431,9 +2425,9 @@
inline void requestRoutesBMCDumpCreate(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/Dump/"
- "Actions/"
- "LogService.CollectDiagnosticData/")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData/")
.privileges(redfish::privileges::postLogService)
.methods(boost::beast::http::verb::post)(
[](const crow::Request& req,
@@ -2444,9 +2438,9 @@
inline void requestRoutesBMCDumpClear(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/Dump/"
- "Actions/"
- "LogService.ClearLog/")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.ClearLog/")
.privileges(redfish::privileges::postLogService)
.methods(boost::beast::http::verb::post)(
[](const crow::Request&,
@@ -2487,12 +2481,10 @@
asyncResp->res.jsonValue["Actions"] = {
{"#LogService.ClearLog",
{{"target",
- "/redfish/v1/Systems/system/LogServices/Dump/Actions/"
- "LogService.ClearLog"}}},
+ "/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.ClearLog"}}},
{"#LogService.CollectDiagnosticData",
{{"target",
- "/redfish/v1/Systems/system/LogServices/Dump/Actions/"
- "LogService.CollectDiagnosticData"}}}};
+ "/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.CollectDiagnosticData"}}}};
});
}
@@ -2545,9 +2537,9 @@
inline void requestRoutesSystemDumpCreate(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/Dump/"
- "Actions/"
- "LogService.CollectDiagnosticData/")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.CollectDiagnosticData/")
.privileges(redfish::privileges::postLogService)
.methods(boost::beast::http::verb::post)(
[](const crow::Request& req,
@@ -2558,9 +2550,9 @@
inline void requestRoutesSystemDumpClear(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/Dump/"
- "Actions/"
- "LogService.ClearLog/")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.ClearLog/")
.privileges(redfish::privileges::postLogService)
.methods(boost::beast::http::verb::post)(
[](const crow::Request&,
@@ -2607,19 +2599,19 @@
"/redfish/v1/Systems/system/LogServices/Crashdump/Entries"}};
asyncResp->res.jsonValue["Actions"] = {
{"#LogService.ClearLog",
- {{"target", "/redfish/v1/Systems/system/LogServices/Crashdump/"
- "Actions/LogService.ClearLog"}}},
+ {{"target",
+ "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/LogService.ClearLog"}}},
{"#LogService.CollectDiagnosticData",
- {{"target", "/redfish/v1/Systems/system/LogServices/Crashdump/"
- "Actions/LogService.CollectDiagnosticData"}}}};
+ {{"target",
+ "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/LogService.CollectDiagnosticData"}}}};
});
}
void inline requestRoutesCrashdumpClear(App& app)
{
- BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/"
- "LogService.ClearLog/")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/LogService.ClearLog/")
// This is incorrect, should be:
//.privileges(redfish::privileges::postLogService)
.privileges({{"ConfigureComponents"}})
@@ -2886,8 +2878,9 @@
{
// Note: Deviated from redfish privilege registry for GET & HEAD
// method for security reasons.
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/Crashdump/"
- "Actions/LogService.CollectDiagnosticData/")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/LogService.CollectDiagnosticData/")
// The below is incorrect; Should be ConfigureManager
//.privileges(redfish::privileges::postLogService)
.privileges({{"ConfigureComponents"}})
@@ -2938,24 +2931,22 @@
}
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) {
- if (!err)
- {
- taskData->messages.emplace_back(
- messages::taskCompletedOK(
- std::to_string(taskData->index)));
- taskData->state = "Completed";
- }
- return task::completed;
- },
- "type='signal',interface='org.freedesktop.DBus."
- "Properties',"
- "member='PropertiesChanged',arg0namespace='com.intel."
- "crashdump'");
+ std::shared_ptr<task::TaskData> task = task::TaskData::createTask(
+ [](boost::system::error_code err,
+ sdbusplus::message::message&,
+ const std::shared_ptr<task::TaskData>& taskData) {
+ if (!err)
+ {
+ taskData->messages.emplace_back(
+ messages::taskCompletedOK(
+ std::to_string(taskData->index)));
+ taskData->state = "Completed";
+ }
+ return task::completed;
+ },
+ "type='signal',interface='org.freedesktop.DBus."
+ "Properties',"
+ "member='PropertiesChanged',arg0namespace='com.intel.crashdump'");
task->startTimer(std::chrono::minutes(5));
task->populateResp(asyncResp->res);
task->payload.emplace(req);
@@ -2998,8 +2989,9 @@
* all entries found in the Entries collection for this Log Service.
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/EventLog/Actions/"
- "LogService.ClearLog/")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Systems/system/LogServices/EventLog/Actions/LogService.ClearLog/")
.privileges(redfish::privileges::postLogService)
.methods(boost::beast::http::verb::post)(
[](const crow::Request&,
@@ -3041,40 +3033,39 @@
{
BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/PostCodes/")
.privileges(redfish::privileges::getLogService)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request&,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- asyncResp->res.jsonValue = {
- {"@odata.id",
- "/redfish/v1/Systems/system/LogServices/PostCodes"},
- {"@odata.type", "#LogService.v1_1_0.LogService"},
- {"Name", "POST Code Log Service"},
- {"Description", "POST Code Log Service"},
- {"Id", "BIOS POST Code Log"},
- {"OverWritePolicy", "WrapsWhenFull"},
- {"Entries",
- {{"@odata.id", "/redfish/v1/Systems/system/LogServices/"
- "PostCodes/Entries"}}}};
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ asyncResp->res.jsonValue = {
+ {"@odata.id",
+ "/redfish/v1/Systems/system/LogServices/PostCodes"},
+ {"@odata.type", "#LogService.v1_1_0.LogService"},
+ {"Name", "POST Code Log Service"},
+ {"Description", "POST Code Log Service"},
+ {"Id", "BIOS POST Code Log"},
+ {"OverWritePolicy", "WrapsWhenFull"},
+ {"Entries",
+ {{"@odata.id",
+ "/redfish/v1/Systems/system/LogServices/PostCodes/Entries"}}}};
- std::pair<std::string, std::string> redfishDateTimeOffset =
- crow::utility::getDateTimeOffsetNow();
- asyncResp->res.jsonValue["DateTime"] =
- redfishDateTimeOffset.first;
- asyncResp->res.jsonValue["DateTimeLocalOffset"] =
- redfishDateTimeOffset.second;
+ std::pair<std::string, std::string> redfishDateTimeOffset =
+ crow::utility::getDateTimeOffsetNow();
+ asyncResp->res.jsonValue["DateTime"] = redfishDateTimeOffset.first;
+ asyncResp->res.jsonValue["DateTimeLocalOffset"] =
+ redfishDateTimeOffset.second;
- asyncResp->res.jsonValue["Actions"]["#LogService.ClearLog"] = {
- {"target",
- "/redfish/v1/Systems/system/LogServices/PostCodes/"
- "Actions/LogService.ClearLog"}};
- });
+ asyncResp->res.jsonValue["Actions"]["#LogService.ClearLog"] = {
+ {"target",
+ "/redfish/v1/Systems/system/LogServices/PostCodes/Actions/LogService.ClearLog"}};
+ });
}
inline void requestRoutesPostCodesClear(App& app)
{
- BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/system/LogServices/PostCodes/Actions/"
- "LogService.ClearLog/")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Systems/system/LogServices/PostCodes/Actions/LogService.ClearLog/")
// The following privilege is incorrect; It should be ConfigureManager
//.privileges(redfish::privileges::postLogService)
.privileges({{"ConfigureComponents"}})
@@ -3208,18 +3199,19 @@
// add to AsyncResp
logEntryArray.push_back({});
nlohmann::json& bmcLogEntry = logEntryArray.back();
- bmcLogEntry = {{"@odata.type", "#LogEntry.v1_8_0.LogEntry"},
- {"@odata.id", "/redfish/v1/Systems/system/LogServices/"
- "PostCodes/Entries/" +
- postcodeEntryID},
- {"Name", "POST Code Log Entry"},
- {"Id", postcodeEntryID},
- {"Message", std::move(msg)},
- {"MessageId", "OpenBMC.0.2.BIOSPOSTCode"},
- {"MessageArgs", std::move(messageArgs)},
- {"EntryType", "Event"},
- {"Severity", std::move(severity)},
- {"Created", entryTimeStr}};
+ bmcLogEntry = {
+ {"@odata.type", "#LogEntry.v1_8_0.LogEntry"},
+ {"@odata.id",
+ "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/" +
+ postcodeEntryID},
+ {"Name", "POST Code Log Entry"},
+ {"Id", postcodeEntryID},
+ {"Message", std::move(msg)},
+ {"MessageId", "OpenBMC.0.2.BIOSPOSTCode"},
+ {"MessageArgs", std::move(messageArgs)},
+ {"EntryType", "Event"},
+ {"Severity", std::move(severity)},
+ {"Created", entryTimeStr}};
if (!std::get<std::vector<uint8_t>>(code.second).empty())
{
bmcLogEntry["AdditionalDataURI"] =
@@ -3309,8 +3301,7 @@
else
{
aResp->res.jsonValue["Members@odata.nextLink"] =
- "/redfish/v1/Systems/system/LogServices/PostCodes/"
- "Entries?$skip=" +
+ "/redfish/v1/Systems/system/LogServices/PostCodes/Entries?$skip=" +
std::to_string(skip + top);
}
},
@@ -3425,8 +3416,9 @@
inline void requestRoutesPostCodesEntryAdditionalData(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/PostCodes/"
- "Entries/<str>/attachment/")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/<str>/attachment/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(
[](const crow::Request& req,
@@ -3530,8 +3522,7 @@
asyncResp->res.jsonValue["@odata.type"] =
"#LogEntry.v1_4_0.LogEntry";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/PostCodes/"
- "Entries";
+ "/redfish/v1/Systems/system/LogServices/PostCodes/Entries";
asyncResp->res.jsonValue["Name"] = "BIOS POST Code Log Entries";
asyncResp->res.jsonValue["Description"] =
"Collection of POST Code Log Entries";
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 344ca83..12af99d 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -187,9 +187,9 @@
if (resetType != "ResetAll")
{
- BMCWEB_LOG_DEBUG << "Invalid property value for "
- "ResetToDefaultsType: "
- << resetType;
+ BMCWEB_LOG_DEBUG
+ << "Invalid property value for ResetToDefaultsType: "
+ << resetType;
messages::actionParameterNotSupported(
asyncResp->res, resetType, "ResetToDefaultsType");
return;
@@ -276,8 +276,8 @@
asyncResp->res.jsonValue["Oem"]["OpenBmc"]["Fan"];
nlohmann::json& fans = configRoot["FanControllers"];
fans["@odata.type"] = "#OemManager.FanControllers";
- fans["@odata.id"] = "/redfish/v1/Managers/bmc#/Oem/OpenBmc/"
- "Fan/FanControllers";
+ fans["@odata.id"] =
+ "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers";
nlohmann::json& pids = configRoot["PidControllers"];
pids["@odata.type"] = "#OemManager.PidControllers";
@@ -373,9 +373,9 @@
nlohmann::json& zone = zones[name];
zone["Chassis"] = {
{"@odata.id", "/redfish/v1/Chassis/" + chassis}};
- zone["@odata.id"] = "/redfish/v1/Managers/bmc#/Oem/"
- "OpenBmc/Fan/FanZones/" +
- name;
+ zone["@odata.id"] =
+ "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/" +
+ name;
zone["@odata.type"] = "#OemManager.FanZone";
config = &zone;
}
@@ -393,8 +393,7 @@
config = &controller;
controller["@odata.id"] =
- "/redfish/v1/Managers/bmc#/Oem/"
- "OpenBmc/Fan/StepwiseControllers/" +
+ "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/StepwiseControllers/" +
name;
controller["@odata.type"] =
"#OemManager.StepwiseController";
@@ -419,8 +418,7 @@
if (isFan)
{
element["@odata.id"] =
- "/redfish/v1/Managers/bmc#/Oem/"
- "OpenBmc/Fan/FanControllers/" +
+ "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers/" +
name;
element["@odata.type"] =
"#OemManager.FanController";
@@ -428,8 +426,7 @@
else
{
element["@odata.id"] =
- "/redfish/v1/Managers/bmc#/Oem/"
- "OpenBmc/Fan/PidControllers/" +
+ "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/PidControllers/" +
name;
element["@odata.type"] =
"#OemManager.PidController";
@@ -500,8 +497,7 @@
if (keys->size() != values->size())
{
BMCWEB_LOG_ERROR
- << "Reading and Output size don't "
- "match ";
+ << "Reading and Output size don't match ";
messages::internalError(asyncResp->res);
return;
}
@@ -556,8 +552,7 @@
dbus::utility::escapePathForDbus(itemCopy);
data.push_back(
{{"@odata.id",
- "/redfish/v1/Managers/bmc#/Oem/"
- "OpenBmc/Fan/FanZones/" +
+ "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones/" +
itemCopy}});
}
}
@@ -1190,9 +1185,9 @@
std::string>>& resp) {
if (ec2)
{
- BMCWEB_LOG_ERROR << "GetPIDValues: Can't get "
- "thermalModeIface "
- << path;
+ BMCWEB_LOG_ERROR
+ << "GetPIDValues: Can't get thermalModeIface "
+ << path;
messages::internalError(self->asyncResp->res);
return;
}
@@ -1206,8 +1201,7 @@
if (current == nullptr)
{
BMCWEB_LOG_ERROR
- << "GetPIDValues: thermal mode "
- "iface invalid "
+ << "GetPIDValues: thermal mode iface invalid "
<< path;
messages::internalError(
self->asyncResp->res);
@@ -1222,8 +1216,7 @@
if (supported == nullptr)
{
BMCWEB_LOG_ERROR
- << "GetPIDValues: thermal mode "
- "iface invalid"
+ << "GetPIDValues: thermal mode iface invalid"
<< path;
messages::internalError(
self->asyncResp->res);
@@ -1233,9 +1226,9 @@
}
if (current == nullptr || supported == nullptr)
{
- BMCWEB_LOG_ERROR << "GetPIDValues: thermal mode "
- "iface invalid "
- << path;
+ BMCWEB_LOG_ERROR
+ << "GetPIDValues: thermal mode iface invalid "
+ << path;
messages::internalError(self->asyncResp->res);
return;
}
@@ -1407,9 +1400,9 @@
std::string>>& r) {
if (ec2)
{
- BMCWEB_LOG_ERROR << "SetPIDValues: Can't get "
- "thermalModeIface "
- << path;
+ BMCWEB_LOG_ERROR
+ << "SetPIDValues: Can't get thermalModeIface "
+ << path;
messages::internalError(self->asyncResp->res);
return;
}
@@ -1423,8 +1416,7 @@
if (current == nullptr)
{
BMCWEB_LOG_ERROR
- << "SetPIDValues: thermal mode "
- "iface invalid "
+ << "SetPIDValues: thermal mode iface invalid "
<< path;
messages::internalError(
self->asyncResp->res);
@@ -1439,8 +1431,7 @@
if (supported == nullptr)
{
BMCWEB_LOG_ERROR
- << "SetPIDValues: thermal mode "
- "iface invalid"
+ << "SetPIDValues: thermal mode iface invalid"
<< path;
messages::internalError(
self->asyncResp->res);
@@ -1450,9 +1441,9 @@
}
if (current == nullptr || supported == nullptr)
{
- BMCWEB_LOG_ERROR << "SetPIDValues: thermal mode "
- "iface invalid "
- << path;
+ BMCWEB_LOG_ERROR
+ << "SetPIDValues: thermal mode iface invalid "
+ << path;
messages::internalError(self->asyncResp->res);
return;
}
@@ -1721,9 +1712,7 @@
*value;
},
connectionName, path, "org.freedesktop.DBus.Properties", "Get",
- "xyz.openbmc_project.Inventory.Decorator."
- "LocationCode",
- "LocationCode");
+ "xyz.openbmc_project.Inventory.Decorator.LocationCode", "LocationCode");
}
// avoid name collision systems.hpp
inline void
@@ -2168,12 +2157,11 @@
},
connectionName, path,
"org.freedesktop.DBus.Properties", "GetAll",
- "xyz.openbmc_project.Inventory.Decorator."
- "Asset");
+ "xyz.openbmc_project.Inventory.Decorator.Asset");
}
- else if (interfaceName ==
- "xyz.openbmc_project.Inventory."
- "Decorator.LocationCode")
+ else if (
+ interfaceName ==
+ "xyz.openbmc_project.Inventory.Decorator.LocationCode")
{
getLocation(asyncResp, connectionName, path);
}
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 5d508c4..90e54e8 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -75,8 +75,8 @@
{
return "DDR2_SDRAM_FB_DIMM";
}
- if (memoryType == "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR2_"
- "SDRAM_FB_DIMM_PROB")
+ if (memoryType ==
+ "xyz.openbmc_project.Inventory.Item.Dimm.DeviceType.DDR2_SDRAM_FB_DIMM_PROB")
{
return "DDR2_SDRAM_FB_DIMM_PROBE";
}
@@ -188,8 +188,8 @@
if (value == nullptr)
{
messages::internalError(aResp->res);
- BMCWEB_LOG_DEBUG << "Invalid property type for "
- "VolatileRegionSizeLimitKiB";
+ BMCWEB_LOG_DEBUG
+ << "Invalid property type for VolatileRegionSizeLimitKiB";
return;
}
aResp->res.jsonValue["VolatileRegionSizeLimitMiB"] = (*value) >> 10;
@@ -251,8 +251,8 @@
if (value == nullptr)
{
messages::internalError(aResp->res);
- BMCWEB_LOG_DEBUG << "Invalid property type for "
- "VolatileRegionMaxSizeInKib";
+ BMCWEB_LOG_DEBUG
+ << "Invalid property type for VolatileRegionMaxSizeInKib";
return;
}
aResp->res.jsonValue["VolatileRegionSizeMaxMiB"] = (*value) >> 10;
@@ -277,8 +277,8 @@
if (value == nullptr)
{
messages::internalError(aResp->res);
- BMCWEB_LOG_DEBUG << "Invalid property type for "
- "AllocationIncrementInKiB";
+ BMCWEB_LOG_DEBUG
+ << "Invalid property type for AllocationIncrementInKiB";
return;
}
aResp->res.jsonValue["AllocationIncrementMiB"] = (*value) >> 10;
@@ -290,8 +290,8 @@
if (value == nullptr)
{
messages::internalError(aResp->res);
- BMCWEB_LOG_DEBUG << "Invalid property type for "
- "AllocationAlignmentInKiB";
+ BMCWEB_LOG_DEBUG
+ << "Invalid property type for AllocationAlignmentInKiB";
return;
}
aResp->res.jsonValue["AllocationAlignmentMiB"] = (*value) >> 10;
@@ -353,8 +353,8 @@
if (value == nullptr)
{
messages::internalError(aResp->res);
- BMCWEB_LOG_DEBUG << "Invalid property type for "
- "MaxAveragePowerLimitmW";
+ BMCWEB_LOG_DEBUG
+ << "Invalid property type for MaxAveragePowerLimitmW";
return;
}
aResp->res.jsonValue["MaxTDPMilliWatts"] = *value;
@@ -860,9 +860,9 @@
// device, i.e.
// /xyz/openbmc_project/Inventory/Item/Dimm1/Partition1
// /xyz/openbmc_project/Inventory/Item/Dimm1/Partition2
- if (std::find(interfaces.begin(), interfaces.end(),
- "xyz.openbmc_project.Inventory.Item."
- "PersistentMemory.Partition") !=
+ if (std::find(
+ interfaces.begin(), interfaces.end(),
+ "xyz.openbmc_project.Inventory.Item.PersistentMemory.Partition") !=
interfaces.end())
{
getDimmPartitionData(aResp, service, path);
diff --git a/redfish-core/lib/message_registries.hpp b/redfish-core/lib/message_registries.hpp
index 43359e3..ae02189 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -34,8 +34,8 @@
// because it has a duplicate entry for members
asyncResp->res.jsonValue = {
- {"@odata.type", "#MessageRegistryFileCollection."
- "MessageRegistryFileCollection"},
+ {"@odata.type",
+ "#MessageRegistryFileCollection.MessageRegistryFileCollection"},
{"@odata.id", "/redfish/v1/Registries"},
{"Name", "MessageRegistryFile Collection"},
{"Description", "Collection of MessageRegistryFiles"},
diff --git a/redfish-core/lib/metric_report_definition.hpp b/redfish-core/lib/metric_report_definition.hpp
index fc717e4..cb38633 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -235,9 +235,8 @@
!dbus::utility::getNthStringFromPath(uri, 3, chassis) ||
!dbus::utility::getNthStringFromPath(uri, 4, node))
{
- BMCWEB_LOG_ERROR << "Failed to get chassis and sensor Node "
- "from "
- << uri;
+ BMCWEB_LOG_ERROR
+ << "Failed to get chassis and sensor Node from " << uri;
messages::propertyValueIncorrect(asyncResp->res, uri,
"MetricProperties/" +
std::to_string(i));
@@ -281,9 +280,9 @@
auto el = uriToDbus.find(uri);
if (el == uriToDbus.end())
{
- BMCWEB_LOG_ERROR << "Failed to find DBus sensor "
- "corresponding to URI "
- << uri;
+ BMCWEB_LOG_ERROR
+ << "Failed to find DBus sensor corresponding to URI "
+ << uri;
messages::propertyValueNotInList(asyncResp->res, uri,
"MetricProperties/" +
std::to_string(i));
@@ -371,45 +370,45 @@
BMCWEB_ROUTE(app, "/redfish/v1/TelemetryService/MetricReportDefinitions/")
.privileges(redfish::privileges::postMetricReportDefinitionCollection)
- .methods(boost::beast::http::verb::post)(
- [](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- telemetry::AddReportArgs args;
- if (!telemetry::getUserParameters(asyncResp->res, req, args))
- {
- return;
- }
+ .methods(
+ boost::beast::http::verb::
+ post)([](const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ telemetry::AddReportArgs args;
+ if (!telemetry::getUserParameters(asyncResp->res, req, args))
+ {
+ return;
+ }
- boost::container::flat_set<std::pair<std::string, std::string>>
- chassisSensors;
- if (!telemetry::getChassisSensorNode(asyncResp, args.metrics,
- chassisSensors))
- {
- return;
- }
+ boost::container::flat_set<std::pair<std::string, std::string>>
+ chassisSensors;
+ if (!telemetry::getChassisSensorNode(asyncResp, args.metrics,
+ chassisSensors))
+ {
+ return;
+ }
- auto addReportReq = std::make_shared<telemetry::AddReport>(
- std::move(args), asyncResp);
- for (const auto& [chassis, sensorType] : chassisSensors)
- {
- retrieveUriToDbusMap(
- chassis, sensorType,
- [asyncResp, addReportReq](
- const boost::beast::http::status status,
- const boost::container::flat_map<
- std::string, std::string>& uriToDbus) {
- if (status != boost::beast::http::status::ok)
- {
- BMCWEB_LOG_ERROR
- << "Failed to retrieve URI to dbus "
- "sensors map with err "
- << static_cast<unsigned>(status);
- return;
- }
- addReportReq->insert(uriToDbus);
- });
- }
- });
+ auto addReportReq = std::make_shared<telemetry::AddReport>(
+ std::move(args), asyncResp);
+ for (const auto& [chassis, sensorType] : chassisSensors)
+ {
+ retrieveUriToDbusMap(
+ chassis, sensorType,
+ [asyncResp,
+ addReportReq](const boost::beast::http::status status,
+ const boost::container::flat_map<
+ std::string, std::string>& uriToDbus) {
+ if (status != boost::beast::http::status::ok)
+ {
+ BMCWEB_LOG_ERROR
+ << "Failed to retrieve URI to dbus sensors map with err "
+ << static_cast<unsigned>(status);
+ return;
+ }
+ addReportReq->insert(uriToDbus);
+ });
+ }
+ });
}
inline void requestRoutesMetricReportDefinition(App& app)
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index 3a769af..9acf5d4 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -380,8 +380,8 @@
{
asyncResp->res.jsonValue["NTP"]["ProtocolEnabled"] = true;
}
- else if (*s == "xyz.openbmc_project.Time.Synchronization."
- "Method.Manual")
+ else if (*s ==
+ "xyz.openbmc_project.Time.Synchronization.Method.Manual")
{
asyncResp->res.jsonValue["NTP"]["ProtocolEnabled"] = false;
}
@@ -395,88 +395,87 @@
{
BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/NetworkProtocol/")
.privileges(redfish::privileges::patchManagerNetworkProtocol)
- .methods(boost::beast::http::verb::patch)(
- [](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- std::optional<std::string> newHostName;
- std::optional<nlohmann::json> ntp;
- std::optional<nlohmann::json> ipmi;
- std::optional<nlohmann::json> ssh;
+ .methods(
+ boost::beast::http::verb::
+ patch)([](const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ std::optional<std::string> newHostName;
+ std::optional<nlohmann::json> ntp;
+ std::optional<nlohmann::json> ipmi;
+ std::optional<nlohmann::json> ssh;
- if (!json_util::readJson(req, asyncResp->res, "NTP", ntp,
- "HostName", newHostName, "IPMI", ipmi,
- "SSH", ssh))
+ if (!json_util::readJson(req, asyncResp->res, "NTP", ntp,
+ "HostName", newHostName, "IPMI", ipmi,
+ "SSH", ssh))
+ {
+ return;
+ }
+
+ asyncResp->res.result(boost::beast::http::status::no_content);
+ if (newHostName)
+ {
+ messages::propertyNotWritable(asyncResp->res, "HostName");
+ return;
+ }
+
+ if (ntp)
+ {
+ std::optional<std::vector<std::string>> ntpServers;
+ std::optional<bool> ntpEnabled;
+ if (!json_util::readJson(*ntp, asyncResp->res, "NTPServers",
+ ntpServers, "ProtocolEnabled",
+ ntpEnabled))
{
return;
}
- asyncResp->res.result(boost::beast::http::status::no_content);
- if (newHostName)
+ if (ntpEnabled)
{
- messages::propertyNotWritable(asyncResp->res, "HostName");
+ handleNTPProtocolEnabled(*ntpEnabled, asyncResp);
+ }
+
+ if (ntpServers)
+ {
+ stl_utils::removeDuplicate(*ntpServers);
+ handleNTPServersPatch(asyncResp, *ntpServers);
+ }
+ }
+
+ if (ipmi)
+ {
+ std::optional<bool> ipmiProtocolEnabled;
+ if (!json_util::readJson(*ipmi, asyncResp->res,
+ "ProtocolEnabled",
+ ipmiProtocolEnabled))
+ {
return;
}
- if (ntp)
+ if (ipmiProtocolEnabled)
{
- std::optional<std::vector<std::string>> ntpServers;
- std::optional<bool> ntpEnabled;
- if (!json_util::readJson(*ntp, asyncResp->res, "NTPServers",
- ntpServers, "ProtocolEnabled",
- ntpEnabled))
- {
- return;
- }
+ handleProtocolEnabled(
+ *ipmiProtocolEnabled, asyncResp,
+ "/xyz/openbmc_project/control/service/phosphor_2dipmi_2dnet_40");
+ }
+ }
- if (ntpEnabled)
- {
- handleNTPProtocolEnabled(*ntpEnabled, asyncResp);
- }
-
- if (ntpServers)
- {
- stl_utils::removeDuplicate(*ntpServers);
- handleNTPServersPatch(asyncResp, *ntpServers);
- }
+ if (ssh)
+ {
+ std::optional<bool> sshProtocolEnabled;
+ if (!json_util::readJson(*ssh, asyncResp->res,
+ "ProtocolEnabled", sshProtocolEnabled))
+ {
+ return;
}
- if (ipmi)
+ if (sshProtocolEnabled)
{
- std::optional<bool> ipmiProtocolEnabled;
- if (!json_util::readJson(*ipmi, asyncResp->res,
- "ProtocolEnabled",
- ipmiProtocolEnabled))
- {
- return;
- }
-
- if (ipmiProtocolEnabled)
- {
- handleProtocolEnabled(
- *ipmiProtocolEnabled, asyncResp,
- "/xyz/openbmc_project/control/service/"
- "phosphor_2dipmi_2dnet_40");
- }
+ handleProtocolEnabled(
+ *sshProtocolEnabled, asyncResp,
+ "/xyz/openbmc_project/control/service/dropbear");
}
-
- if (ssh)
- {
- std::optional<bool> sshProtocolEnabled;
- if (!json_util::readJson(*ssh, asyncResp->res,
- "ProtocolEnabled",
- sshProtocolEnabled))
- {
- return;
- }
-
- if (sshProtocolEnabled)
- {
- handleProtocolEnabled(
- *sshProtocolEnabled, asyncResp,
- "/xyz/openbmc_project/control/service/dropbear");
- }
- }
- });
+ }
+ });
BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/NetworkProtocol/")
.privileges(redfish::privileges::getManagerNetworkProtocol)
diff --git a/redfish-core/lib/power.hpp b/redfish-core/lib/power.hpp
index bf33250..d7fb7dd 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -27,102 +27,99 @@
const std::shared_ptr<SensorsAsyncResp>& sensorsAsyncResp,
std::vector<nlohmann::json>& powerControlCollections)
{
- auto getChassisPath =
- [sensorsAsyncResp, powerControlCollections](
- const std::optional<std::string>& chassisPath) mutable {
- if (!chassisPath)
+ auto getChassisPath = [sensorsAsyncResp, powerControlCollections](
+ const std::optional<std::string>&
+ chassisPath) mutable {
+ if (!chassisPath)
+ {
+ BMCWEB_LOG_ERROR << "Don't find valid chassis path ";
+ messages::resourceNotFound(sensorsAsyncResp->asyncResp->res,
+ "Chassis", sensorsAsyncResp->chassisId);
+ return;
+ }
+
+ if (powerControlCollections.size() != 1)
+ {
+ BMCWEB_LOG_ERROR << "Don't support multiple hosts at present ";
+ messages::resourceNotFound(sensorsAsyncResp->asyncResp->res,
+ "Power", "PowerControl");
+ return;
+ }
+
+ auto& item = powerControlCollections[0];
+
+ std::optional<nlohmann::json> powerLimit;
+ if (!json_util::readJson(item, sensorsAsyncResp->asyncResp->res,
+ "PowerLimit", powerLimit))
+ {
+ return;
+ }
+ if (!powerLimit)
+ {
+ return;
+ }
+ std::optional<uint32_t> value;
+ if (!json_util::readJson(*powerLimit, sensorsAsyncResp->asyncResp->res,
+ "LimitInWatts", value))
+ {
+ return;
+ }
+ if (!value)
+ {
+ return;
+ }
+ auto valueHandler = [value, sensorsAsyncResp](
+ const boost::system::error_code ec,
+ const SensorVariant& powerCapEnable) {
+ if (ec)
{
- BMCWEB_LOG_ERROR << "Don't find valid chassis path ";
- messages::resourceNotFound(sensorsAsyncResp->asyncResp->res,
- "Chassis",
- sensorsAsyncResp->chassisId);
+ messages::internalError(sensorsAsyncResp->asyncResp->res);
+ BMCWEB_LOG_ERROR << "powerCapEnable Get handler: Dbus error "
+ << ec;
+ return;
+ }
+ // Check PowerCapEnable
+ const bool* b = std::get_if<bool>(&powerCapEnable);
+ if (b == nullptr)
+ {
+ messages::internalError(sensorsAsyncResp->asyncResp->res);
+ BMCWEB_LOG_ERROR << "Fail to get PowerCapEnable status ";
+ return;
+ }
+ if (!(*b))
+ {
+ messages::actionNotSupported(
+ sensorsAsyncResp->asyncResp->res,
+ "Setting LimitInWatts when PowerLimit feature is disabled");
+ BMCWEB_LOG_ERROR << "PowerLimit feature is disabled ";
return;
}
- if (powerControlCollections.size() != 1)
- {
- BMCWEB_LOG_ERROR << "Don't support multiple hosts at present ";
- messages::resourceNotFound(sensorsAsyncResp->asyncResp->res,
- "Power", "PowerControl");
- return;
- }
-
- auto& item = powerControlCollections[0];
-
- std::optional<nlohmann::json> powerLimit;
- if (!json_util::readJson(item, sensorsAsyncResp->asyncResp->res,
- "PowerLimit", powerLimit))
- {
- return;
- }
- if (!powerLimit)
- {
- return;
- }
- std::optional<uint32_t> value;
- if (!json_util::readJson(*powerLimit,
- sensorsAsyncResp->asyncResp->res,
- "LimitInWatts", value))
- {
- return;
- }
- if (!value)
- {
- return;
- }
- auto valueHandler = [value, sensorsAsyncResp](
- const boost::system::error_code ec,
- const SensorVariant& powerCapEnable) {
- if (ec)
- {
- messages::internalError(sensorsAsyncResp->asyncResp->res);
- BMCWEB_LOG_ERROR
- << "powerCapEnable Get handler: Dbus error " << ec;
- return;
- }
- // Check PowerCapEnable
- const bool* b = std::get_if<bool>(&powerCapEnable);
- if (b == nullptr)
- {
- messages::internalError(sensorsAsyncResp->asyncResp->res);
- BMCWEB_LOG_ERROR << "Fail to get PowerCapEnable status ";
- return;
- }
- if (!(*b))
- {
- messages::actionNotSupported(
- sensorsAsyncResp->asyncResp->res,
- "Setting LimitInWatts when PowerLimit "
- "feature is disabled");
- BMCWEB_LOG_ERROR << "PowerLimit feature is disabled ";
- return;
- }
-
- crow::connections::systemBus->async_method_call(
- [sensorsAsyncResp](const boost::system::error_code ec2) {
- if (ec2)
- {
- BMCWEB_LOG_DEBUG << "Power Limit Set: Dbus error: "
- << ec2;
- messages::internalError(
- sensorsAsyncResp->asyncResp->res);
- return;
- }
- sensorsAsyncResp->asyncResp->res.result(
- boost::beast::http::status::no_content);
- },
- "xyz.openbmc_project.Settings",
- "/xyz/openbmc_project/control/host0/power_cap",
- "org.freedesktop.DBus.Properties", "Set",
- "xyz.openbmc_project.Control.Power.Cap", "PowerCap",
- std::variant<uint32_t>(*value));
- };
crow::connections::systemBus->async_method_call(
- std::move(valueHandler), "xyz.openbmc_project.Settings",
+ [sensorsAsyncResp](const boost::system::error_code ec2) {
+ if (ec2)
+ {
+ BMCWEB_LOG_DEBUG << "Power Limit Set: Dbus error: "
+ << ec2;
+ messages::internalError(
+ sensorsAsyncResp->asyncResp->res);
+ return;
+ }
+ sensorsAsyncResp->asyncResp->res.result(
+ boost::beast::http::status::no_content);
+ },
+ "xyz.openbmc_project.Settings",
"/xyz/openbmc_project/control/host0/power_cap",
- "org.freedesktop.DBus.Properties", "Get",
- "xyz.openbmc_project.Control.Power.Cap", "PowerCapEnable");
+ "org.freedesktop.DBus.Properties", "Set",
+ "xyz.openbmc_project.Control.Power.Cap", "PowerCap",
+ std::variant<uint32_t>(*value));
};
+ crow::connections::systemBus->async_method_call(
+ std::move(valueHandler), "xyz.openbmc_project.Settings",
+ "/xyz/openbmc_project/control/host0/power_cap",
+ "org.freedesktop.DBus.Properties", "Get",
+ "xyz.openbmc_project.Control.Power.Cap", "PowerCapEnable");
+ };
getValidChassisPath(sensorsAsyncResp, std::move(getChassisPath));
}
inline void requestRoutesPower(App& app)
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 59b7ff2..ec24735 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -591,8 +591,7 @@
},
service, dbusPath, "org.freedesktop.DBus.Properties",
"Get",
- "xyz.openbmc_project.Inventory.Item.Cpu."
- "OperatingConfig",
+ "xyz.openbmc_project.Inventory.Item.Cpu.OperatingConfig",
"BaseSpeedPrioritySettings");
}
else if (dbusPropName == "BaseSpeedPriorityEnabled")
@@ -778,8 +777,8 @@
{
getCpuAssetData(aResp, serviceName, objectPath);
}
- else if (interface == "xyz.openbmc_project.Inventory."
- "Decorator.Revision")
+ else if (interface ==
+ "xyz.openbmc_project.Inventory.Decorator.Revision")
{
getCpuRevisionData(aResp, serviceName, objectPath);
}
@@ -788,19 +787,20 @@
getCpuDataByService(aResp, processorId, serviceName,
objectPath);
}
- else if (interface == "xyz.openbmc_project.Inventory."
- "Item.Accelerator")
+ else if (interface ==
+ "xyz.openbmc_project.Inventory.Item.Accelerator")
{
getAcceleratorDataByService(aResp, processorId, serviceName,
objectPath);
}
- else if (interface == "xyz.openbmc_project.Control.Processor."
- "CurrentOperatingConfig")
+ else if (
+ interface ==
+ "xyz.openbmc_project.Control.Processor.CurrentOperatingConfig")
{
getCpuConfigData(aResp, processorId, serviceName, objectPath);
}
- else if (interface == "xyz.openbmc_project.Inventory."
- "Decorator.LocationCode")
+ else if (interface ==
+ "xyz.openbmc_project.Inventory.Decorator.LocationCode")
{
getCpuLocationCode(aResp, serviceName, objectPath);
}
@@ -808,8 +808,8 @@
{
getProcessorUUID(aResp, serviceName, objectPath);
}
- else if (interface == "xyz.openbmc_project.Inventory."
- "Decorator.UniqueIdentifier")
+ else if (interface ==
+ "xyz.openbmc_project.Inventory.Decorator.UniqueIdentifier")
{
getCpuUniqueId(aResp, serviceName, objectPath);
}
@@ -1068,61 +1068,58 @@
BMCWEB_ROUTE(
app, "/redfish/v1/Systems/system/Processors/<str>/OperatingConfigs/")
.privileges(redfish::privileges::getOperatingConfigCollection)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& cpuName) {
- asyncResp->res.jsonValue["@odata.type"] =
- "#OperatingConfigCollection.OperatingConfigCollection";
- asyncResp->res.jsonValue["@odata.id"] = req.url;
- asyncResp->res.jsonValue["Name"] =
- "Operating Config Collection";
+ .methods(
+ boost::beast::http::verb::get)([](const crow::Request& req,
+ const std::shared_ptr<
+ bmcweb::AsyncResp>& asyncResp,
+ const std::string& cpuName) {
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#OperatingConfigCollection.OperatingConfigCollection";
+ asyncResp->res.jsonValue["@odata.id"] = req.url;
+ asyncResp->res.jsonValue["Name"] = "Operating Config Collection";
- // First find the matching CPU object so we know how to
- // constrain our search for related Config objects.
- crow::connections::systemBus->async_method_call(
- [asyncResp,
- cpuName](const boost::system::error_code ec,
- const std::vector<std::string>& objects) {
- if (ec)
+ // First find the matching CPU object so we know how to
+ // constrain our search for related Config objects.
+ crow::connections::systemBus->async_method_call(
+ [asyncResp, cpuName](const boost::system::error_code ec,
+ const std::vector<std::string>& objects) {
+ if (ec)
+ {
+ BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", "
+ << ec.message();
+ messages::internalError(asyncResp->res);
+ return;
+ }
+
+ for (const std::string& object : objects)
+ {
+ if (!boost::ends_with(object, cpuName))
{
- BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", "
- << ec.message();
- messages::internalError(asyncResp->res);
- return;
+ continue;
}
- for (const std::string& object : objects)
- {
- if (!boost::ends_with(object, cpuName))
- {
- continue;
- }
+ // Not expected that there will be multiple matching
+ // CPU objects, but if there are just use the first
+ // one.
- // Not expected that there will be multiple matching
- // CPU objects, but if there are just use the first
- // one.
-
- // Use the common search routine to construct the
- // Collection of all Config objects under this CPU.
- collection_util::getCollectionMembers(
- asyncResp,
- "/redfish/v1/Systems/system/Processors/" +
- cpuName + "/OperatingConfigs",
- {"xyz.openbmc_project.Inventory.Item.Cpu."
- "OperatingConfig"},
- object.c_str());
- return;
- }
- },
- "xyz.openbmc_project.ObjectMapper",
- "/xyz/openbmc_project/object_mapper",
- "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
- "/xyz/openbmc_project/inventory", 0,
- std::array<const char*, 1>{
- "xyz.openbmc_project.Control.Processor."
- "CurrentOperatingConfig"});
- });
+ // Use the common search routine to construct the
+ // Collection of all Config objects under this CPU.
+ collection_util::getCollectionMembers(
+ asyncResp,
+ "/redfish/v1/Systems/system/Processors/" + cpuName +
+ "/OperatingConfigs",
+ {"xyz.openbmc_project.Inventory.Item.Cpu.OperatingConfig"},
+ object.c_str());
+ return;
+ }
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths",
+ "/xyz/openbmc_project/inventory", 0,
+ std::array<const char*, 1>{
+ "xyz.openbmc_project.Control.Processor.CurrentOperatingConfig"});
+ });
}
inline void requestRoutesOperatingConfig(App& app)
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index af9f466..6257dce 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -1251,8 +1251,7 @@
{
BMCWEB_LOG_ERROR
- << "Invalid redundancy interface "
- "types";
+ << "Invalid redundancy interface types";
messages::internalError(
sensorsAsyncResp->asyncResp->res);
return;
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 80e6059..b83e13f 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -152,8 +152,7 @@
storageController["@odata.type"] =
"#Storage.v1_7_0.StorageController";
storageController["@odata.id"] =
- "/redfish/v1/Systems/system/Storage/1"
- "#/StorageControllers/" +
+ "/redfish/v1/Systems/system/Storage/1#/StorageControllers/" +
std::to_string(index);
storageController["Name"] = id;
storageController["MemberId"] = id;
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index fc9ad81..2f88a77 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -348,16 +348,13 @@
if (value == nullptr)
{
BMCWEB_LOG_DEBUG
- << "Find incorrect type of "
- "MemorySize";
+ << "Find incorrect type of MemorySize";
continue;
}
nlohmann::json& totalMemory =
- aResp->res
- .jsonValue["MemorySummar"
- "y"]
- ["TotalSystemMe"
- "moryGiB"];
+ aResp->res.jsonValue
+ ["MemorySummary"]
+ ["TotalSystemMemoryGiB"];
uint64_t* preValue =
totalMemory
.get_ptr<uint64_t*>();
@@ -365,10 +362,9 @@
{
continue;
}
- aResp->res
- .jsonValue["MemorySummary"]
- ["TotalSystemMemoryGi"
- "B"] =
+ aResp->res.jsonValue
+ ["MemorySummary"]
+ ["TotalSystemMemoryGiB"] =
*value / (1024 * 1024) +
*preValue;
aResp->res
@@ -388,8 +384,7 @@
if (ec3)
{
BMCWEB_LOG_ERROR
- << "DBUS response "
- "error "
+ << "DBUS response error "
<< ec3;
return;
}
@@ -400,11 +395,9 @@
->async_method_call(
std::move(getDimmProperties),
service, path,
- "org.freedesktop.DBus."
- "Properties",
+ "org.freedesktop.DBus.Properties",
"Get",
- "xyz.openbmc_project.State."
- "Decorator.OperationalStatus",
+ "xyz.openbmc_project.State.Decorator.OperationalStatus",
"Functional");
}
},
@@ -526,8 +519,7 @@
},
connection.first, path,
"org.freedesktop.DBus.Properties", "GetAll",
- "xyz.openbmc_project.Inventory.Decorator."
- "Asset");
+ "xyz.openbmc_project.Inventory.Decorator.Asset");
crow::connections::systemBus->async_method_call(
[aResp](
@@ -550,8 +542,7 @@
},
connection.first, path,
"org.freedesktop.DBus.Properties", "Get",
- "xyz.openbmc_project.Inventory.Decorator."
- "AssetTag",
+ "xyz.openbmc_project.Inventory.Decorator.AssetTag",
"AssetTag");
}
}
@@ -601,26 +592,29 @@
aResp->res.jsonValue["PowerState"] = "On";
aResp->res.jsonValue["Status"]["State"] = "Enabled";
}
- else if (*s == "xyz.openbmc_project.State.Host.HostState."
- "Quiesced")
+ else if (*s ==
+ "xyz.openbmc_project.State.Host.HostState.Quiesced")
{
aResp->res.jsonValue["PowerState"] = "On";
aResp->res.jsonValue["Status"]["State"] = "Quiesced";
}
- else if (*s == "xyz.openbmc_project.State.Host.HostState."
- "DiagnosticMode")
+ else if (
+ *s ==
+ "xyz.openbmc_project.State.Host.HostState.DiagnosticMode")
{
aResp->res.jsonValue["PowerState"] = "On";
aResp->res.jsonValue["Status"]["State"] = "InTest";
}
- else if (*s == "xyz.openbmc_project.State.Host.HostState."
- "TransitioningToRunning")
+ else if (
+ *s ==
+ "xyz.openbmc_project.State.Host.HostState.TransitioningToRunning")
{
aResp->res.jsonValue["PowerState"] = "PoweringOn";
aResp->res.jsonValue["Status"]["State"] = "Starting";
}
- else if (*s == "xyz.openbmc_project.State.Host.HostState."
- "TransitioningToOff")
+ else if (
+ *s ==
+ "xyz.openbmc_project.State.Host.HostState.TransitioningToOff")
{
aResp->res.jsonValue["PowerState"] = "PoweringOff";
aResp->res.jsonValue["Status"]["State"] = "Disabled";
@@ -766,9 +760,9 @@
}
else
{
- BMCWEB_LOG_DEBUG << "Invalid property value for "
- "BootSourceOverrideTarget: "
- << bootSource;
+ BMCWEB_LOG_DEBUG
+ << "Invalid property value for BootSourceOverrideTarget: "
+ << bootSource;
messages::propertyValueNotInList(aResp->res, rfSource,
"BootSourceTargetOverride");
return -1;
@@ -811,56 +805,56 @@
// Now convert the D-Bus BootProgress to the appropriate Redfish
// enum
std::string rfBpLastState = "None";
- if (*bootProgressStr == "xyz.openbmc_project.State.Boot.Progress."
- "ProgressStages.Unspecified")
+ if (*bootProgressStr ==
+ "xyz.openbmc_project.State.Boot.Progress.ProgressStages.Unspecified")
{
rfBpLastState = "None";
}
- else if (*bootProgressStr ==
- "xyz.openbmc_project.State.Boot.Progress.ProgressStages."
- "PrimaryProcInit")
+ else if (
+ *bootProgressStr ==
+ "xyz.openbmc_project.State.Boot.Progress.ProgressStages.PrimaryProcInit")
{
rfBpLastState = "PrimaryProcessorInitializationStarted";
}
- else if (*bootProgressStr ==
- "xyz.openbmc_project.State.Boot.Progress.ProgressStages."
- "BusInit")
+ else if (
+ *bootProgressStr ==
+ "xyz.openbmc_project.State.Boot.Progress.ProgressStages.BusInit")
{
rfBpLastState = "BusInitializationStarted";
}
- else if (*bootProgressStr ==
- "xyz.openbmc_project.State.Boot.Progress.ProgressStages."
- "MemoryInit")
+ else if (
+ *bootProgressStr ==
+ "xyz.openbmc_project.State.Boot.Progress.ProgressStages.MemoryInit")
{
rfBpLastState = "MemoryInitializationStarted";
}
- else if (*bootProgressStr ==
- "xyz.openbmc_project.State.Boot.Progress.ProgressStages."
- "SecondaryProcInit")
+ else if (
+ *bootProgressStr ==
+ "xyz.openbmc_project.State.Boot.Progress.ProgressStages.SecondaryProcInit")
{
rfBpLastState = "SecondaryProcessorInitializationStarted";
}
- else if (*bootProgressStr ==
- "xyz.openbmc_project.State.Boot.Progress.ProgressStages."
- "PCIInit")
+ else if (
+ *bootProgressStr ==
+ "xyz.openbmc_project.State.Boot.Progress.ProgressStages.PCIInit")
{
rfBpLastState = "PCIResourceConfigStarted";
}
- else if (*bootProgressStr ==
- "xyz.openbmc_project.State.Boot.Progress.ProgressStages."
- "SystemInitComplete")
+ else if (
+ *bootProgressStr ==
+ "xyz.openbmc_project.State.Boot.Progress.ProgressStages.SystemInitComplete")
{
rfBpLastState = "SystemHardwareInitializationComplete";
}
- else if (*bootProgressStr ==
- "xyz.openbmc_project.State.Boot.Progress.ProgressStages."
- "OSStart")
+ else if (
+ *bootProgressStr ==
+ "xyz.openbmc_project.State.Boot.Progress.ProgressStages.OSStart")
{
rfBpLastState = "OSBootStarted";
}
- else if (*bootProgressStr ==
- "xyz.openbmc_project.State.Boot.Progress.ProgressStages."
- "OSRunning")
+ else if (
+ *bootProgressStr ==
+ "xyz.openbmc_project.State.Boot.Progress.ProgressStages.OSRunning")
{
rfBpLastState = "OSRunning";
}
@@ -908,9 +902,10 @@
BMCWEB_LOG_DEBUG << "Boot type: " << *bootTypeStr;
- aResp->res.jsonValue["Boot"]["BootSourceOverrideMode@Redfish."
- "AllowableValues"] = {"Legacy",
- "UEFI"};
+ aResp->res
+ .jsonValue["Boot"]
+ ["BootSourceOverrideMode@Redfish.AllowableValues"] = {
+ "Legacy", "UEFI"};
auto rfType = dbusToRfBootType(*bootTypeStr);
if (rfType.empty())
@@ -958,9 +953,10 @@
BMCWEB_LOG_DEBUG << "Boot mode: " << *bootModeStr;
- aResp->res.jsonValue["Boot"]["BootSourceOverrideTarget@Redfish."
- "AllowableValues"] = {
- "None", "Pxe", "Hdd", "Cd", "Diags", "BiosSetup", "Usb"};
+ aResp->res
+ .jsonValue["Boot"]
+ ["BootSourceOverrideTarget@Redfish.AllowableValues"] =
+ {"None", "Pxe", "Hdd", "Cd", "Diags", "BiosSetup", "Usb"};
if (*bootModeStr !=
"xyz.openbmc_project.Control.Boot.Mode.Modes.Regular")
@@ -1269,9 +1265,10 @@
// "AutomaticRetryConfig" can be 3 values, Disabled, RetryAlways,
// and RetryAttempts. OpenBMC only supports Disabled and
// RetryAttempts.
- aResp->res.jsonValue["Boot"]["AutomaticRetryConfig@Redfish."
- "AllowableValues"] = {"Disabled",
- "RetryAttempts"};
+ aResp->res
+ .jsonValue["Boot"]
+ ["AutomaticRetryConfig@Redfish.AllowableValues"] = {
+ "Disabled", "RetryAttempts"};
},
"xyz.openbmc_project.Settings",
"/xyz/openbmc_project/control/host0/auto_reboot",
@@ -1300,17 +1297,13 @@
return;
}
- const boost::container::flat_map<std::string, std::string>
- policyMaps = {
- {"xyz.openbmc_project.Control.Power.RestorePolicy.Policy."
- "AlwaysOn",
- "AlwaysOn"},
- {"xyz.openbmc_project.Control.Power.RestorePolicy.Policy."
- "AlwaysOff",
- "AlwaysOff"},
- {"xyz.openbmc_project.Control.Power.RestorePolicy.Policy."
- "Restore",
- "LastState"}};
+ const boost::container::flat_map<std::string, std::string> policyMaps = {
+ {"xyz.openbmc_project.Control.Power.RestorePolicy.Policy.AlwaysOn",
+ "AlwaysOn"},
+ {"xyz.openbmc_project.Control.Power.RestorePolicy.Policy.AlwaysOff",
+ "AlwaysOff"},
+ {"xyz.openbmc_project.Control.Power.RestorePolicy.Policy.Restore",
+ "LastState"}};
const std::string* policyPtr = std::get_if<std::string>(&policy);
@@ -1507,9 +1500,9 @@
[aResp](const boost::system::error_code ec) {
if (ec)
{
- BMCWEB_LOG_DEBUG << "DBUS response error: Set "
- "TrustedModuleRequiredToBoot"
- << ec;
+ BMCWEB_LOG_DEBUG
+ << "DBUS response error: Set TrustedModuleRequiredToBoot"
+ << ec;
messages::internalError(aResp->res);
return;
}
@@ -1624,9 +1617,9 @@
}
else
{
- BMCWEB_LOG_DEBUG << "Invalid property value for "
- "BootSourceOverrideEnabled: "
- << *bootEnable;
+ BMCWEB_LOG_DEBUG
+ << "Invalid property value for BootSourceOverrideEnabled: "
+ << *bootEnable;
messages::propertyValueNotInList(aResp->res, *bootEnable,
"BootSourceOverrideEnabled");
return;
@@ -1873,8 +1866,7 @@
}
else
{
- BMCWEB_LOG_DEBUG << "Invalid property value for "
- "AutomaticRetryConfig: "
+ BMCWEB_LOG_DEBUG << "Invalid property value for AutomaticRetryConfig: "
<< automaticRetryConfig;
messages::propertyValueNotInList(aResp->res, automaticRetryConfig,
"AutomaticRetryConfig");
@@ -1911,12 +1903,12 @@
BMCWEB_LOG_DEBUG << "Set power restore policy.";
const boost::container::flat_map<std::string, std::string> policyMaps = {
- {"AlwaysOn", "xyz.openbmc_project.Control.Power.RestorePolicy.Policy."
- "AlwaysOn"},
- {"AlwaysOff", "xyz.openbmc_project.Control.Power.RestorePolicy.Policy."
- "AlwaysOff"},
- {"LastState", "xyz.openbmc_project.Control.Power.RestorePolicy.Policy."
- "Restore"}};
+ {"AlwaysOn",
+ "xyz.openbmc_project.Control.Power.RestorePolicy.Policy.AlwaysOn"},
+ {"AlwaysOff",
+ "xyz.openbmc_project.Control.Power.RestorePolicy.Policy.AlwaysOff"},
+ {"LastState",
+ "xyz.openbmc_project.Control.Power.RestorePolicy.Policy.Restore"}};
std::string powerRestorPolicy;
@@ -2031,23 +2023,23 @@
{
std::string modeString;
- if (modeValue == "xyz.openbmc_project.Control.Power.Mode."
- "PowerMode.Static")
+ if (modeValue == "xyz.openbmc_project.Control.Power.Mode.PowerMode.Static")
{
aResp->res.jsonValue["PowerMode"] = "Static";
}
- else if (modeValue == "xyz.openbmc_project.Control.Power.Mode."
- "PowerMode.MaximumPerformance")
+ else if (
+ modeValue ==
+ "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance")
{
aResp->res.jsonValue["PowerMode"] = "MaximumPerformance";
}
- else if (modeValue == "xyz.openbmc_project.Control.Power.Mode."
- "PowerMode.PowerSaving")
+ else if (modeValue ==
+ "xyz.openbmc_project.Control.Power.Mode.PowerMode.PowerSaving")
{
aResp->res.jsonValue["PowerMode"] = "PowerSaving";
}
- else if (modeValue == "xyz.openbmc_project.Control.Power.Mode."
- "PowerMode.OEM")
+ else if (modeValue ==
+ "xyz.openbmc_project.Control.Power.Mode.PowerMode.OEM")
{
aResp->res.jsonValue["PowerMode"] = "OEM";
}
@@ -2172,8 +2164,8 @@
}
else if (modeString == "MaximumPerformance")
{
- mode = "xyz.openbmc_project.Control.Power.Mode.PowerMode."
- "MaximumPerformance";
+ mode =
+ "xyz.openbmc_project.Control.Power.Mode.PowerMode.MaximumPerformance";
}
else if (modeString == "PowerSaving")
{
@@ -2694,9 +2686,9 @@
{
// More then one PowerIdlePowerSaver object is not supported and
// is an error
- BMCWEB_LOG_DEBUG << "Found more than 1 system D-Bus "
- "Power.IdlePowerSaver objects: "
- << subtree.size();
+ BMCWEB_LOG_DEBUG
+ << "Found more than 1 system D-Bus Power.IdlePowerSaver objects: "
+ << subtree.size();
messages::internalError(aResp->res);
return;
}
@@ -2928,8 +2920,8 @@
}
else if (resetType == "GracefulRestart")
{
- command = "xyz.openbmc_project.State.Host.Transition."
- "GracefulWarmReboot";
+ command =
+ "xyz.openbmc_project.State.Host.Transition.GracefulWarmReboot";
hostCommand = true;
}
else if (resetType == "PowerCycle")
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index e420130..f3987d4 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -56,8 +56,7 @@
service, objPath, "org.freedesktop.DBus.Properties", "Set",
"xyz.openbmc_project.Software.Activation", "RequestedActivation",
std::variant<std::string>(
- "xyz.openbmc_project.Software.Activation.RequestedActivations."
- "Active"));
+ "xyz.openbmc_project.Software.Activation.RequestedActivations.Active"));
}
// Note that asyncResp can be either a valid pointer or nullptr. If nullptr
@@ -143,8 +142,8 @@
std::to_string(taskData->index);
msg.read(iface, values);
- if (iface == "xyz.openbmc_project.Software."
- "Activation")
+ if (iface ==
+ "xyz.openbmc_project.Software.Activation")
{
auto findActivation =
values.find("Activation");
@@ -199,9 +198,9 @@
return task::completed;
}
}
- else if (iface ==
- "xyz.openbmc_project.Software."
- "ActivationProgress")
+ else if (
+ iface ==
+ "xyz.openbmc_project.Software.ActivationProgress")
{
auto findProgress =
values.find("Progress");
@@ -238,8 +237,7 @@
return !task::completed;
},
- "type='signal',interface='org.freedesktop.DBus."
- "Properties',"
+ "type='signal',interface='org.freedesktop.DBus.Properties',"
"member='PropertiesChanged',path='" +
objPath.str + "'");
task->startTimer(std::chrono::minutes(5));
@@ -347,8 +345,9 @@
redfish::messages::invalidUpload(asyncResp->res, url,
"Invalid archive");
}
- else if (*type == "xyz.openbmc_project.Software.Image.Error."
- "ManifestFileFailure")
+ else if (
+ *type ==
+ "xyz.openbmc_project.Software.Image.Error.ManifestFileFailure")
{
redfish::messages::invalidUpload(asyncResp->res, url,
"Invalid manifest");
@@ -359,8 +358,8 @@
redfish::messages::invalidUpload(asyncResp->res, url,
"Invalid image format");
}
- else if (*type == "xyz.openbmc_project.Software.Version.Error."
- "AlreadyExists")
+ else if (*type ==
+ "xyz.openbmc_project.Software.Version.Error.AlreadyExists")
{
redfish::messages::invalidUpload(
@@ -559,16 +558,17 @@
return;
}
// Store the ApplyTime Value
- if (*s == "xyz.openbmc_project.Software.ApplyTime."
- "RequestedApplyTimes.Immediate")
+ if (*s ==
+ "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.Immediate")
{
asyncResp->res
.jsonValue["HttpPushUriOptions"]
["HttpPushUriApplyTime"]["ApplyTime"] =
"Immediate";
}
- else if (*s == "xyz.openbmc_project.Software.ApplyTime."
- "RequestedApplyTimes.OnReset")
+ else if (
+ *s ==
+ "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.OnReset")
{
asyncResp->res
.jsonValue["HttpPushUriOptions"]
@@ -583,86 +583,82 @@
});
BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/")
.privileges(redfish::privileges::patchUpdateService)
- .methods(boost::beast::http::verb::patch)(
- [](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- BMCWEB_LOG_DEBUG << "doPatch...";
+ .methods(
+ boost::beast::http::verb::
+ patch)([](const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ BMCWEB_LOG_DEBUG << "doPatch...";
- std::optional<nlohmann::json> pushUriOptions;
- if (!json_util::readJson(req, asyncResp->res,
- "HttpPushUriOptions", pushUriOptions))
+ std::optional<nlohmann::json> pushUriOptions;
+ if (!json_util::readJson(req, asyncResp->res, "HttpPushUriOptions",
+ pushUriOptions))
+ {
+ return;
+ }
+
+ if (pushUriOptions)
+ {
+ std::optional<nlohmann::json> pushUriApplyTime;
+ if (!json_util::readJson(*pushUriOptions, asyncResp->res,
+ "HttpPushUriApplyTime",
+ pushUriApplyTime))
{
return;
}
- if (pushUriOptions)
+ if (pushUriApplyTime)
{
- std::optional<nlohmann::json> pushUriApplyTime;
- if (!json_util::readJson(*pushUriOptions, asyncResp->res,
- "HttpPushUriApplyTime",
- pushUriApplyTime))
+ std::optional<std::string> applyTime;
+ if (!json_util::readJson(*pushUriApplyTime, asyncResp->res,
+ "ApplyTime", applyTime))
{
return;
}
- if (pushUriApplyTime)
+ if (applyTime)
{
- std::optional<std::string> applyTime;
- if (!json_util::readJson(*pushUriApplyTime,
- asyncResp->res, "ApplyTime",
- applyTime))
+ std::string applyTimeNewVal;
+ if (applyTime == "Immediate")
{
+ applyTimeNewVal =
+ "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.Immediate";
+ }
+ else if (applyTime == "OnReset")
+ {
+ applyTimeNewVal =
+ "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.OnReset";
+ }
+ else
+ {
+ BMCWEB_LOG_INFO
+ << "ApplyTime value is not in the list of acceptable values";
+ messages::propertyValueNotInList(
+ asyncResp->res, *applyTime, "ApplyTime");
return;
}
- if (applyTime)
- {
- std::string applyTimeNewVal;
- if (applyTime == "Immediate")
- {
- applyTimeNewVal =
- "xyz.openbmc_project.Software.ApplyTime."
- "RequestedApplyTimes.Immediate";
- }
- else if (applyTime == "OnReset")
- {
- applyTimeNewVal =
- "xyz.openbmc_project.Software.ApplyTime."
- "RequestedApplyTimes.OnReset";
- }
- else
- {
- BMCWEB_LOG_INFO
- << "ApplyTime value is not in the list of "
- "acceptable values";
- messages::propertyValueNotInList(
- asyncResp->res, *applyTime, "ApplyTime");
- return;
- }
-
- // Set the requested image apply time value
- crow::connections::systemBus->async_method_call(
- [asyncResp](
- const boost::system::error_code ec) {
- if (ec)
- {
- BMCWEB_LOG_ERROR
- << "D-Bus responses error: " << ec;
- messages::internalError(asyncResp->res);
- return;
- }
- messages::success(asyncResp->res);
- },
- "xyz.openbmc_project.Settings",
- "/xyz/openbmc_project/software/apply_time",
- "org.freedesktop.DBus.Properties", "Set",
- "xyz.openbmc_project.Software.ApplyTime",
- "RequestedApplyTime",
- std::variant<std::string>{applyTimeNewVal});
- }
+ // Set the requested image apply time value
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](const boost::system::error_code ec) {
+ if (ec)
+ {
+ BMCWEB_LOG_ERROR
+ << "D-Bus responses error: " << ec;
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ messages::success(asyncResp->res);
+ },
+ "xyz.openbmc_project.Settings",
+ "/xyz/openbmc_project/software/apply_time",
+ "org.freedesktop.DBus.Properties", "Set",
+ "xyz.openbmc_project.Software.ApplyTime",
+ "RequestedApplyTime",
+ std::variant<std::string>{applyTimeNewVal});
}
}
- });
+ }
+ });
BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/")
.privileges(redfish::privileges::postUpdateService)
.methods(boost::beast::http::verb::post)(
@@ -691,66 +687,66 @@
{
BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/FirmwareInventory/")
.privileges(redfish::privileges::getSoftwareInventoryCollection)
- .methods(boost::beast::http::verb::get)(
- [](const crow::Request&,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
- asyncResp->res.jsonValue["@odata.type"] =
- "#SoftwareInventoryCollection.SoftwareInventoryCollection";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/UpdateService/FirmwareInventory";
- asyncResp->res.jsonValue["Name"] =
- "Software Inventory Collection";
+ .methods(
+ boost::beast::http::verb::
+ get)([](const crow::Request&,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ asyncResp->res.jsonValue["@odata.type"] =
+ "#SoftwareInventoryCollection.SoftwareInventoryCollection";
+ asyncResp->res.jsonValue["@odata.id"] =
+ "/redfish/v1/UpdateService/FirmwareInventory";
+ asyncResp->res.jsonValue["Name"] = "Software Inventory Collection";
- crow::connections::systemBus->async_method_call(
- [asyncResp](
- const boost::system::error_code ec,
- const std::vector<std::pair<
- std::string,
- std::vector<std::pair<std::string,
- std::vector<std::string>>>>>&
- subtree) {
- if (ec)
+ crow::connections::systemBus->async_method_call(
+ [asyncResp](
+ const boost::system::error_code ec,
+ const std::vector<
+ std::pair<std::string,
+ std::vector<std::pair<
+ std::string, std::vector<std::string>>>>>&
+ subtree) {
+ if (ec)
+ {
+ messages::internalError(asyncResp->res);
+ return;
+ }
+ asyncResp->res.jsonValue["Members"] =
+ nlohmann::json::array();
+ asyncResp->res.jsonValue["Members@odata.count"] = 0;
+
+ for (auto& obj : subtree)
+ {
+ sdbusplus::message::object_path path(obj.first);
+ std::string swId = path.filename();
+ if (swId.empty())
{
messages::internalError(asyncResp->res);
+ BMCWEB_LOG_DEBUG << "Can't parse firmware ID!!";
return;
}
- asyncResp->res.jsonValue["Members"] =
- nlohmann::json::array();
- asyncResp->res.jsonValue["Members@odata.count"] = 0;
- for (auto& obj : subtree)
- {
- sdbusplus::message::object_path path(obj.first);
- std::string swId = path.filename();
- if (swId.empty())
- {
- messages::internalError(asyncResp->res);
- BMCWEB_LOG_DEBUG << "Can't parse firmware ID!!";
- return;
- }
-
- nlohmann::json& members =
- asyncResp->res.jsonValue["Members"];
- members.push_back(
- {{"@odata.id", "/redfish/v1/UpdateService/"
- "FirmwareInventory/" +
- swId}});
- asyncResp->res.jsonValue["Members@odata.count"] =
- members.size();
- }
- },
- // Note that only firmware levels associated with a device
- // are stored under /xyz/openbmc_project/software therefore
- // to ensure only real FirmwareInventory items are returned,
- // this full object path must be used here as input to
- // mapper
- "xyz.openbmc_project.ObjectMapper",
- "/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"});
- });
+ nlohmann::json& members =
+ asyncResp->res.jsonValue["Members"];
+ members.push_back(
+ {{"@odata.id",
+ "/redfish/v1/UpdateService/FirmwareInventory/" +
+ swId}});
+ asyncResp->res.jsonValue["Members@odata.count"] =
+ members.size();
+ }
+ },
+ // Note that only firmware levels associated with a device
+ // are stored under /xyz/openbmc_project/software therefore
+ // to ensure only real FirmwareInventory items are returned,
+ // this full object path must be used here as input to
+ // mapper
+ "xyz.openbmc_project.ObjectMapper",
+ "/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"});
+ });
}
/* Fill related item links (i.e. bmc, bios) in for inventory */
inline static void
@@ -853,8 +849,8 @@
std::get_if<std::string>(&it->second);
if (swInvPurpose == nullptr)
{
- BMCWEB_LOG_DEBUG << "wrong types for "
- "property\"Purpose\"!";
+ BMCWEB_LOG_DEBUG
+ << "wrong types for property\"Purpose\"!";
messages::propertyValueTypeError(
asyncResp->res, "", "Purpose");
return;
diff --git a/redfish-core/lib/virtual_media.hpp b/redfish-core/lib/virtual_media.hpp
index 7383477..64f9a4c 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -777,8 +777,9 @@
inline void requestNBDVirtualMediaRoutes(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/"
- "VirtualMedia.InsertMedia")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/VirtualMedia.InsertMedia")
.privileges(redfish::privileges::postVirtualMedia)
.methods(boost::beast::http::verb::post)(
[](const crow::Request& req,
@@ -922,8 +923,9 @@
std::array<const char*, 0>());
});
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/"
- "VirtualMedia.EjectMedia")
+ BMCWEB_ROUTE(
+ app,
+ "/redfish/v1/Managers/<str>/VirtualMedia/<str>/Actions/VirtualMedia.EjectMedia")
.privileges(redfish::privileges::postVirtualMedia)
.methods(boost::beast::http::verb::post)(
[](const crow::Request& req,