summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Liu <liuxiwei@inspur.com>2021-11-16 05:06:17 +0300
committerEd Tanous <ed@tanous.net>2021-11-19 20:59:32 +0300
commit0fda0f12bb9ae0604a083dfae419be38a1418913 (patch)
treea7b1939ac5c88dbe2d509edb3d7194974049dc22
parent266a2affcef91ca12e1b04386ebb5cd03cb7b345 (diff)
downloadbmcweb-0fda0f12bb9ae0604a083dfae419be38a1418913.tar.xz
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
-rw-r--r--.clang-format2
-rw-r--r--redfish-core/lib/account_service.hpp59
-rw-r--r--redfish-core/lib/certificate_service.hpp783
-rw-r--r--redfish-core/lib/chassis.hpp36
-rw-r--r--redfish-core/lib/ethernet.hpp4
-rw-r--r--redfish-core/lib/event_service.hpp83
-rw-r--r--redfish-core/lib/hypervisor_system.hpp186
-rw-r--r--redfish-core/lib/log_services.hpp589
-rw-r--r--redfish-core/lib/managers.hpp80
-rw-r--r--redfish-core/lib/memory.hpp30
-rw-r--r--redfish-core/lib/message_registries.hpp4
-rw-r--r--redfish-core/lib/metric_report_definition.hpp85
-rw-r--r--redfish-core/lib/network_protocol.hpp133
-rw-r--r--redfish-core/lib/power.hpp163
-rw-r--r--redfish-core/lib/processor.hpp125
-rw-r--r--redfish-core/lib/sensors.hpp3
-rw-r--r--redfish-core/lib/storage.hpp3
-rw-r--r--redfish-core/lib/systems.hpp206
-rw-r--r--redfish-core/lib/update_service.hpp270
-rw-r--r--redfish-core/lib/virtual_media.hpp10
20 files changed, 1396 insertions, 1458 deletions
diff --git a/.clang-format b/.clang-format
index 52ac0a17d4..cab313967c 100644
--- a/.clang-format
+++ b/.clang-format
@@ -41,7 +41,7 @@ BreakBeforeBraces: Custom
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: AfterColon
BreakInheritanceList: AfterColon
-BreakStringLiterals: true
+BreakStringLiterals: false
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index 2ab0a1e487..8890ae18de 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -146,8 +146,10 @@ inline void userErrorMessageHandler(
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 @@ inline void getLDAPConfigData(const std::string& ldapType,
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 @@ inline void getLDAPConfigData(const std::string& ldapType,
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 @@ inline void getLDAPConfigData(const std::string& ldapType,
}
}
}
- 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 @@ inline void
{
#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 @@ inline void
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 @@ inline void
{
#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 @@ inline void
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 @@ inline void
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 @@ inline void requestAccountServiceRoutes(App& app)
asyncResp->res.jsonValue["Links"]["Role"] =
{{"@odata.id",
- "/redfish/v1/AccountService/"
- "Roles/" +
+ "/redfish/v1/AccountService/Roles/" +
role}};
}
else if (property.first ==
@@ -1809,9 +1809,8 @@ inline void requestAccountServiceRoutes(App& app)
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 a316cc5080..045426e362 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -67,15 +67,16 @@ inline void requestRoutesCertificateService(App& app)
{"@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 @@ static void getCSR(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
*/
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;
-
- // 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))
- {
- return;
- }
+ .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;
+
+ // 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;
- }
+ // 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 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"))
+ 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)
{
- objectPath = certs::httpsObjectPath;
- service = certs::httpsServiceName;
+ optKeyUsage->push_back("ServerAuthentication");
}
- else if (boost::starts_with(
- certURI,
- "/redfish/v1/AccountService/LDAP/Certificates"))
+ else if (optKeyUsage->size() == 1)
{
- 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")
- {
- 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)
+ }
+ else if (boost::starts_with(
+ certURI,
+ "/redfish/v1/AccountService/LDAP/Certificates"))
+ {
+ if (optKeyUsage->size() == 0)
{
- messages::propertyValueNotInList(
- asyncResp->res, std::to_string(*optKeyBitLength),
- "KeyBitLength");
- return;
+ optKeyUsage->push_back("ClientAuthentication");
}
-
- // validate KeyUsage supporting only 1 type based on URL
- if (boost::starts_with(certURI,
- "/redfish/v1/Managers/bmc/"
- "NetworkProtocol/HTTPS/Certificates"))
+ else if (optKeyUsage->size() == 1)
{
- 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
+ if ((*optKeyUsage)[0] != "ClientAuthentication")
{
- messages::actionParameterNotSupported(
- asyncResp->res, "KeyUsage", "GenerateCSR");
+ messages::propertyValueNotInList(
+ asyncResp->res, (*optKeyUsage)[0], "KeyUsage");
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)
+ else
{
- messages::serviceTemporarilyUnavailable(
- asyncResp->res, std::to_string(timeOut));
+ 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 @@ inline void requestRoutesCertificateActionGenerateCSR(App& app)
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())
- {
- 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")
- {
- 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)
+ // 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 response error: "
- << ec.message();
- messages::internalError(asyncResp->res);
- return;
+ getCSR(asyncResp, certURI, service, objectPath,
+ csrObjectPath.str);
+ break;
}
- },
- 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 @@ using GetObjectType =
*/
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 @@ inline void requestRoutesCertificateActionsReplaceCertificate(App& app)
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 @@ inline void requestRoutesHTTPSCertificateCollection(App& app)
{
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 @@ inline void requestRoutesHTTPSCertificateCollection(App& app)
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 @@ inline void requestRoutesLDAPCertificateCollection(App& app)
{
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)
- {
- BMCWEB_LOG_WARNING
- << "LDAP certificate query failed: " << ec;
- return;
- }
- for (const auto& cert : certs)
+ 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)
{
- long id = getIDFromURL(cert.first.str);
- if (id >= 0)
- {
- members.push_back(
- {{"@odata.id", "/redfish/v1/AccountService/"
- "LDAP/Certificates/" +
- std::to_string(id)}});
- }
+ 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 @@ inline void requestRoutesTrustStoreCertificateCollection(App& app)
{
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)
- {
- 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)
+ 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)
{
- long id = getIDFromURL(cert.first.str);
- if (id >= 0)
- {
- members.push_back(
- {{"@odata.id", "/redfish/v1/Managers/bmc/"
- "Truststore/Certificates/" +
- std::to_string(id)}});
- }
+ 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);
-
- 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());
- });
+ 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());
+ });
} // requestRoutesTrustStoreCertificateCollection
/**
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 745f5af768..8fc9129c20 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -189,8 +189,7 @@ inline void
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 @@ inline void
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 @@ inline void getChassisUUID(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
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 @@ inline void requestRoutesChassis(App& app)
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 @@ inline void requestRoutesChassis(App& app)
if (ec)
{
BMCWEB_LOG_DEBUG
- << "DBus response error for "
- "AssetTag";
+ << "DBus response error for AssetTag";
messages::internalError(asyncResp->res);
return;
}
@@ -365,8 +358,7 @@ inline void requestRoutesChassis(App& app)
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 @@ inline void requestRoutesChassis(App& app)
{
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 @@ inline void requestRoutesChassis(App& app)
{
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 @@ inline void requestRoutesChassis(App& app)
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 82d44ae239..6723d5bd18 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1089,8 +1089,8 @@ inline bool isDomainnameValid(const std::string& domainname)
{
// 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 b802280b91..d273aea3b8 100644
--- a/redfish-core/lib/event_service.hpp
+++ b/redfish-core/lib/event_service.hpp
@@ -44,48 +44,47 @@ inline void requestRoutesEventService(App& app)
{
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"}};
-
- 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;
-
- nlohmann::json supportedSSEFilters = {
- {"EventFormatType", true}, {"MessageId", true},
- {"MetricReportDefinition", true}, {"RegistryPrefix", true},
- {"OriginResource", false}, {"ResourceType", false}};
-
- asyncResp->res.jsonValue["SSEFilterPropertiesSupported"] =
- supportedSSEFilters;
- });
+ .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();
+
+ 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}};
+
+ 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 107a5fa8ca..54166a7f66 100644
--- a/redfish-core/lib/hypervisor_system.hpp
+++ b/redfish-core/lib/hypervisor_system.hpp
@@ -58,26 +58,26 @@ inline void getHypervisorState(const std::shared_ptr<bmcweb::AsyncResp>& aResp)
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 @@ inline void requestRoutesHypervisorSystems(App& app)
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";
-
- 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");
- });
+ .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");
+ });
/**
* HypervisorInterfaceCollection class to handle the GET and PATCH on
@@ -772,58 +772,58 @@ inline void requestRoutesHypervisorSystems(App& app)
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)
+ {
+ 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";
- crow::connections::systemBus->async_method_call(
- [asyncResp](const boost::system::error_code error,
- const std::vector<std::string>& ifaceList) {
- if (error)
+ 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 92caac9c18..65b12f3038 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -495,8 +495,8 @@ inline void
}
}
- 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 @@ inline void
}
}
- 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 @@ inline void createDump(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
{
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 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
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 @@ inline void requestRoutesEventLogService(App& app)
"/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 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app)
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 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app)
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 @@ inline void requestRoutesDBusEventLogEntry(App& app)
}
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 @@ inline void requestRoutesDBusEventLogEntry(App& app)
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 @@ inline void requestRoutesDBusEventLogEntry(App& app)
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 @@ inline void requestRoutesDBusEventLogEntry(App& app)
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 requestRoutesDBusEventLogEntry(App& app)
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 @@ inline void requestRoutesSystemHostLogger(App& app)
{
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 @@ inline void requestRoutesSystemHostLoggerCollection(App& app)
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))
- {
- BMCWEB_LOG_ERROR << "fail to get host log file path";
- return;
- }
+ 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)
+ 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++)
{
- asyncResp->res.jsonValue["Members@odata.count"] = logCount;
- return;
+ logEntryArray.push_back({});
+ nlohmann::json& hostLogEntry = logEntryArray.back();
+ fillHostLoggerEntryJson(std::to_string(skip + i),
+ logEntries[i], hostLogEntry);
}
- 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);
- }
+ 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 @@ inline void requestRoutesBMCJournalLogEntryCollection(App& app)
{
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))
+ .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)
+ {
+ 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)
{
- return;
+ continue;
}
- if (!getTopParam(asyncResp, req, top))
+
+ std::string idStr;
+ if (!getUniqueEntryID(journal.get(), idStr, firstEntry))
{
- return;
+ continue;
}
- // 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)
+ if (firstEntry)
{
- BMCWEB_LOG_ERROR << "failed to open journal: "
- << strerror(-ret);
- messages::internalError(asyncResp->res);
- return;
+ firstEntry = false;
}
- 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)
+ logEntryArray.push_back({});
+ nlohmann::json& bmcJournalLogEntry = logEntryArray.back();
+ if (fillBMCJournalLogEntryJson(idStr, journal.get(),
+ bmcJournalLogEntry) != 0)
{
- asyncResp->res.jsonValue["Members@odata.nextLink"] =
- "/redfish/v1/Managers/bmc/LogServices/Journal/"
- "Entries?$skip=" +
- std::to_string(skip + top);
+ 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);
+ }
+ });
}
inline void requestRoutesBMCJournalLogEntry(App& app)
@@ -2351,36 +2345,36 @@ inline void requestRoutesBMCDumpService(App& app)
{
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 requestRoutesBMCDumpEntry(App& app)
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 requestRoutesBMCDumpCreate(App& app)
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 @@ inline void requestRoutesSystemDumpService(App& app)
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 requestRoutesSystemDumpEntry(App& app)
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 requestRoutesSystemDumpCreate(App& app)
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 @@ inline void requestRoutesCrashdumpService(App& app)
"/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 @@ inline void requestRoutesCrashdumpCollect(App& app)
{
// 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 @@ inline void requestRoutesCrashdumpCollect(App& app)
}
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 @@ inline void requestRoutesDBusLogServiceActionsClear(App& app)
* 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 @@ inline void requestRoutesPostCodesLogService(App& app)
{
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 @@ static void fillPostCodeEntry(
// 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 @@ static void getPostCodeForBoot(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
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 static bool parsePostCode(const std::string& postCodeID,
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 @@ inline void requestRoutesPostCodesEntry(App& app)
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 344ca83292..12af99dc89 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -187,9 +187,9 @@ inline void requestRoutesManagerResetToDefaultsAction(App& app)
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 @@ inline void
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 @@ inline void
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 @@ inline void
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 @@ inline void
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 @@ inline void
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 @@ inline void
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 @@ inline void
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 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
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 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
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 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
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 @@ struct GetPIDValues : std::enable_shared_from_this<GetPIDValues>
}
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 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
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 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
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 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
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 @@ struct SetPIDValues : std::enable_shared_from_this<SetPIDValues>
}
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 @@ inline void getLocation(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
*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 @@ inline void requestRoutesManager(App& app)
},
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 5d508c498d..90e54e82e7 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -75,8 +75,8 @@ inline std::string translateMemoryTypeToRedfish(const std::string& memoryType)
{
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 @@ inline void getPersistentMemoryProperties(
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 @@ inline void getPersistentMemoryProperties(
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 @@ inline void getPersistentMemoryProperties(
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 @@ inline void getPersistentMemoryProperties(
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 @@ inline void getPersistentMemoryProperties(
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 @@ inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> aResp,
// 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 43359e3cdf..ae02189f64 100644
--- a/redfish-core/lib/message_registries.hpp
+++ b/redfish-core/lib/message_registries.hpp
@@ -34,8 +34,8 @@ inline void handleMessageRegistryFileCollectionGet(
// 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 fc717e4073..cb38633fb0 100644
--- a/redfish-core/lib/metric_report_definition.hpp
+++ b/redfish-core/lib/metric_report_definition.hpp
@@ -235,9 +235,8 @@ inline bool getChassisSensorNode(
!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 @@ class AddReport
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 @@ inline void requestRoutesMetricReportDefinitionCollection(App& app)
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 3a769afa78..9acf5d417a 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -380,8 +380,8 @@ inline void
{
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 @@ inline void requestRoutesNetworkProtocol(App& app)
{
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;
-
- if (!json_util::readJson(req, asyncResp->res, "NTP", ntp,
- "HostName", newHostName, "IPMI", ipmi,
- "SSH", 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))
+ {
+ 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");
- return;
+ handleNTPProtocolEnabled(*ntpEnabled, asyncResp);
}
- if (ntp)
+ if (ntpServers)
{
- std::optional<std::vector<std::string>> ntpServers;
- std::optional<bool> ntpEnabled;
- if (!json_util::readJson(*ntp, asyncResp->res, "NTPServers",
- ntpServers, "ProtocolEnabled",
- ntpEnabled))
- {
- return;
- }
-
- if (ntpEnabled)
- {
- handleNTPProtocolEnabled(*ntpEnabled, asyncResp);
- }
-
- if (ntpServers)
- {
- stl_utils::removeDuplicate(*ntpServers);
- handleNTPServersPatch(asyncResp, *ntpServers);
- }
+ stl_utils::removeDuplicate(*ntpServers);
+ handleNTPServersPatch(asyncResp, *ntpServers);
}
+ }
- if (ipmi)
+ if (ipmi)
+ {
+ std::optional<bool> ipmiProtocolEnabled;
+ if (!json_util::readJson(*ipmi, asyncResp->res,
+ "ProtocolEnabled",
+ ipmiProtocolEnabled))
{
- std::optional<bool> ipmiProtocolEnabled;
- if (!json_util::readJson(*ipmi, asyncResp->res,
- "ProtocolEnabled",
- ipmiProtocolEnabled))
- {
- return;
- }
+ return;
+ }
- if (ipmiProtocolEnabled)
- {
- handleProtocolEnabled(
- *ipmiProtocolEnabled, asyncResp,
- "/xyz/openbmc_project/control/service/"
- "phosphor_2dipmi_2dnet_40");
- }
+ if (ipmiProtocolEnabled)
+ {
+ handleProtocolEnabled(
+ *ipmiProtocolEnabled, asyncResp,
+ "/xyz/openbmc_project/control/service/phosphor_2dipmi_2dnet_40");
}
+ }
- if (ssh)
+ if (ssh)
+ {
+ std::optional<bool> sshProtocolEnabled;
+ if (!json_util::readJson(*ssh, asyncResp->res,
+ "ProtocolEnabled", sshProtocolEnabled))
{
- std::optional<bool> sshProtocolEnabled;
- if (!json_util::readJson(*ssh, asyncResp->res,
- "ProtocolEnabled",
- sshProtocolEnabled))
- {
- return;
- }
+ return;
+ }
- if (sshProtocolEnabled)
- {
- handleProtocolEnabled(
- *sshProtocolEnabled, asyncResp,
- "/xyz/openbmc_project/control/service/dropbear");
- }
+ 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 bf332502c1..d7fb7dd9be 100644
--- a/redfish-core/lib/power.hpp
+++ b/redfish-core/lib/power.hpp
@@ -27,102 +27,99 @@ inline void setPowerCapOverride(
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;
}
-
- 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))
+ // 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 (!powerLimit)
+ if (!(*b))
{
+ messages::actionNotSupported(
+ sensorsAsyncResp->asyncResp->res,
+ "Setting LimitInWatts when PowerLimit feature is disabled");
+ BMCWEB_LOG_ERROR << "PowerLimit feature is disabled ";
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 59b7ff29d7..ec24735ba1 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -591,8 +591,7 @@ inline void getCpuConfigData(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
},
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 @@ inline void getProcessorData(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
{
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 @@ inline void getProcessorData(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
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 @@ inline void getProcessorData(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
{
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 @@ inline void requestRoutesOperatingConfigCollection(App& app)
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";
-
- // 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;
- }
+ .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)
+ {
+ BMCWEB_LOG_WARNING << "D-Bus error: " << ec << ", "
+ << ec.message();
+ messages::internalError(asyncResp->res);
+ return;
+ }
- for (const std::string& object : objects)
+ for (const std::string& object : objects)
+ {
+ if (!boost::ends_with(object, cpuName))
{
- 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.
-
- // 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;
+ continue;
}
- },
- "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"});
- });
+
+ // 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"});
+ });
}
inline void requestRoutesOperatingConfig(App& app)
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index af9f466e28..6257dce9fe 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -1251,8 +1251,7 @@ inline void populateFanRedundancy(
{
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 80e60599b5..b83e13f2d8 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -152,8 +152,7 @@ inline void requestRoutesStorage(App& app)
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 fc9ad81c77..2f88a7771f 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -348,16 +348,13 @@ inline void
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 @@ inline void
{
continue;
}
- aResp->res
- .jsonValue["MemorySummary"]
- ["TotalSystemMemoryGi"
- "B"] =
+ aResp->res.jsonValue
+ ["MemorySummary"]
+ ["TotalSystemMemoryGiB"] =
*value / (1024 * 1024) +
*preValue;
aResp->res
@@ -388,8 +384,7 @@ inline void
if (ec3)
{
BMCWEB_LOG_ERROR
- << "DBUS response "
- "error "
+ << "DBUS response error "
<< ec3;
return;
}
@@ -400,11 +395,9 @@ inline void
->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 @@ inline void
},
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 @@ inline void
},
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 @@ inline void getHostState(const std::shared_ptr<bmcweb::AsyncResp>& aResp)
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 @@ inline int assignBootParameters(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
}
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 @@ inline void getBootProgress(const std::shared_ptr<bmcweb::AsyncResp>& aResp)
// 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 @@ inline void getBootOverrideType(const std::shared_ptr<bmcweb::AsyncResp>& aResp)
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 @@ inline void getBootOverrideMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp)
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 @@ inline void getAutomaticRetry(const std::shared_ptr<bmcweb::AsyncResp>& aResp)
// "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 @@ inline void
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 @@ inline void setTrustedModuleRequiredToBoot(
[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 @@ inline void setBootEnable(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
}
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 @@ inline void setAutomaticRetry(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
}
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 @@ inline void
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 @@ inline void translatePowerMode(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
{
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 @@ inline std::string
}
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 @@ inline void setIdlePowerSaver(const std::shared_ptr<bmcweb::AsyncResp>& aResp,
{
// 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 @@ inline void requestRoutesSystemActionsReset(App& app)
}
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 e420130df7..f3987d4c74 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -56,8 +56,7 @@ inline static void activateImage(const std::string& objPath,
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 @@ static void
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 @@ static void
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 @@ static void
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 @@ static void monitorForSoftwareAvailable(
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 @@ static void monitorForSoftwareAvailable(
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 @@ inline void requestRoutesUpdateService(App& app)
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 @@ inline void requestRoutesUpdateService(App& app)
});
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))
+ {
+ return;
+ }
- std::optional<nlohmann::json> pushUriOptions;
- if (!json_util::readJson(req, asyncResp->res,
- "HttpPushUriOptions", pushUriOptions))
+ 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")
{
- return;
+ applyTimeNewVal =
+ "xyz.openbmc_project.Software.ApplyTime.RequestedApplyTimes.Immediate";
}
-
- if (applyTime)
+ else if (applyTime == "OnReset")
{
- 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});
+ 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});
}
}
- });
+ }
+ });
BMCWEB_ROUTE(app, "/redfish/v1/UpdateService/")
.privileges(redfish::privileges::postUpdateService)
.methods(boost::beast::http::verb::post)(
@@ -691,66 +687,66 @@ inline void requestRoutesSoftwareInventoryCollection(App& app)
{
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";
-
- 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)
+ .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)
+ {
+ 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 @@ inline void requestRoutesSoftwareInventory(App& app)
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 7383477b3f..64f9a4cb42 100644
--- a/redfish-core/lib/virtual_media.hpp
+++ b/redfish-core/lib/virtual_media.hpp
@@ -777,8 +777,9 @@ inline void doVmAction(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
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 @@ inline void requestNBDVirtualMediaRoutes(App& app)
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,