control: Add net target decrease action

Add the YAML based set_net_speed_decrease action function as an action
class for JSON configs to use.

Change-Id: Ibbd784586318dffd795123128f0988faec46ce8f
Signed-off-by: Matthew Barth <msbarth@us.ibm.com>
diff --git a/control/json/zone.hpp b/control/json/zone.hpp
index 2f6e925..3ae8139 100644
--- a/control/json/zone.hpp
+++ b/control/json/zone.hpp
@@ -146,6 +146,16 @@
     };
 
     /**
+     * @brief Get the target decrease delta
+     *
+     * @return - The current target decrease delta
+     */
+    inline auto& getDecDelta() const
+    {
+        return _decDelta;
+    };
+
+    /**
      * @brief Add a fan object to the zone
      *
      * @param[in] fan - Unique pointer to a fan object that will be moved into
@@ -191,6 +201,17 @@
     }
 
     /**
+     * @brief Sets the decrease allowed state of a group
+     *
+     * @param[in] ident - An identifier that affects speed decreases
+     * @param[in] isAllow - Allow state according to the identifier
+     */
+    inline void setDecreaseAllow(const std::string& ident, bool isAllow)
+    {
+        _decAllowed[ident] = isAllow;
+    }
+
+    /**
      * @brief Calculate the requested target from the given delta and increases
      * the fans, not going above the ceiling.
      *
@@ -199,6 +220,14 @@
     void requestIncrease(uint64_t targetDelta);
 
     /**
+     * @brief Calculate the lowest requested decrease target from the given
+     * delta within a decrease interval.
+     *
+     * @param[in] targetDelta - The delta to decrease the target by
+     */
+    void requestDecrease(uint64_t targetDelta);
+
+    /**
      * @brief Set the requested target base to be used as the target to base a
      * new requested target from
      *
@@ -300,6 +329,9 @@
     /* Zone increase delta */
     uint64_t _incDelta;
 
+    /* Zone decrease delta */
+    uint64_t _decDelta;
+
     /* The ceiling target to not go above */
     uint64_t _ceiling;
 
@@ -309,6 +341,9 @@
     /* Map of whether floor changes are allowed by a string identifier */
     std::map<std::string, bool> _floorChange;
 
+    /* Map of controlling decreases allowed by a string identifer */
+    std::map<std::string, bool> _decAllowed;
+
     /* Map of interfaces to persisted properties the zone hosts*/
     std::map<std::string, std::vector<std::string>> _propsPersisted;