From: Michael Mokry Date: Fri, 7 Sep 2018 21:46:20 +0000 (-0500) Subject: Added min and max vnf count support X-Git-Tag: 1.3.0~24 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F61%2F65561%2F4;p=policy%2Fdrools-applications.git 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 --- 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 timeWindow; private Map activeTimeRange; + private Integer minVnfCount; + private Integer maxVnfCount; private List 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 getTime_window() { - return timeWindow; - } - - - public void setTime_window(Map timeWindow) { - this.timeWindow = timeWindow; - } - - - public Map getActive_time_range() { - return activeTimeRange; - } - - - public void setActive_time_range(Map activeTimeRange) { - this.activeTimeRange = activeTimeRange; - } - - - public List getBlacklist() { - return blacklist; - } - - public void setBlacklist(List 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 activeTimeRange) { + this.minVnfCount = minVnfCount; + this.maxVnfCount = maxVnfCount; + + if (activeTimeRange != null) { + this.activeTimeRange = Collections.unmodifiableMap(activeTimeRange); + } + } public Constraint(List 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 getTime_window() { + return timeWindow; + } + + + public void setTime_window(Map timeWindow) { + this.timeWindow = timeWindow; + } + + + public Map getActive_time_range() { + return activeTimeRange; + } + + + public void setActive_time_range(Map activeTimeRange) { + this.activeTimeRange = activeTimeRange; + } + + + public List getBlacklist() { + return blacklist; + } + + + public void setBlacklist(List 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)