diff options
Diffstat (limited to 'controlloop/common/policy-yaml/src/main/java')
-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) |