summaryrefslogtreecommitdiff
path: root/redfish-core
diff options
context:
space:
mode:
Diffstat (limited to 'redfish-core')
-rw-r--r--redfish-core/include/utils/fw_utils.hpp29
-rw-r--r--redfish-core/lib/update_service.hpp1
2 files changed, 29 insertions, 1 deletions
diff --git a/redfish-core/include/utils/fw_utils.hpp b/redfish-core/include/utils/fw_utils.hpp
index 7043291429..2f1435836e 100644
--- a/redfish-core/include/utils/fw_utils.hpp
+++ b/redfish-core/include/utils/fw_utils.hpp
@@ -220,6 +220,33 @@ std::string getRedfishFWState(const std::string &fwState)
}
/**
+ * @brief Translate input fwState to Redfish health state
+ *
+ * This function will return the corresponding Redfish health state
+ *
+ * @param[i] fwState The OpenBMC firmware state
+ *
+ * @return The corresponding Redfish health state
+ */
+std::string getRedfishFWHealth(const std::string &fwState)
+{
+ if ((fwState ==
+ "xyz.openbmc_project.Software.Activation.Activations.Active") ||
+ (fwState ==
+ "xyz.openbmc_project.Software.Activation.Activations.Activating") ||
+ (fwState ==
+ "xyz.openbmc_project.Software.Activation.Activations.Ready"))
+ {
+ return "OK";
+ }
+ else
+ {
+ BMCWEB_LOG_DEBUG << "FW state " << fwState << " to Warning";
+ return "Warning";
+ }
+}
+
+/**
* @brief Put status of input swId into json response
*
* This function will put the appropriate Redfish state of the input
@@ -268,6 +295,8 @@ void getFwStatus(std::shared_ptr<AsyncResp> asyncResp,
BMCWEB_LOG_DEBUG << "getFwStatus: Activation " << *swInvActivation;
asyncResp->res.jsonValue["Status"]["State"] =
getRedfishFWState(*swInvActivation);
+ asyncResp->res.jsonValue["Status"]["Health"] =
+ getRedfishFWHealth(*swInvActivation);
},
dbusSvc, "/xyz/openbmc_project/software/" + *swId,
"org.freedesktop.DBus.Properties", "GetAll",
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index 57dcc0705d..e3f5df77c0 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -772,7 +772,6 @@ class SoftwareInventory : public Node
"/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory";
asyncResp->res.jsonValue["Name"] = "Software Inventory";
asyncResp->res.jsonValue["Updateable"] = false;
- asyncResp->res.jsonValue["Status"]["Health"] = "OK";
asyncResp->res.jsonValue["Status"]["HealthRollup"] = "OK";
},
"xyz.openbmc_project.ObjectMapper",