Added min and max vnf count support 61/65561/4
authorMichael Mokry <mm117s@att.com>
Fri, 7 Sep 2018 21:46:20 +0000 (16:46 -0500)
committerMichael Mokry <mm117s@att.com>
Mon, 10 Sep 2018 19:26:13 +0000 (14:26 -0500)
Added variables for min and max with associated Constructor,  getters and setters
We will need to merge this commit before merging the policy/engine
commit to avoid compilation errors in policy/engine build

Made changes to address Jim Hahn's comments

Change-Id: I45357077cfe046028adcc0033ecf29f8cc1a525b
Issue-ID: POLICY-1038
Signed-off-by: Mike Mokry <mm117s@att.com>
controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Constraint.java

index 6931de4..b54e2f6 100644 (file)
@@ -30,51 +30,15 @@ public class Constraint {
     private Integer freqLimitPerTarget;
     private Map<String,String> timeWindow;
     private Map<String, String> activeTimeRange;
+    private Integer minVnfCount;
+    private Integer maxVnfCount;
     
     private List<String> blacklist;
     
     public Constraint() {
         // Do Nothing empty constructor. 
     }
-
-    public Integer getFreq_limit_per_target() {
-        return freqLimitPerTarget;
-    }
-
-
-    public void setFreq_limit_per_target(Integer freqLimitPerTarget) {
-        this.freqLimitPerTarget = freqLimitPerTarget;
-    }
-
-
-    public Map<String, String> getTime_window() {
-        return timeWindow;
-    }
-
-
-    public void setTime_window(Map<String, String> timeWindow) {
-        this.timeWindow = timeWindow;
-    }
-
-
-    public Map<String, String> getActive_time_range() {
-        return activeTimeRange;
-    }
-
-
-    public void setActive_time_range(Map<String, String> activeTimeRange) {
-        this.activeTimeRange = activeTimeRange;
-    }
-
-
-    public List<String> getBlacklist() {
-        return blacklist;
-    }
-
-    public void setBlacklist(List<String> blacklist) {
-        this.blacklist = blacklist;
-    }
-
+    
     /**
      * Constructor.
      * 
@@ -87,6 +51,22 @@ public class Constraint {
             this.timeWindow = Collections.unmodifiableMap(timeWindow);
         }
     }
+
+    /**
+     * Constructor.
+     * 
+     * @param minVNFLimit minimum VNF count
+     * @param maxVNFLimit maximum VNF count
+     * @param activeTimeRange active time range
+     */
+    public Constraint(Integer minVnfCount, Integer maxVnfCount, Map<String, String> activeTimeRange) {
+        this.minVnfCount = minVnfCount;
+        this.maxVnfCount = maxVnfCount;
+
+        if (activeTimeRange != null) {
+            this.activeTimeRange = Collections.unmodifiableMap(activeTimeRange);
+        }
+    }
     
     public Constraint(List<String> blacklist) {
         this.blacklist = new LinkedList<>(blacklist);
@@ -151,6 +131,66 @@ public class Constraint {
         }
         this.blacklist = new LinkedList<>(constraint.blacklist);
     }
+
+    public Integer getFreq_limit_per_target() {
+        return freqLimitPerTarget;
+    }
+
+
+    public void setFreq_limit_per_target(Integer freqLimitPerTarget) {
+        this.freqLimitPerTarget = freqLimitPerTarget;
+    }
+
+
+    public Map<String, String> getTime_window() {
+        return timeWindow;
+    }
+
+
+    public void setTime_window(Map<String, String> timeWindow) {
+        this.timeWindow = timeWindow;
+    }
+
+
+    public Map<String, String> getActive_time_range() {
+        return activeTimeRange;
+    }
+
+
+    public void setActive_time_range(Map<String, String> activeTimeRange) {
+        this.activeTimeRange = activeTimeRange;
+    }
+
+    
+    public List<String> getBlacklist() {
+        return blacklist;
+    }
+
+    
+    public void setBlacklist(List<String> blacklist) {
+        this.blacklist = blacklist;
+    }
+    
+    
+    public Integer getMinVnfCount() {
+        return minVnfCount;
+    }
+
+    
+    public void setMinVnfCount(Integer minVnfCount) {
+        this.minVnfCount = minVnfCount;
+    }
+
+    
+    public Integer getMaxVnfCount() {
+        return maxVnfCount;
+    }
+
+    
+    public void setMaxVnfCount(Integer maxVnfCount) {
+        this.maxVnfCount = maxVnfCount;
+    }
+
     
     public boolean isValid() {
         return ((freqLimitPerTarget == null && timeWindow != null)