summaryrefslogtreecommitdiff
path: root/redfish-core/lib/aggregation_service.hpp
diff options
context:
space:
mode:
authorCarson Labrado <clabrado@google.com>2023-02-18 04:02:18 +0300
committerCarson Labrado <clabrado@google.com>2023-03-14 03:45:03 +0300
commit5315c1b149b724d0395f42ca75d4660aaecdf351 (patch)
tree8febdc0704eed0d1710d9ceeba3f44d46b7e797d /redfish-core/lib/aggregation_service.hpp
parenta90323367863533ae3456ed2ee1baa705439eea9 (diff)
downloadbmcweb-5315c1b149b724d0395f42ca75d4660aaecdf351.tar.xz
Implement AggregationSourceCollection
This is an intermediate step in setting up aggregation sources. A future patch will add aggregation sources based on the existence of satellite configs. For now the collection will always return as 0 members. Adds the AggregationSourceCollection schema which we previously ignored. Tested: Service Validator passes Signed-off-by: Carson Labrado <clabrado@google.com> Change-Id: I65c9231289bf0a9b6392696d55bc3feb0023c694
Diffstat (limited to 'redfish-core/lib/aggregation_service.hpp')
-rw-r--r--redfish-core/lib/aggregation_service.hpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/redfish-core/lib/aggregation_service.hpp b/redfish-core/lib/aggregation_service.hpp
index e03047aac4..f0eb651dc2 100644
--- a/redfish-core/lib/aggregation_service.hpp
+++ b/redfish-core/lib/aggregation_service.hpp
@@ -46,6 +46,8 @@ inline void handleAggregationServiceGet(
json["Name"] = "Aggregation Service";
json["Description"] = "Aggregation Service";
json["ServiceEnabled"] = true;
+ json["AggregationSources"]["@odata.id"] =
+ "/redfish/v1/AggregationService/AggregationSources";
}
inline void requestAggregationServiceRoutes(App& app)
@@ -60,4 +62,34 @@ inline void requestAggregationServiceRoutes(App& app)
std::bind_front(handleAggregationServiceGet, std::ref(app)));
}
+inline void handleAggregationSourcesGet(
+ App& app, const crow::Request& req,
+ const std::shared_ptr<bmcweb::AsyncResp>& asyncResp)
+{
+ if (!redfish::setUpRedfishRoute(app, req, asyncResp))
+ {
+ return;
+ }
+ asyncResp->res.addHeader(
+ boost::beast::http::field::link,
+ "</redfish/v1/JsonSchemas/AggregationSourceCollection/AggregationSourceCollection.json>; rel=describedby");
+ nlohmann::json& json = asyncResp->res.jsonValue;
+ json["@odata.id"] = "/redfish/v1/AggregationService/AggregationSources";
+ json["@odata.type"] =
+ "#AggregationSourceCollection.AggregationSourceCollection";
+ json["Name"] = "Aggregation Source Collection";
+ json["Members"] = nlohmann::json::array();
+ json["Members@odata.count"] = 0;
+
+ // TODO: Query D-Bus for satellite configs and add them to the Members array
+}
+
+inline void requestAggregationSourcesRoutes(App& app)
+{
+ BMCWEB_ROUTE(app, "/redfish/v1/AggregationService/AggregationSources/")
+ .privileges(redfish::privileges::getAggregationService)
+ .methods(boost::beast::http::verb::get)(
+ std::bind_front(handleAggregationSourcesGet, std::ref(app)));
+}
+
} // namespace redfish