IBM Read VPD support for processor vpd

This commit adds support to read and parse the processor vpd

Test-

NAME                                          TYPE      SIGNATURE RESULT/VALUE                             FLAGS
com.ibm.ipzvpd.CP00                           interface -         -                                        -
.AW                                           property  ay        4 0 0 0 0                                emits-change writable
xyz.openbmc_project.Inventory.Decorator.Asset interface -         -                                        -
.BuildDate                                    property  s         ""                                       emits-change writable
.Manufacturer                                 property  s         ""                                       emits-change writable
.Model                                        property  s         ""                                       emits-change writable
.PartNumber                                   property  s         "2345678"                                emits-change writable
.SerialNumber                                 property  s         "YLAB41010000"                           emits-change writable
xyz.openbmc_project.Inventory.Item            interface -         -                                        -
.Present                                      property  b         true                                     emits-change writable
.PrettyName                                   property  s         "6 WAY  PROC CUOD"                       emits-change writable

Change-Id: I7f1aad29c4413c6db7c2ec2525df427d048658f1
Signed-off-by: Alpana Kumari <alpankum@in.ibm.com>
diff --git a/ibm_vpd_app.cpp b/ibm_vpd_app.cpp
index 9022e3d..b761b10 100644
--- a/ibm_vpd_app.cpp
+++ b/ibm_vpd_app.cpp
@@ -6,6 +6,8 @@
 #include "parser.hpp"
 #include "utils.hpp"
 
+#include <ctype.h>
+
 #include <CLI/CLI.hpp>
 #include <algorithm>
 #include <exception>
@@ -116,6 +118,10 @@
         {
             kw = std::string("PD_") + kw[1];
         }
+        else if (isdigit(kw[0]))
+        {
+            kw = std::string("N_") + kw;
+        }
         prop.emplace(move(kw), move(vec));
     }
 
@@ -429,11 +435,25 @@
             return 0;
         }
 
-        // Open the file in binary mode
-        ifstream vpdFile(file, ios::binary);
-        // Read the content of the binary file into a vector
-        Binary vpdVector((istreambuf_iterator<char>(vpdFile)),
-                         istreambuf_iterator<char>());
+        uint32_t offset = 0;
+        // check if offset present?
+        for (const auto& item : js["frus"][file])
+        {
+            if (item.find("offset") != item.end())
+            {
+                offset = item["offset"];
+            }
+        }
+
+        // TODO: Figure out a better way to get max possible VPD size.
+        Binary vpdVector;
+        vpdVector.resize(65504);
+        ifstream vpdFile;
+        vpdFile.open(file, ios::binary);
+
+        vpdFile.seekg(offset, ios_base::cur);
+        vpdFile.read(reinterpret_cast<char*>(&vpdVector[0]), 65504);
+        vpdVector.resize(vpdFile.gcount());
 
         vpdType type = vpdTypeCheck(vpdVector);