Add BMCWEB_ENABLE_REDFISH_ONE_CHASSIS build option
Define a new build option named BMCWEB_ENABLE_REDFISH_ONE_CHASSIS that
is not set by default.
When this build option is set, bmcweb will always return a single
chassis named "chassis".
Setting this option will also cause all sensors to be shown under this
chassis.
This is a short-term solution. Long term, inventory-manager needs to be
enhanced to allow sensors to be under a chassis, or the rest of the
project needs to move to EntityManager.
Currently IBM does not use EntityManager, but EntityManager is called
directly in sensors.hpp. This results in an HTTP 500 Internal Server
Error.
Tested: The URLs /redfish/v1/Chassis/ and /redfish/v1/Chassis/chassis
show correct data on a Witherspoon. /redfish/v1/Managers/bmc/
now has a link to the single chassis.
/redfish/v1/Chassis/chassis/Power and
/redfish/v1/Chassis/chassis/Thermal no longer result in an
HTTP 500 Internal Server Error. Ran Redfish Service Validator.
Change-Id: Iec8f4da333946f19330f37ab084cd9787c52c8ea
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
diff --git a/redfish-core/lib/managers.hpp b/redfish-core/lib/managers.hpp
index 936d655..f9c2f38 100644
--- a/redfish-core/lib/managers.hpp
+++ b/redfish-core/lib/managers.hpp
@@ -968,11 +968,14 @@
"GracefulRestart"};
res.jsonValue["DateTime"] = getDateTime();
- res.jsonValue["Links"] = {
- {"ManagerForServers@odata.count", 1},
- {"ManagerForServers",
- {{{"@odata.id", "/redfish/v1/Systems/system"}}}},
- {"ManagerForServers", nlohmann::json::array()}};
+ res.jsonValue["Links"]["ManagerForServers@odata.count"] = 1;
+ res.jsonValue["Links"]["ManagerForServers"] = {
+ {{"@odata.id", "/redfish/v1/Systems/system"}}};
+#ifdef BMCWEB_ENABLE_REDFISH_ONE_CHASSIS
+ res.jsonValue["Links"]["ManagerForChassis@odata.count"] = 1;
+ res.jsonValue["Links"]["ManagerForChassis"] = {
+ {{"@odata.id", "/redfish/v1/Chassis/chassis"}}};
+#endif
std::shared_ptr<AsyncResp> asyncResp = std::make_shared<AsyncResp>(res);
crow::connections::systemBus->async_method_call(