summaryrefslogtreecommitdiff
path: root/http/http_response.hpp
diff options
context:
space:
mode:
authorCarson Labrado <clabrado@google.com>2022-04-28 00:11:37 +0300
committerEd Tanous <edtanous@google.com>2022-08-24 00:47:32 +0300
commit46a81465f991637341b0a877b3a027db58a3d330 (patch)
tree7103d9e940ec1ade36f5c89dcc314579fae64302 /http/http_response.hpp
parent05916cef0fce4dd2532e1e7e33f6abc4dcf339be (diff)
downloadbmcweb-46a81465f991637341b0a877b3a027db58a3d330.tar.xz
Redfish Aggregation: Router to satellite resources
Adds ability to route requests to either native resources or resources that belong to a satellite BMC as part of Redfish Aggregation. A prefix in the URI denotes if the resource is actually from a satellite BMC. Prefixes are only used to denote satellite resources. The URI of resources on the local/aggregating BMC will remain unchanged. Prefixes are separated from the resource ID by an underscore. This means that underscores cannot be used in the prefix name itself. The prefixes used by satellite BMCs are revealed via D-Bus as well as the config information needed to connect to that BMC. Requests for satellite resources will not be handled locally. Care should be taken to not name any local resources in a way that could cause a collision (e.g. having a Chassis object named "aggregated0_1U" on the aggregating BMC). The patch only covers routing requests. Requests to collection URIs like /redfish/v1/Chassis will only return resources on the local BMC. A future patch will cover adding satellite resources to collections. Also note that URIs returned in the responses will not have the proper prefix included. Fixing these URIs will be addressed in future patches. A number of TODO comments are included in the code to indicate that this functionality (collections and URI fixup) still needs to be implemented. Example URIs w/o Redfish Aggregation: /redfish/v1/Chassis/1U/ /redfish/v1/Systems/system/ /redfish/v1/Managers/bmc/ Example URIs after enabling Redfish Aggregation if the associated resources are located on the local/aggregating BMC: /redfish/v1/Chassis/1U/ /redfish/v1/Systems/system/ /redfish/v1/Managers/bmc/ Example URIs if resources are instead located on a satellite BMC named "aggregated0": /redfish/v1/Chassis/aggregated0_1U/ /redfish/v1/Systems/aggregated0_system/ /redfish/v1/Managers/aggregated0_bmc/ Tested: I was able to query supported resources located on the local BMC as well as on a satellite BMC. Requests with unknown prefixes return a 404. Requests to resource collections only return the resources that are located on the aggregating BMC. Signed-off-by: Carson Labrado <clabrado@google.com> Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I87a3deb730bda95e72ecd3144ea40b0e5ee7d491
Diffstat (limited to 'http/http_response.hpp')
-rw-r--r--http/http_response.hpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/http/http_response.hpp b/http/http_response.hpp
index 38bebb5c8a..dd1f37aea2 100644
--- a/http/http_response.hpp
+++ b/http/http_response.hpp
@@ -122,6 +122,11 @@ struct Response
return stringResponse->body();
}
+ std::string_view getHeaderValue(std::string_view key) const
+ {
+ return stringResponse->base()[key];
+ }
+
void keepAlive(bool k)
{
stringResponse->keep_alive(k);