regulators: Implements support for run_rule
Implements support for parsing the run_rule JSON elements in the
configuration file parser.
Signed-off-by: Bob King <Bob_King@wistron.com>
Change-Id: I9b8d96716a7710e3829fc346d89ef418cc091858
diff --git a/phosphor-regulators/src/config_file_parser.cpp b/phosphor-regulators/src/config_file_parser.cpp
index 3959978..1d64c96 100644
--- a/phosphor-regulators/src/config_file_parser.cpp
+++ b/phosphor-regulators/src/config_file_parser.cpp
@@ -148,9 +148,8 @@
}
else if (element.contains("run_rule"))
{
- // TODO: Not implemented yet
- // action = parseRunRule(element["run_rule"]);
- // ++propertyCount;
+ action = parseRunRule(element["run_rule"]);
+ ++propertyCount;
}
else if (element.contains("set_device"))
{
@@ -422,6 +421,14 @@
return rules;
}
+std::unique_ptr<RunRuleAction> parseRunRule(const json& element)
+{
+ // String ruleID
+ std::string ruleID = parseString(element);
+
+ return std::make_unique<RunRuleAction>(ruleID);
+}
+
} // namespace internal
} // namespace phosphor::power::regulators::config_file_parser