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
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index d4ef1f1..ecd5d59 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -910,15 +910,23 @@
     /**
      * 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 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 @@
 {
     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 @@
 
 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 @@
         {
             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 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 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 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 @@
         });
 
     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 @@
         });
 
     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 @@
 {
     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 @@
             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 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 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 @@
         {
             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 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 @@
     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 @@
     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 @@
     }
     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 @@
     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 @@
     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 @@
     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 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 @@
     /**
      * 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 @@
 {
     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 @@
      * 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 @@
     // 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 @@
     // 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 @@
     // 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 @@
 
     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 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 @@
 {
     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 @@
 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 @@
         {
             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 @@
 {
     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 @@
             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 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))