diff options
author | Michael Mokry <mm117s@att.com> | 2018-09-07 16:46:20 -0500 |
---|---|---|
committer | Michael Mokry <mm117s@att.com> | 2018-09-10 14:26:13 -0500 |
commit | 3ba94e8dede50d54fee58351cbb2c0d0f56eb1e8 (patch) | |
tree | b023a9810b8292aadd7fffac7190e1a2d4bd96c1 | |
parent | 38ec336ca105b38d272d1d86b8ee56bafc524acb (diff) |
Added min and max vnf count support
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>
-rw-r--r-- | controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Constraint.java | 118 |
1 files changed, 79 insertions, 39 deletions
diff --git a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Constraint.java b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Constraint.java index 6931de430..b54e2f665 100644 --- a/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Constraint.java +++ b/controlloop/common/policy-yaml/src/main/java/org/onap/policy/controlloop/policy/guard/Constraint.java @@ -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) |