summaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP
diff options
context:
space:
mode:
Diffstat (limited to 'POLICY-SDK-APP')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java11
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js17
-rw-r--r--POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html116
3 files changed, 136 insertions, 8 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java
index 69c3d2fcb..4e8c8c141 100644
--- a/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java
+++ b/POLICY-SDK-APP/src/main/java/org/onap/policy/controller/DecisionPolicyController.java
@@ -69,6 +69,7 @@ public class DecisionPolicyController extends RestrictedBaseController {
private static final String DECISIONRAWTYPE = "@#RuleProvider@#Decision_Raw@#RuleProvider@#";
private static final String GUARD_YAML= "GUARD_YAML";
private static final String GUARD_BL_YAML= "GUARD_BL_YAML";
+ private static final String GUARD_MIN_MAX= "GUARD_MIN_MAX";
protected PolicyRestAdapter policyAdapter = null;
private ArrayList<Object> ruleAlgorithmList;
@@ -233,6 +234,9 @@ public class DecisionPolicyController extends RestrictedBaseController {
} else if (GUARD_BL_YAML.equalsIgnoreCase(((RuleType) object).getAdviceExpressions()
.getAdviceExpression().get(0).getAdviceId())) {
policyAdapter.setRuleProvider(GUARD_BL_YAML);
+ } else if (GUARD_MIN_MAX.equalsIgnoreCase(((RuleType) object).getAdviceExpressions()
+ .getAdviceExpression().get(0).getAdviceId())) {
+ policyAdapter.setRuleProvider(GUARD_MIN_MAX);
}
} else {
policyAdapter.setRuleProvider("Custom");
@@ -244,7 +248,8 @@ public class DecisionPolicyController extends RestrictedBaseController {
ruleAlgoirthmTracker = new LinkedList<>();
if (policyAdapter.getRuleProvider() != null
&& (GUARD_YAML.equals(policyAdapter.getRuleProvider())
- || (GUARD_BL_YAML.equals(policyAdapter.getRuleProvider())))) {
+ || (GUARD_BL_YAML.equals(policyAdapter.getRuleProvider()))
+ || (GUARD_MIN_MAX.equals(policyAdapter.getRuleProvider())))){
YAMLParams yamlParams = new YAMLParams();
for (int i = 0; i < attributeList.size(); i++) {
Map<String, String> map = (Map<String, String>) attributeList.get(i);
@@ -256,6 +261,10 @@ public class DecisionPolicyController extends RestrictedBaseController {
yamlParams.setTargets(Arrays.asList(map.get("value").split("\\|")));
} else if ("clname".equals(map.get("key"))) {
yamlParams.setClname(map.get("value"));
+ } else if ("min".equals(map.get("key"))) {
+ yamlParams.setMin(map.get("value"));
+ } else if ("max".equals(map.get("key"))) {
+ yamlParams.setMax(map.get("value"));
}
}
ApplyType apply =
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
index ba9e44868..0e53ce9de 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplateController/DecisionPolicyController.js
@@ -238,10 +238,11 @@ angular.module('abs').controller('decisionPolicyController', [ '$scope', 'Policy
$scope.blackListEntries = [];
$scope.temp.policy.appendBlackListEntries = [];
$scope.blackListEntries = arrayUnique($scope.temp.policy.blackListEntries.concat($scope.temp.policy.yamlparams.blackList));
- } else if ($scope.temp.policy.ruleProvider == "GUARD_YAML") {
- if ($scope.temp.policy.yamlparams.targets.length == 0) {
- $scope.temp.policy.yamlparams.targets = [];
- }
+
+ }else if($scope.temp.policy.ruleProvider=="GUARD_YAML" || $scope.temp.policy.ruleProvider=="GUARD_MIN_MAX"){
+ if($scope.temp.policy.yamlparams.targets.length==0){
+ $scope.temp.policy.yamlparams.targets = [];
+ }
} else if ($scope.temp.policy.ruleProvider == "Rainy_Day") {
if ($scope.temp.policy.rainyday.treatmentTableChoices == null || $scope.temp.policy.rainyday.treatmentTableChoices.length == 0) {
$scope.temp.policy.rainyday.treatmentTableChoices = [];
@@ -286,9 +287,9 @@ angular.module('abs').controller('decisionPolicyController', [ '$scope', 'Policy
$scope.addNewBL = function() {
$scope.temp.policy.yamlparams.blackList.push('');
};
-
- $scope.removeBL = function(id) {
- $scope.temp.policy.yamlparams.blackList = $scope.temp.policy.yamlparams.blackList.filter(function(obj) {
+
+ $scope.removeBL = function(id) {
+ $scope.temp.policy.yamlparams.blackList = $scope.temp.policy.yamlparams.blackList.filter(function (obj){
return obj !== id;
});
};
@@ -296,9 +297,11 @@ angular.module('abs').controller('decisionPolicyController', [ '$scope', 'Policy
$scope.treatmentDatas = [ {
"treatmentValues" : $scope.temp.policy.rainyday.treatmentTableChoices
} ];
+
$scope.addNewTreatment = function() {
$scope.temp.policy.rainyday.treatmentTableChoices.push({});
};
+
$scope.removeTreatment = function() {
var lastItem = $scope.temp.policy.rainyday.treatmentTableChoices.length - 1;
$scope.temp.policy.rainyday.treatmentTableChoices.splice(lastItem);
diff --git a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html
index f27d5c619..f482554a2 100644
--- a/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html
+++ b/POLICY-SDK-APP/src/main/webapp/app/policyApp/policy-models/Editor/PolicyTemplates/DecisionPolicyTemplate.html
@@ -55,6 +55,7 @@
<option>Rainy_Day</option>
<option>GUARD_YAML</option>
<option>GUARD_BL_YAML</option>
+ <option>GUARD_MIN_MAX</option>
<option>Raw</option>
</select>
</div>
@@ -438,6 +439,121 @@
</div>
</div>
+ <div ng-if="temp.policy.ruleProvider == 'GUARD_MIN_MAX'">
+ <div class="well">
+ <div class="form-group row">
+ <div class="form-group col-sm-1">
+ <label>Guard MIN/MAX Attributes:</label><br>
+ </div>
+ </div>
+ <div class="form-group row">
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> actor: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="temp.policy.yamlparams.actor" placeholder="Actor" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> recipe: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="temp.policy.yamlparams.recipe" placeholder="Recipe" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> CLName: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="temp.policy.yamlparams.clname" placeholder="CLName" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> Targets: </label>
+ <button type="button" class="btn btn-default"
+ ng-disabled="temp.policy.readOnly" ng-click="addNewTarget()">
+ <i class="fa fa-plus"></i>
+ </button>
+ </div>
+ <div class="form-group col-sm-4">
+ <div
+ data-ng-repeat="choice in temp.policy.yamlparams.targets track by $index">
+ <div class="form-group row">
+ <div class="form-group col-sm-9">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="temp.policy.yamlparams.targets[$index]"
+ placeholder="Target" />
+ </div>
+ <div class="form-group col-sm-1">
+ <button type="button" class="btn btn-default" ng-show="$last"
+ ng-disabled="temp.policy.readOnly" ng-click="removeTarget()">
+ <i class="fa fa-minus"></i>
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> min: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="temp.policy.yamlparams.min" placeholder="Min"
+ title="Enter minimum number of VNF instances" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> max: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="temp.policy.yamlparams.max" placeholder="Max"
+ title="Enter maximum number of VNF instances" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> guardActiveStart: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="temp.policy.yamlparams.guardActiveStart"
+ title="Enter Guard Active Start value in following patren '00:00:00-05:00'."
+ placeholder="00:00:00-05:00" />
+ </div>
+ </div>
+ <div class="form-group row" style="margin-left: 2%">
+ <div class="form-group col-sm-3">
+ <label> guardActiveEnd: </label>
+ </div>
+ <div class="form-group col-sm-3">
+ <input type="text" class="form-control"
+ ng-disabled="temp.policy.readOnly"
+ ng-model="temp.policy.yamlparams.guardActiveEnd"
+ title="Enter Guard Active End value in following patren '00:00:00-05:00'."
+ placeholder="00:00:00-05:00" />
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
<div ng-if="temp.policy.ruleProvider == 'Custom'">
<div class="well">