regulators: Add phase fault type to parser
Enhance the JSON configuration file parser to support the new
phase fault type values.
Add gtest test cases to exercise new code.
Signed-off-by: Shawn McCarney <shawnmm@us.ibm.com>
Change-Id: If5ac011f740fdb6f24692c713a56d4947709d660
diff --git a/phosphor-regulators/src/config_file_parser.hpp b/phosphor-regulators/src/config_file_parser.hpp
index 1062ced..a1bdd6e 100644
--- a/phosphor-regulators/src/config_file_parser.hpp
+++ b/phosphor-regulators/src/config_file_parser.hpp
@@ -33,6 +33,7 @@
#include "if_action.hpp"
#include "not_action.hpp"
#include "or_action.hpp"
+#include "phase_fault.hpp"
#include "pmbus_read_sensor_action.hpp"
#include "pmbus_write_vout_command_action.hpp"
#include "presence_detection.hpp"
@@ -539,6 +540,18 @@
std::unique_ptr<OrAction> parseOr(const nlohmann::json& element);
/**
+ * Parses a JSON element containing a PhaseFaultType expressed as a string.
+ *
+ * Returns the corresponding PhaseFaultType enum value.
+ *
+ * Throws an exception if parsing fails.
+ *
+ * @param element JSON element
+ * @return PhaseFaultType enum value
+ */
+PhaseFaultType parsePhaseFaultType(const nlohmann::json& element);
+
+/**
* Parses a JSON element containing a pmbus_read_sensor action.
*
* Returns the corresponding C++ PMBusReadSensorAction object.