summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2024-04-18 01:40:31 +0300
committerEd Tanous <ed@tanous.net>2024-05-01 18:14:17 +0300
commit25b54dba775b31021a3a4677eb79e9771bcb97f7 (patch)
treefcf84de17508887775cc14a9c15ad4a41d72b049 /redfish-core
parentaca174983be5a0d2af08044dd93487908ae6cfe5 (diff)
downloadbmcweb-25b54dba775b31021a3a4677eb79e9771bcb97f7.tar.xz
Bring consistency to config options
The configuration options that exist in bmcweb are an amalgimation of CROW options, CMAKE options using #define, pre-bmcweb ifdef mechanisms and meson options using a config file. This history has led to a lot of different ways to configure code in the codebase itself, which has led to problems, and issues in consistency. ifdef options do no compile time checking of code not within the branch. This is good when you have optional dependencies, but not great when you're trying to ensure both options compile. This commit moves all internal configuration options to: 1. A namespace called bmcweb 2. A naming scheme matching the meson option. hyphens are replaced with underscores, and the option is uppercased. This consistent transform allows matching up option keys with their code counterparts, without naming changes. 3. All options are bool true = enabled, and any options with _ENABLED or _DISABLED postfixes have those postfixes removed. (note, there are still some options with disable in the name, those are left as-is) 4. All options are now constexpr booleans, without an explicit compare. To accomplish this, unfortunately an option list in config/meson.build is required, given that meson doesn't provide a way to dump all options, as is a manual entry in bmcweb_config.h.in, in addition to the meson_options. This obsoletes the map in the main meson.build, which helps some of the complexity. Now that we've done this, we have some rules that will be documented. 1. Runtime behavior changes should be added as a constexpr bool to bmcweb_config.h 2. Options that require optionally pulling in a dependency shall use an ifdef, defined in the primary meson.build. (note, there are no options that currently meet this class, but it's included for completeness.) Note, that this consolidation means that at configure time, all options are printed. This is a good thing and allows direct comparison of configs in log files. Tested: Code compiles Server boots, and shows options configured in the default build. (HTTPS, log level, etc) Change-Id: I94e79a56bcdc01755036e4e7278c7e69e25809ce Signed-off-by: Ed Tanous <ed@tanous.net>
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/include/query.hpp14
-rw-r--r--redfish-core/include/utils/query_param.hpp2
-rw-r--r--redfish-core/lib/account_service.hpp102
-rw-r--r--redfish-core/lib/bios.hpp4
-rw-r--r--redfish-core/lib/chassis.hpp39
-rw-r--r--redfish-core/lib/fabric_adapters.hpp8
-rw-r--r--redfish-core/lib/log_services.hpp178
-rw-r--r--redfish-core/lib/managers.hpp87
-rw-r--r--redfish-core/lib/memory.hpp4
-rw-r--r--redfish-core/lib/pcie.hpp8
-rw-r--r--redfish-core/lib/processor.hpp10
-rw-r--r--redfish-core/lib/sensors.hpp39
-rw-r--r--redfish-core/lib/service_root.hpp21
-rw-r--r--redfish-core/lib/storage.hpp4
-rw-r--r--redfish-core/lib/systems.hpp46
-rw-r--r--redfish-core/lib/update_service.hpp9
-rw-r--r--redfish-core/src/redfish.cpp158
17 files changed, 393 insertions, 340 deletions
diff --git a/redfish-core/include/query.hpp b/redfish-core/include/query.hpp
index e68b89ae00..063f1a8ef2 100644
--- a/redfish-core/include/query.hpp
+++ b/redfish-core/include/query.hpp
@@ -147,13 +147,15 @@ inline bool handleIfMatch(crow::App& app, const crow::Request& req,
bool needToCallHandlers = true;
-#ifdef BMCWEB_ENABLE_REDFISH_AGGREGATION
- needToCallHandlers = RedfishAggregator::beginAggregation(req, asyncResp) ==
- Result::LocalHandle;
+ if constexpr (BMCWEB_REDFISH_AGGREGATION)
+ {
+ needToCallHandlers = RedfishAggregator::beginAggregation(
+ req, asyncResp) == Result::LocalHandle;
- // If the request should be forwarded to a satellite BMC then we don't want
- // to write anything to the asyncResp since it will get overwritten later.
-#endif
+ // If the request should be forwarded to a satellite BMC then we don't
+ // want to write anything to the asyncResp since it will get overwritten
+ // later.
+ }
// If this isn't a get, no need to do anything with parameters
if (req.method() != boost::beast::http::verb::get)
diff --git a/redfish-core/include/utils/query_param.hpp b/redfish-core/include/utils/query_param.hpp
index 2441c9f3c0..eadb66ed5c 100644
--- a/redfish-core/include/utils/query_param.hpp
+++ b/redfish-core/include/utils/query_param.hpp
@@ -389,7 +389,7 @@ inline std::optional<Query> parseParameters(boost::urls::params_view urlParams,
}
ret.isOnly = true;
}
- else if (it.key == "$expand" && bmcwebInsecureEnableQueryParams)
+ else if (it.key == "$expand" && BMCWEB_INSECURE_ENABLE_REDFISH_QUERY)
{
if (!getExpandType(it.value, ret))
{
diff --git a/redfish-core/lib/account_service.hpp b/redfish-core/lib/account_service.hpp
index aab116e6b1..972512b145 100644
--- a/redfish-core/lib/account_service.hpp
+++ b/redfish-core/lib/account_service.hpp
@@ -829,56 +829,62 @@ inline void
if (auth.basicAuth)
{
-#ifndef BMCWEB_ENABLE_BASIC_AUTHENTICATION
- messages::actionNotSupported(
- asyncResp->res,
- "Setting BasicAuth when basic-auth feature is disabled");
- return;
-#endif
+ if constexpr (!BMCWEB_BASIC_AUTH)
+ {
+ messages::actionNotSupported(
+ asyncResp->res,
+ "Setting BasicAuth when basic-auth feature is disabled");
+ return;
+ }
+
authMethodsConfig.basic = *auth.basicAuth;
}
if (auth.cookie)
{
-#ifndef BMCWEB_ENABLE_COOKIE_AUTHENTICATION
- messages::actionNotSupported(
- asyncResp->res,
- "Setting Cookie when cookie-auth feature is disabled");
- return;
-#endif
+ if constexpr (!BMCWEB_COOKIE_AUTH)
+ {
+ messages::actionNotSupported(
+ asyncResp->res,
+ "Setting Cookie when cookie-auth feature is disabled");
+ return;
+ }
authMethodsConfig.cookie = *auth.cookie;
}
if (auth.sessionToken)
{
-#ifndef BMCWEB_ENABLE_SESSION_AUTHENTICATION
- messages::actionNotSupported(
- asyncResp->res,
- "Setting SessionToken when session-auth feature is disabled");
- return;
-#endif
+ if constexpr (!BMCWEB_SESSION_AUTH)
+ {
+ messages::actionNotSupported(
+ asyncResp->res,
+ "Setting SessionToken when session-auth feature is disabled");
+ return;
+ }
authMethodsConfig.sessionToken = *auth.sessionToken;
}
if (auth.xToken)
{
-#ifndef BMCWEB_ENABLE_XTOKEN_AUTHENTICATION
- messages::actionNotSupported(
- asyncResp->res,
- "Setting XToken when xtoken-auth feature is disabled");
- return;
-#endif
+ if constexpr (!BMCWEB_XTOKEN_AUTH)
+ {
+ messages::actionNotSupported(
+ asyncResp->res,
+ "Setting XToken when xtoken-auth feature is disabled");
+ return;
+ }
authMethodsConfig.xtoken = *auth.xToken;
}
if (auth.tls)
{
-#ifndef BMCWEB_ENABLE_MUTUAL_TLS_AUTHENTICATION
- messages::actionNotSupported(
- asyncResp->res,
- "Setting TLS when mutual-tls-auth feature is disabled");
- return;
-#endif
+ if constexpr (!BMCWEB_MUTUAL_TLS_AUTH)
+ {
+ messages::actionNotSupported(
+ asyncResp->res,
+ "Setting TLS when mutual-tls-auth feature is disabled");
+ return;
+ }
authMethodsConfig.tls = *auth.tls;
}
@@ -1705,11 +1711,13 @@ inline void
boost::beast::http::field::link,
"</redfish/v1/JsonSchemas/ManagerAccount/ManagerAccount.json>; rel=describedby");
-#ifdef BMCWEB_INSECURE_DISABLE_AUTHENTICATION
- // If authentication is disabled, there are no user accounts
- messages::resourceNotFound(asyncResp->res, "ManagerAccount", accountName);
- return;
-#endif // BMCWEB_INSECURE_DISABLE_AUTHENTICATION
+ if constexpr (BMCWEB_INSECURE_DISABLE_AUTH)
+ {
+ // If authentication is disabled, there are no user accounts
+ messages::resourceNotFound(asyncResp->res, "ManagerAccount",
+ accountName);
+ return;
+ }
if (req.session == nullptr)
{
@@ -1882,12 +1890,12 @@ inline void
return;
}
-#ifdef BMCWEB_INSECURE_DISABLE_AUTHENTICATION
- // If authentication is disabled, there are no user accounts
- messages::resourceNotFound(asyncResp->res, "ManagerAccount", username);
- return;
-
-#endif // BMCWEB_INSECURE_DISABLE_AUTHENTICATION
+ if constexpr (BMCWEB_INSECURE_DISABLE_AUTH)
+ {
+ // If authentication is disabled, there are no user accounts
+ messages::resourceNotFound(asyncResp->res, "ManagerAccount", username);
+ return;
+ }
sdbusplus::message::object_path tempObjPath(rootUserDbusPath);
tempObjPath /= username;
const std::string userPath(tempObjPath);
@@ -1916,12 +1924,12 @@ inline void
{
return;
}
-#ifdef BMCWEB_INSECURE_DISABLE_AUTHENTICATION
- // If authentication is disabled, there are no user accounts
- messages::resourceNotFound(asyncResp->res, "ManagerAccount", username);
- return;
-
-#endif // BMCWEB_INSECURE_DISABLE_AUTHENTICATION
+ if constexpr (BMCWEB_INSECURE_DISABLE_AUTH)
+ {
+ // If authentication is disabled, there are no user accounts
+ messages::resourceNotFound(asyncResp->res, "ManagerAccount", username);
+ return;
+ }
std::optional<std::string> newUserName;
std::optional<std::string> password;
std::optional<bool> enabled;
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index 025f4361c8..477c15e1d0 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -19,7 +19,7 @@ inline void
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -70,7 +70,7 @@ inline void
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 9ee10b5c62..19728a470e 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -402,23 +402,28 @@ inline void handleDecoratorAssetProperties(
asyncResp->res.jsonValue["Name"] = chassisId;
asyncResp->res.jsonValue["Id"] = chassisId;
-#ifdef BMCWEB_ALLOW_DEPRECATED_POWER_THERMAL
- asyncResp->res.jsonValue["Thermal"]["@odata.id"] =
- boost::urls::format("/redfish/v1/Chassis/{}/Thermal", chassisId);
- // Power object
- asyncResp->res.jsonValue["Power"]["@odata.id"] =
- boost::urls::format("/redfish/v1/Chassis/{}/Power", chassisId);
-#endif
-#ifdef BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM
- asyncResp->res.jsonValue["ThermalSubsystem"]["@odata.id"] =
- boost::urls::format("/redfish/v1/Chassis/{}/ThermalSubsystem",
- chassisId);
- asyncResp->res.jsonValue["PowerSubsystem"]["@odata.id"] =
- boost::urls::format("/redfish/v1/Chassis/{}/PowerSubsystem", chassisId);
- asyncResp->res.jsonValue["EnvironmentMetrics"]["@odata.id"] =
- boost::urls::format("/redfish/v1/Chassis/{}/EnvironmentMetrics",
- chassisId);
-#endif
+
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_POWER_THERMAL)
+ {
+ asyncResp->res.jsonValue["Thermal"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/Thermal", chassisId);
+ // Power object
+ asyncResp->res.jsonValue["Power"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/Power", chassisId);
+ }
+
+ if constexpr (BMCWEB_REDFISH_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM)
+ {
+ asyncResp->res.jsonValue["ThermalSubsystem"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/ThermalSubsystem",
+ chassisId);
+ asyncResp->res.jsonValue["PowerSubsystem"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/PowerSubsystem",
+ chassisId);
+ asyncResp->res.jsonValue["EnvironmentMetrics"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Chassis/{}/EnvironmentMetrics",
+ chassisId);
+ }
// SensorCollection
asyncResp->res.jsonValue["Sensors"]["@odata.id"] =
boost::urls::format("/redfish/v1/Chassis/{}/Sensors", chassisId);
diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp
index 87015dd3c5..46e67d2b49 100644
--- a/redfish-core/lib/fabric_adapters.hpp
+++ b/redfish-core/lib/fabric_adapters.hpp
@@ -266,7 +266,7 @@ inline void
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -293,7 +293,7 @@ inline void handleFabricAdapterCollectionGet(
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -333,7 +333,7 @@ inline void handleFabricAdapterCollectionHead(
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -391,7 +391,7 @@ inline void
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 1e5a34f15b..1453a4b11f 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -865,7 +865,7 @@ inline void
const std::string& entryID,
const std::string& dumpType)
{
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1276,7 +1276,7 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1305,25 +1305,29 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
eventLog["@odata.id"] =
"/redfish/v1/Systems/system/LogServices/EventLog";
logServiceArray.emplace_back(std::move(eventLog));
-#ifdef BMCWEB_ENABLE_REDFISH_DUMP_LOG
- nlohmann::json::object_t dumpLog;
- dumpLog["@odata.id"] = "/redfish/v1/Systems/system/LogServices/Dump";
- logServiceArray.emplace_back(std::move(dumpLog));
-#endif
-
-#ifdef BMCWEB_ENABLE_REDFISH_CPU_LOG
- nlohmann::json::object_t crashdump;
- crashdump["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/Crashdump";
- logServiceArray.emplace_back(std::move(crashdump));
-#endif
+ if constexpr (BMCWEB_REDFISH_DUMP_LOG)
+ {
+ nlohmann::json::object_t dumpLog;
+ dumpLog["@odata.id"] =
+ "/redfish/v1/Systems/system/LogServices/Dump";
+ logServiceArray.emplace_back(std::move(dumpLog));
+ }
-#ifdef BMCWEB_ENABLE_REDFISH_HOST_LOGGER
- nlohmann::json::object_t hostlogger;
- hostlogger["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/HostLogger";
- logServiceArray.emplace_back(std::move(hostlogger));
-#endif
+ if constexpr (BMCWEB_REDFISH_DUMP_LOG)
+ {
+ nlohmann::json::object_t crashdump;
+ crashdump["@odata.id"] =
+ "/redfish/v1/Systems/system/LogServices/Crashdump";
+ logServiceArray.emplace_back(std::move(crashdump));
+ }
+
+ if constexpr (BMCWEB_REDFISH_HOST_LOGGER)
+ {
+ nlohmann::json::object_t hostlogger;
+ hostlogger["@odata.id"] =
+ "/redfish/v1/Systems/system/LogServices/HostLogger";
+ logServiceArray.emplace_back(std::move(hostlogger));
+ }
asyncResp->res.jsonValue["Members@odata.count"] =
logServiceArray.size();
@@ -1556,7 +1560,7 @@ inline void requestRoutesJournalEventLogEntryCollection(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1661,7 +1665,7 @@ inline void requestRoutesJournalEventLogEntry(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1738,7 +1742,7 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1935,7 +1939,7 @@ inline void requestRoutesDBusEventLogEntry(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -2049,7 +2053,7 @@ inline void requestRoutesDBusEventLogEntry(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -2089,7 +2093,7 @@ inline void requestRoutesDBusEventLogEntry(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -2229,7 +2233,7 @@ inline void requestRoutesSystemHostLogger(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -2273,7 +2277,7 @@ inline void requestRoutesSystemHostLoggerCollection(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -2357,7 +2361,7 @@ inline void requestRoutesSystemHostLoggerLogEntry(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -2435,57 +2439,59 @@ inline void handleBMCLogServicesCollectionGet(
nlohmann::json& logServiceArray = asyncResp->res.jsonValue["Members"];
logServiceArray = nlohmann::json::array();
-#ifdef BMCWEB_ENABLE_REDFISH_BMC_JOURNAL
- nlohmann::json::object_t journal;
- journal["@odata.id"] = "/redfish/v1/Managers/bmc/LogServices/Journal";
- logServiceArray.emplace_back(std::move(journal));
-#endif
+ if constexpr (BMCWEB_REDFISH_BMC_JOURNAL)
+ {
+ nlohmann::json::object_t journal;
+ journal["@odata.id"] = "/redfish/v1/Managers/bmc/LogServices/Journal";
+ logServiceArray.emplace_back(std::move(journal));
+ }
asyncResp->res.jsonValue["Members@odata.count"] = logServiceArray.size();
-#ifdef BMCWEB_ENABLE_REDFISH_DUMP_LOG
- constexpr std::array<std::string_view, 1> interfaces = {
- "xyz.openbmc_project.Collection.DeleteAll"};
- dbus::utility::getSubTreePaths(
- "/xyz/openbmc_project/dump", 0, interfaces,
- [asyncResp](
- const boost::system::error_code& ec,
- const dbus::utility::MapperGetSubTreePathsResponse& subTreePaths) {
- if (ec)
- {
- BMCWEB_LOG_ERROR(
- "handleBMCLogServicesCollectionGet respHandler got error {}",
- ec);
- // Assume that getting an error simply means there are no dump
- // LogServices. Return without adding any error response.
- return;
- }
-
- nlohmann::json& logServiceArrayLocal =
- asyncResp->res.jsonValue["Members"];
-
- for (const std::string& path : subTreePaths)
- {
- if (path == "/xyz/openbmc_project/dump/bmc")
+ if constexpr (BMCWEB_REDFISH_DUMP_LOG)
+ {
+ constexpr std::array<std::string_view, 1> interfaces = {
+ "xyz.openbmc_project.Collection.DeleteAll"};
+ dbus::utility::getSubTreePaths(
+ "/xyz/openbmc_project/dump", 0, interfaces,
+ [asyncResp](const boost::system::error_code& ec,
+ const dbus::utility::MapperGetSubTreePathsResponse&
+ subTreePaths) {
+ if (ec)
{
- nlohmann::json::object_t member;
- member["@odata.id"] =
- "/redfish/v1/Managers/bmc/LogServices/Dump";
- logServiceArrayLocal.emplace_back(std::move(member));
+ BMCWEB_LOG_ERROR(
+ "handleBMCLogServicesCollectionGet respHandler got error {}",
+ ec);
+ // Assume that getting an error simply means there are no dump
+ // LogServices. Return without adding any error response.
+ return;
}
- else if (path == "/xyz/openbmc_project/dump/faultlog")
+
+ nlohmann::json& logServiceArrayLocal =
+ asyncResp->res.jsonValue["Members"];
+
+ for (const std::string& path : subTreePaths)
{
- nlohmann::json::object_t member;
- member["@odata.id"] =
- "/redfish/v1/Managers/bmc/LogServices/FaultLog";
- logServiceArrayLocal.emplace_back(std::move(member));
+ if (path == "/xyz/openbmc_project/dump/bmc")
+ {
+ nlohmann::json::object_t member;
+ member["@odata.id"] =
+ "/redfish/v1/Managers/bmc/LogServices/Dump";
+ logServiceArrayLocal.emplace_back(std::move(member));
+ }
+ else if (path == "/xyz/openbmc_project/dump/faultlog")
+ {
+ nlohmann::json::object_t member;
+ member["@odata.id"] =
+ "/redfish/v1/Managers/bmc/LogServices/FaultLog";
+ logServiceArrayLocal.emplace_back(std::move(member));
+ }
}
- }
- asyncResp->res.jsonValue["Members@odata.count"] =
- logServiceArrayLocal.size();
- });
-#endif
+ asyncResp->res.jsonValue["Members@odata.count"] =
+ logServiceArrayLocal.size();
+ });
+ }
}
inline void requestRoutesBMCLogServiceCollection(App& app)
@@ -3004,7 +3010,7 @@ inline void handleLogServicesDumpCollectDiagnosticDataComputerSystemPost(
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3040,7 +3046,7 @@ inline void handleLogServicesDumpClearLogComputerSystemPost(
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3242,7 +3248,7 @@ inline void requestRoutesCrashdumpService(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3300,7 +3306,7 @@ void inline requestRoutesCrashdumpClear(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3417,7 +3423,7 @@ inline void requestRoutesCrashdumpEntryCollection(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3493,7 +3499,7 @@ inline void requestRoutesCrashdumpEntry(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3527,7 +3533,7 @@ inline void requestRoutesCrashdumpFile(App& app)
// Do not call getRedfishRoute here since the crashdump file is not a
// Redfish resource.
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3633,7 +3639,7 @@ inline void requestRoutesCrashdumpCollect(App& app)
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3769,7 +3775,7 @@ inline void requestRoutesDBusLogServiceActionsClear(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3823,7 +3829,7 @@ inline void requestRoutesPostCodesLogService(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3875,7 +3881,7 @@ inline void requestRoutesPostCodesClear(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -4236,7 +4242,7 @@ inline void requestRoutesPostCodesEntryCollection(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -4287,7 +4293,7 @@ inline void requestRoutesPostCodesEntryAdditionalData(App& app)
asyncResp->res.result(boost::beast::http::status::bad_request);
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -4373,7 +4379,7 @@ inline void requestRoutesPostCodesEntry(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 592bbd8642..e6f42bea8c 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -1945,7 +1945,7 @@ inline void requestRoutesManager(App& app)
asyncResp->res.jsonValue["EthernetInterfaces"]["@odata.id"] =
"/redfish/v1/Managers/bmc/EthernetInterfaces";
- if constexpr (bmcwebNbdProxy)
+ if constexpr (BMCWEB_VM_NBDPROXY)
{
asyncResp->res.jsonValue["VirtualMedia"]["@odata.id"] =
"/redfish/v1/Managers/bmc/VirtualMedia";
@@ -1998,15 +1998,18 @@ inline void requestRoutesManager(App& app)
asyncResp->res.jsonValue["SerialConsole"]["MaxConcurrentSessions"] = 15;
asyncResp->res.jsonValue["SerialConsole"]["ConnectTypesSupported"] =
nlohmann::json::array_t({"IPMI", "SSH"});
-#ifdef BMCWEB_ENABLE_KVM
- // Fill in GraphicalConsole info
- asyncResp->res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true;
- asyncResp->res.jsonValue["GraphicalConsole"]["MaxConcurrentSessions"] =
- 4;
- asyncResp->res.jsonValue["GraphicalConsole"]["ConnectTypesSupported"] =
- nlohmann::json::array_t({"KVMIP"});
-#endif // BMCWEB_ENABLE_KVM
- if constexpr (!bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_KVM)
+ {
+ // Fill in GraphicalConsole info
+ asyncResp->res.jsonValue["GraphicalConsole"]["ServiceEnabled"] =
+ true;
+ asyncResp->res
+ .jsonValue["GraphicalConsole"]["MaxConcurrentSessions"] = 4;
+ asyncResp->res
+ .jsonValue["GraphicalConsole"]["ConnectTypesSupported"] =
+ nlohmann::json::array_t({"KVMIP"});
+ }
+ if constexpr (!BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
asyncResp->res.jsonValue["Links"]["ManagerForServers@odata.count"] =
1;
@@ -2031,10 +2034,11 @@ inline void requestRoutesManager(App& app)
managerDiagnosticData["@odata.id"] =
"/redfish/v1/Managers/bmc/ManagerDiagnosticData";
-#ifdef BMCWEB_ENABLE_REDFISH_OEM_MANAGER_FAN_DATA
- auto pids = std::make_shared<GetPIDValues>(asyncResp);
- pids->run();
-#endif
+ if constexpr (BMCWEB_REDFISH_OEM_MANAGER_FAN_DATA)
+ {
+ auto pids = std::make_shared<GetPIDValues>(asyncResp);
+ pids->run();
+ }
getMainChassisId(asyncResp,
[](const std::string& chassisId,
@@ -2217,36 +2221,39 @@ inline void requestRoutesManager(App& app)
if (pidControllers || fanControllers || fanZones ||
stepwiseControllers || profile)
{
-#ifdef BMCWEB_ENABLE_REDFISH_OEM_MANAGER_FAN_DATA
- std::vector<
- std::pair<std::string, std::optional<nlohmann::json::object_t>>>
- configuration;
- if (pidControllers)
- {
- configuration.emplace_back("PidControllers",
- std::move(pidControllers));
- }
- if (fanControllers)
- {
- configuration.emplace_back("FanControllers",
- std::move(fanControllers));
- }
- if (fanZones)
+ if constexpr (BMCWEB_REDFISH_OEM_MANAGER_FAN_DATA)
{
- configuration.emplace_back("FanZones", std::move(fanZones));
+ std::vector<std::pair<std::string,
+ std::optional<nlohmann::json::object_t>>>
+ configuration;
+ if (pidControllers)
+ {
+ configuration.emplace_back("PidControllers",
+ std::move(pidControllers));
+ }
+ if (fanControllers)
+ {
+ configuration.emplace_back("FanControllers",
+ std::move(fanControllers));
+ }
+ if (fanZones)
+ {
+ configuration.emplace_back("FanZones", std::move(fanZones));
+ }
+ if (stepwiseControllers)
+ {
+ configuration.emplace_back("StepwiseControllers",
+ std::move(stepwiseControllers));
+ }
+ auto pid = std::make_shared<SetPIDValues>(
+ asyncResp, std::move(configuration), profile);
+ pid->run();
}
- if (stepwiseControllers)
+ else
{
- configuration.emplace_back("StepwiseControllers",
- std::move(stepwiseControllers));
+ messages::propertyUnknown(asyncResp->res, "Oem");
+ return;
}
- auto pid = std::make_shared<SetPIDValues>(
- asyncResp, std::move(configuration), profile);
- pid->run();
-#else
- messages::propertyUnknown(asyncResp->res, "Oem");
- return;
-#endif
}
if (activeSoftwareImageOdataId)
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 2882da0ea7..49d19623fa 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -778,7 +778,7 @@ inline void requestRoutesMemoryCollection(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -822,7 +822,7 @@ inline void requestRoutesMemory(App& app)
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index 223522b5f0..af78cc8ab2 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -108,7 +108,7 @@ static inline void handlePCIeDeviceCollectionGet(
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -566,7 +566,7 @@ inline void
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -639,7 +639,7 @@ inline void handlePCIeFunctionCollectionGet(
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -790,7 +790,7 @@ inline void
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index ff17ebdcc3..481c2a5df3 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -1105,7 +1105,7 @@ inline void requestRoutesOperatingConfigCollection(App& app)
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1184,7 +1184,7 @@ inline void requestRoutesOperatingConfig(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1263,7 +1263,7 @@ inline void requestRoutesProcessorCollection(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1318,7 +1318,7 @@ inline void requestRoutesProcessor(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -1356,7 +1356,7 @@ inline void requestRoutesProcessor(App& app)
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/sensors.hpp b/redfish-core/lib/sensors.hpp
index 75eaa7cde1..906888849a 100644
--- a/redfish-core/lib/sensors.hpp
+++ b/redfish-core/lib/sensors.hpp
@@ -64,21 +64,30 @@ constexpr auto powerPaths = std::to_array<std::string_view>({
"/xyz/openbmc_project/sensors/power"
});
-constexpr auto sensorPaths = std::to_array<std::string_view>({
- "/xyz/openbmc_project/sensors/power",
- "/xyz/openbmc_project/sensors/current",
- "/xyz/openbmc_project/sensors/airflow",
- "/xyz/openbmc_project/sensors/humidity",
-#ifdef BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM
- "/xyz/openbmc_project/sensors/voltage",
- "/xyz/openbmc_project/sensors/fan_tach",
- "/xyz/openbmc_project/sensors/temperature",
- "/xyz/openbmc_project/sensors/fan_pwm",
- "/xyz/openbmc_project/sensors/altitude",
- "/xyz/openbmc_project/sensors/energy",
-#endif
- "/xyz/openbmc_project/sensors/utilization"
-});
+constexpr auto getSensorPaths(){
+ if constexpr(BMCWEB_REDFISH_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM){
+ return std::to_array<std::string_view>({
+ "/xyz/openbmc_project/sensors/power",
+ "/xyz/openbmc_project/sensors/current",
+ "/xyz/openbmc_project/sensors/airflow",
+ "/xyz/openbmc_project/sensors/humidity",
+ "/xyz/openbmc_project/sensors/voltage",
+ "/xyz/openbmc_project/sensors/fan_tach",
+ "/xyz/openbmc_project/sensors/temperature",
+ "/xyz/openbmc_project/sensors/fan_pwm",
+ "/xyz/openbmc_project/sensors/altitude",
+ "/xyz/openbmc_project/sensors/energy",
+ "/xyz/openbmc_project/sensors/utilization"});
+ } else {
+ return std::to_array<std::string_view>({"/xyz/openbmc_project/sensors/power",
+ "/xyz/openbmc_project/sensors/current",
+ "/xyz/openbmc_project/sensors/airflow",
+ "/xyz/openbmc_project/sensors/humidity",
+ "/xyz/openbmc_project/sensors/utilization"});
+}
+}
+
+constexpr auto sensorPaths = getSensorPaths();
constexpr auto thermalPaths = std::to_array<std::string_view>({
"/xyz/openbmc_project/sensors/fan_tach",
diff --git a/redfish-core/lib/service_root.hpp b/redfish-core/lib/service_root.hpp
index 6ae16c3780..2fc35150dd 100644
--- a/redfish-core/lib/service_root.hpp
+++ b/redfish-core/lib/service_root.hpp
@@ -62,10 +62,11 @@ inline void handleServiceRootGetImpl(
"/redfish/v1/SessionService/Sessions";
asyncResp->res.jsonValue["AccountService"]["@odata.id"] =
"/redfish/v1/AccountService";
-#ifdef BMCWEB_ENABLE_REDFISH_AGGREGATION
- asyncResp->res.jsonValue["AggregationService"]["@odata.id"] =
- "/redfish/v1/AggregationService";
-#endif
+ if constexpr (BMCWEB_REDFISH_AGGREGATION)
+ {
+ asyncResp->res.jsonValue["AggregationService"]["@odata.id"] =
+ "/redfish/v1/AggregationService";
+ }
asyncResp->res.jsonValue["Chassis"]["@odata.id"] = "/redfish/v1/Chassis";
asyncResp->res.jsonValue["JsonSchemas"]["@odata.id"] =
"/redfish/v1/JsonSchemas";
@@ -95,16 +96,18 @@ inline void handleServiceRootGetImpl(
protocolFeatures["ExcerptQuery"] = false;
protocolFeatures["ExpandQuery"]["ExpandAll"] =
- bmcwebInsecureEnableQueryParams;
+ BMCWEB_INSECURE_ENABLE_REDFISH_QUERY;
// This is the maximum level defined in ServiceRoot.v1_13_0.json
- if (bmcwebInsecureEnableQueryParams)
+ if constexpr (BMCWEB_INSECURE_ENABLE_REDFISH_QUERY)
{
protocolFeatures["ExpandQuery"]["MaxLevels"] = 6;
}
- protocolFeatures["ExpandQuery"]["Levels"] = bmcwebInsecureEnableQueryParams;
- protocolFeatures["ExpandQuery"]["Links"] = bmcwebInsecureEnableQueryParams;
+ protocolFeatures["ExpandQuery"]["Levels"] =
+ BMCWEB_INSECURE_ENABLE_REDFISH_QUERY;
+ protocolFeatures["ExpandQuery"]["Links"] =
+ BMCWEB_INSECURE_ENABLE_REDFISH_QUERY;
protocolFeatures["ExpandQuery"]["NoLinks"] =
- bmcwebInsecureEnableQueryParams;
+ BMCWEB_INSECURE_ENABLE_REDFISH_QUERY;
protocolFeatures["FilterQuery"] = false;
protocolFeatures["OnlyMemberQuery"] = true;
protocolFeatures["SelectQuery"] = true;
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index 9438144c12..c6141df555 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -193,7 +193,7 @@ inline void
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -690,7 +690,7 @@ inline void handleSystemsStorageDriveGet(
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 5765af89ab..e12db494ab 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -1926,15 +1926,16 @@ inline void
"PowerRestorePolicy", powerRestorePolicy);
}
-#ifdef BMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE
/**
* @brief Retrieves provisioning status
*
- * @param[in] asyncResp Shared pointer for completing asynchronous calls.
+ * @param[in] asyncResp Shared pointer for completing asynchronous
+ * calls.
*
* @return None.
*/
-inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> asyncResp)
+inline void
+ getProvisioningStatus(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
{
BMCWEB_LOG_DEBUG("Get OEM information.");
sdbusplus::asio::getAllProperties(
@@ -1976,9 +1977,9 @@ inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> asyncResp)
return;
}
- if (*provState == true)
+ if (*provState)
{
- if (*lockState == true)
+ if (*lockState)
{
oemPFR["ProvisioningStatus"] = "ProvisionedAndLocked";
}
@@ -1993,7 +1994,6 @@ inline void getProvisioningStatus(std::shared_ptr<bmcweb::AsyncResp> asyncResp)
}
});
}
-#endif
/**
* @brief Translate the PowerMode string to enum value
@@ -2773,7 +2773,7 @@ inline void handleComputerSystemCollectionGet(
nlohmann::json& ifaceArray = asyncResp->res.jsonValue["Members"];
ifaceArray = nlohmann::json::array();
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
asyncResp->res.jsonValue["Members@odata.count"] = 0;
// Option currently returns no systems. TBD
@@ -2853,7 +2853,7 @@ inline void handleComputerSystemResetActionPost(
systemName);
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -2991,7 +2991,7 @@ inline void
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3063,14 +3063,15 @@ inline void
getPortStatusAndPath(std::span{protocolToDBusForSystems},
std::bind_front(afterPortRequest, asyncResp));
-#ifdef BMCWEB_ENABLE_KVM
- // Fill in GraphicalConsole info
- asyncResp->res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true;
- asyncResp->res.jsonValue["GraphicalConsole"]["MaxConcurrentSessions"] = 4;
- asyncResp->res.jsonValue["GraphicalConsole"]["ConnectTypesSupported"] =
- nlohmann::json::array_t({"KVMIP"});
-
-#endif // BMCWEB_ENABLE_KVM
+ if constexpr (BMCWEB_KVM)
+ {
+ // Fill in GraphicalConsole info
+ asyncResp->res.jsonValue["GraphicalConsole"]["ServiceEnabled"] = true;
+ asyncResp->res.jsonValue["GraphicalConsole"]["MaxConcurrentSessions"] =
+ 4;
+ asyncResp->res.jsonValue["GraphicalConsole"]["ConnectTypesSupported"] =
+ nlohmann::json::array_t({"KVMIP"});
+ }
getMainChassisId(asyncResp,
[](const std::string& chassisId,
@@ -3097,9 +3098,10 @@ inline void
getStopBootOnFault(asyncResp);
getAutomaticRetryPolicy(asyncResp);
getLastResetTime(asyncResp);
-#ifdef BMCWEB_ENABLE_REDFISH_PROVISIONING_FEATURE
- getProvisioningStatus(asyncResp);
-#endif
+ if constexpr (BMCWEB_REDFISH_PROVISIONING_FEATURE)
+ {
+ getProvisioningStatus(asyncResp);
+ }
getTrustedModuleRequiredToBoot(asyncResp);
getPowerMode(asyncResp);
getIdlePowerSaver(asyncResp);
@@ -3114,7 +3116,7 @@ inline void handleComputerSystemPatch(
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
@@ -3363,7 +3365,7 @@ inline void handleSystemCollectionResetActionGet(
{
return;
}
- if constexpr (bmcwebEnableMultiHost)
+ if constexpr (BMCWEB_EXPERIMENTAL_REDFISH_MULTI_COMPUTER_SYSTEM)
{
// Option currently returns no systems. TBD
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 0418d269b9..6895cb4949 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -831,7 +831,7 @@ inline void
asyncResp->res.jsonValue["FirmwareInventory"]["@odata.id"] =
"/redfish/v1/UpdateService/FirmwareInventory";
// Get the MaxImageSizeBytes
- asyncResp->res.jsonValue["MaxImageSizeBytes"] = bmcwebHttpReqBodyLimitMb *
+ asyncResp->res.jsonValue["MaxImageSizeBytes"] = BMCWEB_HTTP_BODY_LIMIT *
1024 * 1024;
// Update Actions object.
@@ -842,9 +842,10 @@ inline void
nlohmann::json::array_t allowed;
-#ifdef BMCWEB_INSECURE_ENABLE_REDFISH_FW_TFTP_UPDATE
- allowed.emplace_back(update_service::TransferProtocolType::TFTP);
-#endif
+ if constexpr (BMCWEB_INSECURE_PUSH_STYLE_NOTIFICATION)
+ {
+ allowed.emplace_back(update_service::TransferProtocolType::TFTP);
+ }
updateSvcSimpleUpdate["TransferProtocol@Redfish.AllowableValues"] =
std::move(allowed);
diff --git a/redfish-core/src/redfish.cpp b/redfish-core/src/redfish.cpp
index 66a43d76f0..e7a58c1f41 100644
--- a/redfish-core/src/redfish.cpp
+++ b/redfish-core/src/redfish.cpp
@@ -51,31 +51,34 @@ namespace redfish
RedfishService::RedfishService(App& app)
{
requestAccountServiceRoutes(app);
-#ifdef BMCWEB_ENABLE_REDFISH_AGGREGATION
- requestRoutesAggregationService(app);
- requestRoutesAggregationSourceCollection(app);
- requestRoutesAggregationSource(app);
-#endif
+ if constexpr (BMCWEB_REDFISH_AGGREGATION)
+ {
+ requestRoutesAggregationService(app);
+ requestRoutesAggregationSourceCollection(app);
+ requestRoutesAggregationSource(app);
+ }
requestRoutesRoles(app);
requestRoutesRoleCollection(app);
requestRoutesServiceRoot(app);
requestRoutesNetworkProtocol(app);
requestRoutesSession(app);
requestEthernetInterfacesRoutes(app);
-#ifdef BMCWEB_ALLOW_DEPRECATED_POWER_THERMAL
- requestRoutesThermal(app);
- requestRoutesPower(app);
-#endif
-#ifdef BMCWEB_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM
- requestRoutesEnvironmentMetrics(app);
- requestRoutesPowerSubsystem(app);
- requestRoutesPowerSupply(app);
- requestRoutesPowerSupplyCollection(app);
- requestRoutesThermalMetrics(app);
- requestRoutesThermalSubsystem(app);
- requestRoutesFan(app);
- requestRoutesFanCollection(app);
-#endif
+ if constexpr (BMCWEB_REDFISH_ALLOW_DEPRECATED_POWER_THERMAL)
+ {
+ requestRoutesThermal(app);
+ requestRoutesPower(app);
+ }
+ if constexpr (BMCWEB_REDFISH_NEW_POWERSUBSYSTEM_THERMALSUBSYSTEM)
+ {
+ requestRoutesEnvironmentMetrics(app);
+ requestRoutesPowerSubsystem(app);
+ requestRoutesPowerSupply(app);
+ requestRoutesPowerSupplyCollection(app);
+ requestRoutesThermalMetrics(app);
+ requestRoutesThermalSubsystem(app);
+ requestRoutesFan(app);
+ requestRoutesFanCollection(app);
+ }
requestRoutesManagerCollection(app);
requestRoutesManager(app);
requestRoutesManagerResetAction(app);
@@ -106,47 +109,51 @@ RedfishService::RedfishService(App& app)
requestRoutesPostCodesEntry(app);
requestRoutesPostCodesEntryCollection(app);
-#ifdef BMCWEB_ENABLE_REDFISH_DUMP_LOG
- requestRoutesSystemDumpService(app);
- requestRoutesSystemDumpEntryCollection(app);
- requestRoutesSystemDumpEntry(app);
- requestRoutesSystemDumpCreate(app);
- requestRoutesSystemDumpClear(app);
-
- requestRoutesBMCDumpService(app);
- requestRoutesBMCDumpEntryCollection(app);
- requestRoutesBMCDumpEntry(app);
- requestRoutesBMCDumpEntryDownload(app);
- requestRoutesBMCDumpCreate(app);
- requestRoutesBMCDumpClear(app);
-
- requestRoutesFaultLogDumpService(app);
- requestRoutesFaultLogDumpEntryCollection(app);
- requestRoutesFaultLogDumpEntry(app);
- requestRoutesFaultLogDumpClear(app);
-#endif
-
-#ifndef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
- requestRoutesJournalEventLogEntryCollection(app);
- requestRoutesJournalEventLogEntry(app);
- requestRoutesJournalEventLogClear(app);
-#endif
+ if constexpr (BMCWEB_REDFISH_DUMP_LOG)
+ {
+ requestRoutesSystemDumpService(app);
+ requestRoutesSystemDumpEntryCollection(app);
+ requestRoutesSystemDumpEntry(app);
+ requestRoutesSystemDumpCreate(app);
+ requestRoutesSystemDumpClear(app);
+
+ requestRoutesBMCDumpService(app);
+ requestRoutesBMCDumpEntryCollection(app);
+ requestRoutesBMCDumpEntry(app);
+ requestRoutesBMCDumpEntryDownload(app);
+ requestRoutesBMCDumpCreate(app);
+ requestRoutesBMCDumpClear(app);
+
+ requestRoutesFaultLogDumpService(app);
+ requestRoutesFaultLogDumpEntryCollection(app);
+ requestRoutesFaultLogDumpEntry(app);
+ requestRoutesFaultLogDumpClear(app);
+ }
+
+ if constexpr (BMCWEB_REDFISH_DBUS_LOG)
+ {
+ requestRoutesJournalEventLogEntryCollection(app);
+ requestRoutesJournalEventLogEntry(app);
+ requestRoutesJournalEventLogClear(app);
+ }
requestRoutesBMCLogServiceCollection(app);
-#ifdef BMCWEB_ENABLE_REDFISH_BMC_JOURNAL
- requestRoutesBMCJournalLogService(app);
- requestRoutesBMCJournalLogEntryCollection(app);
- requestRoutesBMCJournalLogEntry(app);
-#endif
-
-#ifdef BMCWEB_ENABLE_REDFISH_CPU_LOG
- requestRoutesCrashdumpService(app);
- requestRoutesCrashdumpEntryCollection(app);
- requestRoutesCrashdumpEntry(app);
- requestRoutesCrashdumpFile(app);
- requestRoutesCrashdumpClear(app);
- requestRoutesCrashdumpCollect(app);
-#endif // BMCWEB_ENABLE_REDFISH_CPU_LOG
+ if constexpr (BMCWEB_REDFISH_BMC_JOURNAL)
+ {
+ requestRoutesBMCJournalLogService(app);
+ requestRoutesBMCJournalLogEntryCollection(app);
+ requestRoutesBMCJournalLogEntry(app);
+ }
+
+ if constexpr (BMCWEB_REDFISH_CPU_LOG)
+ {
+ requestRoutesCrashdumpService(app);
+ requestRoutesCrashdumpEntryCollection(app);
+ requestRoutesCrashdumpEntry(app);
+ requestRoutesCrashdumpFile(app);
+ requestRoutesCrashdumpClear(app);
+ requestRoutesCrashdumpCollect(app);
+ }
requestRoutesProcessorCollection(app);
requestRoutesProcessor(app);
@@ -160,22 +167,25 @@ RedfishService::RedfishService(App& app)
requestRoutesBiosService(app);
requestRoutesBiosReset(app);
-#ifdef BMCWEB_ENABLE_VM_NBDPROXY
- requestNBDVirtualMediaRoutes(app);
-#endif // BMCWEB_ENABLE_VM_NBDPROXY
-
-#ifdef BMCWEB_ENABLE_REDFISH_DBUS_LOG_ENTRIES
- requestRoutesDBusLogServiceActionsClear(app);
- requestRoutesDBusEventLogEntryCollection(app);
- requestRoutesDBusEventLogEntry(app);
- requestRoutesDBusEventLogEntryDownload(app);
-#endif
-
-#ifdef BMCWEB_ENABLE_REDFISH_HOST_LOGGER
- requestRoutesSystemHostLogger(app);
- requestRoutesSystemHostLoggerCollection(app);
- requestRoutesSystemHostLoggerLogEntry(app);
-#endif
+ if constexpr (BMCWEB_VM_NBDPROXY)
+ {
+ requestNBDVirtualMediaRoutes(app);
+ }
+
+ if constexpr (BMCWEB_REDFISH_DBUS_LOG)
+ {
+ requestRoutesDBusLogServiceActionsClear(app);
+ requestRoutesDBusEventLogEntryCollection(app);
+ requestRoutesDBusEventLogEntry(app);
+ requestRoutesDBusEventLogEntryDownload(app);
+ }
+
+ if constexpr (BMCWEB_REDFISH_HOST_LOGGER)
+ {
+ requestRoutesSystemHostLogger(app);
+ requestRoutesSystemHostLoggerCollection(app);
+ requestRoutesSystemHostLoggerLogEntry(app);
+ }
requestRoutesMessageRegistryFileCollection(app);
requestRoutesMessageRegistryFile(app);