redfish-core: Unify fan routing
This change unifies fan collection and fan property get route setup.
Change-Id: Ib09a3b7b667ee551df74f2483babf4d0526e26dd
Signed-off-by: Christopher Meis <christopher.meis@9elements.com>
diff --git a/redfish-core/lib/fan.hpp b/redfish-core/lib/fan.hpp
index 9319dfa..40368e7 100644
--- a/redfish-core/lib/fan.hpp
+++ b/redfish-core/lib/fan.hpp
@@ -162,19 +162,6 @@
std::bind_front(doFanCollection, asyncResp, chassisId));
}
-inline void requestRoutesFanCollection(App& app)
-{
- BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/ThermalSubsystem/Fans/")
- .privileges(redfish::privileges::headFanCollection)
- .methods(boost::beast::http::verb::head)(
- std::bind_front(handleFanCollectionHead, std::ref(app)));
-
- BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/ThermalSubsystem/Fans/")
- .privileges(redfish::privileges::getFanCollection)
- .methods(boost::beast::http::verb::get)(
- std::bind_front(handleFanCollectionGet, std::ref(app)));
-}
-
inline bool checkFanId(const std::string& fanPath, const std::string& fanId)
{
std::string fanName = sdbusplus::message::object_path(fanPath).filename();
@@ -463,6 +450,16 @@
inline void requestRoutesFan(App& app)
{
+ BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/ThermalSubsystem/Fans/")
+ .privileges(redfish::privileges::headFanCollection)
+ .methods(boost::beast::http::verb::head)(
+ std::bind_front(handleFanCollectionHead, std::ref(app)));
+
+ BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/ThermalSubsystem/Fans/")
+ .privileges(redfish::privileges::getFanCollection)
+ .methods(boost::beast::http::verb::get)(
+ std::bind_front(handleFanCollectionGet, std::ref(app)));
+
BMCWEB_ROUTE(app, "/redfish/v1/Chassis/<str>/ThermalSubsystem/Fans/<str>/")
.privileges(redfish::privileges::headFan)
.methods(boost::beast::http::verb::head)(
diff --git a/redfish-core/src/redfish.cpp b/redfish-core/src/redfish.cpp
index a2801f1..3eac59d 100644
--- a/redfish-core/src/redfish.cpp
+++ b/redfish-core/src/redfish.cpp
@@ -95,7 +95,6 @@
requestRoutesThermalMetrics(app);
requestRoutesThermalSubsystem(app);
requestRoutesFan(app);
- requestRoutesFanCollection(app);
}
requestRoutesManager(app);
requestRoutesManagerResetAction(app);