summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEd Tanous <ed@tanous.net>2024-05-16 19:38:31 +0300
committerEd Tanous <ed@tanous.net>2024-05-21 01:42:28 +0300
commit253f11b84347de6bff7c6b624bef270fefae5f5a (patch)
tree71f8a40411f3a7482c689ea6448bc24956fc17cb
parentfe907df460896297eb8b1fde00a18dd7cccab109 (diff)
downloadbmcweb-253f11b84347de6bff7c6b624bef270fefae5f5a.tar.xz
Allow configuring "bmc" and "system"
In the early days of bmcweb, we made two pretty critical assumptions; First, is that a given platform would only have a single BMC instance (represented as "bmc") and a single host instance (represented as "system"). Second we assumed that, given that Redfish suggests against hardcoding URIs in client implementation and leaves them freeform, clients would code to the standard. Our own webui-vue hardcodes Redfish URIs [1], and the documentation is littered with examples of hardcoded curl examples of hardcoding these URIs. That bug was filed in 2020, and the issue has only gotten worse over time. This patchset is an attempt to give a target that we can start solving these issues, without trying to boil the ocean and fix all clients in parallel. This commit adds the meson options redfish-manager-uri-name and redfish-system-uri-name These are used to control the "name" that bmcweb places in the fixed locations in the ManagerCollection and ComputerSystemCollection schemas. Note, managers is added, but is not currently testable. It will be iterated on over time. Tested: Changed the URL options to "edsbmc" and "edssystem" in meson options. Redfish service validator passes. URLs appear changed when walking the tree. [1] https://github.com/openbmc/webui-vue/issues/43 Change-Id: I4b44685067051512bd065da8c2e3db68ae5ce23a Signed-off-by: Ed Tanous <ed@tanous.net>
-rw-r--r--config/meson.build2
-rw-r--r--meson_options.txt22
-rw-r--r--redfish-core/include/utils/pcie_util.hpp4
-rw-r--r--redfish-core/lib/bios.hpp13
-rw-r--r--redfish-core/lib/certificate_service.hpp142
-rw-r--r--redfish-core/lib/chassis.hpp11
-rw-r--r--redfish-core/lib/ethernet.hpp79
-rw-r--r--redfish-core/lib/fabric_adapters.hpp11
-rw-r--r--redfish-core/lib/hypervisor_system.hpp3
-rw-r--r--redfish-core/lib/log_services.hpp411
-rw-r--r--redfish-core/lib/manager_diagnostic_data.hpp16
-rw-r--r--redfish-core/lib/managers.hpp141
-rw-r--r--redfish-core/lib/memory.hpp15
-rw-r--r--redfish-core/lib/network_protocol.hpp49
-rw-r--r--redfish-core/lib/pcie.hpp38
-rw-r--r--redfish-core/lib/processor.hpp45
-rw-r--r--redfish-core/lib/service_root.hpp3
-rw-r--r--redfish-core/lib/storage.hpp47
-rw-r--r--redfish-core/lib/systems.hpp56
-rw-r--r--redfish-core/lib/update_service.hpp10
20 files changed, 763 insertions, 355 deletions
diff --git a/config/meson.build b/config/meson.build
index 887c48d495..b500dee4dd 100644
--- a/config/meson.build
+++ b/config/meson.build
@@ -42,6 +42,8 @@ feature_options = [
string_options = [
'dns-resolver',
'mutual-tls-common-name-parsing',
+ 'redfish-manager-uri-name',
+ 'redfish-system-uri-name',
]
int_options = [
diff --git a/meson_options.txt b/meson_options.txt
index 11b476f9a4..d528875a70 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -128,6 +128,28 @@ option(
)
option(
+ 'redfish-manager-uri-name',
+ type: 'string',
+ value: 'bmc',
+ description: '''The static Redfish Manager ID representing the BMC
+ instance. This option will appear in the Redfish tree at
+ /redfish/v1/Managers/<redfish-manager-uri-name>.
+ Defaults to \'bmc\' which resolves to
+ /redfish/v1/Managers/bmc'''
+)
+
+option(
+ 'redfish-system-uri-name',
+ type: 'string',
+ value: 'system',
+ description: '''The static Redfish System ID representing the host
+ instance. This option will appear in the Redfish tree at
+ /redfish/v1/Systems/<redfish-system-uri-name>.
+ Defaults to \'system\' which resolves to
+ /redfish/v1/Systems/system'''
+)
+
+option(
'bmcweb-logging',
type: 'combo',
choices : [ 'disabled', 'enabled', 'debug', 'info', 'warning', 'error', 'critical' ],
diff --git a/redfish-core/include/utils/pcie_util.hpp b/redfish-core/include/utils/pcie_util.hpp
index c685c3e3af..0ad586b624 100644
--- a/redfish-core/include/utils/pcie_util.hpp
+++ b/redfish-core/include/utils/pcie_util.hpp
@@ -39,8 +39,8 @@ inline void
{
static constexpr std::array<std::string_view, 1> pcieDeviceInterface = {
"xyz.openbmc_project.Inventory.Item.PCIeDevice"};
- const boost::urls::url pcieDeviceUrl =
- boost::urls::url("/redfish/v1/Systems/system/PCIeDevices");
+ const boost::urls::url pcieDeviceUrl = boost::urls::format(
+ "/redfish/v1/Systems/{}/PCIeDevices", BMCWEB_REDFISH_SYSTEM_URI_NAME);
collection_util::getCollectionToKey(
asyncResp, pcieDeviceUrl, pcieDeviceInterface,
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index 477c15e1d0..a0e440b7cc 100644
--- a/redfish-core/lib/bios.hpp
+++ b/redfish-core/lib/bios.hpp
@@ -5,6 +5,8 @@
#include "registries/privilege_registry.hpp"
#include "utils/sw_utils.hpp"
+#include <boost/url/format.hpp>
+
namespace redfish
{
/**
@@ -26,19 +28,22 @@ inline void
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
return;
}
- asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system/Bios";
+ asyncResp->res.jsonValue["@odata.id"] = std::format(
+ "/redfish/v1/Systems/{}/Bios", BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["@odata.type"] = "#Bios.v1_1_0.Bios";
asyncResp->res.jsonValue["Name"] = "BIOS Configuration";
asyncResp->res.jsonValue["Description"] = "BIOS Configuration Service";
asyncResp->res.jsonValue["Id"] = "BIOS";
asyncResp->res.jsonValue["Actions"]["#Bios.ResetBios"] = {
- {"target", "/redfish/v1/Systems/system/Bios/Actions/Bios.ResetBios"}};
+ {"target",
+ std::format("/redfish/v1/Systems/{}/Bios/Actions/Bios.ResetBios",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME)}};
// Get the ActiveSoftwareImage and SoftwareImages
sw_util::populateSoftwareInformation(asyncResp, sw_util::biosPurpose, "",
@@ -78,7 +83,7 @@ inline void
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
diff --git a/redfish-core/lib/certificate_service.hpp b/redfish-core/lib/certificate_service.hpp
index 6fba827371..af35450ab7 100644
--- a/redfish-core/lib/certificate_service.hpp
+++ b/redfish-core/lib/certificate_service.hpp
@@ -249,8 +249,8 @@ static void
if (objPath.parent_path() == certs::httpsObjectPath)
{
certURL = boost::urls::format(
- "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/{}",
- certId);
+ "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, certId);
}
else if (objPath.parent_path() == certs::ldapObjectPath)
{
@@ -260,8 +260,8 @@ static void
else if (objPath.parent_path() == certs::authorityObjectPath)
{
certURL = boost::urls::format(
- "/redfish/v1/Managers/bmc/Truststore/Certificates/{}",
- certId);
+ "/redfish/v1/Managers/{}/Truststore/Certificates/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, certId);
}
else
{
@@ -672,8 +672,9 @@ inline void
std::string objectPath;
std::string service;
- if (certURI.starts_with(
- "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates"))
+ if (certURI.starts_with(std::format(
+ "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates",
+ BMCWEB_REDFISH_MANAGER_URI_NAME)))
{
objectPath = certs::httpsObjectPath;
service = certs::httpsServiceName;
@@ -709,8 +710,9 @@ inline void
}
// validate KeyUsage supporting only 1 type based on URL
- if (certURI.starts_with(
- "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates"))
+ if (certURI.starts_with(std::format(
+ "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates",
+ BMCWEB_REDFISH_MANAGER_URI_NAME)))
{
if (optKeyUsage->empty())
{
@@ -871,15 +873,23 @@ inline void requestRoutesCertificateService(App& app)
inline void handleHTTPSCertificateCollectionGet(
App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates";
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
+ asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["@odata.type"] =
"#CertificateCollection.CertificateCollection";
asyncResp->res.jsonValue["Name"] = "HTTPS Certificates Collection";
@@ -893,12 +903,20 @@ inline void handleHTTPSCertificateCollectionGet(
inline void handleHTTPSCertificateCollectionPost(
App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
BMCWEB_LOG_DEBUG("HTTPSCertificateCollection::doPost");
asyncResp->res.jsonValue["Name"] = "HTTPS Certificate";
@@ -929,8 +947,8 @@ inline void handleHTTPSCertificateCollectionPost(
sdbusplus::message::object_path path(objectPath);
std::string certId = path.filename();
const boost::urls::url certURL = boost::urls::format(
- "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/{}",
- certId);
+ "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, certId);
getCertificateProperties(asyncResp, objectPath, certs::httpsServiceName,
certId, certURL, "HTTPS Certificate");
BMCWEB_LOG_DEBUG("HTTPS certificate install file={}",
@@ -942,39 +960,47 @@ inline void handleHTTPSCertificateCollectionPost(
inline void handleHTTPSCertificateGet(
App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& id)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId, const std::string& certId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
- BMCWEB_LOG_DEBUG("HTTPS Certificate ID={}", id);
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
+ BMCWEB_LOG_DEBUG("HTTPS Certificate ID={}", certId);
const boost::urls::url certURL = boost::urls::format(
- "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/{}", id);
+ "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, certId);
std::string objPath =
- sdbusplus::message::object_path(certs::httpsObjectPath) / id;
- getCertificateProperties(asyncResp, objPath, certs::httpsServiceName, id,
- certURL, "HTTPS Certificate");
+ sdbusplus::message::object_path(certs::httpsObjectPath) / certId;
+ getCertificateProperties(asyncResp, objPath, certs::httpsServiceName,
+ certId, certURL, "HTTPS Certificate");
}
inline void requestRoutesHTTPSCertificate(App& app)
{
- BMCWEB_ROUTE(app,
- "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/")
+ BMCWEB_ROUTE(
+ app, "/redfish/v1/Managers/<str>/NetworkProtocol/HTTPS/Certificates/")
.privileges(redfish::privileges::getCertificateCollection)
.methods(boost::beast::http::verb::get)(std::bind_front(
handleHTTPSCertificateCollectionGet, std::ref(app)));
- BMCWEB_ROUTE(app,
- "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/")
+ BMCWEB_ROUTE(
+ app, "/redfish/v1/Managers/<str>/NetworkProtocol/HTTPS/Certificates/")
.privileges(redfish::privileges::postCertificateCollection)
.methods(boost::beast::http::verb::post)(std::bind_front(
handleHTTPSCertificateCollectionPost, std::ref(app)));
BMCWEB_ROUTE(
app,
- "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates/<str>/")
+ "/redfish/v1/Managers/<str>/NetworkProtocol/HTTPS/Certificates/<str>/")
.privileges(redfish::privileges::getCertificate)
.methods(boost::beast::http::verb::get)(
std::bind_front(handleHTTPSCertificateGet, std::ref(app)));
@@ -1104,15 +1130,23 @@ inline void requestRoutesLDAPCertificate(App& app)
inline void handleTrustStoreCertificateCollectionGet(
App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/Truststore/Certificates/";
+ boost::urls::format("/redfish/v1/Managers/{}/Truststore/Certificates/",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["@odata.type"] =
"#CertificateCollection.CertificateCollection";
asyncResp->res.jsonValue["Name"] = "TrustStore Certificates Collection";
@@ -1126,12 +1160,20 @@ inline void handleTrustStoreCertificateCollectionGet(
inline void handleTrustStoreCertificateCollectionPost(
App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
std::string certHttpBody = getCertificateFromReqBody(asyncResp, req);
if (certHttpBody.empty())
@@ -1156,7 +1198,8 @@ inline void handleTrustStoreCertificateCollectionPost(
sdbusplus::message::object_path path(objectPath);
std::string certId = path.filename();
const boost::urls::url certURL = boost::urls::format(
- "/redfish/v1/Managers/bmc/Truststore/Certificates/{}", certId);
+ "/redfish/v1/Managers/{}/Truststore/Certificates/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, certId);
getCertificateProperties(asyncResp, objectPath,
certs::authorityServiceName, certId, certURL,
"TrustStore Certificate");
@@ -1169,56 +1212,73 @@ inline void handleTrustStoreCertificateCollectionPost(
inline void handleTrustStoreCertificateGet(
App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& id)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId, const std::string& certId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
- BMCWEB_LOG_DEBUG("Truststore Certificate ID={}", id);
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
+ BMCWEB_LOG_DEBUG("Truststore Certificate ID={}", certId);
const boost::urls::url certURL = boost::urls::format(
- "/redfish/v1/Managers/bmc/Truststore/Certificates/{}", id);
+ "/redfish/v1/Managers/{}/Truststore/Certificates/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, certId);
std::string objPath =
- sdbusplus::message::object_path(certs::authorityObjectPath) / id;
+ sdbusplus::message::object_path(certs::authorityObjectPath) / certId;
getCertificateProperties(asyncResp, objPath, certs::authorityServiceName,
- id, certURL, "TrustStore Certificate");
+ certId, certURL, "TrustStore Certificate");
}
inline void handleTrustStoreCertificateDelete(
App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp, const std::string& id)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId, const std::string& certId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
- BMCWEB_LOG_DEBUG("Delete TrustStore Certificate ID={}", id);
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
+ BMCWEB_LOG_DEBUG("Delete TrustStore Certificate ID={}", certId);
std::string objPath =
- sdbusplus::message::object_path(certs::authorityObjectPath) / id;
+ sdbusplus::message::object_path(certs::authorityObjectPath) / certId;
deleteCertificate(asyncResp, certs::authorityServiceName, objPath);
}
inline void requestRoutesTrustStoreCertificate(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/Truststore/Certificates/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/Truststore/Certificates/")
.privileges(redfish::privileges::getCertificate)
.methods(boost::beast::http::verb::get)(std::bind_front(
handleTrustStoreCertificateCollectionGet, std::ref(app)));
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/Truststore/Certificates/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/Truststore/Certificates/")
.privileges(redfish::privileges::postCertificateCollection)
.methods(boost::beast::http::verb::post)(std::bind_front(
handleTrustStoreCertificateCollectionPost, std::ref(app)));
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/Truststore/Certificates/<str>/")
+ BMCWEB_ROUTE(app,
+ "/redfish/v1/Managers/<str>/Truststore/Certificates/<str>/")
.privileges(redfish::privileges::getCertificate)
.methods(boost::beast::http::verb::get)(
std::bind_front(handleTrustStoreCertificateGet, std::ref(app)));
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/Truststore/Certificates/<str>/")
+ BMCWEB_ROUTE(app,
+ "/redfish/v1/Managers/<str>/Truststore/Certificates/<str>/")
.privileges(redfish::privileges::deleteCertificate)
.methods(boost::beast::http::verb::delete_)(
std::bind_front(handleTrustStoreCertificateDelete, std::ref(app)));
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index 19728a470e..c654760f65 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -76,8 +76,9 @@ inline void getStorageLink(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
}
nlohmann::json::object_t storage;
- storage["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/Storage/{}", id);
+ storage["@odata.id"] =
+ boost::urls::format("/redfish/v1/Systems/{}/Storage/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, id);
storages.emplace_back(std::move(storage));
}
asyncResp->res.jsonValue["Links"]["Storage@odata.count"] =
@@ -431,14 +432,16 @@ inline void handleDecoratorAssetProperties(
nlohmann::json::array_t computerSystems;
nlohmann::json::object_t system;
- system["@odata.id"] = "/redfish/v1/Systems/system";
+ system["@odata.id"] = std::format("/redfish/v1/Systems/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
computerSystems.emplace_back(std::move(system));
asyncResp->res.jsonValue["Links"]["ComputerSystems"] =
std::move(computerSystems);
nlohmann::json::array_t managedBy;
nlohmann::json::object_t manager;
- manager["@odata.id"] = "/redfish/v1/Managers/bmc";
+ manager["@odata.id"] = boost::urls::format("/redfish/v1/Managers/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
managedBy.emplace_back(std::move(manager));
asyncResp->res.jsonValue["Links"]["ManagedBy"] = std::move(managedBy);
getChassisState(asyncResp);
diff --git a/redfish-core/lib/ethernet.hpp b/redfish-core/lib/ethernet.hpp
index 533c7f5c2e..f797bfb612 100644
--- a/redfish-core/lib/ethernet.hpp
+++ b/redfish-core/lib/ethernet.hpp
@@ -1840,8 +1840,9 @@ inline void
{
nlohmann::json& jsonResponse = asyncResp->res.jsonValue;
jsonResponse["Id"] = ifaceId;
- jsonResponse["@odata.id"] = boost::urls::format(
- "/redfish/v1/Managers/bmc/EthernetInterfaces/{}", ifaceId);
+ jsonResponse["@odata.id"] =
+ boost::urls::format("/redfish/v1/Managers/{}/EthernetInterfaces/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, ifaceId);
jsonResponse["InterfaceEnabled"] = ethData.nicEnabled;
if (ethData.nicEnabled)
@@ -1897,7 +1898,8 @@ inline void
nlohmann::json::array_t relatedInterfaces;
nlohmann::json& parentInterface = relatedInterfaces.emplace_back();
parentInterface["@odata.id"] =
- boost::urls::format("/redfish/v1/Managers/bmc/EthernetInterfaces",
+ boost::urls::format("/redfish/v1/Managers/{}/EthernetInterfaces",
+ BMCWEB_REDFISH_MANAGER_URI_NAME,
extractParentInterfaceName(ifaceId));
jsonResponse["Links"]["RelatedInterfaces"] =
std::move(relatedInterfaces);
@@ -2051,27 +2053,36 @@ inline void afterVlanCreate(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
return;
}
- const boost::urls::url vlanInterfaceUri = boost::urls::format(
- "/redfish/v1/Managers/bmc/EthernetInterfaces/{}", vlanInterface);
+ const boost::urls::url vlanInterfaceUri =
+ boost::urls::format("/redfish/v1/Managers/{}/EthernetInterfaces/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, vlanInterface);
asyncResp->res.addHeader("Location", vlanInterfaceUri.buffer());
}
inline void requestEthernetInterfacesRoutes(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/EthernetInterfaces/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/EthernetInterfaces/")
.privileges(redfish::privileges::getEthernetInterfaceCollection)
.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& managerId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
asyncResp->res.jsonValue["@odata.type"] =
"#EthernetInterfaceCollection.EthernetInterfaceCollection";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/EthernetInterfaces";
+ boost::urls::format("/redfish/v1/Managers/{}/EthernetInterfaces",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["Name"] =
"Ethernet Network Interface Collection";
asyncResp->res.jsonValue["Description"] =
@@ -2094,27 +2105,35 @@ inline void requestEthernetInterfacesRoutes(App& app)
{
nlohmann::json::object_t iface;
iface["@odata.id"] = boost::urls::format(
- "/redfish/v1/Managers/bmc/EthernetInterfaces/{}",
- ifaceItem);
+ "/redfish/v1/Managers/{}/EthernetInterfaces/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, ifaceItem);
ifaceArray.push_back(std::move(iface));
}
asyncResp->res.jsonValue["Members@odata.count"] = ifaceArray.size();
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/EthernetInterfaces";
+ asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}/EthernetInterfaces",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
});
});
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/EthernetInterfaces/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/EthernetInterfaces/")
.privileges(redfish::privileges::postEthernetInterfaceCollection)
.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& managerId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
bool vlanEnable = false;
uint32_t vlanId = 0;
std::vector<nlohmann::json::object_t> relatedInterfaces;
@@ -2189,16 +2208,23 @@ inline void requestEthernetInterfacesRoutes(App& app)
vlanId);
});
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/EthernetInterfaces/<str>/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/EthernetInterfaces/<str>/")
.privileges(redfish::privileges::getEthernetInterface)
.methods(boost::beast::http::verb::get)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& ifaceId) {
+ const std::string& managerId, const std::string& ifaceId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
getEthernetIfaceData(
ifaceId,
[asyncResp,
@@ -2226,16 +2252,23 @@ inline void requestEthernetInterfacesRoutes(App& app)
});
});
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/EthernetInterfaces/<str>/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/EthernetInterfaces/<str>/")
.privileges(redfish::privileges::patchEthernetInterface)
.methods(boost::beast::http::verb::patch)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& ifaceId) {
+ const std::string& managerId, const std::string& ifaceId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
std::optional<std::string> hostname;
std::optional<std::string> fqdn;
std::optional<std::string> macAddress;
@@ -2382,17 +2415,23 @@ inline void requestEthernetInterfacesRoutes(App& app)
});
});
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/EthernetInterfaces/<str>/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/EthernetInterfaces/<str>/")
.privileges(redfish::privileges::deleteEthernetInterface)
.methods(boost::beast::http::verb::delete_)(
[&app](const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& ifaceId) {
+ const std::string& managerId, const std::string& ifaceId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
crow::connections::systemBus->async_method_call(
[asyncResp, ifaceId](const boost::system::error_code& ec,
const sdbusplus::message_t& m) {
diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp
index 46e67d2b49..11dc7c6973 100644
--- a/redfish-core/lib/fabric_adapters.hpp
+++ b/redfish-core/lib/fabric_adapters.hpp
@@ -273,7 +273,7 @@ inline void
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -300,7 +300,7 @@ inline void handleFabricAdapterCollectionGet(
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -320,7 +320,8 @@ inline void handleFabricAdapterCollectionGet(
"xyz.openbmc_project.Inventory.Item.FabricAdapter"};
collection_util::getCollectionMembers(
asyncResp,
- boost::urls::url("/redfish/v1/Systems/system/FabricAdapters"),
+ boost::urls::format("/redfish/v1/Systems/{}/FabricAdapters",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME),
interfaces, "/xyz/openbmc_project/inventory");
}
@@ -340,7 +341,7 @@ inline void handleFabricAdapterCollectionHead(
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -398,7 +399,7 @@ inline void
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
diff --git a/redfish-core/lib/hypervisor_system.hpp b/redfish-core/lib/hypervisor_system.hpp
index ad1fae8850..5eb9f610fe 100644
--- a/redfish-core/lib/hypervisor_system.hpp
+++ b/redfish-core/lib/hypervisor_system.hpp
@@ -714,7 +714,8 @@ inline void handleHypervisorSystemGet(
asyncResp->res.jsonValue["SystemType"] = "OS";
nlohmann::json::array_t managedBy;
nlohmann::json::object_t manager;
- manager["@odata.id"] = "/redfish/v1/Managers/bmc";
+ manager["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}", BMCWEB_REDFISH_MANAGER_URI_NAME);
managedBy.emplace_back(std::move(manager));
asyncResp->res.jsonValue["Links"]["ManagedBy"] = std::move(managedBy);
asyncResp->res.jsonValue["EthernetInterfaces"]["@odata.id"] =
diff --git a/redfish-core/lib/log_services.hpp b/redfish-core/lib/log_services.hpp
index 058852c62c..2524502d51 100644
--- a/redfish-core/lib/log_services.hpp
+++ b/redfish-core/lib/log_services.hpp
@@ -482,15 +482,21 @@ static std::string getDumpEntriesPath(const std::string& dumpType)
if (dumpType == "BMC")
{
- entriesPath = "/redfish/v1/Managers/bmc/LogServices/Dump/Entries/";
+ entriesPath =
+ std::format("/redfish/v1/Managers/{}/LogServices/Dump/Entries/",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
}
else if (dumpType == "FaultLog")
{
- entriesPath = "/redfish/v1/Managers/bmc/LogServices/FaultLog/Entries/";
+ entriesPath =
+ std::format("/redfish/v1/Managers/{}/LogServices/FaultLog/Entries/",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
}
else if (dumpType == "System")
{
- entriesPath = "/redfish/v1/Systems/system/LogServices/Dump/Entries/";
+ entriesPath =
+ std::format("/redfish/v1/Systems/{}/LogServices/Dump/Entries/",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
}
else
{
@@ -872,7 +878,7 @@ inline void
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -935,11 +941,13 @@ inline std::string getDumpEntryPath(const std::string& dumpPath)
{
if (dumpPath == "/xyz/openbmc_project/dump/bmc/entry")
{
- return "/redfish/v1/Managers/bmc/LogServices/Dump/Entries/";
+ return std::format("/redfish/v1/Managers/{}/LogServices/Dump/Entries/",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
}
if (dumpPath == "/xyz/openbmc_project/dump/system/entry")
{
- return "/redfish/v1/Systems/system/LogServices/Dump/Entries/";
+ return std::format("/redfish/v1/Systems/{}/LogServices/Dump/Entries/",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
}
return "";
}
@@ -1051,7 +1059,8 @@ inline void createDumpTaskCallback(
taskData->messages.emplace_back(retMessage);
boost::urls::url url = boost::urls::format(
- "/redfish/v1/Managers/bmc/LogServices/Dump/Entries/{}", dumpId);
+ "/redfish/v1/Managers/{}/LogServices/Dump/Entries/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, dumpId);
std::string headerLoc = "Location: ";
headerLoc += url.buffer();
@@ -1115,7 +1124,8 @@ inline void createDump(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
messages::internalError(asyncResp->res);
return;
}
- dumpPath = "/redfish/v1/Systems/system/LogServices/Dump/";
+ dumpPath = std::format("/redfish/v1/Systems/{}/LogServices/Dump/",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
}
else if (dumpType == "BMC")
{
@@ -1134,7 +1144,8 @@ inline void createDump(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
messages::internalError(asyncResp->res);
return;
}
- dumpPath = "/redfish/v1/Managers/bmc/LogServices/Dump/";
+ dumpPath = std::format("/redfish/v1/Managers/{}/LogServices/Dump/",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
}
else
{
@@ -1283,7 +1294,7 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -1295,7 +1306,8 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
asyncResp->res.jsonValue["@odata.type"] =
"#LogServiceCollection.LogServiceCollection";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices";
+ std::format("/redfish/v1/Systems/{}/LogServices",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["Name"] = "System Log Services Collection";
asyncResp->res.jsonValue["Description"] =
"Collection of LogServices for this Computer System";
@@ -1303,13 +1315,15 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
logServiceArray = nlohmann::json::array();
nlohmann::json::object_t eventLog;
eventLog["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/EventLog";
+ std::format("/redfish/v1/Systems/{}/LogServices/EventLog",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
logServiceArray.emplace_back(std::move(eventLog));
if constexpr (BMCWEB_REDFISH_DUMP_LOG)
{
nlohmann::json::object_t dumpLog;
dumpLog["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/Dump";
+ std::format("/redfish/v1/Systems/{}/LogServices/Dump",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
logServiceArray.emplace_back(std::move(dumpLog));
}
@@ -1317,7 +1331,8 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
{
nlohmann::json::object_t crashdump;
crashdump["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/Crashdump";
+ std::format("/redfish/v1/Systems/{}/LogServices/Crashdump",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
logServiceArray.emplace_back(std::move(crashdump));
}
@@ -1325,7 +1340,8 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
{
nlohmann::json::object_t hostlogger;
hostlogger["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/HostLogger";
+ std::format("/redfish/v1/Systems/{}/LogServices/HostLogger",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
logServiceArray.emplace_back(std::move(hostlogger));
}
asyncResp->res.jsonValue["Members@odata.count"] =
@@ -1351,8 +1367,9 @@ inline void requestRoutesSystemLogServiceCollection(App& app)
nlohmann::json& logServiceArrayLocal =
asyncResp->res.jsonValue["Members"];
nlohmann::json::object_t member;
- member["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/PostCodes";
+ member["@odata.id"] = std::format(
+ "/redfish/v1/Systems/{}/LogServices/PostCodes",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
logServiceArrayLocal.emplace_back(std::move(member));
@@ -1377,14 +1394,15 @@ inline void requestRoutesEventLogService(App& app)
{
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
return;
}
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/EventLog";
+ std::format("/redfish/v1/Systems/{}/LogServices/EventLog",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["@odata.type"] =
"#LogService.v1_2_0.LogService";
asyncResp->res.jsonValue["Name"] = "Event Log Service";
@@ -1400,11 +1418,14 @@ inline void requestRoutesEventLogService(App& app)
redfishDateTimeOffset.second;
asyncResp->res.jsonValue["Entries"]["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries";
+ std::format("/redfish/v1/Systems/{}/LogServices/EventLog/Entries",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["Actions"]["#LogService.ClearLog"] = {
{"target",
- "/redfish/v1/Systems/system/LogServices/EventLog/Actions/LogService.ClearLog"}};
+ std::format(
+ "/redfish/v1/Systems/{}/LogServices/EventLog/Actions/LogService.ClearLog",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME)}};
});
}
@@ -1422,7 +1443,7 @@ inline void requestRoutesJournalEventLogClear(App& app)
{
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -1529,8 +1550,8 @@ static LogParseError
// Fill in the log entry with the gathered data
logEntryJson["@odata.type"] = "#LogEntry.v1_9_0.LogEntry";
logEntryJson["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries/{}",
- logEntryID);
+ "/redfish/v1/Systems/{}/LogServices/EventLog/Entries/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, logEntryID);
logEntryJson["Name"] = "System Event Log Entry";
logEntryJson["Id"] = logEntryID;
logEntryJson["Message"] = std::move(msg);
@@ -1567,7 +1588,7 @@ inline void requestRoutesJournalEventLogEntryCollection(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -1582,7 +1603,8 @@ inline void requestRoutesJournalEventLogEntryCollection(App& app)
asyncResp->res.jsonValue["@odata.type"] =
"#LogEntryCollection.LogEntryCollection";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries";
+ std::format("/redfish/v1/Systems/{}/LogServices/EventLog/Entries",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["Name"] = "System Event Log Entries";
asyncResp->res.jsonValue["Description"] =
"Collection of System Event Log Entries";
@@ -1645,9 +1667,10 @@ inline void requestRoutesJournalEventLogEntryCollection(App& app)
asyncResp->res.jsonValue["Members@odata.count"] = entryCount;
if (skip + top < entryCount)
{
- asyncResp->res.jsonValue["Members@odata.nextLink"] =
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries?$skip=" +
- std::to_string(skip + top);
+ asyncResp->res
+ .jsonValue["Members@odata.nextLink"] = boost::urls::format(
+ "/redfish/v1/Systems/{}/LogServices/EventLog/Entries?$skip={}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, std::to_string(skip + top));
}
});
}
@@ -1673,7 +1696,7 @@ inline void requestRoutesJournalEventLogEntry(App& app)
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -1749,7 +1772,7 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -1761,7 +1784,8 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app)
asyncResp->res.jsonValue["@odata.type"] =
"#LogEntryCollection.LogEntryCollection";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries";
+ std::format("/redfish/v1/Systems/{}/LogServices/EventLog/Entries",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["Name"] = "System Event Log Entries";
asyncResp->res.jsonValue["Description"] =
"Collection of System Event Log Entries";
@@ -1885,8 +1909,8 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app)
nlohmann::json& thisEntry = entriesArray.emplace_back();
thisEntry["@odata.type"] = "#LogEntry.v1_9_0.LogEntry";
thisEntry["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries/{}",
- std::to_string(*id));
+ "/redfish/v1/Systems/{}/LogServices/EventLog/Entries/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, std::to_string(*id));
thisEntry["Name"] = "System Event Log Entry";
thisEntry["Id"] = std::to_string(*id);
thisEntry["Message"] = *message;
@@ -1911,7 +1935,9 @@ inline void requestRoutesDBusEventLogEntryCollection(App& app)
if (filePath != nullptr)
{
thisEntry["AdditionalDataURI"] =
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries/" +
+ std::format(
+ "/redfish/v1/Systems/{}/LogServices/EventLog/Entries/",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME) +
std::to_string(*id) + "/attachment";
}
}
@@ -1946,7 +1972,7 @@ inline void requestRoutesDBusEventLogEntry(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -2010,8 +2036,8 @@ inline void requestRoutesDBusEventLogEntry(App& app)
asyncResp->res.jsonValue["@odata.type"] =
"#LogEntry.v1_9_0.LogEntry";
asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries/{}",
- std::to_string(*id));
+ "/redfish/v1/Systems/{}/LogServices/EventLog/Entries/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, std::to_string(*id));
asyncResp->res.jsonValue["Name"] = "System Event Log Entry";
asyncResp->res.jsonValue["Id"] = std::to_string(*id);
asyncResp->res.jsonValue["Message"] = *message;
@@ -2036,7 +2062,9 @@ inline void requestRoutesDBusEventLogEntry(App& app)
if (filePath != nullptr)
{
asyncResp->res.jsonValue["AdditionalDataURI"] =
- "/redfish/v1/Systems/system/LogServices/EventLog/Entries/" +
+ std::format(
+ "/redfish/v1/Systems/{}/LogServices/EventLog/Entries/",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME) +
std::to_string(*id) + "/attachment";
}
});
@@ -2060,7 +2088,7 @@ inline void requestRoutesDBusEventLogEntry(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -2100,7 +2128,7 @@ inline void requestRoutesDBusEventLogEntry(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -2211,8 +2239,8 @@ inline void fillHostLoggerEntryJson(std::string_view logEntryID,
// Fill in the log entry with the gathered data.
logEntryJson["@odata.type"] = "#LogEntry.v1_9_0.LogEntry";
logEntryJson["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/LogServices/HostLogger/Entries/{}",
- logEntryID);
+ "/redfish/v1/Systems/{}/LogServices/HostLogger/Entries/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, logEntryID);
logEntryJson["Name"] = "Host Logger Entry";
logEntryJson["Id"] = logEntryID;
logEntryJson["Message"] = msg;
@@ -2240,21 +2268,23 @@ inline void requestRoutesSystemHostLogger(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
return;
}
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/HostLogger";
+ std::format("/redfish/v1/Systems/{}/LogServices/HostLogger",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["@odata.type"] =
"#LogService.v1_2_0.LogService";
asyncResp->res.jsonValue["Name"] = "Host Logger Service";
asyncResp->res.jsonValue["Description"] = "Host Logger Service";
asyncResp->res.jsonValue["Id"] = "HostLogger";
asyncResp->res.jsonValue["Entries"]["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/HostLogger/Entries";
+ std::format("/redfish/v1/Systems/{}/LogServices/HostLogger/Entries",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
});
}
@@ -2284,14 +2314,15 @@ inline void requestRoutesSystemHostLoggerCollection(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
return;
}
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/HostLogger/Entries";
+ std::format("/redfish/v1/Systems/{}/LogServices/HostLogger/Entries",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["@odata.type"] =
"#LogEntryCollection.LogEntryCollection";
asyncResp->res.jsonValue["Name"] = "HostLogger Entries";
@@ -2341,7 +2372,9 @@ inline void requestRoutesSystemHostLoggerCollection(App& app)
if (skip + top < logCount)
{
asyncResp->res.jsonValue["Members@odata.nextLink"] =
- "/redfish/v1/Systems/system/LogServices/HostLogger/Entries?$skip=" +
+ std::format(
+ "/redfish/v1/Systems/{}/LogServices/HostLogger/Entries?$skip=",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME) +
std::to_string(skip + top);
}
}
@@ -2368,7 +2401,7 @@ inline void requestRoutesSystemHostLoggerLogEntry(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -2421,18 +2454,26 @@ inline void requestRoutesSystemHostLoggerLogEntry(App& app)
inline void handleBMCLogServicesCollectionGet(
crow::App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
// Collections don't include the static data added by SubRoute
// because it has a duplicate entry for members
asyncResp->res.jsonValue["@odata.type"] =
"#LogServiceCollection.LogServiceCollection";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/LogServices";
+ asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}/LogServices", BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["Name"] = "Open BMC Log Services Collection";
asyncResp->res.jsonValue["Description"] =
"Collection of LogServices for this Manager";
@@ -2442,7 +2483,9 @@ inline void handleBMCLogServicesCollectionGet(
if constexpr (BMCWEB_REDFISH_BMC_JOURNAL)
{
nlohmann::json::object_t journal;
- journal["@odata.id"] = "/redfish/v1/Managers/bmc/LogServices/Journal";
+ journal["@odata.id"] =
+ boost::urls::format("/redfish/v1/Managers/{}/LogServices/Journal",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
logServiceArray.emplace_back(std::move(journal));
}
@@ -2475,15 +2518,17 @@ inline void handleBMCLogServicesCollectionGet(
if (path == "/xyz/openbmc_project/dump/bmc")
{
nlohmann::json::object_t member;
- member["@odata.id"] =
- "/redfish/v1/Managers/bmc/LogServices/Dump";
+ member["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}/LogServices/Dump",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
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";
+ member["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}/LogServices/FaultLog",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
logServiceArrayLocal.emplace_back(std::move(member));
}
}
@@ -2496,7 +2541,7 @@ inline void handleBMCLogServicesCollectionGet(
inline void requestRoutesBMCLogServiceCollection(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/LogServices/")
.privileges(redfish::privileges::getLogServiceCollection)
.methods(boost::beast::http::verb::get)(
std::bind_front(handleBMCLogServicesCollectionGet, std::ref(app)));
@@ -2504,19 +2549,28 @@ inline void requestRoutesBMCLogServiceCollection(App& app)
inline void requestRoutesBMCJournalLogService(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/Journal/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/LogServices/Journal/")
.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& managerId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
asyncResp->res.jsonValue["@odata.type"] =
"#LogService.v1_2_0.LogService";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/LogServices/Journal";
+ boost::urls::format("/redfish/v1/Managers/{}/LogServices/Journal",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["Name"] = "Open BMC Journal Log Service";
asyncResp->res.jsonValue["Description"] = "BMC Journal Log Service";
asyncResp->res.jsonValue["Id"] = "Journal";
@@ -2528,8 +2582,9 @@ inline void requestRoutesBMCJournalLogService(App& app)
asyncResp->res.jsonValue["DateTimeLocalOffset"] =
redfishDateTimeOffset.second;
- asyncResp->res.jsonValue["Entries"]["@odata.id"] =
- "/redfish/v1/Managers/bmc/LogServices/Journal/Entries";
+ asyncResp->res.jsonValue["Entries"]["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}/LogServices/Journal/Entries",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
});
}
@@ -2581,8 +2636,8 @@ static int
// Fill in the log entry with the gathered data
bmcJournalLogEntryJson["@odata.type"] = "#LogEntry.v1_9_0.LogEntry";
bmcJournalLogEntryJson["@odata.id"] = boost::urls::format(
- "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/{}",
- bmcJournalLogEntryID);
+ "/redfish/v1/Managers/{}/LogServices/Journal/Entries/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, bmcJournalLogEntryID);
bmcJournalLogEntryJson["Name"] = "BMC Journal Entry";
bmcJournalLogEntryJson["Id"] = bmcJournalLogEntryID;
bmcJournalLogEntryJson["Message"] = std::move(message);
@@ -2605,11 +2660,12 @@ static int
inline void requestRoutesBMCJournalLogEntryCollection(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/LogServices/Journal/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& managerId) {
query_param::QueryCapabilities capabilities = {
.canDelegateTop = true,
.canDelegateSkip = true,
@@ -2621,6 +2677,12 @@ inline void requestRoutesBMCJournalLogEntryCollection(App& app)
return;
}
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
size_t skip = delegatedQuery.skip.value_or(0);
size_t top = delegatedQuery.top.value_or(query_param::Query::maxTop);
@@ -2628,8 +2690,9 @@ inline void requestRoutesBMCJournalLogEntryCollection(App& app)
// because it has a duplicate entry for members
asyncResp->res.jsonValue["@odata.type"] =
"#LogEntryCollection.LogEntryCollection";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/LogServices/Journal/Entries";
+ asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}/LogServices/Journal/Entries",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["Name"] = "Open BMC Journal Entries";
asyncResp->res.jsonValue["Description"] =
"Collection of BMC Journal Entries";
@@ -2681,26 +2744,34 @@ inline void requestRoutesBMCJournalLogEntryCollection(App& app)
asyncResp->res.jsonValue["Members@odata.count"] = entryCount;
if (skip + top < entryCount)
{
- asyncResp->res.jsonValue["Members@odata.nextLink"] =
- "/redfish/v1/Managers/bmc/LogServices/Journal/Entries?$skip=" +
- std::to_string(skip + top);
+ asyncResp->res
+ .jsonValue["Members@odata.nextLink"] = boost::urls::format(
+ "/redfish/v1/Managers/{}/LogServices/Journal/Entries?$skip={}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME, std::to_string(skip + top));
}
});
}
inline void requestRoutesBMCJournalLogEntry(App& app)
{
- BMCWEB_ROUTE(app,
- "/redfish/v1/Managers/bmc/LogServices/Journal/Entries/<str>/")
+ BMCWEB_ROUTE(
+ app, "/redfish/v1/Managers/<str>/LogServices/Journal/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& entryID) {
+ const std::string& managerId, const std::string& entryID) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
// Convert the unique ID back to a timestamp to find the entry
sd_id128_t bootID{};
uint64_t ts = 0;
@@ -2771,19 +2842,22 @@ inline void
if (dumpType == "BMC")
{
- dumpPath = "/redfish/v1/Managers/bmc/LogServices/Dump";
+ dumpPath = std::format("/redfish/v1/Managers/{}/LogServices/Dump",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
overWritePolicy = "WrapsWhenFull";
collectDiagnosticDataSupported = true;
}
else if (dumpType == "FaultLog")
{
- dumpPath = "/redfish/v1/Managers/bmc/LogServices/FaultLog";
+ dumpPath = std::format("/redfish/v1/Managers/{}/LogServices/FaultLog",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
overWritePolicy = "Unknown";
collectDiagnosticDataSupported = false;
}
else if (dumpType == "System")
{
- dumpPath = "/redfish/v1/Systems/system/LogServices/Dump";
+ dumpPath = std::format("/redfish/v1/Systems/{}/LogServices/Dump",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
overWritePolicy = "WrapsWhenFull";
collectDiagnosticDataSupported = true;
}
@@ -2846,12 +2920,20 @@ inline void
inline void handleLogServicesDumpServiceGet(
crow::App& app, const std::string& dumpType, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
getDumpServiceInfo(asyncResp, dumpType);
}
@@ -2864,7 +2946,7 @@ inline void handleLogServicesDumpServiceComputerSystemGet(
{
return;
}
- if (chassisId != "system")
+ if (chassisId != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
return;
@@ -2874,12 +2956,19 @@ inline void handleLogServicesDumpServiceComputerSystemGet(
inline void handleLogServicesDumpEntriesCollectionGet(
crow::App& app, const std::string& dumpType, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
getDumpEntryCollection(asyncResp, dumpType);
}
@@ -2892,7 +2981,7 @@ inline void handleLogServicesDumpEntriesCollectionComputerSystemGet(
{
return;
}
- if (chassisId != "system")
+ if (chassisId != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
return;
@@ -2903,12 +2992,17 @@ inline void handleLogServicesDumpEntriesCollectionComputerSystemGet(
inline void handleLogServicesDumpEntryGet(
crow::App& app, const std::string& dumpType, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& dumpId)
+ const std::string& managerId, const std::string& dumpId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
getDumpEntryById(asyncResp, dumpId, dumpType);
}
@@ -2921,7 +3015,7 @@ inline void handleLogServicesDumpEntryComputerSystemGet(
{
return;
}
- if (chassisId != "system")
+ if (chassisId != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
return;
@@ -2932,12 +3026,18 @@ inline void handleLogServicesDumpEntryComputerSystemGet(
inline void handleLogServicesDumpEntryDelete(
crow::App& app, const std::string& dumpType, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& dumpId)
+ const std::string& managerId, const std::string& dumpId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
deleteDumpEntry(asyncResp, dumpId, dumpType);
}
@@ -2950,7 +3050,7 @@ inline void handleLogServicesDumpEntryComputerSystemDelete(
{
return;
}
- if (chassisId != "system")
+ if (chassisId != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem", chassisId);
return;
@@ -2961,12 +3061,18 @@ inline void handleLogServicesDumpEntryComputerSystemDelete(
inline void handleLogServicesDumpEntryDownloadGet(
crow::App& app, const std::string& dumpType, const crow::Request& req,
const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
- const std::string& dumpId)
+ const std::string& managerId, const std::string& dumpId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
downloadDumpEntry(asyncResp, dumpId, dumpType);
}
@@ -2991,12 +3097,19 @@ inline void handleDBusEventLogEntryDownloadGet(
inline void handleLogServicesDumpCollectDiagnosticDataPost(
crow::App& app, const std::string& dumpType, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
createDump(asyncResp, req, dumpType);
}
@@ -3017,7 +3130,7 @@ inline void handleLogServicesDumpCollectDiagnosticDataComputerSystemPost(
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3028,12 +3141,19 @@ inline void handleLogServicesDumpCollectDiagnosticDataComputerSystemPost(
inline void handleLogServicesDumpClearLogPost(
crow::App& app, const std::string& dumpType, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
clearDump(asyncResp, dumpType);
}
@@ -3053,7 +3173,7 @@ inline void handleLogServicesDumpClearLogComputerSystemPost(
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3064,7 +3184,7 @@ inline void handleLogServicesDumpClearLogComputerSystemPost(
inline void requestRoutesBMCDumpService(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/Dump/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/LogServices/Dump/")
.privileges(redfish::privileges::getLogService)
.methods(boost::beast::http::verb::get)(std::bind_front(
handleLogServicesDumpServiceGet, std::ref(app), "BMC"));
@@ -3072,7 +3192,7 @@ inline void requestRoutesBMCDumpService(App& app)
inline void requestRoutesBMCDumpEntryCollection(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/Dump/Entries/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/LogServices/Dump/Entries/")
.privileges(redfish::privileges::getLogEntryCollection)
.methods(boost::beast::http::verb::get)(std::bind_front(
handleLogServicesDumpEntriesCollectionGet, std::ref(app), "BMC"));
@@ -3081,13 +3201,13 @@ inline void requestRoutesBMCDumpEntryCollection(App& app)
inline void requestRoutesBMCDumpEntry(App& app)
{
BMCWEB_ROUTE(app,
- "/redfish/v1/Managers/bmc/LogServices/Dump/Entries/<str>/")
+ "/redfish/v1/Managers/<str>/LogServices/Dump/Entries/<str>/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(std::bind_front(
handleLogServicesDumpEntryGet, std::ref(app), "BMC"));
BMCWEB_ROUTE(app,
- "/redfish/v1/Managers/bmc/LogServices/Dump/Entries/<str>/")
+ "/redfish/v1/Managers/<str>/LogServices/Dump/Entries/<str>/")
.privileges(redfish::privileges::deleteLogEntry)
.methods(boost::beast::http::verb::delete_)(std::bind_front(
handleLogServicesDumpEntryDelete, std::ref(app), "BMC"));
@@ -3097,7 +3217,7 @@ inline void requestRoutesBMCDumpEntryDownload(App& app)
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Managers/bmc/LogServices/Dump/Entries/<str>/attachment/")
+ "/redfish/v1/Managers/<str>/LogServices/Dump/Entries/<str>/attachment/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(std::bind_front(
handleLogServicesDumpEntryDownloadGet, std::ref(app), "BMC"));
@@ -3107,7 +3227,7 @@ inline void requestRoutesBMCDumpCreate(App& app)
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.CollectDiagnosticData/")
+ "/redfish/v1/Managers/<str>/LogServices/Dump/Actions/LogService.CollectDiagnosticData/")
.privileges(redfish::privileges::postLogService)
.methods(boost::beast::http::verb::post)(
std::bind_front(handleLogServicesDumpCollectDiagnosticDataPost,
@@ -3118,7 +3238,7 @@ inline void requestRoutesBMCDumpClear(App& app)
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Managers/bmc/LogServices/Dump/Actions/LogService.ClearLog/")
+ "/redfish/v1/Managers/<str>/LogServices/Dump/Actions/LogService.ClearLog/")
.privileges(redfish::privileges::postLogService)
.methods(boost::beast::http::verb::post)(std::bind_front(
handleLogServicesDumpClearLogPost, std::ref(app), "BMC"));
@@ -3136,7 +3256,7 @@ inline void requestRoutesDBusEventLogEntryDownload(App& app)
inline void requestRoutesFaultLogDumpService(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/FaultLog/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/LogServices/FaultLog/")
.privileges(redfish::privileges::getLogService)
.methods(boost::beast::http::verb::get)(std::bind_front(
handleLogServicesDumpServiceGet, std::ref(app), "FaultLog"));
@@ -3144,7 +3264,8 @@ inline void requestRoutesFaultLogDumpService(App& app)
inline void requestRoutesFaultLogDumpEntryCollection(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/LogServices/FaultLog/Entries/")
+ BMCWEB_ROUTE(app,
+ "/redfish/v1/Managers/<str>/LogServices/FaultLog/Entries/")
.privileges(redfish::privileges::getLogEntryCollection)
.methods(boost::beast::http::verb::get)(
std::bind_front(handleLogServicesDumpEntriesCollectionGet,
@@ -3153,14 +3274,14 @@ inline void requestRoutesFaultLogDumpEntryCollection(App& app)
inline void requestRoutesFaultLogDumpEntry(App& app)
{
- BMCWEB_ROUTE(app,
- "/redfish/v1/Managers/bmc/LogServices/FaultLog/Entries/<str>/")
+ BMCWEB_ROUTE(
+ app, "/redfish/v1/Managers/<str>/LogServices/FaultLog/Entries/<str>/")
.privileges(redfish::privileges::getLogEntry)
.methods(boost::beast::http::verb::get)(std::bind_front(
handleLogServicesDumpEntryGet, std::ref(app), "FaultLog"));
- BMCWEB_ROUTE(app,
- "/redfish/v1/Managers/bmc/LogServices/FaultLog/Entries/<str>/")
+ BMCWEB_ROUTE(
+ app, "/redfish/v1/Managers/<str>/LogServices/FaultLog/Entries/<str>/")
.privileges(redfish::privileges::deleteLogEntry)
.methods(boost::beast::http::verb::delete_)(std::bind_front(
handleLogServicesDumpEntryDelete, std::ref(app), "FaultLog"));
@@ -3170,7 +3291,7 @@ inline void requestRoutesFaultLogDumpClear(App& app)
{
BMCWEB_ROUTE(
app,
- "/redfish/v1/Managers/bmc/LogServices/FaultLog/Actions/LogService.ClearLog/")
+ "/redfish/v1/Managers/<str>/LogServices/FaultLog/Actions/LogService.ClearLog/")
.privileges(redfish::privileges::postLogService)
.methods(boost::beast::http::verb::post)(std::bind_front(
handleLogServicesDumpClearLogPost, std::ref(app), "FaultLog"));
@@ -3255,7 +3376,7 @@ inline void requestRoutesCrashdumpService(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3265,7 +3386,8 @@ inline void requestRoutesCrashdumpService(App& app)
// Copy over the static data to include the entries added by
// SubRoute
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/Crashdump";
+ std::format("/redfish/v1/Systems/{}/LogServices/Crashdump",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["@odata.type"] =
"#LogService.v1_2_0.LogService";
asyncResp->res.jsonValue["Name"] = "Open BMC Oem Crashdump Service";
@@ -3281,12 +3403,16 @@ inline void requestRoutesCrashdumpService(App& app)
redfishDateTimeOffset.second;
asyncResp->res.jsonValue["Entries"]["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/Crashdump/Entries";
- asyncResp->res.jsonValue["Actions"]["#LogService.ClearLog"]["target"] =
- "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/LogService.ClearLog";
+ std::format("/redfish/v1/Systems/{}/LogServices/Crashdump/Entries",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
+ asyncResp->res.jsonValue["Actions"]["#LogService.ClearLog"]
+ ["target"] = std::format(
+ "/redfish/v1/Systems/{}/LogServices/Crashdump/Actions/LogService.ClearLog",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["Actions"]["#LogService.CollectDiagnosticData"]
- ["target"] =
- "/redfish/v1/Systems/system/LogServices/Crashdump/Actions/LogService.CollectDiagnosticData";
+ ["target"] = std::format(
+ "/redfish/v1/Systems/{}/LogServices/Crashdump/Actions/LogService.CollectDiagnosticData",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
});
}
@@ -3313,7 +3439,7 @@ void inline requestRoutesCrashdumpClear(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3368,13 +3494,14 @@ static void
}
std::string crashdumpURI =
- "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/" +
+ std::format("/redfish/v1/Systems/{}/LogServices/Crashdump/Entries/",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME) +
logID + "/" + filename;
nlohmann::json::object_t logEntry;
logEntry["@odata.type"] = "#LogEntry.v1_9_0.LogEntry";
logEntry["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/LogServices/Crashdump/Entries/{}",
- logID);
+ "/redfish/v1/Systems/{}/LogServices/Crashdump/Entries/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, logID);
logEntry["Name"] = "CPU Crashdump";
logEntry["Id"] = logID;
logEntry["EntryType"] = "Oem";
@@ -3430,7 +3557,7 @@ inline void requestRoutesCrashdumpEntryCollection(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3456,8 +3583,9 @@ inline void requestRoutesCrashdumpEntryCollection(App& app)
}
asyncResp->res.jsonValue["@odata.type"] =
"#LogEntryCollection.LogEntryCollection";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/Crashdump/Entries";
+ asyncResp->res.jsonValue["@odata.id"] = std::format(
+ "/redfish/v1/Systems/{}/LogServices/Crashdump/Entries",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["Name"] = "Open BMC Crashdump Entries";
asyncResp->res.jsonValue["Description"] =
"Collection of Crashdump Entries";
@@ -3506,7 +3634,7 @@ inline void requestRoutesCrashdumpEntry(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3540,7 +3668,7 @@ inline void requestRoutesCrashdumpFile(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3646,7 +3774,7 @@ inline void requestRoutesCrashdumpCollect(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3782,7 +3910,7 @@ inline void requestRoutesDBusLogServiceActionsClear(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3836,14 +3964,15 @@ inline void requestRoutesPostCodesLogService(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
return;
}
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/PostCodes";
+ std::format("/redfish/v1/Systems/{}/LogServices/PostCodes",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["@odata.type"] =
"#LogService.v1_2_0.LogService";
asyncResp->res.jsonValue["Name"] = "POST Code Log Service";
@@ -3851,7 +3980,8 @@ inline void requestRoutesPostCodesLogService(App& app)
asyncResp->res.jsonValue["Id"] = "PostCodes";
asyncResp->res.jsonValue["OverWritePolicy"] = "WrapsWhenFull";
asyncResp->res.jsonValue["Entries"]["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/PostCodes/Entries";
+ std::format("/redfish/v1/Systems/{}/LogServices/PostCodes/Entries",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
std::pair<std::string, std::string> redfishDateTimeOffset =
redfish::time_utils::getDateTimeOffsetNow();
@@ -3861,7 +3991,9 @@ inline void requestRoutesPostCodesLogService(App& app)
asyncResp->res.jsonValue["Actions"]["#LogService.ClearLog"] = {
{"target",
- "/redfish/v1/Systems/system/LogServices/PostCodes/Actions/LogService.ClearLog"}};
+ std::format(
+ "/redfish/v1/Systems/{}/LogServices/PostCodes/Actions/LogService.ClearLog",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME)}};
});
}
@@ -3888,7 +4020,7 @@ inline void requestRoutesPostCodesClear(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -4061,8 +4193,8 @@ static bool fillPostCodeEntry(
nlohmann::json::object_t bmcLogEntry;
bmcLogEntry["@odata.type"] = "#LogEntry.v1_9_0.LogEntry";
bmcLogEntry["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/{}",
- postcodeEntryID);
+ "/redfish/v1/Systems/{}/LogServices/PostCodes/Entries/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, postcodeEntryID);
bmcLogEntry["Name"] = "POST Code Log Entry";
bmcLogEntry["Id"] = postcodeEntryID;
bmcLogEntry["Message"] = std::move(msg);
@@ -4074,7 +4206,9 @@ static bool fillPostCodeEntry(
if (!std::get<std::vector<uint8_t>>(code.second).empty())
{
bmcLogEntry["AdditionalDataURI"] =
- "/redfish/v1/Systems/system/LogServices/PostCodes/Entries/" +
+ std::format(
+ "/redfish/v1/Systems/{}/LogServices/PostCodes/Entries/",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME) +
postcodeEntryID + "/attachment";
}
@@ -4191,7 +4325,9 @@ static void
else if (skip + top < endCount)
{
asyncResp->res.jsonValue["Members@odata.nextLink"] =
- "/redfish/v1/Systems/system/LogServices/PostCodes/Entries?$skip=" +
+ std::format(
+ "/redfish/v1/Systems/{}/LogServices/PostCodes/Entries?$skip=",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME) +
std::to_string(skip + top);
}
},
@@ -4250,7 +4386,7 @@ inline void requestRoutesPostCodesEntryCollection(App& app)
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -4259,7 +4395,8 @@ inline void requestRoutesPostCodesEntryCollection(App& app)
asyncResp->res.jsonValue["@odata.type"] =
"#LogEntryCollection.LogEntryCollection";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices/PostCodes/Entries";
+ std::format("/redfish/v1/Systems/{}/LogServices/PostCodes/Entries",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["Name"] = "BIOS POST Code Log Entries";
asyncResp->res.jsonValue["Description"] =
"Collection of POST Code Log Entries";
@@ -4300,7 +4437,7 @@ inline void requestRoutesPostCodesEntryAdditionalData(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -4386,7 +4523,7 @@ inline void requestRoutesPostCodesEntry(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
diff --git a/redfish-core/lib/manager_diagnostic_data.hpp b/redfish-core/lib/manager_diagnostic_data.hpp
index 1ff116f66d..1856e1f9e6 100644
--- a/redfish-core/lib/manager_diagnostic_data.hpp
+++ b/redfish-core/lib/manager_diagnostic_data.hpp
@@ -10,6 +10,7 @@
#include <boost/system/error_code.hpp>
#include <boost/system/linux_error.hpp>
+#include <boost/url/format.hpp>
#include <nlohmann/json.hpp>
#include <sdbusplus/asio/property.hpp>
@@ -228,16 +229,25 @@ inline void managerGetServiceRootUptime(
*/
inline void handleManagerDiagnosticDataGet(
crow::App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
asyncResp->res.jsonValue["@odata.type"] =
"#ManagerDiagnosticData.v1_2_0.ManagerDiagnosticData";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/ManagerDiagnosticData";
+ boost::urls::format("/redfish/v1/Managers/{}/ManagerDiagnosticData",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["Id"] = "ManagerDiagnosticData";
asyncResp->res.jsonValue["Name"] = "Manager Diagnostic Data";
@@ -249,7 +259,7 @@ inline void handleManagerDiagnosticDataGet(
inline void requestRoutesManagerDiagnosticData(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/ManagerDiagnosticData")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/ManagerDiagnosticData")
.privileges(redfish::privileges::getManagerDiagnosticData)
.methods(boost::beast::http::verb::get)(
std::bind_front(handleManagerDiagnosticDataGet, std::ref(app)));
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index e6f42bea8c..138b1258da 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -118,15 +118,22 @@ inline void requestRoutesManagerResetAction(App& app)
* OpenBMC supports ResetType "GracefulRestart" and "ForceRestart".
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/Actions/Manager.Reset/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/Actions/Manager.Reset/")
.privileges(redfish::privileges::postManager)
.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& managerId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
BMCWEB_LOG_DEBUG("Post Manager Reset.");
std::string resetType;
@@ -176,15 +183,23 @@ inline void requestRoutesManagerResetToDefaultsAction(App& app)
*/
BMCWEB_ROUTE(app,
- "/redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults/")
+ "/redfish/v1/Managers/<str>/Actions/Manager.ResetToDefaults/")
.privileges(redfish::privileges::postManager)
.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& managerId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
BMCWEB_LOG_DEBUG("Post ResetToDefaults.");
std::optional<std::string> resetType;
@@ -246,20 +261,28 @@ inline void requestRoutesManagerResetActionInfo(App& app)
* Functions triggers appropriate requests on DBus
*/
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/ResetActionInfo/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<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& managerId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
asyncResp->res.jsonValue["@odata.type"] =
"#ActionInfo.v1_1_2.ActionInfo";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/ResetActionInfo";
+ boost::urls::format("/redfish/v1/Managers/{}/ResetActionInfo",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["Name"] = "Reset Action Info";
asyncResp->res.jsonValue["Id"] = "ResetActionInfo";
nlohmann::json::object_t parameter;
@@ -312,24 +335,30 @@ inline void
asyncResp->res.jsonValue["Oem"]["OpenBmc"]["Fan"];
nlohmann::json& fans = configRoot["FanControllers"];
fans["@odata.type"] = "#OemManager.FanControllers";
- fans["@odata.id"] =
- "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanControllers";
+ fans["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}#/Oem/OpenBmc/Fan/FanControllers",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
nlohmann::json& pids = configRoot["PidControllers"];
pids["@odata.type"] = "#OemManager.PidControllers";
- pids["@odata.id"] =
- "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/PidControllers";
+ pids["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}#/Oem/OpenBmc/Fan/PidControllers",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
nlohmann::json& stepwise = configRoot["StepwiseControllers"];
stepwise["@odata.type"] = "#OemManager.StepwiseControllers";
- stepwise["@odata.id"] =
- "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/StepwiseControllers";
+ stepwise["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}#/Oem/OpenBmc/Fan/StepwiseControllers",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
nlohmann::json& zones = configRoot["FanZones"];
- zones["@odata.id"] =
- "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan/FanZones";
+ zones["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}#/Oem/OpenBmc/Fan/FanZones",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
zones["@odata.type"] = "#OemManager.FanZones";
- configRoot["@odata.id"] = "/redfish/v1/Managers/bmc#/Oem/OpenBmc/Fan";
+ configRoot["@odata.id"] =
+ boost::urls::format("/redfish/v1/Managers/{}#/Oem/OpenBmc/Fan",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
configRoot["@odata.type"] = "#OemManager.Fan";
configRoot["Profile@Redfish.AllowableValues"] = supportedProfiles;
@@ -402,7 +431,9 @@ inline void
}
}
- boost::urls::url url("/redfish/v1/Managers/bmc");
+ boost::urls::url url(
+ boost::urls::format("/redfish/v1/Managers/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME));
if (intfPair.first == pidZoneConfigurationIface)
{
std::string chassis;
@@ -594,7 +625,8 @@ inline void
dbus::utility::escapePathForDbus(itemCopy);
nlohmann::json::object_t input;
boost::urls::url managerUrl = boost::urls::format(
- "/redfish/v1/Managers/bmc#{}",
+ "/redfish/v1/Managers/{}#{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME,
("/Oem/OpenBmc/Fan/FanZones"_json_pointer /
itemCopy)
.to_string());
@@ -1916,18 +1948,27 @@ inline void requestRoutesManager(App& app)
{
std::string uuid = persistent_data::getConfig().systemUuid;
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/")
.privileges(redfish::privileges::getManager)
.methods(boost::beast::http::verb::get)(
[&app, uuid](const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp) {
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
- asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Managers/bmc";
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
+ asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}", BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["@odata.type"] = "#Manager.v1_14_0.Manager";
- asyncResp->res.jsonValue["Id"] = "bmc";
+ asyncResp->res.jsonValue["Id"] = BMCWEB_REDFISH_MANAGER_URI_NAME;
asyncResp->res.jsonValue["Name"] = "OpenBmc Manager";
asyncResp->res.jsonValue["Description"] =
"Baseboard Management Controller";
@@ -1939,29 +1980,37 @@ inline void requestRoutesManager(App& app)
asyncResp->res.jsonValue["Model"] = "OpenBmc"; // TODO(ed), get model
asyncResp->res.jsonValue["LogServices"]["@odata.id"] =
- "/redfish/v1/Managers/bmc/LogServices";
+ boost::urls::format("/redfish/v1/Managers/{}/LogServices",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["NetworkProtocol"]["@odata.id"] =
- "/redfish/v1/Managers/bmc/NetworkProtocol";
+ boost::urls::format("/redfish/v1/Managers/{}/NetworkProtocol",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["EthernetInterfaces"]["@odata.id"] =
- "/redfish/v1/Managers/bmc/EthernetInterfaces";
+ boost::urls::format("/redfish/v1/Managers/{}/EthernetInterfaces",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
if constexpr (BMCWEB_VM_NBDPROXY)
{
asyncResp->res.jsonValue["VirtualMedia"]["@odata.id"] =
- "/redfish/v1/Managers/bmc/VirtualMedia";
+ boost::urls::format("/redfish/v1/Managers/{}/VirtualMedia",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
}
// default oem data
nlohmann::json& oem = asyncResp->res.jsonValue["Oem"];
nlohmann::json& oemOpenbmc = oem["OpenBmc"];
oem["@odata.type"] = "#OemManager.Oem";
- oem["@odata.id"] = "/redfish/v1/Managers/bmc#/Oem";
+ oem["@odata.id"] = boost::urls::format("/redfish/v1/Managers/{}#/Oem",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
oemOpenbmc["@odata.type"] = "#OemManager.OpenBmc";
- oemOpenbmc["@odata.id"] = "/redfish/v1/Managers/bmc#/Oem/OpenBmc";
+ oemOpenbmc["@odata.id"] =
+ boost::urls::format("/redfish/v1/Managers/{}#/Oem/OpenBmc",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
nlohmann::json::object_t certificates;
- certificates["@odata.id"] =
- "/redfish/v1/Managers/bmc/Truststore/Certificates";
+ certificates["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}/Truststore/Certificates",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
oemOpenbmc["Certificates"] = std::move(certificates);
// Manager.Reset (an action) can be many values, OpenBMC only
@@ -1969,17 +2018,20 @@ inline void requestRoutesManager(App& app)
nlohmann::json& managerReset =
asyncResp->res.jsonValue["Actions"]["#Manager.Reset"];
managerReset["target"] =
- "/redfish/v1/Managers/bmc/Actions/Manager.Reset";
+ boost::urls::format("/redfish/v1/Managers/{}/Actions/Manager.Reset",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
managerReset["@Redfish.ActionInfo"] =
- "/redfish/v1/Managers/bmc/ResetActionInfo";
+ boost::urls::format("/redfish/v1/Managers/{}/ResetActionInfo",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
// ResetToDefaults (Factory Reset) has values like
// PreserveNetworkAndUsers and PreserveNetwork that aren't supported
// on OpenBMC
nlohmann::json& resetToDefaults =
asyncResp->res.jsonValue["Actions"]["#Manager.ResetToDefaults"];
- resetToDefaults["target"] =
- "/redfish/v1/Managers/bmc/Actions/Manager.ResetToDefaults";
+ resetToDefaults["target"] = boost::urls::format(
+ "/redfish/v1/Managers/{}/Actions/Manager.ResetToDefaults",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
resetToDefaults["ResetType@Redfish.AllowableValues"] =
nlohmann::json::array_t({"ResetAll"});
@@ -2016,7 +2068,8 @@ inline void requestRoutesManager(App& app)
nlohmann::json::array_t managerForServers;
nlohmann::json::object_t manager;
- manager["@odata.id"] = "/redfish/v1/Systems/system";
+ manager["@odata.id"] = std::format("/redfish/v1/Systems/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
managerForServers.emplace_back(std::move(manager));
asyncResp->res.jsonValue["Links"]["ManagerForServers"] =
@@ -2032,7 +2085,8 @@ inline void requestRoutesManager(App& app)
nlohmann::json& managerDiagnosticData =
asyncResp->res.jsonValue["ManagerDiagnosticData"];
managerDiagnosticData["@odata.id"] =
- "/redfish/v1/Managers/bmc/ManagerDiagnosticData";
+ boost::urls::format("/redfish/v1/Managers/{}/ManagerDiagnosticData",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
if constexpr (BMCWEB_REDFISH_OEM_MANAGER_FAN_DATA)
{
@@ -2186,15 +2240,23 @@ inline void requestRoutesManager(App& app)
});
});
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/")
.privileges(redfish::privileges::patchManager)
.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& managerId) {
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
std::optional<std::string> activeSoftwareImageOdataId;
std::optional<std::string> datetime;
std::optional<nlohmann::json::object_t> pidControllers;
@@ -2288,7 +2350,8 @@ inline void requestRoutesManagerCollection(App& app)
asyncResp->res.jsonValue["Members@odata.count"] = 1;
nlohmann::json::array_t members;
nlohmann::json& bmc = members.emplace_back();
- bmc["@odata.id"] = "/redfish/v1/Managers/bmc";
+ bmc["@odata.id"] = boost::urls::format("/redfish/v1/Managers/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["Members"] = std::move(members);
});
}
diff --git a/redfish-core/lib/memory.hpp b/redfish-core/lib/memory.hpp
index 49d19623fa..c77a5346a6 100644
--- a/redfish-core/lib/memory.hpp
+++ b/redfish-core/lib/memory.hpp
@@ -758,7 +758,8 @@ inline void getDimmData(std::shared_ptr<bmcweb::AsyncResp> asyncResp,
// Set @odata only if object is found
asyncResp->res.jsonValue["@odata.type"] = "#Memory.v1_11_0.Memory";
asyncResp->res.jsonValue["@odata.id"] =
- boost::urls::format("/redfish/v1/Systems/system/Memory/{}", dimmId);
+ boost::urls::format("/redfish/v1/Systems/{}/Memory/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, dimmId);
return;
});
}
@@ -785,7 +786,7 @@ inline void requestRoutesMemoryCollection(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -795,13 +796,15 @@ inline void requestRoutesMemoryCollection(App& app)
asyncResp->res.jsonValue["@odata.type"] =
"#MemoryCollection.MemoryCollection";
asyncResp->res.jsonValue["Name"] = "Memory Module Collection";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/Memory";
+ asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Systems/{}/Memory", BMCWEB_REDFISH_SYSTEM_URI_NAME);
constexpr std::array<std::string_view, 1> interfaces{
"xyz.openbmc_project.Inventory.Item.Dimm"};
collection_util::getCollectionMembers(
- asyncResp, boost::urls::url("/redfish/v1/Systems/system/Memory"),
+ asyncResp,
+ boost::urls::format("/redfish/v1/Systems/{}/Memory",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME),
interfaces, "/xyz/openbmc_project/inventory");
});
}
@@ -830,7 +833,7 @@ inline void requestRoutesMemory(App& app)
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
diff --git a/redfish-core/lib/network_protocol.hpp b/redfish-core/lib/network_protocol.hpp
index adafcbb0be..1957ee9df7 100644
--- a/redfish-core/lib/network_protocol.hpp
+++ b/redfish-core/lib/network_protocol.hpp
@@ -26,6 +26,7 @@
#include "utils/stl_utils.hpp"
#include <boost/system/error_code.hpp>
+#include <boost/url/format.hpp>
#include <sdbusplus/asio/property.hpp>
#include <array>
@@ -166,7 +167,8 @@ inline void getNetworkData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
asyncResp->res.jsonValue["@odata.type"] =
"#ManagerNetworkProtocol.v1_5_0.ManagerNetworkProtocol";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Managers/bmc/NetworkProtocol";
+ boost::urls::format("/redfish/v1/Managers/{}/NetworkProtocol",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["Id"] = "NetworkProtocol";
asyncResp->res.jsonValue["Name"] = "Manager Network Protocol";
asyncResp->res.jsonValue["Description"] = "Manager Network Service";
@@ -231,7 +233,9 @@ inline void getNetworkData(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
effectiveUserPrivileges))
{
asyncResp->res.jsonValue["HTTPS"]["Certificates"]["@odata.id"] =
- "/redfish/v1/Managers/bmc/NetworkProtocol/HTTPS/Certificates";
+ boost::urls::format(
+ "/redfish/v1/Managers/{}/NetworkProtocol/HTTPS/Certificates",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
}
getPortStatusAndPath(std::span(networkProtocolToDbus),
@@ -463,12 +467,20 @@ inline void handleBmcNetworkProtocolHead(
inline void handleManagersNetworkProtocolPatch(
App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
return;
}
+
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
std::optional<std::string> newHostName;
std::optional<std::vector<IpAddress>> ntpServerObjects;
@@ -532,7 +544,8 @@ inline void handleManagersNetworkProtocolPatch(
inline void handleManagersNetworkProtocolHead(
App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
if (!redfish::setUpRedfishRoute(app, req, asyncResp))
{
@@ -541,29 +554,47 @@ inline void handleManagersNetworkProtocolHead(
asyncResp->res.addHeader(
boost::beast::http::field::link,
"</redfish/v1/JsonSchemas/ManagerNetworkProtocol/ManagerNetworkProtocol.json>; rel=describedby");
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
}
inline void handleManagersNetworkProtocolGet(
App& app, const crow::Request& req,
- const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
+ const std::string& managerId)
{
- handleManagersNetworkProtocolHead(app, req, asyncResp);
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/ManagerNetworkProtocol/ManagerNetworkProtocol.json>; rel=describedby");
+ if (managerId != BMCWEB_REDFISH_MANAGER_URI_NAME)
+ {
+ messages::resourceNotFound(asyncResp->res, "Manager", managerId);
+ return;
+ }
+
getNetworkData(asyncResp, req);
}
inline void requestRoutesNetworkProtocol(App& app)
{
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/NetworkProtocol/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/NetworkProtocol/")
.privileges(redfish::privileges::patchManagerNetworkProtocol)
.methods(boost::beast::http::verb::patch)(
std::bind_front(handleManagersNetworkProtocolPatch, std::ref(app)));
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/NetworkProtocol/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/NetworkProtocol/")
.privileges(redfish::privileges::headManagerNetworkProtocol)
.methods(boost::beast::http::verb::head)(
std::bind_front(handleManagersNetworkProtocolHead, std::ref(app)));
- BMCWEB_ROUTE(app, "/redfish/v1/Managers/bmc/NetworkProtocol/")
+ BMCWEB_ROUTE(app, "/redfish/v1/Managers/<str>/NetworkProtocol/")
.privileges(redfish::privileges::getManagerNetworkProtocol)
.methods(boost::beast::http::verb::get)(
std::bind_front(handleManagersNetworkProtocolGet, std::ref(app)));
diff --git a/redfish-core/lib/pcie.hpp b/redfish-core/lib/pcie.hpp
index af78cc8ab2..e62dc42ae8 100644
--- a/redfish-core/lib/pcie.hpp
+++ b/redfish-core/lib/pcie.hpp
@@ -115,7 +115,7 @@ static inline void handlePCIeDeviceCollectionGet(
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -127,8 +127,8 @@ static inline void handlePCIeDeviceCollectionGet(
"PCIeDeviceCollection.json>; rel=describedby");
asyncResp->res.jsonValue["@odata.type"] =
"#PCIeDeviceCollection.PCIeDeviceCollection";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/PCIeDevices";
+ asyncResp->res.jsonValue["@odata.id"] = std::format(
+ "/redfish/v1/Systems/{}/PCIeDevices", BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["Name"] = "PCIe Device Collection";
asyncResp->res.jsonValue["Description"] = "Collection of PCIe Devices";
@@ -494,8 +494,8 @@ inline void addPCIeDeviceProperties(
asyncResp->res.jsonValue["PCIeFunctions"]["@odata.id"] =
boost::urls::format(
- "/redfish/v1/Systems/system/PCIeDevices/{}/PCIeFunctions",
- pcieDeviceId);
+ "/redfish/v1/Systems/{}/PCIeDevices/{}/PCIeFunctions",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId);
}
inline void getPCIeDeviceProperties(
@@ -531,8 +531,9 @@ inline void addPCIeDeviceCommonProperties(
boost::beast::http::field::link,
"</redfish/v1/JsonSchemas/PCIeDevice/PCIeDevice.json>; rel=describedby");
asyncResp->res.jsonValue["@odata.type"] = "#PCIeDevice.v1_9_0.PCIeDevice";
- asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/PCIeDevices/{}", pcieDeviceId);
+ asyncResp->res.jsonValue["@odata.id"] =
+ boost::urls::format("/redfish/v1/Systems/{}/PCIeDevices/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId);
asyncResp->res.jsonValue["Name"] = "PCIe Device";
asyncResp->res.jsonValue["Id"] = pcieDeviceId;
asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
@@ -573,7 +574,7 @@ inline void
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -623,8 +624,9 @@ inline void addPCIeFunctionList(
nlohmann::json::object_t pcieFunction;
pcieFunction["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/PCIeDevices/{}/PCIeFunctions/{}",
- pcieDeviceId, std::to_string(functionNum));
+ "/redfish/v1/Systems/{}/PCIeDevices/{}/PCIeFunctions/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId,
+ std::to_string(functionNum));
pcieFunctionList.emplace_back(std::move(pcieFunction));
}
res.jsonValue["PCIeFunctions@odata.count"] = pcieFunctionList.size();
@@ -657,8 +659,8 @@ inline void handlePCIeFunctionCollectionGet(
asyncResp->res.jsonValue["@odata.type"] =
"#PCIeFunctionCollection.PCIeFunctionCollection";
asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/PCIeDevices/{}/PCIeFunctions",
- pcieDeviceId);
+ "/redfish/v1/Systems/{}/PCIeDevices/{}/PCIeFunctions",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId);
asyncResp->res.jsonValue["Name"] = "PCIe Function Collection";
asyncResp->res.jsonValue["Description"] =
"Collection of PCIe Functions for PCIe Device " + pcieDeviceId;
@@ -770,13 +772,15 @@ inline void addPCIeFunctionCommonProperties(crow::Response& resp,
"</redfish/v1/JsonSchemas/PCIeFunction/PCIeFunction.json>; rel=describedby");
resp.jsonValue["@odata.type"] = "#PCIeFunction.v1_2_3.PCIeFunction";
resp.jsonValue["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/PCIeDevices/{}/PCIeFunctions/{}",
- pcieDeviceId, std::to_string(pcieFunctionId));
+ "/redfish/v1/Systems/{}/PCIeDevices/{}/PCIeFunctions/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId,
+ std::to_string(pcieFunctionId));
resp.jsonValue["Name"] = "PCIe Function";
resp.jsonValue["Id"] = std::to_string(pcieFunctionId);
resp.jsonValue["FunctionId"] = pcieFunctionId;
- resp.jsonValue["Links"]["PCIeDevice"]["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/PCIeDevices/{}", pcieDeviceId);
+ resp.jsonValue["Links"]["PCIeDevice"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Systems/{}/PCIeDevices/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, pcieDeviceId);
}
inline void
@@ -797,7 +801,7 @@ inline void
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
diff --git a/redfish-core/lib/processor.hpp b/redfish-core/lib/processor.hpp
index 481c2a5df3..36acbf4a0b 100644
--- a/redfish-core/lib/processor.hpp
+++ b/redfish-core/lib/processor.hpp
@@ -644,8 +644,8 @@ inline void
const std::string& dbusPath = appliedConfig->str;
nlohmann::json::object_t operatingConfig;
operatingConfig["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/Processors/{}/OperatingConfigs",
- cpuId);
+ "/redfish/v1/Systems/{}/Processors/{}/OperatingConfigs",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, cpuId);
json["OperatingConfigs"] = std::move(operatingConfig);
// Reuse the D-Bus config object name for the Redfish
@@ -662,8 +662,9 @@ inline void
}
nlohmann::json::object_t appliedOperatingConfig;
appliedOperatingConfig["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/Processors/{}/OperatingConfigs/{}",
- cpuId, dbusPath.substr(baseNamePos + 1));
+ "/redfish/v1/Systems/{}/Processors/{}/OperatingConfigs/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, cpuId,
+ dbusPath.substr(baseNamePos + 1));
json["AppliedOperatingConfig"] = std::move(appliedOperatingConfig);
// Once we found the current applied config, queue another
@@ -1034,7 +1035,8 @@ inline void patchAppliedOperatingConfig(
}
// Check that the config URI is a child of the cpu URI being patched.
- std::string expectedPrefix("/redfish/v1/Systems/system/Processors/");
+ std::string expectedPrefix(std::format("/redfish/v1/Systems/{}/Processors/",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME));
expectedPrefix += processorId;
expectedPrefix += "/OperatingConfigs/";
if (!appliedConfigUri.starts_with(expectedPrefix) ||
@@ -1113,7 +1115,7 @@ inline void requestRoutesOperatingConfigCollection(App& app)
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -1122,8 +1124,8 @@ inline void requestRoutesOperatingConfigCollection(App& app)
asyncResp->res.jsonValue["@odata.type"] =
"#OperatingConfigCollection.OperatingConfigCollection";
asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/Processors/{}/OperatingConfigs",
- cpuName);
+ "/redfish/v1/Systems/{}/Processors/{}/OperatingConfigs",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, cpuName);
asyncResp->res.jsonValue["Name"] = "Operating Config Collection";
// First find the matching CPU object so we know how to
@@ -1160,8 +1162,8 @@ inline void requestRoutesOperatingConfigCollection(App& app)
collection_util::getCollectionMembers(
asyncResp,
boost::urls::format(
- "/redfish/v1/Systems/system/Processors/{}/OperatingConfigs",
- cpuName),
+ "/redfish/v1/Systems/{}/Processors/{}/OperatingConfigs",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, cpuName),
interface, object);
return;
}
@@ -1192,7 +1194,7 @@ inline void requestRoutesOperatingConfig(App& app)
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -1225,8 +1227,8 @@ inline void requestRoutesOperatingConfig(App& app)
nlohmann::json& json = asyncResp->res.jsonValue;
json["@odata.type"] = "#OperatingConfig.v1_0_0.OperatingConfig";
json["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/Processors/{}/OperatingConfigs/{}",
- cpuName, configName);
+ "/redfish/v1/Systems/{}/Processors/{}/OperatingConfigs/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, cpuName, configName);
json["Name"] = "Processor Profile";
json["Id"] = configName;
@@ -1271,7 +1273,7 @@ inline void requestRoutesProcessorCollection(App& app)
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -1287,11 +1289,13 @@ inline void requestRoutesProcessorCollection(App& app)
asyncResp->res.jsonValue["Name"] = "Processor Collection";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/Processors";
+ std::format("/redfish/v1/Systems/{}/Processors",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
collection_util::getCollectionMembers(
asyncResp,
- boost::urls::url("/redfish/v1/Systems/system/Processors"),
+ boost::urls::format("/redfish/v1/Systems/{}/Processors",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME),
processorInterfaces, "/xyz/openbmc_project/inventory");
});
}
@@ -1325,7 +1329,7 @@ inline void requestRoutesProcessor(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -1337,8 +1341,9 @@ inline void requestRoutesProcessor(App& app)
"</redfish/v1/JsonSchemas/Processor/Processor.json>; rel=describedby");
asyncResp->res.jsonValue["@odata.type"] =
"#Processor.v1_18_0.Processor";
- asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/Processors/{}", processorId);
+ asyncResp->res.jsonValue["@odata.id"] =
+ boost::urls::format("/redfish/v1/Systems/{}/Processors/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, processorId);
getProcessorObject(
asyncResp, processorId,
@@ -1363,7 +1368,7 @@ inline void requestRoutesProcessor(App& app)
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
diff --git a/redfish-core/lib/service_root.hpp b/redfish-core/lib/service_root.hpp
index 2fc35150dd..fcaee98241 100644
--- a/redfish-core/lib/service_root.hpp
+++ b/redfish-core/lib/service_root.hpp
@@ -89,7 +89,8 @@ inline void handleServiceRootGetImpl(
asyncResp->res.jsonValue["Cables"]["@odata.id"] = "/redfish/v1/Cables";
asyncResp->res.jsonValue["Links"]["ManagerProvidingService"]["@odata.id"] =
- "/redfish/v1/Managers/bmc";
+ boost::urls::format("/redfish/v1/Managers/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
nlohmann::json& protocolFeatures =
asyncResp->res.jsonValue["ProtocolFeaturesSupported"];
diff --git a/redfish-core/lib/storage.hpp b/redfish-core/lib/storage.hpp
index c6141df555..adbcc8aa2b 100644
--- a/redfish-core/lib/storage.hpp
+++ b/redfish-core/lib/storage.hpp
@@ -50,7 +50,7 @@ inline void handleSystemsStorageCollectionGet(
{
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -59,14 +59,16 @@ inline void handleSystemsStorageCollectionGet(
asyncResp->res.jsonValue["@odata.type"] =
"#StorageCollection.StorageCollection";
- asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/Storage";
+ asyncResp->res.jsonValue["@odata.id"] = std::format(
+ "/redfish/v1/Systems/{}/Storage", BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["Name"] = "Storage Collection";
constexpr std::array<std::string_view, 1> interface{
"xyz.openbmc_project.Inventory.Item.Storage"};
collection_util::getCollectionMembers(
- asyncResp, boost::urls::format("/redfish/v1/Systems/system/Storage"),
+ asyncResp,
+ boost::urls::format("/redfish/v1/Systems/{}/Storage",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME),
interface, "/xyz/openbmc_project/inventory");
}
@@ -129,8 +131,8 @@ inline void afterChassisDriveCollectionSubtree(
nlohmann::json::object_t driveJson;
driveJson["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/Storage/1/Drives/{}",
- object.filename());
+ "/redfish/v1/Systems/{}/Storage/1/Drives/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, object.filename());
driveArray.emplace_back(std::move(driveJson));
}
@@ -173,14 +175,16 @@ inline void afterSystemsStorageGetSubtree(
asyncResp->res.jsonValue["@odata.type"] = "#Storage.v1_13_0.Storage";
asyncResp->res.jsonValue["@odata.id"] =
- boost::urls::format("/redfish/v1/Systems/system/Storage/{}", storageId);
+ boost::urls::format("/redfish/v1/Systems/{}/Storage/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, storageId);
asyncResp->res.jsonValue["Name"] = "Storage";
asyncResp->res.jsonValue["Id"] = storageId;
asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
getDrives(asyncResp);
- asyncResp->res.jsonValue["Controllers"]["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/Storage/{}/Controllers", storageId);
+ asyncResp->res.jsonValue["Controllers"]["@odata.id"] =
+ boost::urls::format("/redfish/v1/Systems/{}/Storage/{}/Controllers",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, storageId);
}
inline void
@@ -245,7 +249,8 @@ inline void afterSubtree(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
nlohmann::json::array_t storageServices;
nlohmann::json::object_t storageService;
storageService["@odata.id"] =
- boost::urls::format("/redfish/v1/Systems/system/Storage/{}", storageId);
+ boost::urls::format("/redfish/v1/Systems/{}/Storage/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, storageId);
storageServices.emplace_back(storageService);
asyncResp->res.jsonValue["Links"]["StorageServices"] =
std::move(storageServices);
@@ -654,8 +659,9 @@ inline void afterGetSubtreeSystemsStorageDrive(
const dbus::utility::MapperServiceMap& connectionNames = drive->second;
asyncResp->res.jsonValue["@odata.type"] = "#Drive.v1_7_0.Drive";
- asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/Storage/1/Drives/{}", driveId);
+ asyncResp->res.jsonValue["@odata.id"] =
+ boost::urls::format("/redfish/v1/Systems/{}/Storage/1/Drives/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, driveId);
asyncResp->res.jsonValue["Name"] = driveId;
asyncResp->res.jsonValue["Id"] = driveId;
@@ -698,7 +704,7 @@ inline void handleSystemsStorageDriveGet(
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -1021,8 +1027,9 @@ inline void populateStorageController(
{
asyncResp->res.jsonValue["@odata.type"] =
"#StorageController.v1_6_0.StorageController";
- asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/Storage/1/Controllers/{}", controllerId);
+ asyncResp->res.jsonValue["@odata.id"] =
+ boost::urls::format("/redfish/v1/Systems/{}/Storage/1/Controllers/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, controllerId);
asyncResp->res.jsonValue["Name"] = controllerId;
asyncResp->res.jsonValue["Id"] = controllerId;
asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
@@ -1119,7 +1126,8 @@ inline void populateStorageControllerCollection(
}
nlohmann::json::object_t member;
member["@odata.id"] = boost::urls::format(
- "/redfish/v1/Systems/system/Storage/1/Controllers/{}", id);
+ "/redfish/v1/Systems/{}/Storage/1/Controllers/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME, id);
members.emplace_back(member);
}
asyncResp->res.jsonValue["Members@odata.count"] = members.size();
@@ -1137,7 +1145,7 @@ inline void handleSystemsStorageControllerCollectionGet(
"Failed to setup Redfish Route for StorageController Collection");
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -1148,7 +1156,8 @@ inline void handleSystemsStorageControllerCollectionGet(
asyncResp->res.jsonValue["@odata.type"] =
"#StorageControllerCollection.StorageControllerCollection";
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/Storage/1/Controllers";
+ std::format("/redfish/v1/Systems/{}/Storage/1/Controllers",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["Name"] = "Storage Controller Collection";
constexpr std::array<std::string_view, 1> interfaces = {
@@ -1172,7 +1181,7 @@ inline void handleSystemsStorageControllerGet(
BMCWEB_LOG_DEBUG("Failed to setup Redfish Route for StorageController");
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index e12db494ab..6b758e7092 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -2781,7 +2781,8 @@ inline void handleComputerSystemCollectionGet(
}
asyncResp->res.jsonValue["Members@odata.count"] = 1;
nlohmann::json::object_t system;
- system["@odata.id"] = "/redfish/v1/Systems/system";
+ system["@odata.id"] = boost::urls::format("/redfish/v1/Systems/{}",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
ifaceArray.emplace_back(std::move(system));
sdbusplus::asio::getProperty<std::string>(
*crow::connections::systemBus, "xyz.openbmc_project.Settings",
@@ -2847,7 +2848,7 @@ inline void handleComputerSystemResetActionPost(
{
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3005,7 +3006,7 @@ inline void
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3016,38 +3017,44 @@ inline void
"</redfish/v1/JsonSchemas/ComputerSystem/ComputerSystem.json>; rel=describedby");
asyncResp->res.jsonValue["@odata.type"] =
"#ComputerSystem.v1_22_0.ComputerSystem";
- asyncResp->res.jsonValue["Name"] = "system";
- asyncResp->res.jsonValue["Id"] = "system";
+ asyncResp->res.jsonValue["Name"] = BMCWEB_REDFISH_SYSTEM_URI_NAME;
+ asyncResp->res.jsonValue["Id"] = BMCWEB_REDFISH_SYSTEM_URI_NAME;
asyncResp->res.jsonValue["SystemType"] = "Physical";
asyncResp->res.jsonValue["Description"] = "Computer System";
asyncResp->res.jsonValue["ProcessorSummary"]["Count"] = 0;
asyncResp->res.jsonValue["MemorySummary"]["TotalSystemMemoryGiB"] =
double(0);
- asyncResp->res.jsonValue["@odata.id"] = "/redfish/v1/Systems/system";
-
- asyncResp->res.jsonValue["Processors"]["@odata.id"] =
- "/redfish/v1/Systems/system/Processors";
- asyncResp->res.jsonValue["Memory"]["@odata.id"] =
- "/redfish/v1/Systems/system/Memory";
- asyncResp->res.jsonValue["Storage"]["@odata.id"] =
- "/redfish/v1/Systems/system/Storage";
+ asyncResp->res.jsonValue["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Systems/{}", BMCWEB_REDFISH_SYSTEM_URI_NAME);
+
+ asyncResp->res.jsonValue["Processors"]["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Systems/{}/Processors", BMCWEB_REDFISH_SYSTEM_URI_NAME);
+ asyncResp->res.jsonValue["Memory"]["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Systems/{}/Memory", BMCWEB_REDFISH_SYSTEM_URI_NAME);
+ asyncResp->res.jsonValue["Storage"]["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Systems/{}/Storage", BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["FabricAdapters"]["@odata.id"] =
- "/redfish/v1/Systems/system/FabricAdapters";
+ boost::urls::format("/redfish/v1/Systems/{}/FabricAdapters",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["Actions"]["#ComputerSystem.Reset"]["target"] =
- "/redfish/v1/Systems/system/Actions/ComputerSystem.Reset";
+ boost::urls::format(
+ "/redfish/v1/Systems/{}/Actions/ComputerSystem.Reset",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res
.jsonValue["Actions"]["#ComputerSystem.Reset"]["@Redfish.ActionInfo"] =
- "/redfish/v1/Systems/system/ResetActionInfo";
+ boost::urls::format("/redfish/v1/Systems/{}/ResetActionInfo",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
- asyncResp->res.jsonValue["LogServices"]["@odata.id"] =
- "/redfish/v1/Systems/system/LogServices";
- asyncResp->res.jsonValue["Bios"]["@odata.id"] =
- "/redfish/v1/Systems/system/Bios";
+ asyncResp->res.jsonValue["LogServices"]["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Systems/{}/LogServices", BMCWEB_REDFISH_SYSTEM_URI_NAME);
+ asyncResp->res.jsonValue["Bios"]["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Systems/{}/Bios", BMCWEB_REDFISH_SYSTEM_URI_NAME);
nlohmann::json::array_t managedBy;
nlohmann::json& manager = managedBy.emplace_back();
- manager["@odata.id"] = "/redfish/v1/Managers/bmc";
+ manager["@odata.id"] = boost::urls::format("/redfish/v1/Managers/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME);
asyncResp->res.jsonValue["Links"]["ManagedBy"] = std::move(managedBy);
asyncResp->res.jsonValue["Status"]["Health"] = "OK";
asyncResp->res.jsonValue["Status"]["State"] = "Enabled";
@@ -3123,7 +3130,7 @@ inline void handleComputerSystemPatch(
systemName);
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3379,7 +3386,7 @@ inline void handleSystemCollectionResetActionGet(
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);
@@ -3391,7 +3398,8 @@ inline void handleSystemCollectionResetActionGet(
"</redfish/v1/JsonSchemas/ActionInfo/ActionInfo.json>; rel=describedby");
asyncResp->res.jsonValue["@odata.id"] =
- "/redfish/v1/Systems/system/ResetActionInfo";
+ boost::urls::format("/redfish/v1/Systems/{}/ResetActionInfo",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
asyncResp->res.jsonValue["@odata.type"] = "#ActionInfo.v1_1_2.ActionInfo";
asyncResp->res.jsonValue["Name"] = "Reset Action Info";
asyncResp->res.jsonValue["Id"] = "ResetActionInfo";
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 81534f94de..f3a87c3370 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -771,7 +771,9 @@ inline std::optional<MultiPartUpdateParameters>
asyncResp->res, multiRet.targets, "Targets");
return std::nullopt;
}
- if (multiRet.targets[0].path() != "/redfish/v1/Managers/bmc")
+ if (multiRet.targets[0].path() !=
+ std::format("/redfish/v1/Managers/{}",
+ BMCWEB_REDFISH_MANAGER_URI_NAME))
{
messages::propertyValueNotInList(
asyncResp->res, multiRet.targets[0], "Targets/0");
@@ -998,7 +1000,8 @@ inline void getRelatedItems(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
{
nlohmann::json& relatedItem = asyncResp->res.jsonValue["RelatedItem"];
nlohmann::json::object_t item;
- item["@odata.id"] = "/redfish/v1/Managers/bmc";
+ item["@odata.id"] = boost::urls::format(
+ "/redfish/v1/Managers/{}", BMCWEB_REDFISH_MANAGER_URI_NAME);
relatedItem.emplace_back(std::move(item));
asyncResp->res.jsonValue["RelatedItem@odata.count"] =
relatedItem.size();
@@ -1007,7 +1010,8 @@ inline void getRelatedItems(const std::shared_ptr<bmcweb::AsyncResp>& asyncResp,
{
nlohmann::json& relatedItem = asyncResp->res.jsonValue["RelatedItem"];
nlohmann::json::object_t item;
- item["@odata.id"] = "/redfish/v1/Systems/system/Bios";
+ item["@odata.id"] = std::format("/redfish/v1/Systems/{}/Bios",
+ BMCWEB_REDFISH_SYSTEM_URI_NAME);
relatedItem.emplace_back(std::move(item));
asyncResp->res.jsonValue["RelatedItem@odata.count"] =
relatedItem.size();