summaryrefslogtreecommitdiff
path: root/redfish-core/lib/chassis.hpp
diff options
context:
space:
mode:
authorJames Feist <james.feist@linux.intel.com>2019-05-22 01:12:01 +0300
committerJames Feist <james.feist@linux.intel.com>2019-06-27 00:48:44 +0300
commitb49ac87376278d6085c1d10815672c321a484f35 (patch)
treeedce08ece1df38441fb8446723bd01be3d8307d1 /redfish-core/lib/chassis.hpp
parent02e92e32eea6624520f07da928fad109528dbed5 (diff)
downloadbmcweb-b49ac87376278d6085c1d10815672c321a484f35.tar.xz
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>
Diffstat (limited to 'redfish-core/lib/chassis.hpp')
-rw-r--r--redfish-core/lib/chassis.hpp26
1 files changed, 25 insertions, 1 deletions
diff --git a/redfish-core/lib/chassis.hpp b/redfish-core/lib/chassis.hpp
index ae3201a444..4426402c1f 100644
--- a/redfish-core/lib/chassis.hpp
+++ b/redfish-core/lib/chassis.hpp
@@ -15,6 +15,7 @@
*/
#pragma once
+#include "health.hpp"
#include "node.hpp"
#include <boost/container/flat_map.hpp>
@@ -291,6 +292,30 @@ class Chassis : public Node
continue;
}
+ auto health = std::make_shared<HealthPopulate>(asyncResp);
+
+ crow::connections::systemBus->async_method_call(
+ [health](const boost::system::error_code ec,
+ std::variant<std::vector<std::string>> &resp) {
+ if (ec)
+ {
+ return; // no sensors = no failures
+ }
+ std::vector<std::string> *data =
+ std::get_if<std::vector<std::string>>(&resp);
+ if (data == nullptr)
+ {
+ return;
+ }
+ health->inventory = std::move(*data);
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ path + "/all_sensors",
+ "org.freedesktop.DBus.Properties", "Get",
+ "xyz.openbmc_project.Association", "endpoints");
+
+ health->populate();
+
if (connectionNames.size() < 1)
{
BMCWEB_LOG_ERROR << "Only got "
@@ -347,7 +372,6 @@ class Chassis : public Node
{"@odata.id", "/redfish/v1/Chassis/" +
chassisId + "/Power"}};
asyncResp->res.jsonValue["Status"] = {
- {"Health", "OK"},
{"State", "Enabled"},
};