regulators: Implements support for or action

Enhance the configuration file parser to support the or action element.

Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I6e6dee26c23a2ea414e96a0cda3525b91b806509
diff --git a/phosphor-regulators/src/config_file_parser.cpp b/phosphor-regulators/src/config_file_parser.cpp
index 5f0181e..8c6dc12 100644
--- a/phosphor-regulators/src/config_file_parser.cpp
+++ b/phosphor-regulators/src/config_file_parser.cpp
@@ -125,9 +125,8 @@
     }
     else if (element.contains("or"))
     {
-        // TODO: Not implemented yet
-        // action = parseOr(element["or"]);
-        // ++propertyCount;
+        action = parseOr(element["or"]);
+        ++propertyCount;
     }
     else if (element.contains("pmbus_read_sensor"))
     {
@@ -583,6 +582,21 @@
     return std::make_unique<NotAction>(std::move(action));
 }
 
+std::unique_ptr<OrAction> parseOr(const json& element)
+{
+    verifyIsArray(element);
+
+    // Verify if array size less than 2
+    if (element.size() < 2)
+    {
+        throw std::invalid_argument{"Array must contain two or more actions"};
+    }
+    // Array of two or more actions
+    std::vector<std::unique_ptr<Action>> actions = parseActionArray(element);
+
+    return std::make_unique<OrAction>(std::move(actions));
+}
+
 std::unique_ptr<PMBusWriteVoutCommandAction>
     parsePMBusWriteVoutCommand(const json& element)
 {