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>
diff --git a/redfish-core/lib/bios.hpp b/redfish-core/lib/bios.hpp
index 477c15e..a0e440b 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 @@
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 @@
return;
}
- if (systemName != "system")
+ if (systemName != BMCWEB_REDFISH_SYSTEM_URI_NAME)
{
messages::resourceNotFound(asyncResp->res, "ComputerSystem",
systemName);