VPD Tool: Write keyword command line interface

This commit has the command line interface
for writeKeyword option in the VPD tool.

--help option will provide the user - the argument format
for writeKeyword option.

Note:
	The application "vpd-manager" acts as the backend for the keyword updation.
	The vpd-manager executable should run in the background while testing in simics.
	The commits which points to the vpd-manager backend application are,
		< https://gerrit.openbmc-project.xyz/c/openbmc/openpower-vpd-parser/+/28991/43 >
		< https://gerrit.openbmc-project.xyz/c/openbmc/openpower-vpd-parser/+/29039/43 >
		< https://gerrit.openbmc-project.xyz/c/openbmc/openpower-vpd-parser/+/32439/10 >

Tested on rainier:
root@rainier:/tmp# ./vpd-tool -r -O /system/chassis/motherboard/vdd_vrm1 -R VINI -K FN
{
    "/system/chassis/motherboard/vdd_vrm1": {
        "FN": "F190827"
    }
}
root@rainier:/tmp#
root@rainier:/tmp# ./vpd-tool -w -O /system/chassis/motherboard/vdd_vrm1 -R VINI -K FN -V 0x616263
root@rainier:/tmp#
root@rainier:/tmp# ./vpd-tool -r -O /system/chassis/motherboard/vdd_vrm1 -R VINI -K FN
{
    "/system/chassis/motherboard/vdd_vrm1": {
        "FN": "abc0827"
    }
}

Change-Id: I6c586a9848497e44bf88eda78694989d0287cbba
Signed-off-by: Priyanga Ramasamy <priyanga24@in.ibm.com>
diff --git a/vpd_tool_impl.cpp b/vpd_tool_impl.cpp
index d7c8504..893109c 100644
--- a/vpd_tool_impl.cpp
+++ b/vpd_tool_impl.cpp
@@ -1,5 +1,6 @@
 #include "vpd_tool_impl.hpp"
 
+#include <iomanip>
 #include <iostream>
 #include <sdbusplus/bus.hpp>
 #include <sstream>
@@ -289,3 +290,50 @@
         }
     }
 }
+
+int VpdTool::updateKeyword()
+{
+    Binary val;
+
+    if (value.find("0x") == string::npos)
+    {
+        val.assign(value.begin(), value.end());
+    }
+    else if (value.find("0x") != string::npos)
+    {
+        stringstream ss;
+        ss.str(value.substr(2));
+        string byteStr{};
+
+        while (!ss.eof())
+        {
+            ss >> setw(2) >> byteStr;
+            uint8_t byte = strtoul(byteStr.c_str(), nullptr, 16);
+
+            val.push_back(byte);
+        }
+    }
+
+    else
+    {
+        throw runtime_error("The value to be updated should be either in ascii "
+                            "or in hex. Refer --help option");
+    }
+
+    // writeKeyword(fruPath, recordName, keyword, val);
+
+    auto bus = sdbusplus::bus::new_default();
+    auto properties =
+        bus.new_method_call(BUSNAME, OBJPATH, IFACE, "WriteKeyword");
+    properties.append(static_cast<sdbusplus::message::object_path>(fruPath));
+    properties.append(recordName);
+    properties.append(keyword);
+    properties.append(val);
+    auto result = bus.call(properties);
+
+    if (result.is_method_error())
+    {
+        throw runtime_error("Get api failed");
+    }
+    return 0;
+}