VPD tool : Read Keyword option
One of the options the VPD tool provides is
to Read the value of the keyword. This commit has its implementation.
The user should provide a valid object path, valid record name
and valid keyword inorder to get the value of the keyword.
Test:
Tested on simics.
Output:
root@rainier:/tmp# ./vpd-tool -r -O /system/chassis/motherboard/vdd_vrm1 -R VINI -K FN
{
"/system/chassis/motherboard/vdd_vrm1": {
"FN": "F190827"
}
}
Signed-off-by: PriyangaRamasamy <priyanga24@in.ibm.com>
Change-Id: I244b9fe276feefa27e4c99063a9e9aa01aeb2f12
diff --git a/vpd_tool_impl.hpp b/vpd_tool_impl.hpp
index 378ece2..d31bc25 100644
--- a/vpd_tool_impl.hpp
+++ b/vpd_tool_impl.hpp
@@ -10,6 +10,8 @@
{
private:
const std::string fruPath;
+ const std::string recordName;
+ const std::string keyword;
/**
* @brief Debugger
@@ -117,6 +119,14 @@
void dumpObject(const nlohmann::basic_json<>& jsObject);
/**
+ * @brief Read keyword
+ * Read the given object path, record name and keyword
+ * from the inventory and display the value of the keyword
+ * in JSON format.
+ */
+ void readKeyword();
+
+ /**
* @brief A Constructor
* Constructor is called during the
* object instantiation for dumpInventory option.
@@ -133,4 +143,16 @@
VpdTool(const std::string&& fru) : fruPath(std::move(fru))
{
}
+
+ /**
+ * @brief Constructor
+ * Constructor is called during the
+ * object instantiation for readKeyword option.
+ */
+ VpdTool(const std::string&& fru, const std::string&& recName,
+ const std::string&& kw) :
+ fruPath(std::move(fru)),
+ recordName(std::move(recName)), keyword(std::move(kw))
+ {
+ }
};