Health / Rollup Support
Look for associations for inventory and compare the
inventory warning / critical and global warning / critical
to get HealthRollup and Health respectively.
Tested:
Used sensor override to set BMC temp to Upper critical
and saw:
{
"@odata.context": "/redfish/v1/$metadata#Chassis.Chassis",
"@odata.id": "/redfish/v1/Chassis/WFP_Baseboard",
"@odata.type": "#Chassis.v1_4_0.Chassis",
"ChassisType": "RackMount",
"Id": "WFP_Baseboard",
"Links": {
"ComputerSystems": [
{
"@odata.id": "/redfish/v1/Systems/system"
}
],
"ManagedBy": [
{
"@odata.id": "/redfish/v1/Managers/bmc"
}
]
},
"Manufacturer": "Intel Corporation",
"Model": "S2600WFT",
"Name": "WFP_Baseboard",
"PartNumber": "123456789",
"Power": {
"@odata.id": "/redfish/v1/Chassis/WFP_Baseboard/Power"
},
"PowerState": "Off",
"SerialNumber": "123454321",
"Status": {
"Health": "Warning",
"HealthRollup": "Critical",
"State": "StandbyOffline"
},
"Thermal": {
"@odata.id": "/redfish/v1/Chassis/WFP_Baseboard/Thermal"
}
}
Change-Id: Idd9e832db18bb4769f1452fe243d68339a6f844d
Signed-off-by: James Feist <james.feist@linux.intel.com>
diff --git a/redfish-core/lib/systems.hpp b/redfish-core/lib/systems.hpp
index 6ea5f2e..f28ab92 100644
--- a/redfish-core/lib/systems.hpp
+++ b/redfish-core/lib/systems.hpp
@@ -15,6 +15,7 @@
*/
#pragma once
+#include "health.hpp"
#include "redfish_util.hpp"
#include <boost/container/flat_map.hpp>
@@ -1215,6 +1216,29 @@
};
auto asyncResp = std::make_shared<AsyncResp>(res);
+ constexpr const std::array<const char *, 2> inventoryForSystems = {
+ "xyz.openbmc_project.Inventory.Item.Dimm",
+ "xyz.openbmc_project.Inventory.Item.Cpu"};
+
+ auto health = std::make_shared<HealthPopulate>(asyncResp);
+ crow::connections::systemBus->async_method_call(
+ [health](const boost::system::error_code ec,
+ std::vector<std::string> &resp) {
+ if (ec)
+ {
+ // no inventory
+ return;
+ }
+
+ health->inventory = std::move(resp);
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/object_mapper",
+ "xyz.openbmc_project.ObjectMapper", "GetSubTreePaths", "/",
+ int32_t(0), inventoryForSystems);
+
+ health->populate();
+
getMainChassisId(asyncResp, [](const std::string &chassisId,
std::shared_ptr<AsyncResp> aRsp) {
aRsp->res.jsonValue["Links"]["Chassis"] = {