regulators: Enhance config file parser
Enhance JSON config file parser to convert relative inventory paths to
absolute form.
Tested:
Run local CI with -Dlong-tests=enabled to enable tests for
validate-regulators-config.py.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I80237a673f9c5918898db15363847722141388e6
diff --git a/phosphor-regulators/src/config_file_parser.hpp b/phosphor-regulators/src/config_file_parser.hpp
index 848ed95..4b39b7e 100644
--- a/phosphor-regulators/src/config_file_parser.hpp
+++ b/phosphor-regulators/src/config_file_parser.hpp
@@ -485,6 +485,21 @@
}
/**
+ * Parses a JSON element containing a relative inventory path.
+ *
+ * Returns the corresponding C++ string containing the absolute inventory path.
+ *
+ * Inventory paths in the JSON configuration file are relative. Adds the
+ * necessary prefix to make the path absolute.
+ *
+ * Throws an exception if parsing fails.
+ *
+ * @param element JSON element
+ * @return absolute D-Bus inventory path
+ */
+std::string parseInventoryPath(const nlohmann::json& element);
+
+/**
* Parses a JSON element containing a not action.
*
* Returns the corresponding C++ NotAction object.