diff options
author | Lakshmi Yadlapati <lakshmiy@us.ibm.com> | 2023-01-28 02:53:18 +0300 |
---|---|---|
committer | Lakshmi Yadlapati <lakshmiy@us.ibm.com> | 2023-02-16 20:08:57 +0300 |
commit | 7da847b63120150b4fd0538306b37bc32645e0b3 (patch) | |
tree | 9a8270038efba61ab1a666d657dff63cb0584e22 /redfish-core/lib/fabric_adapters.hpp | |
parent | cd7af44f12a56813a464b77828502138ed3eacf2 (diff) | |
download | bmcweb-7da847b63120150b4fd0538306b37bc32645e0b3.tar.xz |
Add Health information for FabricAdapter
This commit is to add health information according to the Redfish
FabricAdapter schema. If the
`xyz.openbmc_project.State.Decorator.OperationalStatus` interface does
not exist, the health information property is not displayed.
ref: http://redfish.dmtf.org/schemas/v1/FabricAdapter.v1_4_0.json
Tested: Validator passes #
```
curl -k https://$bmc/redfish/v1/Systems/system/FabricAdapters/disk_backplane0
{
"@odata.id": "/redfish/v1/Systems/system/FabricAdapters/disk_backplane0",
"@odata.type": "#FabricAdapter.v1_4_0.FabricAdapter",
"Id": "disk_backplane0",
"Location": {
"PartLocation": {
"ServiceLabel": "U78DA.ND0.WZS0042-P1"
}
},
"Model": "6B89",
"Name": "Fabric Adapter",
"PartNumber": "02WG682",
"SerialNumber": "YA31UF09P002",
"SparePartNumber": "02WG681",
"Status": {
"Health": "OK",
"State": "Enabled"
}
}
```
Change-Id: I1fc4549fbac37189e29ba5e49137634b14a08a36
Signed-off-by: Lakshmi Yadlapati <lakshmiy@us.ibm.com>
Diffstat (limited to 'redfish-core/lib/fabric_adapters.hpp')
-rw-r--r-- | redfish-core/lib/fabric_adapters.hpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/redfish-core/lib/fabric_adapters.hpp b/redfish-core/lib/fabric_adapters.hpp index ba52e679c3..768a2f735f 100644 --- a/redfish-core/lib/fabric_adapters.hpp +++ b/redfish-core/lib/fabric_adapters.hpp @@ -144,6 +144,32 @@ inline void }); } +inline void + getFabricAdapterHealth(const std::shared_ptr<bmcweb::AsyncResp>& aResp, + const std::string& serviceName, + const std::string& fabricAdapterPath) +{ + sdbusplus::asio::getProperty<bool>( + *crow::connections::systemBus, serviceName, fabricAdapterPath, + "xyz.openbmc_project.State.Decorator.OperationalStatus", "Functional", + [aResp](const boost::system::error_code ec, const bool functional) { + if (ec) + { + if (ec.value() != EBADR) + { + BMCWEB_LOG_ERROR << "DBUS response error for Health"; + messages::internalError(aResp->res); + } + return; + } + + if (!functional) + { + aResp->res.jsonValue["Status"]["Health"] = "Critical"; + } + }); +} + inline void doAdapterGet(const std::shared_ptr<bmcweb::AsyncResp>& aResp, const std::string& systemName, const std::string& adapterId, @@ -160,10 +186,12 @@ inline void doAdapterGet(const std::shared_ptr<bmcweb::AsyncResp>& aResp, "redfish", "v1", "Systems", systemName, "FabricAdapters", adapterId); aResp->res.jsonValue["Status"]["State"] = "Enabled"; + aResp->res.jsonValue["Status"]["Health"] = "OK"; getFabricAdapterLocation(aResp, serviceName, fabricAdapterPath); getFabricAdapterAsset(aResp, serviceName, fabricAdapterPath); getFabricAdapterState(aResp, serviceName, fabricAdapterPath); + getFabricAdapterHealth(aResp, serviceName, fabricAdapterPath); } inline bool checkFabricAdapterId(const std::string& adapterPath, |