summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--redfish-core/include/utils/fw_utils.hpp61
-rw-r--r--redfish-core/lib/update_service.hpp4
2 files changed, 58 insertions, 7 deletions
diff --git a/redfish-core/include/utils/fw_utils.hpp b/redfish-core/include/utils/fw_utils.hpp
index 2f14358..653b067 100644
--- a/redfish-core/include/utils/fw_utils.hpp
+++ b/redfish-core/include/utils/fw_utils.hpp
@@ -202,13 +202,13 @@ std::string getRedfishFWState(const std::string &fwState)
{
return "Enabled";
}
- else if (fwState ==
- "xyz.openbmc_project.Software.Activation.Activations.Activating")
+ else if (fwState == "xyz.openbmc_project.Software.Activation."
+ "Activations.Activating")
{
return "Updating";
}
- else if (fwState ==
- "xyz.openbmc_project.Software.Activation.Activations.StandbySpare")
+ else if (fwState == "xyz.openbmc_project.Software.Activation."
+ "Activations.StandbySpare")
{
return "StandbySpare";
}
@@ -232,8 +232,8 @@ 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."
+ "Activating") ||
(fwState ==
"xyz.openbmc_project.Software.Activation.Activations.Ready"))
{
@@ -302,5 +302,54 @@ void getFwStatus(std::shared_ptr<AsyncResp> asyncResp,
"org.freedesktop.DBus.Properties", "GetAll",
"xyz.openbmc_project.Software.Activation");
}
+
+/**
+ * @brief Updates programmable status of input swId into json response
+ *
+ * This function checks whether firmware inventory component
+ * can be programable or not and fill's the "Updateable"
+ * Property.
+ *
+ * @param[i,o] asyncResp Async response object
+ * @param[i] fwId The firmware ID
+ */
+void getFwUpdateableStatus(std::shared_ptr<AsyncResp> asyncResp,
+ const std::shared_ptr<std::string> fwId)
+{
+ crow::connections::systemBus->async_method_call(
+ [asyncResp, fwId](const boost::system::error_code ec,
+ const std::variant<std::vector<std::string>> &resp) {
+ if (ec)
+ {
+ BMCWEB_LOG_DEBUG << __FUNCTION__ << " error_code = " << ec
+ << " error msg = " << ec.message();
+ // System can exist with no updateable firmware,
+ // so don't throw error here.
+ return;
+ }
+ const std::vector<std::string> *objPaths =
+ std::get_if<std::vector<std::string>>(&resp);
+ if (objPaths)
+ {
+ std::string reqFwObjPath =
+ "/xyz/openbmc_project/software/" + *fwId;
+
+ if (std::find((*objPaths).begin(), (*objPaths).end(),
+ reqFwObjPath) != (*objPaths).end())
+ {
+ asyncResp->res.jsonValue["Updateable"] = true;
+ return;
+ }
+ }
+ return;
+ },
+ "xyz.openbmc_project.ObjectMapper",
+ "/xyz/openbmc_project/software/updateable",
+ "org.freedesktop.DBus.Properties", "Get",
+ "xyz.openbmc_project.Association", "endpoints");
+
+ return;
+}
+
} // namespace fw_util
} // namespace redfish
diff --git a/redfish-core/lib/update_service.hpp b/redfish-core/lib/update_service.hpp
index ec9600e..048430d 100644
--- a/redfish-core/lib/update_service.hpp
+++ b/redfish-core/lib/update_service.hpp
@@ -775,8 +775,10 @@ class SoftwareInventory : public Node
asyncResp->res.jsonValue["@odata.context"] =
"/redfish/v1/$metadata#SoftwareInventory.SoftwareInventory";
asyncResp->res.jsonValue["Name"] = "Software Inventory";
- asyncResp->res.jsonValue["Updateable"] = false;
asyncResp->res.jsonValue["Status"]["HealthRollup"] = "OK";
+
+ asyncResp->res.jsonValue["Updateable"] = false;
+ fw_util::getFwUpdateableStatus(asyncResp, swId);
},
"xyz.openbmc_project.ObjectMapper",
"/xyz/openbmc_project/object_mapper",
OpenPOWER on IntegriCloud