vpd-tool force reset command

This commit implements ‘force reset’ user option in vpd-tool. Command
clears the BMC persisted data and recollects the VPD for all the FRUs
mentioned in system config JSON.

Command will only be processed if chassis is powered off.

stub API is added in VpdTool class to implement this command.

Output:
```
root@p10bmc:/tmp# obmcutil state
CurrentBMCState     : xyz.openbmc_project.State.BMC.BMCState.Ready
CurrentPowerState   : xyz.openbmc_project.State.Chassis.PowerState.On
CurrentHostState    : xyz.openbmc_project.State.Host.HostState.Running
BootProgress        : xyz.openbmc_project.State.Boot.Progress.ProgressStages.MemoryInit
OperatingSystemState: xyz.openbmc_project.State.OperatingSystem.Status.OSStatus.Inactive

When chassis is powered on, force reset command will fail:
root@p10bmc:/tmp# ./vpd-tool -f
The chassis power state is not Off. Force reset operation is not allowed.
```

Change-Id: I58ed0f11cf182d718ae957c4fbe803dc24f83d09
Signed-off-by: Anupama B R <anupama.b.r1@ibm.com>
diff --git a/vpd-tool/include/tool_utils.hpp b/vpd-tool/include/tool_utils.hpp
index 598cdd2..97359c9 100644
--- a/vpd-tool/include/tool_utils.hpp
+++ b/vpd-tool/include/tool_utils.hpp
@@ -834,5 +834,39 @@
     return l_valueRead;
 }
 
+/**
+ * @brief API to check if chassis is powered off.
+ *
+ * This API queries Phosphor Chassis State Manager to know whether
+ * chassis is powered off.
+ *
+ * @return true if chassis is powered off, false otherwise.
+ */
+inline bool isChassisPowerOff()
+{
+    try
+    {
+        // ToDo: Handle in case system has multiple chassis
+        auto l_powerState = readDbusProperty(
+            constants::chassisStateManagerService,
+            constants::chassisStateManagerObjectPath,
+            constants::chassisStateManagerInfName, "CurrentPowerState");
+
+        if (auto l_curPowerState = std::get_if<std::string>(&l_powerState);
+            l_curPowerState &&
+            ("xyz.openbmc_project.State.Chassis.PowerState.Off" ==
+             *l_curPowerState))
+        {
+            return true;
+        }
+    }
+    catch (const std::exception& l_ex)
+    {
+        // Todo: Enale log when verbose is enabled
+        std::cerr << l_ex.what() << std::endl;
+    }
+    return false;
+}
+
 } // namespace utils
 } // namespace vpd