Update vpd-tool forceReset command

The vpd-tool application is updated so that the forceReset command
triggers collection of all FRUs VPD through the wait-vpd-parsers
service, since Prime system inventory and CollectAllFRUVPD are now
handled there.

The system inventory JSON symbolic link is removed so that the assetTag
property on D-Bus can be recreated when vpd-manager restarts.

Change-Id: Ia4e55cffb9f77445ad1dc5571ffbd15165ebb9dd
Signed-off-by: Anupama B R <anupama.b.r1@ibm.com>
diff --git a/vpd-tool/src/vpd_tool.cpp b/vpd-tool/src/vpd_tool.cpp
index 0c6c434..bef2825 100644
--- a/vpd-tool/src/vpd_tool.cpp
+++ b/vpd-tool/src/vpd_tool.cpp
@@ -1366,6 +1366,35 @@
         }
 
         std::error_code l_ec;
+        if (std::filesystem::exists(INVENTORY_JSON_SYM_LINK, l_ec) &&
+            !std::filesystem::remove(INVENTORY_JSON_SYM_LINK, l_ec))
+        {
+            std::cerr
+                << "Error occured while removing the system inventory JSON sym link ["
+                << INVENTORY_JSON_SYM_LINK << "]." << std::endl;
+
+            if (l_ec)
+            {
+                std::cerr << "Reason: " << l_ec.message() << std::endl;
+            }
+
+            std::string l_vpdManagerStartCmd(
+                "systemctl start " +
+                std::string(constants::vpdManagerProcessName));
+
+            std::cout << std::flush;
+            if (auto l_rc = std::system(l_vpdManagerStartCmd.c_str());
+                l_rc != 0)
+            {
+                std::cerr << "Failed to start "
+                          << constants::vpdManagerProcessName
+                          << " service. Return code [" << l_rc << "]. Exiting."
+                          << std::endl
+                          << "Reboot BMC to recover the system." << std::endl;
+            }
+            return l_rc;
+        }
+
         if (static_cast<std::uintmax_t>(-1) ==
             std::filesystem::remove_all(constants::pimPersistPath, l_ec))
         {
@@ -1434,6 +1463,21 @@
             return l_rc;
         }
 
+        std::string l_waitVpdParserStartCmd(
+            "systemctl restart " +
+            std::string(constants::waitVpdParserProcessName));
+
+        std::cout << std::flush;
+        if (auto l_rc = std::system(l_waitVpdParserStartCmd.c_str()); l_rc != 0)
+        {
+            std::cerr << "Failed to start "
+                      << constants::waitVpdParserProcessName
+                      << " service. Return code [" << l_rc << "]. Exiting."
+                      << std::endl
+                      << "Reboot BMC to recover the system." << std::endl;
+            return l_rc;
+        }
+
         l_rc = constants::SUCCESS;
     }
     catch (const std::exception& l_ex)