Collect all FRUs VPD Dbus method in vpd-manager
This commit adds code to expose new dbus method CollectAllFRUVPD under
vpd-manager service for VPD collection for all the FRUs present in the
system config JSON.
Change-Id: I393ffc15d684d6a0934d12a7f4bc1e23fdda054d
Signed-off-by: Anupama B R <anupama.b.r1@ibm.com>
diff --git a/vpd-manager/oem-handler/ibm_handler.cpp b/vpd-manager/oem-handler/ibm_handler.cpp
index 60b0ee8..277b499 100644
--- a/vpd-manager/oem-handler/ibm_handler.cpp
+++ b/vpd-manager/oem-handler/ibm_handler.cpp
@@ -532,4 +532,12 @@
// required.
return true;
}
+
+void IbmHandler::collectAllFruVpd()
+{
+ // Setting status to "InProgress", before trigeering VPD collection.
+ m_interface->set_property("CollectionStatus", std::string("InProgress"));
+ m_worker->collectFrusFromJson();
+ SetTimerToDetectVpdCollectionStatus();
+}
} // namespace vpd
diff --git a/vpd-manager/oem-handler/ibm_handler.hpp b/vpd-manager/oem-handler/ibm_handler.hpp
index 68f021a..74429a2 100644
--- a/vpd-manager/oem-handler/ibm_handler.hpp
+++ b/vpd-manager/oem-handler/ibm_handler.hpp
@@ -44,6 +44,22 @@
const std::shared_ptr<boost::asio::io_context>& i_ioCon,
const std::shared_ptr<sdbusplus::asio::connection>& i_asioConnection);
+ /**
+ * @brief API to collect all FRUs VPD.
+ *
+ * This api will call worker API to perform VPD collection for all FRUs
+ * present in the system config JSON and publish it on DBus. Also updates
+ * the Dbus VPD collection status property hosted under vpd-manager.
+ *
+ * Note:
+ * System VPD collection will always be skipped.
+ * If host is in power on state, FRUs marked as 'powerOffOnly' in the
+ * system config JSON will be skipped.
+ *
+ * @throw JsonException, runtime_error
+ */
+ void collectAllFruVpd();
+
private:
/**
* @brief API to set timer to detect system VPD over D-Bus.