Trigger all FRU VPD collection from wait-vpd-parser

This commit updates wait-vpd-parser to trigger FRU VPD collection.
As part of PST VPD collection flow, FRU VPD collection needs to be
triggered as a part of systemd target, instead of being triggered
internally by vpd-manager. wait-vpd-parser service is triggered by
systemd and then it uses vpd-manager's CollectAllFruVpd Dbus API to
trigger FRU VPD collection.

Test:
```
- Patch wait-vpd-parser executable and wait-vpd-parsers.service into
  rainiest simics
- Restart wait-vpd-parsers.service
- Observe FRU VPD collection is triggered
- While FRU VPD collection is in progress, observe
  wait-vpd-parsers.service goes into retry loop and checks VPD
  CollectionStatus
- Once FRU VPD collection is successful, observe
  wait-vpd-parsers.service exits with code 0
```

Change-Id: I6aa5bc302429265faa0563d5e646c3bebd2fc38b
Signed-off-by: Souvik Roy <souvikroyofficial10@gmail.com>
diff --git a/wait-vpd-parser/src/wait_vpd_parser.cpp b/wait-vpd-parser/src/wait_vpd_parser.cpp
index 2a18b9d..44f1da3 100644
--- a/wait-vpd-parser/src/wait_vpd_parser.cpp
+++ b/wait-vpd-parser/src/wait_vpd_parser.cpp
@@ -72,6 +72,36 @@
     return vpd::constants::VALUE_1;
 }
 
+/**
+ * @brief API to trigger VPD collection for all FRUs.
+ *
+ * This API triggers VPD collection for all FRUs by calling Dbus API
+ * "CollectAllFRUVPD" exposed by vpd-manager
+ *
+ * @return - On success returns true, otherwise returns false
+ */
+inline bool collectAllFruVpd() noexcept
+{
+    bool l_rc{true};
+    try
+    {
+        auto l_bus = sdbusplus::bus::new_default();
+        auto l_method =
+            l_bus.new_method_call(IFACE, OBJPATH, IFACE, "CollectAllFRUVPD");
+
+        l_bus.call_noreply(l_method);
+    }
+    catch (const std::exception& l_ex)
+    {
+        auto l_logger = vpd::Logger::getLoggerInstance();
+        l_logger->logMessage(
+            "Failed to trigger all FRU VPD collection. Error: " +
+            std::string(l_ex.what()));
+        l_rc = false;
+    }
+    return l_rc;
+}
+
 int main(int argc, char** argv)
 {
     CLI::App l_app{"Wait VPD parser app"};
@@ -86,5 +116,8 @@
 
     CLI11_PARSE(l_app, argc, argv);
 
-    return checkVpdCollectionStatus(l_retryLimit, l_sleepDurationInSeconds);
+    return collectAllFruVpd()
+               ? checkVpdCollectionStatus(l_retryLimit,
+                                          l_sleepDurationInSeconds)
+               : vpd::constants::VALUE_1;
 }