From 95524c8ef8be0d41de8bb2b918f320e464ebb897 Mon Sep 17 00:00:00 2001 From: rb7147 Date: Wed, 18 Jul 2018 12:50:06 -0400 Subject: Decision BlackList Guard Enhancements While creating a decision Bl Guard Policy we are allowing to add Blacklist entries through file upload for bulk from GUI. Issue-ID: POLICY-901 Change-Id: I4031fd4a96937b9facc330cecf72777d701d4678 Signed-off-by: rb7147 --- .../policy/pap/xacml/rest/components/DecisionPolicy.java | 16 ++++++++++++++-- .../pap/xacml/rest/policycontroller/PolicyCreation.java | 12 +++++++++++- .../main/resources/Decision_GuardBLPolicyTemplate.xml | 2 +- .../src/main/resources/Decision_GuardPolicyTemplate.xml | 2 +- 4 files changed, 27 insertions(+), 5 deletions(-) (limited to 'ONAP-PAP-REST') diff --git a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java index 56c23ac2c..c8c540c34 100644 --- a/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java +++ b/ONAP-PAP-REST/src/main/java/org/onap/policy/pap/xacml/rest/components/DecisionPolicy.java @@ -167,7 +167,9 @@ public class DecisionPolicy extends Policy { if(policyAdapter.getRuleProvider().equals(GUARD_YAML) || policyAdapter.getRuleProvider().equals(GUARD_BL_YAML)){ Map yamlParams = new HashMap<>(); - yamlParams.put(DESCRIPTION, (policyAdapter.getPolicyDescription()!=null)? policyAdapter.getPolicyDescription(): "YAML Guard Policy"); + String blackListEntryType = policyAdapter.getBlackListEntryType() !=null ? policyAdapter.getBlackListEntryType(): "Use Manual Entry"; + String description = policyAdapter.getPolicyDescription() != null? policyAdapter.getPolicyDescription(): "YAML Guard Policy"; + yamlParams.put(DESCRIPTION, description + "@blEntry@" + blackListEntryType + "@blEntry@"); String fileName = policyAdapter.getNewFileName(); String name = fileName.substring(fileName.lastIndexOf('\\') + 1, fileName.length()); if ((name == null) || ("".equals(name))) { @@ -295,6 +297,16 @@ public class DecisionPolicy extends Policy { blackList.add(blackListString); } } + if(yamlParams.containsKey("appendBlackList")){ + String appendBlackListString = yamlParams.get("appendBlackList"); + List appendBlackList = null; + if(appendBlackListString!=null && !appendBlackListString.trim().isEmpty()){ + appendBlackList = Arrays.asList(appendBlackListString.split(",")); + for(int i=0; i - Denied! + Denied By Blacklist diff --git a/ONAP-PAP-REST/src/main/resources/Decision_GuardPolicyTemplate.xml b/ONAP-PAP-REST/src/main/resources/Decision_GuardPolicyTemplate.xml index 15465f3c0..809dc99fb 100644 --- a/ONAP-PAP-REST/src/main/resources/Decision_GuardPolicyTemplate.xml +++ b/ONAP-PAP-REST/src/main/resources/Decision_GuardPolicyTemplate.xml @@ -118,7 +118,7 @@ - Denied! + Denied By Guard -- cgit 1.2.3-korg