Process json for Extra and Common Interfaces
This commit contains code to process json to check if the
record and keyword combination updated using write keyword
is a part of extra interfaces and common interfaces of
VPD inventory json.
Signed-off-by: Sunny Srivastava <sunnsr25@in.ibm.com>
Change-Id: I95333abec6e7a7ad6981621f89e6d6e7edc7ecc9
diff --git a/vpd-manager/editor_impl.hpp b/vpd-manager/editor_impl.hpp
index 70596a4..ff94692 100644
--- a/vpd-manager/editor_impl.hpp
+++ b/vpd-manager/editor_impl.hpp
@@ -5,6 +5,7 @@
#include <cstddef>
#include <fstream>
+#include <nlohmann/json.hpp>
#include <tuple>
namespace openpower
@@ -52,10 +53,10 @@
*
* @param[in] path - Path to the vpd file
*/
- EditorImpl(const inventory::Path& path, const std::string& record,
- const std::string& kwd) :
+ EditorImpl(const inventory::Path& path, const nlohmann::json& json,
+ const std::string& record, const std::string& kwd) :
vpdFilePath(path),
- thisRecord(record, kwd)
+ jsonFile(json), thisRecord(record, kwd)
{
}
@@ -105,12 +106,31 @@
*/
void updateRecordECC();
+ /** @brief method to update cache once the data for kwd has been updated
+ */
+ void updateCache();
+
+ /** @brief method to process and update CI in case required
+ * @param[in] - objectPath - path of the object to introspect
+ */
+ void processAndUpdateCI(const std::string& objectPath);
+
+ /** @brief method to process and update Extra Interface
+ * @param[in] Inventory - single inventory json subpart
+ * @param[in] objectPath - path of the object to introspect
+ */
+ void processAndUpdateEI(const nlohmann::json& Inventory,
+ const inventory::Path& objPath);
+
// path to the VPD file to edit
const inventory::Path& vpdFilePath;
// stream to perform operation on file
std::fstream vpdFileStream;
+ // file to store parsed json
+ const nlohmann::json& jsonFile;
+
// structure to hold info about record to edit
struct RecInfo
{