control: Parameter use for set_net_increase_speed

Change the set_net_increase_speed to be able to specify a Manager
parameter to get the state value from instead of just looking up a
hardcoded value in the JSON.

The JSON now supports a 'state_parameter_name' field that can be used in
place of the 'state' field.  The code will then call
Manager::getParameter with this parameter name to get the state value to
use in the action.

Signed-off-by: Matt Spinler <spinler@us.ibm.com>
Change-Id: Iaf422787c57c60a3a90c3272813e5f4eb3ca9886
diff --git a/control/json/actions/net_target_increase.cpp b/control/json/actions/net_target_increase.cpp
index 4387a4c..3d6f9f1 100644
--- a/control/json/actions/net_target_increase.cpp
+++ b/control/json/actions/net_target_increase.cpp
@@ -44,6 +44,21 @@
 
 void NetTargetIncrease::run(Zone& zone)
 {
+
+    if (!_stateParameter.empty())
+    {
+        auto s = Manager::getParameter(_stateParameter);
+        if (!s)
+        {
+            log<level::DEBUG>(
+                fmt::format("Action {}: State parameter {} not found",
+                            ActionBase::getName(), _stateParameter)
+                    .c_str());
+            return;
+        }
+        _state = *s;
+    }
+
     auto netDelta = zone.getIncDelta();
     for (const auto& group : _groups)
     {
@@ -129,12 +144,20 @@
 
 void NetTargetIncrease::setState(const json& jsonObj)
 {
-    if (!jsonObj.contains("state"))
+    if (jsonObj.contains("state"))
     {
-        throw ActionParseError{ActionBase::getName(),
-                               "Missing required state value"};
+        _state = getJsonValue(jsonObj["state"]);
     }
-    _state = getJsonValue(jsonObj["state"]);
+    else if (jsonObj.contains("state_parameter_name"))
+    {
+        _stateParameter = jsonObj["state_parameter_name"].get<std::string>();
+    }
+    else
+    {
+        throw ActionParseError{
+            ActionBase::getName(),
+            "Missing required state or state_parameter_name value"};
+    }
 }
 
 void NetTargetIncrease::setDelta(const json& jsonObj)