summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
authorEd Tanous <edtanous@google.com>2022-05-19 19:39:07 +0300
committerEd Tanous <ed@tanous.net>2022-10-04 21:05:08 +0300
commit22d268cb2c0bc00676d08c79f6ab8958bee74a25 (patch)
treeb0256b1cccd28f8ba05e3e33813403a6ce4c62bc /redfish-core
parent7a3a8f7aa20017a1bdb4f22737f03a12d0930f19 (diff)
downloadbmcweb-22d268cb2c0bc00676d08c79f6ab8958bee74a25.tar.xz
Make routes start matching Redfish
This is preliminary patch to set up the route handling such that it's ready for the addition of multiple hosts, multiple managers in the future. Routes previously took the form of /redfish/v1/Systems/system which essentially hardcoded the name "system" into a number of places. As the stack evolves to support multiple systems, this needs to change. This patchset changes all the ComputerSystem resources to the form: /redfish/v1/Systems/<str> and adds 404 checks to each route such that they will be handled properly still. This means that as we evolve our multi-host support, each individual route can be moved one at a time to support multi-host. In the future, moving these to redfish-spec-defined routing would likely mean that we could generate this code in the future at some point, which reduces the likelihood that people do it incorrectly. This patch currently sets the resource id and resource type in the resourceNotFound message to empty string (""). This handling is still arguably more correct than what we had before, which just returned 404 with an empty payload, although this will be corrected in the future. Tested: None yet. RFC to see if this is a pattern we'd like to propogate Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: If9c07ad69f5287bb054645f460d7e370d433dc27
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/lib/bios.hpp24
-rw-r--r--redfish-core/lib/log_services.hpp423
-rw-r--r--redfish-core/lib/memory.hpp23
-rw-r--r--redfish-core/lib/pcie.hpp22
-rw-r--r--redfish-core/lib/processor.hpp32
-rw-r--r--redfish-core/lib/storage.hpp23
-rw-r--r--redfish-core/lib/systems.hpp79
7 files changed, 510 insertions, 116 deletions
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index 045e2ee340..f580f96587 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -12,12 +12,19 @@ namespace redfish
*/
inline void
handleBiosServiceGet(crow::App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/Bios";
asyncResp->res.jsonValue["@odata.type"] = "#Bios.v1_1_0.Bios";
asyncResp->res.jsonValue["Name"] = "BIOS Configuration";
@@ -33,7 +40,7 @@ inline void
inline void requestRoutesBiosService(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Bios/")
.privileges(redfish::privileges::getBios)
.methods(boost::beast::http::verb::get)(
std::bind_front(handleBiosServiceGet, std::ref(app)));
@@ -48,12 +55,21 @@ inline void requestRoutesBiosService(App& app)
*/
inline void
handleBiosResetPost(crow::App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec) {
if (ec)
@@ -69,7 +85,7 @@ inline void
inline void requestRoutesBiosReset(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Bios/Actions/Bios.ResetBios/")
.privileges(redfish::privileges::postBios)
.methods(boost::beast::http::verb::post)(
std::bind_front(handleBiosResetPost, std::ref(app)));
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index d4ef1f19df..ecd5d59684 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -910,15 +910,23 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
/**
* Functions triggers appropriate requests on DBus
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/")
.privileges(redfish::privileges::getLogServiceCollection)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
// Collections don't include the static data added by SubRoute
// because it has a duplicate entry for members
asyncResp->res.jsonValue["@odata.type"] =
@@ -993,15 +1001,22 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
inline void requestRoutesEventLogService(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/EventLog/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/EventLog/")
.privileges(redfish::privileges::getLogService)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
asyncResp->res.jsonValue["@odata.id"] =
"/redfish/v1/Systems/system/LogServices/EventLog";
asyncResp->res.jsonValue["@odata.type"] =
@@ -1031,15 +1046,22 @@ inline void requestRoutesJournalEventLogClear(App& app)
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Systems/system/LogServices/EventLog/Actions/LogService.ClearLog/")
+ "/redfish/v1/Systems/<str>/LogServices/EventLog/Actions/LogService.ClearLog/")
.privileges({{"ConfigureComponents"}})
.methods(boost::beast::http::verb::post)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
// Clear the EventLog by deleting the log files
std::vector<std::filesystem::path> redfishLogFiles;
if (getRedfishLogFiles(redfishLogFiles))
@@ -1173,12 +1195,12 @@ static LogParseError
inline void requestRoutesJournalEventLogEntryCollection(App& app)
{
- BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/EventLog/Entries/")
.privileges(redfish::privileges::getLogEntryCollection)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
query_param::QueryCapabilities capabilities = {
.canDelegateTop = true,
.canDelegateSkip = true,
@@ -1189,6 +1211,13 @@ inline void requestRoutesJournalEventLogEntryCollection(App& app)
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
size_t top = delegatedQuery.top.value_or(query_param::Query::maxTop);
size_t skip = delegatedQuery.skip.value_or(0);
@@ -1270,16 +1299,24 @@ inline void requestRoutesJournalEventLogEntryCollection(App& app)
inline void requestRoutesJournalEventLogEntry(App& app)
{
BMCWEB_ROUTE(
- app, "/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/")
+ app, "/redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& param) {
+ const std::string& systemName, const std::string& param) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
const std::string& targetID = param;
// Go through the log files and check the unique ID for each
@@ -1333,16 +1370,23 @@ inline void requestRoutesJournalEventLogEntry(App& app)
inline void requestRoutesDBusEventLogEntryCollection(App& app)
{
- BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/EventLog/Entries/")
.privileges(redfish::privileges::getLogEntryCollection)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
// Collections don't include the static data added by SubRoute
// because it has a duplicate entry for members
asyncResp->res.jsonValue["@odata.type"] =
@@ -1499,16 +1543,23 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app)
inline void requestRoutesDBusEventLogEntry(App& app)
{
BMCWEB_ROUTE(
- app, "/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/")
+ app, "/redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& param) {
+ const std::string& systemName, const std::string& param) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
std::string entryID = param;
dbus::utility::escapePathForDbus(entryID);
@@ -1589,16 +1640,22 @@ inline void requestRoutesDBusEventLogEntry(App& app)
});
BMCWEB_ROUTE(
- app, "/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/")
+ app, "/redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/")
.privileges(redfish::privileges::patchLogEntry)
.methods(boost::beast::http::verb::patch)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& entryId) {
+ const std::string& systemName, const std::string& entryId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
std::optional<bool> resolved;
if (!json_util::readJsonPatch(req, asyncResp->res, "Resolved",
@@ -1625,17 +1682,23 @@ inline void requestRoutesDBusEventLogEntry(App& app)
});
BMCWEB_ROUTE(
- app, "/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/")
+ app, "/redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/")
.privileges(redfish::privileges::deleteLogEntry)
.methods(boost::beast::http::verb::delete_)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& param) {
+ const std::string& systemName, const std::string& param) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
BMCWEB_LOG_DEBUG << "Do delete single event entries.";
std::string entryID = param;
@@ -1678,12 +1741,12 @@ inline void requestRoutesDBusEventLogEntryDownload(App& app)
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries/<str>/attachment")
+ "/redfish/v1/Systems/<str>/LogServices/EventLog/Entries/<str>/attachment")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& param) {
+ const std::string& systemName, const std::string& param) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
@@ -1695,6 +1758,12 @@ inline void requestRoutesDBusEventLogEntryDownload(App& app)
asyncResp->res.result(boost::beast::http::status::bad_request);
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
std::string entryID = param;
dbus::utility::escapePathForDbus(entryID);
@@ -1848,15 +1917,22 @@ inline void fillHostLoggerEntryJson(const std::string& logEntryID,
inline void requestRoutesSystemHostLogger(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/HostLogger/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/HostLogger/")
.privileges(redfish::privileges::getLogService)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
asyncResp->res.jsonValue["@odata.id"] =
"/redfish/v1/Systems/system/LogServices/HostLogger";
asyncResp->res.jsonValue["@odata.type"] =
@@ -1872,11 +1948,12 @@ inline void requestRoutesSystemHostLogger(App& app)
inline void requestRoutesSystemHostLoggerCollection(App& app)
{
BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/system/LogServices/HostLogger/Entries/")
+ "/redfish/v1/Systems/<str>/LogServices/HostLogger/Entries/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
query_param::QueryCapabilities capabilities = {
.canDelegateTop = true,
.canDelegateSkip = true,
@@ -1887,6 +1964,12 @@ inline void requestRoutesSystemHostLoggerCollection(App& app)
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
asyncResp->res.jsonValue["@odata.id"] =
"/redfish/v1/Systems/system/LogServices/HostLogger/Entries";
asyncResp->res.jsonValue["@odata.type"] =
@@ -1948,16 +2031,22 @@ inline void requestRoutesSystemHostLoggerCollection(App& app)
inline void requestRoutesSystemHostLoggerLogEntry(App& app)
{
BMCWEB_ROUTE(
- app, "/redfish/v1/Systems/system/LogServices/HostLogger/Entries/<str>/")
+ app, "/redfish/v1/Systems/<str>/LogServices/HostLogger/Entries/<str>/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& param) {
+ const std::string& systemName, const std::string& param) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
const std::string& targetID = param;
uint64_t idInt = 0;
@@ -2417,6 +2506,23 @@ inline void handleLogServicesDumpServiceGet(
getDumpServiceInfo(asyncResp, dumpType);
}
+inline void handleLogServicesDumpServiceComputerSystemGet(
+ crow::App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& chassisId)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ if (chassisId != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
+ return;
+ }
+ getDumpServiceInfo(asyncResp, "System");
+}
+
inline void handleLogServicesDumpEntriesCollectionGet(
crow::App& app, const std::string& dumpType, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
@@ -2428,6 +2534,23 @@ inline void handleLogServicesDumpEntriesCollectionGet(
getDumpEntryCollection(asyncResp, dumpType);
}
+inline void handleLogServicesDumpEntriesCollectionComputerSystemGet(
+ crow::App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& chassisId)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ if (chassisId != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
+ return;
+ }
+ getDumpEntryCollection(asyncResp, "System");
+}
+
inline void handleLogServicesDumpEntryGet(
crow::App& app, const std::string& dumpType, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
@@ -2439,6 +2562,22 @@ inline void handleLogServicesDumpEntryGet(
}
getDumpEntryById(asyncResp, dumpId, dumpType);
}
+inline void handleLogServicesDumpEntryComputerSystemGet(
+ crow::App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& chassisId, const std::string& dumpId)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ if (chassisId != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
+ return;
+ }
+ getDumpEntryById(asyncResp, dumpId, "System");
+}
inline void handleLogServicesDumpEntryDelete(
crow::App& app, const std::string& dumpType, const crow::Request& req,
@@ -2452,6 +2591,23 @@ inline void handleLogServicesDumpEntryDelete(
deleteDumpEntry(asyncResp, dumpId, dumpType);
}
+inline void handleLogServicesDumpEntryComputerSystemDelete(
+ crow::App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& chassisId, const std::string& dumpId)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ if (chassisId != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
+ return;
+ }
+ deleteDumpEntry(asyncResp, dumpId, "System");
+}
+
inline void handleLogServicesDumpCollectDiagnosticDataPost(
crow::App& app, const std::string& dumpType, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
@@ -2463,6 +2619,23 @@ inline void handleLogServicesDumpCollectDiagnosticDataPost(
createDump(asyncResp, req, dumpType);
}
+inline void handleLogServicesDumpCollectDiagnosticDataComputerSystemPost(
+ crow::App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& chassisId)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ if (chassisId != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
+ return;
+ }
+ createDump(asyncResp, req, "System");
+}
+
inline void handleLogServicesDumpClearLogPost(
crow::App& app, const std::string& dumpType, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
@@ -2474,6 +2647,23 @@ inline void handleLogServicesDumpClearLogPost(
clearDump(asyncResp, dumpType);
}
+inline void handleLogServicesDumpClearLogComputerSystemPost(
+ crow::App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& chassisId)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ if (chassisId != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
+ return;
+ }
+ clearDump(asyncResp, "System");
+}
+
inline void requestRoutesBMCDumpService(App& app)
{
BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/Dump/")
@@ -2570,55 +2760,55 @@ inline void requestRoutesFaultLogDumpClear(App& app)
inline void requestRoutesSystemDumpService(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/Dump/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/Dump/")
.privileges(redfish::privileges::getLogService)
.methods(boost::beast::http::verb::get)(std::bind_front(
- handleLogServicesDumpServiceGet, std::ref(app), "System"));
+ handleLogServicesDumpServiceComputerSystemGet, std::ref(app)));
}
inline void requestRoutesSystemDumpEntryCollection(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/Dump/Entries/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/Dump/Entries/")
.privileges(redfish::privileges::getLogEntryCollection)
- .methods(boost::beast::http::verb::get)(
- std::bind_front(handleLogServicesDumpEntriesCollectionGet,
- std::ref(app), "System"));
+ .methods(boost::beast::http::verb::get)(std::bind_front(
+ handleLogServicesDumpEntriesCollectionComputerSystemGet,
+ std::ref(app)));
}
inline void requestRoutesSystemDumpEntry(App& app)
{
BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/system/LogServices/Dump/Entries/<str>/")
+ "/redfish/v1/Systems/<str>/LogServices/Dump/Entries/<str>/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(std::bind_front(
- handleLogServicesDumpEntryGet, std::ref(app), "System"));
+ handleLogServicesDumpEntryComputerSystemGet, std::ref(app)));
BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/system/LogServices/Dump/Entries/<str>/")
+ "/redfish/v1/Systems/<str>/LogServices/Dump/Entries/<str>/")
.privileges(redfish::privileges::deleteLogEntry)
.methods(boost::beast::http::verb::delete_)(std::bind_front(
- handleLogServicesDumpEntryDelete, std::ref(app), "System"));
+ handleLogServicesDumpEntryComputerSystemDelete, std::ref(app)));
}
inline void requestRoutesSystemDumpCreate(App& app)
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.CollectDiagnosticData/")
+ "/redfish/v1/Systems/<str>/LogServices/Dump/Actions/LogService.CollectDiagnosticData/")
.privileges(redfish::privileges::postLogService)
- .methods(boost::beast::http::verb::post)(
- std::bind_front(handleLogServicesDumpCollectDiagnosticDataPost,
- std::ref(app), "System"));
+ .methods(boost::beast::http::verb::post)(std::bind_front(
+ handleLogServicesDumpCollectDiagnosticDataComputerSystemPost,
+ std::ref(app)));
}
inline void requestRoutesSystemDumpClear(App& app)
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Systems/system/LogServices/Dump/Actions/LogService.ClearLog/")
+ "/redfish/v1/Systems/<str>/LogServices/Dump/Actions/LogService.ClearLog/")
.privileges(redfish::privileges::postLogService)
.methods(boost::beast::http::verb::post)(std::bind_front(
- handleLogServicesDumpClearLogPost, std::ref(app), "System"));
+ handleLogServicesDumpClearLogComputerSystemPost, std::ref(app)));
}
inline void requestRoutesCrashdumpService(App& app)
@@ -2628,17 +2818,25 @@ inline void requestRoutesCrashdumpService(App& app)
/**
* Functions triggers appropriate requests on DBus
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/Crashdump/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/Crashdump/")
// This is incorrect, should be:
//.privileges(redfish::privileges::getLogService)
.privileges({{"ConfigureManager"}})
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
// Copy over the static data to include the entries added by
// SubRoute
asyncResp->res.jsonValue["@odata.id"] =
@@ -2671,17 +2869,24 @@ void inline requestRoutesCrashdumpClear(App& app)
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/LogService.ClearLog/")
+ "/redfish/v1/Systems/<str>/LogServices/Crashdump/Actions/LogService.ClearLog/")
// This is incorrect, should be:
//.privileges(redfish::privileges::postLogService)
.privileges({{"ConfigureComponents"}})
.methods(boost::beast::http::verb::post)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
const std::string&) {
@@ -2774,17 +2979,25 @@ inline void requestRoutesCrashdumpEntryCollection(App& app)
* Functions triggers appropriate requests on DBus
*/
BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/")
+ "/redfish/v1/Systems/<str>/LogServices/Crashdump/Entries/")
// This is incorrect, should be.
//.privileges(redfish::privileges::postLogEntryCollection)
.privileges({{"ConfigureComponents"}})
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
crow::connections::systemBus->async_method_call(
[asyncResp](const boost::system::error_code ec,
const std::vector<std::string>& resp) {
@@ -2836,18 +3049,25 @@ inline void requestRoutesCrashdumpEntry(App& app)
// method for security reasons.
BMCWEB_ROUTE(
- app, "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/<str>/")
+ app, "/redfish/v1/Systems/<str>/LogServices/Crashdump/Entries/<str>/")
// this is incorrect, should be
// .privileges(redfish::privileges::getLogEntry)
.privileges({{"ConfigureComponents"}})
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& param) {
+ const std::string& systemName, const std::string& param) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ ;
+ return;
+ }
const std::string& logID = param;
logCrashdumpEntry(asyncResp, logID, asyncResp->res.jsonValue);
});
@@ -2859,14 +3079,24 @@ inline void requestRoutesCrashdumpFile(App& app)
// method for security reasons.
BMCWEB_ROUTE(
app,
- "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/<str>/<str>/")
+ "/redfish/v1/Systems/<str>/LogServices/Crashdump/Entries/<str>/<str>/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(
[](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& logID, const std::string& fileName) {
+ const std::string& systemName, const std::string& logID,
+ const std::string& fileName) {
// Do not call getRedfishRoute here since the crashdump file is not a
// Redfish resource.
+
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ ;
+ return;
+ }
+
auto getStoredLogCallback =
[asyncResp, logID, fileName, url(boost::urls::url(req.urlView))](
const boost::system::error_code ec,
@@ -2950,17 +3180,27 @@ inline void requestRoutesCrashdumpCollect(App& app)
// method for security reasons.
BMCWEB_ROUTE(
app,
- "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/LogService.CollectDiagnosticData/")
+ "/redfish/v1/Systems/<str>/LogServices/Crashdump/Actions/LogService.CollectDiagnosticData/")
// The below is incorrect; Should be ConfigureManager
//.privileges(redfish::privileges::postLogService)
.privileges({{"ConfigureComponents"}})
.methods(boost::beast::http::verb::post)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ ;
+ return;
+ }
+
std::string diagnosticDataType;
std::string oemDiagnosticDataType;
if (!redfish::json_util::readJsonAction(
@@ -3073,15 +3313,23 @@ inline void requestRoutesDBusLogServiceActionsClear(App& app)
BMCWEB_ROUTE(
app,
- "/redfish/v1/Systems/system/LogServices/EventLog/Actions/LogService.ClearLog/")
+ "/redfish/v1/Systems/<str>/LogServices/EventLog/Actions/LogService.ClearLog/")
.privileges(redfish::privileges::postLogService)
.methods(boost::beast::http::verb::post)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ ;
+ return;
+ }
BMCWEB_LOG_DEBUG << "Do delete all entries.";
// Process response from Logging service.
@@ -3113,16 +3361,23 @@ inline void requestRoutesDBusLogServiceActionsClear(App& app)
******************************************************/
inline void requestRoutesPostCodesLogService(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/LogServices/PostCodes/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/LogServices/PostCodes/")
.privileges(redfish::privileges::getLogService)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
-
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ ;
+ return;
+ }
asyncResp->res.jsonValue["@odata.id"] =
"/redfish/v1/Systems/system/LogServices/PostCodes";
asyncResp->res.jsonValue["@odata.type"] =
@@ -3150,17 +3405,25 @@ inline void requestRoutesPostCodesClear(App& app)
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Systems/system/LogServices/PostCodes/Actions/LogService.ClearLog/")
+ "/redfish/v1/Systems/<str>/LogServices/PostCodes/Actions/LogService.ClearLog/")
// The following privilege is incorrect; It should be ConfigureManager
//.privileges(redfish::privileges::postLogService)
.privileges({{"ConfigureComponents"}})
.methods(boost::beast::http::verb::post)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ ;
+ return;
+ }
BMCWEB_LOG_DEBUG << "Do delete all postcodes entries.";
// Make call to post-code service to request clear all
@@ -3424,11 +3687,12 @@ static void
inline void requestRoutesPostCodesEntryCollection(App& app)
{
BMCWEB_ROUTE(app,
- "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/")
+ "/redfish/v1/Systems/<str>/LogServices/PostCodes/Entries/")
.privileges(redfish::privileges::getLogEntryCollection)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
query_param::QueryCapabilities capabilities = {
.canDelegateTop = true,
.canDelegateSkip = true,
@@ -3439,6 +3703,14 @@ inline void requestRoutesPostCodesEntryCollection(App& app)
{
return;
}
+
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ ;
+ return;
+ }
asyncResp->res.jsonValue["@odata.type"] =
"#LogEntryCollection.LogEntryCollection";
asyncResp->res.jsonValue["@odata.id"] =
@@ -3498,11 +3770,12 @@ inline void requestRoutesPostCodesEntryAdditionalData(App& app)
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/<str>/attachment/")
+ "/redfish/v1/Systems/<str>/LogServices/PostCodes/Entries/<str>/attachment/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName,
const std::string& postCodeID) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
@@ -3515,6 +3788,13 @@ inline void requestRoutesPostCodesEntryAdditionalData(App& app)
asyncResp->res.result(boost::beast::http::status::bad_request);
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ ;
+ return;
+ }
uint64_t currentValue = 0;
uint16_t index = 0;
@@ -3578,16 +3858,23 @@ inline void requestRoutesPostCodesEntryAdditionalData(App& app)
inline void requestRoutesPostCodesEntry(App& app)
{
BMCWEB_ROUTE(
- app, "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/<str>/")
+ app, "/redfish/v1/Systems/<str>/LogServices/PostCodes/Entries/<str>/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& targetID) {
+ const std::string& systemName, const std::string& targetID) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
uint16_t bootIndex = 0;
uint64_t codeIndex = 0;
if (!parsePostCode(targetID, codeIndex, bootIndex))
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 988a251c03..dd535f7ce7 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -769,15 +769,23 @@ inline void requestRoutesMemoryCollection(App& app)
/**
* Functions triggers appropriate requests on DBus
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Memory/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Memory/")
.privileges(redfish::privileges::getMemoryCollection)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
asyncResp->res.jsonValue["@odata.type"] =
"#MemoryCollection.MemoryCollection";
asyncResp->res.jsonValue["Name"] = "Memory Module Collection";
@@ -795,16 +803,23 @@ inline void requestRoutesMemory(App& app)
/**
* Functions triggers appropriate requests on DBus
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Memory/<str>/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Memory/<str>/")
.privileges(redfish::privileges::getMemory)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& dimmId) {
+ const std::string& systemName, const std::string& dimmId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
getDimmData(asyncResp, dimmId);
});
}
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index 47c5c91bac..13d5ab93eb 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -82,15 +82,22 @@ inline void requestRoutesSystemPCIeDeviceCollection(App& app)
/**
* Functions triggers appropriate requests on DBus
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/PCIeDevices/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/PCIeDevices/")
.privileges(redfish::privileges::getPCIeDeviceCollection)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
asyncResp->res.jsonValue["@odata.type"] =
"#PCIeDeviceCollection.PCIeDeviceCollection";
@@ -145,16 +152,23 @@ inline std::optional<std::string>
inline void requestRoutesSystemPCIeDevice(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/PCIeDevices/<str>/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/PCIeDevices/<str>/")
.privileges(redfish::privileges::getPCIeDevice)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& device) {
+ const std::string& systemName, const std::string& device) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
auto getPCIeDeviceCallback =
[asyncResp, device](
const boost::system::error_code ec,
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 65a3e9cea8..8bc8cf0a2e 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -1156,15 +1156,23 @@ inline void requestRoutesProcessorCollection(App& app)
/**
* Functions triggers appropriate requests on DBus
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Processors/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Processors/")
.privileges(redfish::privileges::getProcessorCollection)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
asyncResp->res.jsonValue["@odata.type"] =
"#ProcessorCollection.ProcessorCollection";
asyncResp->res.jsonValue["Name"] = "Processor Collection";
@@ -1185,16 +1193,24 @@ inline void requestRoutesProcessor(App& app)
* Functions triggers appropriate requests on DBus
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Processors/<str>/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Processors/<str>/")
.privileges(redfish::privileges::getProcessor)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName,
const std::string& processorId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
asyncResp->res.jsonValue["@odata.type"] =
"#Processor.v1_11_0.Processor";
asyncResp->res.jsonValue["@odata.id"] =
@@ -1205,16 +1221,24 @@ inline void requestRoutesProcessor(App& app)
std::bind_front(getProcessorData, asyncResp, processorId));
});
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Processors/<str>/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Processors/<str>/")
.privileges(redfish::privileges::patchProcessor)
.methods(boost::beast::http::verb::patch)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName,
const std::string& processorId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
std::optional<nlohmann::json> appliedConfigJson;
if (!json_util::readJsonPatch(req, asyncResp->res,
"AppliedOperatingConfig",
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index cf1b441d0b..f4a66041b6 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -30,15 +30,23 @@ namespace redfish
{
inline void requestRoutesStorageCollection(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Storage/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Storage/")
.privileges(redfish::privileges::getStorageCollection)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
asyncResp->res.jsonValue["@odata.type"] =
"#StorageCollection.StorageCollection";
asyncResp->res.jsonValue["@odata.id"] =
@@ -546,16 +554,23 @@ static void addAllDriveInfo(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
inline void requestRoutesDrive(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/Storage/1/Drives/<str>/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/Storage/1/Drives/<str>/")
.privileges(redfish::privileges::getDrive)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& driveId) {
+ const std::string& systemName, const std::string& driveId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
crow::connections::systemBus->async_method_call(
[asyncResp,
driveId](const boost::system::error_code ec,
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 975e90bc3c..fc5a8048ad 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -2869,15 +2869,22 @@ inline void requestRoutesSystems(App& app)
/**
* Functions triggers appropriate requests on DBus
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/")
.privileges(redfish::privileges::getComputerSystem)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
asyncResp->res.addHeader(
boost::beast::http::field::link,
"</redfish/v1/JsonSchemas/ComputerSystem/ComputerSystem.json>; rel=describedby");
@@ -2997,15 +3004,23 @@ inline void requestRoutesSystems(App& app)
getIdlePowerSaver(asyncResp);
});
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/")
.privileges(redfish::privileges::patchComputerSystem)
.methods(boost::beast::http::verb::patch)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
asyncResp->res.addHeader(
boost::beast::http::field::link,
"</redfish/v1/JsonSchemas/ComputerSystem/ComputerSystem.json>; rel=describedby");
@@ -3029,28 +3044,28 @@ inline void requestRoutesSystems(App& app)
std::optional<uint64_t> ipsExitTime;
// clang-format off
- if (!json_util::readJsonPatch(
- req, asyncResp->res,
- "IndicatorLED", indicatorLed,
- "LocationIndicatorActive", locationIndicatorActive,
- "AssetTag", assetTag,
- "PowerRestorePolicy", powerRestorePolicy,
- "PowerMode", powerMode,
- "HostWatchdogTimer/FunctionEnabled", wdtEnable,
- "HostWatchdogTimer/TimeoutAction", wdtTimeOutAction,
- "Boot/BootSourceOverrideTarget", bootSource,
- "Boot/BootSourceOverrideMode", bootType,
- "Boot/BootSourceOverrideEnabled", bootEnable,
- "Boot/AutomaticRetryConfig", bootAutomaticRetry,
- "Boot/TrustedModuleRequiredToBoot", bootTrustedModuleRequired,
- "IdlePowerSaver/Enabled", ipsEnable,
- "IdlePowerSaver/EnterUtilizationPercent", ipsEnterUtil,
- "IdlePowerSaver/EnterDwellTimeSeconds", ipsEnterTime,
- "IdlePowerSaver/ExitUtilizationPercent", ipsExitUtil,
- "IdlePowerSaver/ExitDwellTimeSeconds", ipsExitTime))
- {
- return;
- }
+ if (!json_util::readJsonPatch(
+ req, asyncResp->res,
+ "IndicatorLED", indicatorLed,
+ "LocationIndicatorActive", locationIndicatorActive,
+ "AssetTag", assetTag,
+ "PowerRestorePolicy", powerRestorePolicy,
+ "PowerMode", powerMode,
+ "HostWatchdogTimer/FunctionEnabled", wdtEnable,
+ "HostWatchdogTimer/TimeoutAction", wdtTimeOutAction,
+ "Boot/BootSourceOverrideTarget", bootSource,
+ "Boot/BootSourceOverrideMode", bootType,
+ "Boot/BootSourceOverrideEnabled", bootEnable,
+ "Boot/AutomaticRetryConfig", bootAutomaticRetry,
+ "Boot/TrustedModuleRequiredToBoot", bootTrustedModuleRequired,
+ "IdlePowerSaver/Enabled", ipsEnable,
+ "IdlePowerSaver/EnterUtilizationPercent", ipsEnterUtil,
+ "IdlePowerSaver/EnterDwellTimeSeconds", ipsEnterTime,
+ "IdlePowerSaver/ExitUtilizationPercent", ipsExitUtil,
+ "IdlePowerSaver/ExitDwellTimeSeconds", ipsExitTime))
+ {
+ return;
+ }
// clang-format on
asyncResp->res.result(boost::beast::http::status::no_content);
@@ -3140,15 +3155,23 @@ inline void requestRoutesSystemResetActionInfo(App& app)
/**
* Functions triggers appropriate requests on DBus
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Systems/system/ResetActionInfo/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Systems/<str>/ResetActionInfo/")
.privileges(redfish::privileges::getActionInfo)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& systemName) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (systemName != "system")
+ {
+ messages::resourceNotFound(asyncResp->res, "ComputerSystem",
+ systemName);
+ return;
+ }
+
asyncResp->res.addHeader(
boost::beast::http::field::link,
"</redfish/v1/JsonSchemas/ActionInfo/ActionInfo.json>; rel=describedby");