aboutsummaryrefslogtreecommitdiffstats
path: root/ECOMP-XACML/src
diff options
context:
space:
mode:
Diffstat (limited to 'ECOMP-XACML/src')
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPAPPolicy.java2
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDP.java4
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDPGroup.java4
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java123
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java293
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java197
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java3
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java1
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPolicy.java2
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java32
-rw-r--r--ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/util/XACMLPolicyScanner.java23
-rw-r--r--ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/XACMLEngineTest.java3
-rw-r--r--ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/RequestCategoryTest.java50
-rw-r--r--ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/RequestConformanceTest.java109
-rw-r--r--ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/ResponseTest.java29
-rw-r--r--ECOMP-XACML/src/test/resources/CSVPolicy.xml205
-rw-r--r--ECOMP-XACML/src/test/resources/logback.xml5
17 files changed, 671 insertions, 414 deletions
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPAPPolicy.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPAPPolicy.java
index c18ad230f..79ee08e2e 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPAPPolicy.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPAPPolicy.java
@@ -80,7 +80,7 @@ public interface EcompPAPPolicy {
public String getDeleteCondition();
public String getDictionaryType();
public String getDictionary();
- public Map<String, String> getDictionaryFields();
+ public String getDictionaryFields();
public String getRiskLevel();
public String getGuard();
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDP.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDP.java
index f00dd7ac5..ecb21aa09 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDP.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDP.java
@@ -19,14 +19,12 @@
*/
package org.openecomp.policy.xacml.api.pap;
-import java.util.Set;
-
import org.openecomp.policy.xacml.std.pap.StdPDP;
import com.att.research.xacml.api.pap.PDP;
import com.fasterxml.jackson.annotation.JsonSubTypes;
-import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonSubTypes.Type;
+import com.fasterxml.jackson.annotation.JsonTypeInfo;
/*
* The following allows us to use Jackson to convert sub-types of this type into JSON and back to objects.
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDPGroup.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDPGroup.java
index a64b4b6dc..4aa7cbf64 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDPGroup.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/api/pap/EcompPDPGroup.java
@@ -3,9 +3,13 @@ package org.openecomp.policy.xacml.api.pap;
import java.util.Set;
import com.att.research.xacml.api.pap.PDPGroup;
+import com.att.research.xacml.api.pap.PDPPolicy;
public interface EcompPDPGroup extends PDPGroup {
public Set<EcompPDP> getEcompPdps();
+ public Set<PDPPolicy> getSelectedPolicies();
+
+ public String getOperation();
}
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java
index 397f763f2..951f89110 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdEngine.java
@@ -40,14 +40,17 @@ import java.util.TreeSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
import org.openecomp.policy.xacml.api.pap.EcompPDP;
import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
import org.openecomp.policy.xacml.api.pap.PAPPolicyEngine;
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+
import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.api.pap.PDP;
import com.att.research.xacml.api.pap.PDPGroup;
+import com.att.research.xacml.api.pap.PDPPIPConfig;
import com.att.research.xacml.api.pap.PDPPolicy;
import com.att.research.xacml.api.pap.PDPStatus;
import com.att.research.xacml.util.XACMLProperties;
@@ -62,6 +65,8 @@ import com.google.common.collect.Sets;
*
*/
public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyEngine {
+ public static final String pipPropertyFile = "pip.properties";
+
private static Log logger = LogFactory.getLog(StdEngine.class);
public static String PROP_PAP_REPO = "xacml.pap.pdps";
@@ -149,8 +154,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
this.groups = this.readProperties(this.repository, properties);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to load " + file.toAbsolutePath().toString());
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to load properties file");
this.groups = new HashSet<StdPDPGroup>();
}
@@ -210,8 +213,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
try (OutputStream os = Files.newOutputStream(policyPath)) {
props.store(os, "");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to write default policy properties", e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to write default policy properties");
}
}
@@ -223,8 +224,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
try (OutputStream os = Files.newOutputStream(pipPath)) {
props.store(os, "");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to write default pip properties", e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to write default pip properties");
}
}
@@ -250,8 +249,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
properties.store(os, "");
}
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error("Failed to save properties with new default group information.", e);
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdEngine", "Failed to save properties with new default group information.");
}
//
@@ -260,19 +257,13 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
wasDefaultGroupJustAdded = true;
return newDefault;
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error("Failed to create default group: " + defaultId, e);
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdEngine", "Failed to create default group");
throw new PAPException("Failed to create default group");
}
}
-
-
-
@Override
- public EcompPDPGroup getDefaultGroup() throws PAPException
- {
+ public EcompPDPGroup getDefaultGroup() throws PAPException{
for (EcompPDPGroup group : this.groups) {
if (group.isDefaultGroup()) {
return group;
@@ -284,50 +275,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
return null;
}
- /*@Override
- public void SetDefaultGroup(PDPGroup group) throws PAPException {
-
- boolean changesMade = false;
- for (PDPGroup aGroup : groups) {
- if (aGroup.getId().equals(group.getId())) {
- if ( ! aGroup.isDefaultGroup()) {
-//TODO - since the original code checked for type we do also.
- if (aGroup instanceof StdPDPGroup) {
- ((StdPDPGroup) aGroup).setDefault(true);
- changesMade = true;
- } else {
- throw new IllegalArgumentException("Group in groups of unknown type '" + aGroup.getClass().getName() + "'");
- }
- }
- } else {
- // not the new default group
- if (aGroup.isDefaultGroup()) {
-//TODO - since the original code checked for type we do also.
- if (aGroup instanceof StdPDPGroup) {
- ((StdPDPGroup) aGroup).setDefault(false);
- changesMade = true;
- } else {
- throw new IllegalArgumentException("Group in groups of unknown type '" + aGroup.getClass().getName() + "'");
- }
- }
- }
- }
- if (changesMade) {
- this.doSave();
- }
-
- return;
- }*/
-
- /*@Override
- public Set<PDPGroup> getPDPGroups() throws PAPException {
- final Set<PDPGroup> grps = new HashSet<PDPGroup>();
- for (PDPGroup g : this.groups) {
- grps.add(g);
- }
- return Collections.unmodifiableSet(grps);
- }*/
-
@Override
public EcompPDPGroup getGroup(String id) throws PAPException {
for (EcompPDPGroup g: this.groups) {
@@ -339,8 +286,7 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
}
@Override
- public void newGroup(String name, String description) throws PAPException, NullPointerException
- {
+ public void newGroup(String name, String description) throws PAPException, NullPointerException{
//
// Null check
//
@@ -379,8 +325,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
Files.createDirectory(groupPath);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to create " + groupPath);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to create " + groupPath);
throw new PAPException("Failed to create " + id);
}
@@ -402,8 +346,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
props.store(os, "");
}
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error("Failed to create " + policyProperties);
PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdEngine", "Failed to create " + policyProperties);
throw new PAPException("Failed to create " + id);
}
@@ -412,19 +354,17 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
// Create the PIP config
//
Path pipProperties = Paths.get(groupPath.toString(), "xacml.pip.properties");
+ Properties props = new Properties();
if (Files.exists(pipProperties)) {
logger.warn("addGroup " + id + " file exists: " + pipProperties.toString());
} else {
try {
- Properties props = new Properties();
props = setPIPProperties(props);
Files.createFile(pipProperties);
try (OutputStream os = Files.newOutputStream(pipProperties)) {
props.store(os, "");
}
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to create " + pipProperties);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to create " + pipProperties);
throw new PAPException("Failed to create " + id);
}
@@ -434,6 +374,18 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
// Ok now add it
//
StdPDPGroup newGroup = new StdPDPGroup(id, name, description, groupPath);
+ // Add the default PIP configuration.
+ String list = props.getProperty(XACMLProperties.PROP_PIP_ENGINES);
+ if (list != null && list.length() > 0) {
+ Set<PDPPIPConfig> pipConfigs = new HashSet<PDPPIPConfig>();
+ for (String pipID : list.split("[,]")) {
+ StdPDPPIPConfig config = new StdPDPPIPConfig(pipID, props);
+ if (config.isConfigured()) {
+ pipConfigs.add(config);
+ }
+ }
+ newGroup.setPipConfigs(pipConfigs);
+ }
if (this.groups.add(newGroup)) {
// save the new group in our properties and notify any listeners of the change
groupChanged(newGroup);
@@ -511,12 +463,8 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
this.doSave();
} else {
- //TODO:EELF Cleanup - Remove logger
- //logger.error("Failed to add to new group, putting back into original group.");
PolicyLogger.error("Failed to add to new group, putting back into original group.");
if (((StdPDPGroup) currentGroup).removePDP(pdp) == false) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to put PDP back into original group.");
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Failed to put PDP back into original group.");
}
}
@@ -814,23 +762,30 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
this.saveConfiguration();
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to save configuration", e);
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Failed to save configuration");
} catch (PAPException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to save configuration", e);
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Failed to save configuration");
}
}
- // TODO: Adding Default PIP engine(s) while Loading initially. We don't want
- // Programmer intervention with the PIP engines.
private Properties setPIPProperties(Properties props){
props.setProperty(XACMLProperties.PROP_PIP_ENGINES, "AAF");
props.setProperty("AAF.name", "AAFEngine");
props.setProperty("AAF.description", "AAFEngine to communicate with AAF to take decisions");
props.setProperty("AAF.classname","org.openecomp.policy.xacml.std.pip.engines.aaf.AAFEngine");
+ // read from PIP properties file.
+ Path file = Paths.get(pipPropertyFile);
+ if (!Files.notExists(file)) {
+ InputStream in;
+ Properties prop = new Properties();
+ try {
+ in = new FileInputStream(file.toFile());
+ prop.load(in);
+ } catch (IOException e) {
+ PolicyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "can not load the pip properties from file" +e);
+ }
+ props = prop;
+ }
return props;
}
@@ -860,7 +815,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
for (EcompPDPGroup aGroup : groups) {
if (aGroup.getId().equals(group.getId())) {
if ( ! aGroup.isDefaultGroup()) {
-//TODO - since the original code checked for type we do also.
if (aGroup instanceof StdPDPGroup) {
((StdPDPGroup) aGroup).setDefault(true);
changesMade = true;
@@ -871,7 +825,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
} else {
// not the new default group
if (aGroup.isDefaultGroup()) {
-//TODO - since the original code checked for type we do also.
if (aGroup instanceof StdPDPGroup) {
((StdPDPGroup) aGroup).setDefault(false);
changesMade = true;
@@ -969,8 +922,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
throw new PAPException("Unable to rename directory; reason unknown");
}
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Move '" + oldPath + "' to '" + newPath + "': " + e.getMessage(), e);
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdEngine", "Unable to rename directory");
throw new PAPException("Unable to move directory from '" + oldPath + "' to '" + newPath + "': " + e.getMessage());
}
@@ -1002,8 +953,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
// Does this group exist?
//
if (this.groups.contains(group) == false) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "This group doesn't exist.");
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "This group doesn't exist.");
throw new PAPException("The group '" + group.getId() + "' does not exist");
}
@@ -1065,8 +1014,6 @@ public class StdEngine extends StdPDPItemSetChangeNotifier implements PAPPolicyE
//
Files.delete(groupPath);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to delete " + groupPath + ": " +e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdEngine", "Failed to delete " + groupPath);
throw new PAPException("Failed to delete " + id);
}
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java
index f4817ac8a..0606daa79 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPAPPolicy.java
@@ -21,6 +21,7 @@ package org.openecomp.policy.xacml.std.pap;
import java.io.Serializable;
import java.net.URI;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -28,7 +29,7 @@ import org.openecomp.policy.xacml.api.pap.EcompPAPPolicy;
public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
private static final long serialVersionUID = 5260230629397322000L;
-
+
private String policyName = null;
private String oldPolicyFileName = null;
private String policyDescription = null;
@@ -46,6 +47,8 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
private String configBodyData = null;
private String policyID = null;
private String ruleID = null;
+ private String brmsController;
+ private ArrayList<String> brmsDependency;
private String configType = null;
private Boolean editPolicy = false;
private Boolean draft = false;
@@ -65,28 +68,28 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
private String actionDictMethod = null;
private String uuid = null;
private String msLocation = null;
- private String priority = null;
+ private String priority = null;
private Map<String,String> drlRuleAndUIParams=null;
private String deleteCondition = null;
private String dictionaryType = null;
private String dictionary = null;
- private Map<String,String> dictionaryFields = new HashMap<String, String>();
+ private String dictionaryFields = null;
private String providerComboBox = null;
private String riskType = null;
private String guard = null;
private String riskLevel;
private String ttlDate = null;
-
+
public StdPAPPolicy() {
-
+
}
-
+
//Constructor for sending location when pushing policies
public StdPAPPolicy(URI location) {
this.location = location;
}
-
+
//Constructor for Validating Config Policies
public StdPAPPolicy(String policyName, String body, String configType, String configPolicyType) {
this.policyName = policyName;
@@ -94,7 +97,7 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.configType = configType;
this.configPolicyType = configPolicyType;
}
-
+
//convenience constructor
public StdPAPPolicy(String configPolicyType, String policyName, String description, String ecompName, String configName, Map<String, String> attributes, String configType,
String body, Boolean editPolicy, String domain, String riskLevel, String riskType, String guard, String ttlDate){
@@ -104,9 +107,9 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
//Constructor for Create/Update Action Policies from API
public StdPAPPolicy(String policyName, String description, Map<String, String> attributes, List<String> dynamicRuleAlgorithmLabels, List<String> dynamicRuleAlgorithmCombo,
- List<String> dynamicRuleAlgorithmField1, List<String> dynamicRuleAlgorithmField2, String actionPerformer,String actionAttribute, Boolean editPolicy,
- String domain, int highestVersion) {
-
+ List<String> dynamicRuleAlgorithmField1, List<String> dynamicRuleAlgorithmField2, String actionPerformer,String actionAttribute, Boolean editPolicy,
+ String domain, int highestVersion) {
+
this.policyName = policyName;
this.policyDescription = description;
this.dyanamicFieldConfigAttributes = attributes;
@@ -119,15 +122,15 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.editPolicy = editPolicy;
this.domain = domain;
this.highestVersion = highestVersion;
-
+
}
-
+
//Constructor for Create/Update Decision Policies from Admin Console
public StdPAPPolicy(String policyName, String description, String ecompName, String providerComboBox, Map<String, String> attributes, Map<String, String> settings,
List<String> dynamicRuleAlgorithmLabels, List<String> dynamicRuleAlgorithmCombo, List<String> dynamicRuleAlgorithmField1,
List<String> dynamicRuleAlgorithmField2, Map<String, String> dropDownMap, List<Object> dynamicVariableList,
List<String> dataTypeList, Boolean editPolicy, String domain, int highestVersion) {
-
+
this.policyName = policyName;
this.policyDescription = description;
this.ecompName = ecompName;
@@ -144,15 +147,15 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.editPolicy = editPolicy;
this.domain = domain;
this.highestVersion = highestVersion;
-
+
}
-
-
+
+
//Constructor for Create Config Policies from API and Admin Console
//Constructor for Updating Config Policies from the API
public StdPAPPolicy(String configPolicyType, String policyName, String description, String ecompName, String configName, Map<String, String> attributes, String configType,
- String body, Boolean editPolicy, String domain, int highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
-
+ String body, Boolean editPolicy, String domain, int highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -169,18 +172,18 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//convenience constructor
public StdPAPPolicy (String configPolicyType, String policyName, String description, String ecompName, String configName, Map<String, String> attributes, String body, String policyID,
String ruleID, String configType, Boolean editPolicy, String version, String domain, String riskLevel, String riskType, String guard, String ttlDate) {
this (configPolicyType, policyName, description, ecompName, configName, attributes, body, policyID,
ruleID, configType, editPolicy, version, domain, 1, riskLevel, riskType, guard, ttlDate);
- }
+ }
//Constructor for Updating Config Policies from Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description, String ecompName, String configName, Map<String, String> attributes, String body, String policyID,
- String ruleID, String configType, Boolean editPolicy, String version, String domain, int highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
-
+ String ruleID, String configType, Boolean editPolicy, String version, String domain, int highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -200,12 +203,12 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Creating Config Firewall Policies
public StdPAPPolicy (String configPolicyType, String policyName, String description, String configName,
Boolean editPolicy, String domain, String jsonBody, Integer highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
-
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -220,11 +223,11 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.ttlDate = ttlDate;
}
-
+
//Constructor for Creating Goc Policies
public StdPAPPolicy (String configPolicyType, String policyName, String description, String configName,
- Boolean editPolicy, String domain, String jsonBody, Integer highestVersion, String eCompName, String riskLevel, String riskType, String guard, String ttlDate) {
-
+ Boolean editPolicy, String domain, String jsonBody, Integer highestVersion, String eCompName, String riskLevel, String riskType, String guard, String ttlDate) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -239,13 +242,13 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Creating BRMS Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description,
String configName, Boolean editPolicy, String domain,
Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
- String configBodyData, String riskLevel, String riskType, String guard, String ttlDate) {
-
+ String configBodyData, String riskLevel, String riskType, String guard, String ttlDate, String brmsController, ArrayList<String> brmsDependency) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -260,14 +263,16 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.riskType = riskType;
this.guard = guard;
this.ttlDate = ttlDate;
+ this.brmsController = brmsController;
+ this.brmsDependency = brmsDependency;
}
//Constructor for Creating BRMS Param Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description,
String configName, Boolean editPolicy, String domain,
Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
- String configBodyData,Map<String,String> drlRuleAndUIParams, String riskLevel, String riskType, String guard, String ttlDate) {
-
+ String configBodyData,Map<String,String> drlRuleAndUIParams, String riskLevel, String riskType, String guard, String ttlDate, String brmsController, ArrayList<String> brmsDependency) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -283,13 +288,15 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.riskType = riskType;
this.guard = guard;
this.ttlDate = ttlDate;
+ this.brmsController = brmsController;
+ this.brmsDependency = brmsDependency;
}
-
+
//Constructor for Creating CloseLoop_Fault and Performance Metric Policies
public StdPAPPolicy (String configPolicyType, String policyName, String description, String ecompName,
String jsonBody, Boolean draft, String oldPolicyFileName, String serviceType, Boolean editPolicy,
String domain, Integer highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
-
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -306,11 +313,11 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Updating Config Firewall Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description, String configName, Boolean editPolicy, String domain, String policyID,
String ruleID, String version, String jsonBody, Integer highestVersion, String riskLevel, String riskType, String guard, String ttlDate) {
-
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -327,11 +334,11 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
- //Constructor for Micro Service Creating/Updating Policies from the Admin Console
+
+ //Constructor for Micro Service Creating/Updating Policies from the Admin Console
public StdPAPPolicy(String configPolicyType, String policyName, String description, String ecompName, String configName, String serviceType, String uuid,
- String msLocation, String jsonBody, String priority, String version, Boolean editPolicy, String domain, int highestVersion, String riskLevel,
- String riskType, String guard, String ttlDate) {
+ String msLocation, String jsonBody, String priority, String version, Boolean editPolicy, String domain, int highestVersion, String riskLevel,
+ String riskType, String guard, String ttlDate) {
this.configPolicyType = configPolicyType;
this.policyName = policyName;
@@ -341,8 +348,8 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.serviceType = serviceType;
this.uuid = uuid;
this.msLocation = msLocation;
- this.priority = priority;
- this.version = version;
+ this.priority = priority;
+ this.version = version;
this.jsonBody = jsonBody;
this.editPolicy = editPolicy;
this.domain = domain;
@@ -352,13 +359,13 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Updating Goc Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description,
- String configName, Boolean editPolicy, String domain,
- String policyID, String ruleID, String version,
- String jsonBody, Integer highestVersion, String eCompName,String riskLevel, String riskType, String guard, String ttlDate) {
-
+ String configName, Boolean editPolicy, String domain,
+ String policyID, String ruleID, String version,
+ String jsonBody, Integer highestVersion, String eCompName,String riskLevel, String riskType, String guard, String ttlDate) {
+
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -376,14 +383,14 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Updating Brms Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description,
- String configName, Boolean editPolicy, String domain,
- String policyID, String ruleID, String version,
- Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
- String configBodyData , String riskLevel, String riskType, String guard, String ttlDate
- ) {
+ String configName, Boolean editPolicy, String domain,
+ String policyID, String ruleID, String version,
+ Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
+ String configBodyData , String riskLevel, String riskType, String guard, String ttlDate
+ ) {
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -402,14 +409,14 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.guard = guard;
this.ttlDate = ttlDate;
}
-
+
//Constructor for Updating Brms Param Policies from the Admin Console
public StdPAPPolicy (String configPolicyType, String policyName, String description,
- String configName, Boolean editPolicy, String domain,
- String policyID, String ruleID, String version,
- Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
- Map<String,String> drlRuleAndUIParams, String riskLevel, String riskType, String guard, String ttlDate
- ) {
+ String configName, Boolean editPolicy, String domain,
+ String policyID, String ruleID, String version,
+ Map<String,String> dyanamicFieldConfigAttributes, Integer highestVersion, String eCompName,
+ Map<String,String> drlRuleAndUIParams, String riskLevel, String riskType, String guard, String ttlDate
+ ) {
this.configPolicyType = configPolicyType;
this.policyName = policyName;
this.policyDescription = description;
@@ -434,9 +441,9 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.policyName = policyName;
this.deleteCondition = deleteCondition;
}
-
- // Constructor for creating dictionary items from the API
- public StdPAPPolicy(String dictionaryType, String dictionary, Map<String,String> dictionaryFields) {
+
+ // Constructor for creating dictionary items from the API>
+ public StdPAPPolicy(String dictionaryType, String dictionary, String dictionaryFields) {
this.dictionaryType = dictionaryType;
this.dictionary = dictionary;
this.dictionaryFields = dictionaryFields;
@@ -446,87 +453,87 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public String getPolicyName() {
return policyName;
}
-
+
@Override
public String getPolicyDescription() {
return policyDescription;
}
-
+
@Override
public String getEcompName() {
return ecompName;
}
-
+
@Override
public String getConfigName() {
return configName;
}
-
+
@Override
public Map<String, String> getDynamicFieldConfigAttributes() {
return dyanamicFieldConfigAttributes;
}
-
+
@Override
public String getConfigBodyData() {
return configBodyData;
}
-
+
@Override
public String getPolicyID() {
return policyID;
}
-
+
@Override
public String getRuleID() {
return ruleID;
}
-
+
@Override
public String getConfigType() {
return configType;
}
-
+
@Override
public Boolean isEditPolicy() {
return editPolicy;
}
-
+
@Override
public Boolean isDraft() {
return draft;
}
-
+
@Override
public String getVersion() {
return version;
}
-
+
@Override
public String getDomainDir() {
return domain;
}
-
+
@Override
public String getConfigPolicyType() {
return configPolicyType;
}
-
+
@Override
public String getJsonBody() {
return jsonBody;
}
-
+
@Override
public Integer getHighestVersion() {
return highestVersion;
}
-
+
@Override
public URI getLocation() {
return location;
}
-
+
@Override
public List<String> getDynamicRuleAlgorithmLabels() {
return dynamicRuleAlgorithmLabels;
@@ -556,99 +563,99 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public String getActionAttribute() {
return actionAttribute;
}
-
+
@Override
public String getActionBody() {
return actionBody;
}
-
+
@Override
public Map<String, String> getDropDownMap() {
return dropDownMap;
}
-
+
@Override
public String getActionDictHeader() {
return actionDictHeader;
}
-
+
@Override
public String getActionDictType() {
return actionDictType;
}
-
+
@Override
public String getActionDictUrl() {
return actionDictUrl;
}
-
+
@Override
public String getActionDictMethod() {
return actionDictMethod;
}
-
+
@Override
public Map<String, String> getDynamicSettingsMap() {
return dynamicSettingsMap;
}
-
+
@Override
public List<Object> getDynamicVariableList() {
return dynamicVariableList;
}
-
+
@Override
public List<String> getDataTypeList() {
return dataTypeList;
}
-
+
@Override
public String getOldPolicyFileName() {
return oldPolicyFileName;
}
-
+
@Override
public String getServiceType() {
return serviceType;
}
-
+
@Override
public String getUuid() {
return uuid;
}
-
+
@Override
public String getMsLocation() {
return msLocation;
}
-
- @Override
- public String getPriority() {
- return priority;
- }
-
- @Override
+
+ @Override
+ public String getPriority() {
+ return priority;
+ }
+
+ @Override
public String getDeleteCondition() {
return deleteCondition;
}
-
- @Override
+
+ @Override
public String getDictionaryType() {
return dictionaryType;
}
-
- @Override
+
+ @Override
public String getDictionary() {
return dictionary;
}
-
+
@Override
public String getTTLDate(){
return ttlDate;
}
- @Override
- public Map<String, String> getDictionaryFields() {
+ @Override
+ public String getDictionaryFields() {
return dictionaryFields;
}
@@ -656,17 +663,17 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public String getRiskType() {
return riskType;
}
-
+
@Override
public String getRiskLevel() {
return riskLevel;
}
-
+
@Override
public String getGuard() {
return guard;
}
-
+
@Override
public String toString() {
return "StdPAPPolicy [policyName=" + policyName + ", policyDescription=" + policyDescription + ", ecompName="
@@ -679,45 +686,45 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
+ ",actionDictHeader=" + actionDictHeader + ",actionDictType=" + actionDictType + ",actionDictUrl=" + actionDictUrl
+ ",actionDictMethod=" + actionDictMethod + ",dynamicSettingsMap=" + dynamicSettingsMap + ",dynamicVariableList=" + dynamicVariableList + ",providerComboBox=" + providerComboBox
+ ",dataTypeList=" + dataTypeList + ",draft=" + ",oldPolicyFileName=" + oldPolicyFileName + ",serviceType=" + serviceType
- + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority=" + priority + ",deleteCondition=" + deleteCondition + ",dictionaryType=" + dictionaryType
- + ",dictionary=" + dictionary + ",dictionaryFields=" + dictionaryFields + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority="
- + priority + ",deleteCondition=" + deleteCondition + ",riskType="+riskType + ",riskLevel="+riskLevel + ",guard="+ guard + ",ttlDate="+ ttlDate + "]";
+ + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority=" + priority + ",deleteCondition=" + deleteCondition + ",dictionaryType=" + dictionaryType
+ + ",dictionary=" + dictionary + ",dictionaryFields=" + dictionaryFields + ",uuid=" + uuid + ",msLocation=" + msLocation + ",priority="
+ + priority + ",deleteCondition=" + deleteCondition + ",riskType="+riskType + ",riskLevel="+riskLevel + ",guard="+ guard + ",ttlDate="+ ttlDate + "]";
}
-
+
// Methods needed for JSON Deserialization
public void setPolicyName(String policyName) {
this.policyName = policyName;
}
-
+
public void setPolicyDescription(String policyDescription) {
this.policyDescription = policyDescription;
}
-
+
public void setEcompName(String ecompName) {
this.ecompName = ecompName;
}
-
+
public void setConfigName(String configName) {
this.configName = configName;
}
-
+
public void setDyanamicFieldConfigAttributes(
Map<String, String> dyanamicFieldConfigAttributes) {
this.dyanamicFieldConfigAttributes = dyanamicFieldConfigAttributes;
}
-
+
public void setConfigBodyData(String configBodyData) {
this.configBodyData = configBodyData;
}
-
+
public void setPolicyID(String policyID) {
this.policyID = policyID;
}
-
+
public void setRuleID(String ruleID) {
this.ruleID = ruleID;
}
-
+
public void setConfigType(String configType) {
this.configType = configType;
}
@@ -741,15 +748,15 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public void setJsonBody(String jsonBody) {
this.jsonBody = jsonBody;
}
-
+
public void setHighestVersion(Integer highestVersion) {
this.highestVersion = highestVersion;
}
-
+
public void setLocation (URI location) {
this.location = location;
}
-
+
public void setDynamicRuleAlgorithmLabels(
List<String> dynamicRuleAlgorithmLabels) {
this.dynamicRuleAlgorithmLabels = dynamicRuleAlgorithmLabels;
@@ -824,7 +831,6 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public void setServiceType(String serviceType) {
this.serviceType = serviceType;
}
-
public Map<String, String> getDrlRuleAndUIParams() {
return drlRuleAndUIParams;
@@ -841,10 +847,10 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public void setMsLocation(String msLocation) {
this.msLocation = msLocation;
}
-
- public void setPriority(String priority) {
- this.priority = priority;
- }
+
+ public void setPriority(String priority) {
+ this.priority = priority;
+ }
public void setDeleteCondition(String deleteCondition) {
this.deleteCondition = deleteCondition;
@@ -858,7 +864,7 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
this.dictionary = dictionary;
}
- public void setDictionaryFields(Map<String, String> dictionaryFields) {
+ public void setDictionaryFields(String dictionaryFields) {
this.dictionaryFields = dictionaryFields;
}
@@ -869,21 +875,36 @@ public class StdPAPPolicy implements EcompPAPPolicy, Serializable{
public void setProviderComboBox(String providerComboBox) {
this.providerComboBox = providerComboBox;
}
-
+
public void setRiskType(String riskType){
this.riskType = riskType;
}
-
+
public void setRiskLevel(String riskLevel){
this.riskLevel = riskLevel;
}
-
+
public void setGuard(String guard){
this.guard = guard;
}
-
+
public void setTTLDate(String ttlDate){
this.ttlDate = ttlDate;
}
-}
+ public String getBrmsController() {
+ return brmsController;
+ }
+
+ public void setBrmsController(String brmsController) {
+ this.brmsController = brmsController;
+ }
+
+ public ArrayList<String> getBrmsDependency() {
+ return brmsDependency;
+ }
+
+ public void setBrmsDependency(ArrayList<String> brmsDependency) {
+ this.brmsDependency = brmsDependency;
+ }
+} \ No newline at end of file
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java
index ae4a43db6..46bb73b16 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPGroup.java
@@ -19,9 +19,7 @@
*/
package org.openecomp.policy.xacml.std.pap;
-import org.openecomp.policy.common.logging.eelf.MessageCodes;
-import org.openecomp.policy.common.logging.eelf.PolicyLogger;
-
+import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
@@ -40,13 +38,15 @@ import java.util.TreeSet;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.openecomp.policy.common.logging.eelf.MessageCodes;
+import org.openecomp.policy.common.logging.eelf.PolicyLogger;
+import org.openecomp.policy.xacml.api.XACMLErrorConstants;
import org.openecomp.policy.xacml.api.pap.EcompPDP;
import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
import org.openecomp.policy.xacml.std.pap.StdPDPItemSetChangeNotifier.StdItemSetChangeListener;
import com.att.research.xacml.api.pap.PAPException;
import com.att.research.xacml.api.pap.PDP;
-import com.att.research.xacml.api.pap.PDPGroup;
//import com.att.research.xacml.api.pap.PDPGroup;
import com.att.research.xacml.api.pap.PDPGroupStatus;
import com.att.research.xacml.api.pap.PDPGroupStatus.Status;
@@ -76,8 +76,12 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
private Set<PDPPolicy> policies = new HashSet<PDPPolicy>();
+ private Set<PDPPolicy> selectedPolicies = new HashSet<PDPPolicy>();
+
private Set<PDPPIPConfig> pipConfigs = new HashSet<PDPPIPConfig>();
+ private String operation;
+
@JsonIgnore
private Path directory;
@@ -155,8 +159,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
Files.createDirectory(directory);
this.status.addLoadWarning("Group directory does NOT exist");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Group directory does NOT exist");
this.status.addLoadError("Group directory does NOT exist");
this.status.setStatus(PDPGroupStatus.Status.LOAD_ERRORS);
@@ -216,8 +218,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
Properties pipProperties = new Properties();
if ( ! file.toFile().exists()) {
// need to create the properties file with no values
- // TODO: Adding Default PIP engine(s) while Loading initially. We don't want
- // Programmer intervention with the PIP engines.
pipProperties = setPIPProperties(pipProperties);
// save properties to file
try {
@@ -227,6 +227,12 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
} catch (Exception e) {
throw new PAPException("Failed to create new default pip properties file '" + file +"'");
}
+ //Even if we create a new pip file, we still need to parse and load the properties
+ try{
+ this.readPIPProperties(directory, pipProperties);
+ }catch(Exception e){
+ throw new PAPException("Failed to load the new pip properties file");
+ }
} else {
try {
//
@@ -375,12 +381,21 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
}
@Override
- public PDPGroupStatus getStatus()
- {
+ public PDPGroupStatus getStatus(){
return this.status;
}
@Override
+ public Set<PDPPolicy> getSelectedPolicies() {
+ return this.selectedPolicies;
+ }
+
+ @Override
+ public String getOperation() {
+ return this.operation;
+ }
+
+ @Override
public Set<PDP> getPdps() {
return Collections.unmodifiableSet(pdps);
}
@@ -474,8 +489,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try {
Files.delete(tempFile);
} catch(Exception ee) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy was invalid, could NOT delete it.", ee);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, ee, "StdPDPGroup", "Policy was invalid, could NOT delete it.");
}
throw new PAPException("Policy is invalid");
@@ -493,8 +506,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
//
return tempRootPolicy;
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Failed to publishPolicy: ", e);
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdPDPGroup", "Failed to publishPolicy");
}
return null;
@@ -521,43 +532,69 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
long num;
Path policyFilePath = Paths.get(this.directory.toAbsolutePath().toString(), id);
+ Path policyFile;
+ if (Files.exists(policyFilePath)) {
+ policyFile = policyFilePath;
+ } else {
+ policyFile = Files.createFile(policyFilePath);
+ }
+
+ try (OutputStream os = Files.newOutputStream(policyFile)) {
+ num = ByteStreams.copy(policy, os);
+ }
+
+ logger.info("Copied " + num + " bytes for policy " + name);
+
+ for (PDPPolicy p : policies) {
+ if (p.getId().equals(id)) {
+ // we just re-copied/refreshed/updated the policy file for a policy that already exists in this group
+ logger.info("Policy '" + id + "' already exists in group '" + getId() + "'");
+ return;
+ }
+ }
+
+ // policy is new to this group
+ StdPDPPolicy tempRootPolicy = new StdPDPPolicy(id, true, name, policyFile.toUri());
+ if (tempRootPolicy.isValid() == false) {
+ try {
+ Files.delete(policyFile);
+ } catch(Exception ee) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, ee, "StdPDPGroup", "Policy was invalid, could NOT delete it.");
+ }
+ throw new PAPException("Policy is invalid");
+ }
+ //
+ // Add it in
//
- // THERE IS A WEIRD PROBLEM ON WINDOWS...
- // The file is already "in use" when we try to access it.
- // Looking at the file externally while this is halted here does not show the file in use,
- // so there is no indication what is causing the problem.
+ this.policies.add(tempRootPolicy);
//
- // As a way to by-pass the issue, I simply check if the input and the existing file are identical
- // and generate an exception if they are not.
+ // We are changed
//
-
+ this.firePDPGroupChanged(this);
+ } catch (IOException e) {
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to copyPolicyToFile");
+ throw new PAPException("Failed to copy policy to file: " + e);
+ }
+ return;
+ }
+
+ /**
+ * Policy Engine API Copy one policy file into the Group's directory but do not change the configuration.
+ *
+ * @param id
+ * @param name
+ * @param policy
+ * @return
+ * @throws PAPException
+ */
+ public void copyPolicyToFile(String id, String name, InputStream policy) throws PAPException {
+ try {
+ //
+ // Copy the policy over
+ //
+ long num;
+ Path policyFilePath = Paths.get(this.directory.toAbsolutePath().toString(), id);
-
-// if (Files.exists(policyFilePath)) {
-// // compare the
-// String incomingPolicyString = null;
-// try (ByteArrayOutputStream os = new ByteArrayOutputStream()) {
-// num = ByteStreams.copy(policy, os);
-// incomingPolicyString = new String(os.toByteArray(), "UTF-8");
-// }
-// String existingPolicyString = null;
-// try {
-// byte[] bytes = Files.readAllBytes(policyFilePath);
-// existingPolicyString = new String(bytes, "UTF-8");
-// } catch (Exception e) {
-// //TODO:EELF Cleanup - Remove logger
-// logger.error("Unable to read existing file '" + policyFilePath + "': " + e, e);
-// PolicyLogger.error(MessageCodes.EXCEPTION_ERROR, e, "StdPDPGroup", "Unable to read existing policy file");
-// throw new PAPException("Unable to read policy file for comparison: " + e);
-// }
-// if (incomingPolicyString.equals(existingPolicyString)) {
-// throw new PAPException("Policy '" + policyFilePath + "' does not match existing policy on server");
-// }
-// // input is same as existing file
-// return;
-// }
-
-
Path policyFile;
if (Files.exists(policyFilePath)) {
policyFile = policyFilePath;
@@ -568,9 +605,8 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try (OutputStream os = Files.newOutputStream(policyFile)) {
num = ByteStreams.copy(policy, os);
}
-
- logger.info("Copied " + num + " bytes for policy " + name);
+ logger.info("Copied " + num + " bytes for policy " + name);
for (PDPPolicy p : policies) {
if (p.getId().equals(id)) {
// we just re-copied/refreshed/updated the policy file for a policy that already exists in this group
@@ -585,8 +621,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try {
Files.delete(policyFile);
} catch(Exception ee) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy was invalid, could NOT delete it.", ee);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, ee, "StdPDPGroup", "Policy was invalid, could NOT delete it.");
}
throw new PAPException("Policy is invalid");
@@ -599,24 +633,17 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
// We are changed
//
this.firePDPGroupChanged(this);
-
-
-
-
+
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to copyPolicyToFile: ", e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to copyPolicyToFile");
throw new PAPException("Failed to copy policy to file: " + e);
}
return;
}
-
+
public boolean removePolicyFromGroup(PDPPolicy policy) {
StdPDPPolicy currentPolicy = (StdPDPPolicy) this.getPolicy(policy.getId());
if (currentPolicy == null) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy " + policy.getId() + " does not exist.");
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Policy " + policy.getId() + " does not exist.");
return false;
}
@@ -631,8 +658,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
this.firePDPGroupChanged(this);
return true;
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to delete policy " + policy);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to delete policy");
}
return false;
@@ -641,8 +666,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
public boolean removePolicy(PDPPolicy policy) {
StdPDPPolicy currentPolicy = (StdPDPPolicy) this.getPolicy(policy.getId());
if (currentPolicy == null) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Policy " + policy.getId() + " does not exist.");
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Policy " + policy.getId() + " does not exist.");
return false;
}
@@ -661,8 +684,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
this.firePDPGroupChanged(this);
return true;
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to delete policy " + policy);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to delete policy " + policy);
}
return false;
@@ -724,8 +745,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
fire = true;
this.status.addLoadWarning("Created missing group directory");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to create missing Group directory.");
this.status.addLoadError("Failed to create missing Group directory.");
this.status.setStatus(PDPGroupStatus.Status.LOAD_ERRORS);
@@ -741,8 +760,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
fire = true;
this.status.addLoadWarning("Created missing PIP properties file");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to create missing PIP properties file");
this.status.addLoadError("Failed to create missing PIP properties file");
this.status.setStatus(PDPGroupStatus.Status.LOAD_ERRORS);
@@ -758,8 +775,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
fire = true;
this.status.addLoadWarning("Created missing Policy properties file");
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to create missing Policy properties file");
this.status.addLoadError("Failed to create missing Policy properties file");
this.status.setStatus(PDPGroupStatus.Status.LOAD_ERRORS);
@@ -813,8 +828,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try {
policy = new StdPDPPolicy(id, isRoot, policyPath.toUri(), properties);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to create policy object", e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Failed to create policy object");
policy = null;
}
@@ -829,7 +842,7 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
this.status.setStatus(Status.LOAD_ERRORS);
}
// force all policies to have a name
- if (policy.getName() == null) {
+ if (policy!=null && policy.getName() == null) {
policy.setName(policy.getId());
}
}
@@ -884,7 +897,8 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
return "StdPDPGroup [id=" + id + ", isDefault=" + isDefault + ", name="
+ name + ", description=" + description + ", status=" + status
+ ", pdps=" + pdps + ", policies=" + policies + ", pipConfigs="
- + pipConfigs + ", directory=" + directory + "]";
+ + pipConfigs + ", directory=" + directory + ",selectedPolicies="
+ + selectedPolicies + ",operation=" + operation + "]";
}
@Override
@@ -894,8 +908,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try {
saveGroupConfiguration();
} catch (PAPException | IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Unable to save group configuration change");
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW, e, "StdPDPGroup", "Unable to save group configuration change");
// don't notify other things of change if we cannot save it???
return;
@@ -915,8 +927,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
//
// If one of the group's PDP's changed, then the group changed
//
- // TODO Really?
- //
this.changed();
}
@@ -950,8 +960,12 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
public void setPolicies(Set<PDPPolicy> policies) {
this.policies = policies;
}
-
-
+ public void setSelectedPolicies(Set<PDPPolicy> selectedPolicies) {
+ this.selectedPolicies = selectedPolicies;
+ }
+ public void setOperation(String operation) {
+ this.operation = operation;
+ }
public void saveGroupConfiguration() throws PAPException, IOException {
@@ -972,8 +986,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try (OutputStream os = Files.newOutputStream(file)) {
policyProperties.store(os, "");
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Group Policies Config save failed: " + e, e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "STdPDPGroup", "Group Policies Config save failed");
throw new PAPException("Failed to save policy properties file '" + file +"'");
}
@@ -989,8 +1001,6 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
try (OutputStream os = Files.newOutputStream(file)) {
pipProperties.store(os, "");
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Group PIP Config save failed: " + e, e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "StdPDPGroup", "Group PIP Config save failed");
throw new PAPException("Failed to save pip properties file '" + file +"'");
}
@@ -1017,13 +1027,26 @@ public class StdPDPGroup extends StdPDPItemSetChangeNotifier implements EcompPDP
return name.compareTo(((StdPDPGroup)arg0).name);
}
- // TODO: Adding Default PIP engine(s) while Loading initially. We don't want
+ //Adding Default PIP engine(s) while Loading initially. We don't want
// Programmer intervention with the PIP engines.
private Properties setPIPProperties(Properties props){
props.setProperty("AAF.name", "AAFEngine");
props.setProperty("AAF.description", "AAFEngine to communicate with AAF to take decisions");
props.setProperty("AAF.classname","org.openecomp.policy.xacml.std.pip.engines.aaf.AAFEngine");
props.setProperty(XACMLProperties.PROP_PIP_ENGINES, "AAF");
+ // read from PIP properties file.
+ Path file = Paths.get(StdEngine.pipPropertyFile);
+ if (!Files.notExists(file)) {
+ InputStream in;
+ Properties prop = new Properties();
+ try {
+ in = new FileInputStream(file.toFile());
+ prop.load(in);
+ } catch (IOException e) {
+ PolicyLogger.error(XACMLErrorConstants.ERROR_SYSTEM_ERROR + "can not load the pip properties from file" +e);
+ }
+ props = prop;
+ }
return props;
}
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java
index 38f8a5800..a197d5f3d 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPItemSetChangeNotifier.java
@@ -25,9 +25,6 @@ import java.util.LinkedList;
import org.openecomp.policy.xacml.api.pap.EcompPDP;
import org.openecomp.policy.xacml.api.pap.EcompPDPGroup;
-import com.att.research.xacml.api.pap.PDP;
-import com.att.research.xacml.api.pap.PDPGroup;
-
public class StdPDPItemSetChangeNotifier {
private Collection<StdItemSetChangeListener> listeners = null;
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java
index 814dbe3af..909f64620 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPIPConfig.java
@@ -137,7 +137,6 @@ public class StdPDPPIPConfig implements PDPPIPConfig, Serializable {
@JsonIgnore
public boolean isConfigured() {
//
- // TODO
// Also include this in the JSON I/O if it is a data field rather than calculated
//
return true;
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPolicy.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPolicy.java
index 06c2498f6..0300a3d06 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPolicy.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pap/StdPDPPolicy.java
@@ -168,8 +168,6 @@ public class StdPDPPolicy implements PDPPolicy, Serializable {
this.version = versionStringToArray(((PolicyType)rootElement).getVersion());
this.isValid = true;
} else {
- //TODO:EELF Cleanup - Remove logger
- //logger.error("Unknown root element: " + rootElement.getClass().getCanonicalName());
PolicyLogger.error("Unknown root element: " + rootElement.getClass().getCanonicalName());
}
}
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java
index 6dea4c21f..581009d18 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/std/pip/engines/aaf/AAFEngine.java
@@ -19,6 +19,7 @@
*/
package org.openecomp.policy.xacml.std.pip.engines.aaf;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -47,6 +48,7 @@ import com.att.research.xacml.std.pip.StdMutablePIPResponse;
import com.att.research.xacml.std.pip.StdPIPRequest;
import com.att.research.xacml.std.pip.StdPIPResponse;
import com.att.research.xacml.std.pip.engines.StdConfigurableEngine;
+import com.att.research.xacml.util.XACMLProperties;
/**
* PIP Engine for Implementing {@link com.att.research.xacml.std.pip.engines.ConfigurableEngine} interface to provide
@@ -73,7 +75,6 @@ public class AAFEngine extends StdConfigurableEngine {
private static final PIPRequest PIP_REQUEST_TYPE = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("AAF_TYPE"), XACML3.ID_DATATYPE_STRING);
private static final PIPRequest PIP_REQUEST_INSTANCE = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("AAF_INSTANCE"), XACML3.ID_DATATYPE_STRING);
private static final PIPRequest PIP_REQUEST_ACTION = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("AAF_ACTION"), XACML3.ID_DATATYPE_STRING);
- private static final PIPRequest PIP_REQUEST_ENV = new StdPIPRequest(XACML3.ID_ATTRIBUTE_CATEGORY_RESOURCE, new IdentifierImpl("AAF_ENVIRONMENT"), XACML3.ID_DATATYPE_STRING);
private static final List<PIPRequest> mapRequiredAttributes = new ArrayList<PIPRequest>();
static{
@@ -82,7 +83,6 @@ public class AAFEngine extends StdConfigurableEngine {
mapRequiredAttributes.add(new StdPIPRequest(PIP_REQUEST_TYPE));
mapRequiredAttributes.add(new StdPIPRequest(PIP_REQUEST_INSTANCE));
mapRequiredAttributes.add(new StdPIPRequest(PIP_REQUEST_ACTION));
- mapRequiredAttributes.add(new StdPIPRequest(PIP_REQUEST_ENV));
}
private static final Map<PIPRequest, String> mapSupportedAttributes = new HashMap<PIPRequest, String>();
@@ -135,27 +135,21 @@ public class AAFEngine extends StdConfigurableEngine {
PIPResponse pipResponseType = this.getAttribute(PIP_REQUEST_TYPE, pipFinder);
PIPResponse pipResponseAction = this.getAttribute(PIP_REQUEST_ACTION, pipFinder);
PIPResponse pipResponseInstance = this.getAttribute(PIP_REQUEST_INSTANCE, pipFinder);
- PIPResponse pipResponseEnv = this.getAttribute(PIP_REQUEST_ENV, pipFinder);
String response = null;
// Evaluate AAF if we have all the required values.
- if(pipResponseUID!=null && pipResponsePass!=null && pipResponseType != null && pipResponseAction!= null && pipResponseInstance!=null && pipResponseEnv!=null){
- // Check the Environment.
- String environment = getValue(pipResponseEnv);
- if(environment == null){
- response = "Environment Value is not set. ";
- }
+ if(pipResponseUID!=null && pipResponsePass!=null && pipResponseType != null && pipResponseAction!= null && pipResponseInstance!=null){
String userName = getValue(pipResponseUID);
String pass = getValue(pipResponsePass);
AAFPolicyClient aafClient = null;
- Properties properties = new Properties();
- if(environment.equalsIgnoreCase("PROD")){
- properties.setProperty("ENVIRONMENT", "PROD");
- }else if(environment.equalsIgnoreCase("TEST")){
- properties.setProperty("ENVIRONMENT", "TEST");
- }else{
- properties.setProperty("ENVIRONMENT", "DEVL");
- }
- logger.debug("environment : " + environment);
+ Properties properties;
+ try {
+ properties = XACMLProperties.getProperties();
+ logger.debug("environment : " + properties.getProperty("ENVIRONMENT"));
+ } catch (IOException e1) {
+ logger.error("Exception while getting the properties " + e1);
+ properties = new Properties();
+ properties.setProperty("AAF_LOG_LEVEL", "DEBUG");
+ }
if(userName!=null && pass!=null){
try {
aafClient = AAFPolicyClient.getInstance(properties);
@@ -273,4 +267,4 @@ public class AAFEngine extends StdConfigurableEngine {
return attributes;
}
-}
+} \ No newline at end of file
diff --git a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/util/XACMLPolicyScanner.java b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/util/XACMLPolicyScanner.java
index 7fa2aa414..7b91426b5 100644
--- a/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/util/XACMLPolicyScanner.java
+++ b/ECOMP-XACML/src/main/java/org/openecomp/policy/xacml/util/XACMLPolicyScanner.java
@@ -90,8 +90,15 @@ public class XACMLPolicyScanner {
try (InputStream is = Files.newInputStream(filename)) {
this.policyObject = XACMLPolicyScanner.readPolicy(is);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to read policy", e);
+ PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyScanner", "Failed to read policy");
+ }
+ this.callback = callback;
+ }
+
+ public XACMLPolicyScanner(InputStream filename, Callback callback) {
+ try (InputStream is = filename) {
+ this.policyObject = XACMLPolicyScanner.readPolicy(is);
+ } catch (IOException e) {
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyScanner", "Failed to read policy");
}
this.callback = callback;
@@ -155,8 +162,6 @@ public class XACMLPolicyScanner {
} else if (this.policyObject instanceof PolicySetType) {
this.scanPolicySet(null, (PolicySetType) this.policyObject);
} else {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_PROCESS_FLOW + "Unknown class type: " + this.policyObject.getClass().getCanonicalName());
PolicyLogger.error(MessageCodes.ERROR_PROCESS_FLOW + "Unknown class type: " + this.policyObject.getClass().getCanonicalName());
}
if (this.callback != null) {
@@ -518,8 +523,6 @@ public class XACMLPolicyScanner {
try (InputStream is = Files.newInputStream(policy)) {
data = XACMLPolicyScanner.readPolicy(is);
} catch (IOException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Failed to read policy", e);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyScanner", "Failed to read policy");
throw e;
}
@@ -545,8 +548,6 @@ public class XACMLPolicyScanner {
version = ((PolicyType)data).getVersion();
} else {
if (data != null) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Expecting a PolicySet/Policy/Rule object. Got: " + data.getClass().getCanonicalName());
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Expecting a PolicySet/Policy/Rule object. Got: " + data.getClass().getCanonicalName());
}
return null;
@@ -557,8 +558,6 @@ public class XACMLPolicyScanner {
logger.warn("No version set in policy");
}
} catch (NumberFormatException e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Invalid version contained in policy: " + version);
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE, e, "XACMLPolicyScanner", "Invalid version contained in policy: " + version);
return null;
}
@@ -577,8 +576,6 @@ public class XACMLPolicyScanner {
} else if (data instanceof PolicyType) {
return ((PolicyType)data).getPolicyId();
} else {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_DATA_ISSUE + "Expecting a PolicySet/Policy/Rule object. Got: " + data.getClass().getCanonicalName());
PolicyLogger.error(MessageCodes.ERROR_DATA_ISSUE + "Expecting a PolicySet/Policy/Rule object. Got: " + data.getClass().getCanonicalName());
return null;
}
@@ -711,8 +708,6 @@ public class XACMLPolicyScanner {
}
}
} catch (Exception e) {
- //TODO:EELF Cleanup - Remove logger
- //logger.error(XACMLErrorConstants.ERROR_SCHEMA_INVALID + e.getMessage());
PolicyLogger.error(MessageCodes.ERROR_SCHEMA_INVALID, e, "XACMLPolicyScanner", "Exception in readPolicy");
}
return null;
diff --git a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/XACMLEngineTest.java b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/XACMLEngineTest.java
index 660180b9b..d2198a12f 100644
--- a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/XACMLEngineTest.java
+++ b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/XACMLEngineTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.policy.xacml.test;
+/*package org.openecomp.policy.xacml.test;
import java.io.IOException;
import java.util.ArrayList;
@@ -82,3 +82,4 @@ public class XACMLEngineTest extends TestCase{
}
}
+*/ \ No newline at end of file
diff --git a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/RequestCategoryTest.java b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/RequestCategoryTest.java
index e4ef4bef7..905c1a18a 100644
--- a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/RequestCategoryTest.java
+++ b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/RequestCategoryTest.java
@@ -852,9 +852,9 @@ public class RequestCategoryTest {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
"\"DataType\" : \"urn:oasis:names:tc:xacml:2.0:data-type:ipAddress\", " +
- "\"Value\" : \"10.221.43.58:12345\" " +
+ "\"Value\" : \"121.221.43.58:12345\" " +
"}] } ] }}");
- assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=10.221.43.58:12345-12345}],includeInResults=false}]}}]}", request.toString());
+ assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=121.221.43.58:12345-12345}],includeInResults=false}]}}]}", request.toString());
} catch (Exception e) {
fail ("Failed convert from JSON to object: " + e);
}
@@ -1053,9 +1053,9 @@ public class RequestCategoryTest {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
"\"DataType\" : \"ipAddress\", " +
- "\"Value\" : \"10.221.43.58:12345\" " +
+ "\"Value\" : \"121.221.43.58:12345\" " +
"}] } ] }}");
- assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=10.221.43.58:12345-12345}],includeInResults=false}]}}]}", request.toString());
+ assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=121.221.43.58:12345-12345}],includeInResults=false}]}}]}", request.toString());
} catch (Exception e) {
fail ("Failed convert from JSON to object: " + e);
}
@@ -1241,9 +1241,9 @@ public class RequestCategoryTest {
try {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
- "\"Value\" : \"10.221.43.58:12345\" " +
+ "\"Value\" : \"121.221.43.58:12345\" " +
"}] } ] }}");
- assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=10.221.43.58:12345}],includeInResults=false}]}}]}", request.toString());
+ assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=121.221.43.58:12345}],includeInResults=false}]}}]}", request.toString());
} catch (Exception e) {
fail ("Failed convert from JSON to object: " + e);
}
@@ -2594,9 +2594,9 @@ public class RequestCategoryTest {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
"\"DataType\" : \"urn:oasis:names:tc:xacml:2.0:data-type:ipAddress\", " +
- "\"Value\" : [ \"10.221.43.58:12345\",\"10.221.43.58:12345\",\"10.221.43.58:12345\" ] " +
+ "\"Value\" : [ \"121.221.43.58:12345\",\"121.221.43.58:12345\",\"121.221.43.58:12345\" ] " +
"}] } ] }}");
- assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=10.221.43.58:12345-12345}{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=10.221.43.58:12345-12345}{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=10.221.43.58:12345-12345}],includeInResults=false}]}}]}", request.toString());
+ assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=121.221.43.58:12345-12345}{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=121.221.43.58:12345-12345}{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=121.221.43.58:12345-12345}],includeInResults=false}]}}]}", request.toString());
} catch (Exception e) {
fail ("Failed convert from JSON to object: " + e);
}
@@ -2604,9 +2604,9 @@ public class RequestCategoryTest {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
"\"DataType\" : \"ipAddress\", " +
- "\"Value\" : [ \"10.221.43.58:12345\",\"10.221.43.58:12345\",\"10.221.43.58:12345\" ] " +
+ "\"Value\" : [ \"121.221.43.58:12345\",\"121.221.43.58:12345\",\"121.221.43.58:12345\" ] " +
"}] } ] }}");
- assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=10.221.43.58:12345-12345}{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=10.221.43.58:12345-12345}{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=10.221.43.58:12345-12345}],includeInResults=false}]}}]}", request.toString());
+ assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=121.221.43.58:12345-12345}{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=121.221.43.58:12345-12345}{dataTypeId=urn:oasis:names:tc:xacml:2.0:data-type:ipAddress,value=121.221.43.58:12345-12345}],includeInResults=false}]}}]}", request.toString());
} catch (Exception e) {
fail ("Failed convert from JSON to object: " + e);
}
@@ -2614,7 +2614,7 @@ public class RequestCategoryTest {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
"\"DataType\" : \"urn:oasis:names:tc:xacml:2.0:data-type:ipAddress\", " +
- "\"Value\" : [ \"10.221.43.58:12345\",\"not an ip address\",\"10.221.43.58:12345\" ] " +
+ "\"Value\" : [ \"121.221.43.58:12345\",\"not an ip address\",\"121.221.43.58:12345\" ] " +
"}] } ] }}");
fail("Operation should throw exception");
} catch (JSONStructureException e) {
@@ -2626,7 +2626,7 @@ public class RequestCategoryTest {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
"\"DataType\" : \"urn:oasis:names:tc:xacml:2.0:data-type:ipAddress\", " +
- "\"Value\" : [ \"10.221.43.58:12345\",true,\"10.221.43.58:12345\" ] " +
+ "\"Value\" : [ \"121.221.43.58:12345\",true,\"121.221.43.58:12345\" ] " +
"}] } ] }}");
fail("Operation should throw exception");
} catch (JSONStructureException e) {
@@ -2638,7 +2638,7 @@ public class RequestCategoryTest {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
"\"DataType\" : \"urn:oasis:names:tc:xacml:2.0:data-type:ipAddress\", " +
- "\"Value\" : [ \"10.221.43.58:12345\",1111,\"10.221.43.58:12345\" ] " +
+ "\"Value\" : [ \"121.221.43.58:12345\",1111,\"121.221.43.58:12345\" ] " +
"}] } ] }}");
fail("Operation should throw exception");
} catch (JSONStructureException e) {
@@ -2650,7 +2650,7 @@ public class RequestCategoryTest {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
"\"DataType\" : \"urn:oasis:names:tc:xacml:2.0:data-type:ipAddress\", " +
- "\"Value\" : [ \"10.221.43.58:12345\",11.22,\"10.221.43.58:12345\" ] " +
+ "\"Value\" : [ \"121.221.43.58:12345\",11.22,\"121.221.43.58:12345\" ] " +
"}] } ] }}");
fail("Operation should throw exception");
} catch (JSONStructureException e) {
@@ -3534,9 +3534,9 @@ public class RequestCategoryTest {
try {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
- "\"Value\" : [ \"10.221.43.58:12345\",\"10.221.43.58:12345\",\"10.221.43.58:12345\" ] " +
+ "\"Value\" : [ \"121.221.43.58:12345\",\"121.221.43.58:12345\",\"121.221.43.58:12345\" ] " +
"}] } ] }}");
- assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=10.221.43.58:12345}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=10.221.43.58:12345}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=10.221.43.58:12345}],includeInResults=false}]}}]}", request.toString());
+ assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=121.221.43.58:12345}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=121.221.43.58:12345}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=121.221.43.58:12345}],includeInResults=false}]}}]}", request.toString());
} catch (Exception e) {
fail ("Failed convert from JSON to object: " + e);
}
@@ -3544,9 +3544,9 @@ public class RequestCategoryTest {
try {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
- "\"Value\" : [ \"10.221.43.58:12345\",true,\"10.221.43.58:12345\" ] " +
+ "\"Value\" : [ \"121.221.43.58:12345\",true,\"121.221.43.58:12345\" ] " +
"}] } ] }}");
- assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=10.221.43.58:12345}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=true}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=10.221.43.58:12345}],includeInResults=false}]}}]}", request.toString());
+ assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=121.221.43.58:12345}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=true}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=121.221.43.58:12345}],includeInResults=false}]}}]}", request.toString());
} catch (Exception e) {
fail ("Failed convert from JSON to object: " + e);
}
@@ -3554,9 +3554,9 @@ public class RequestCategoryTest {
try {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
- "\"Value\" : [ \"10.221.43.58:12345\",1111,\"10.221.43.58:12345\" ] " +
+ "\"Value\" : [ \"121.221.43.58:12345\",1111,\"121.221.43.58:12345\" ] " +
"}] } ] }}");
- assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=10.221.43.58:12345}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=1111}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=10.221.43.58:12345}],includeInResults=false}]}}]}", request.toString());
+ assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=121.221.43.58:12345}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=1111}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=121.221.43.58:12345}],includeInResults=false}]}}]}", request.toString());
} catch (Exception e) {
fail ("Failed convert from JSON to object: " + e);
}
@@ -3564,9 +3564,9 @@ public class RequestCategoryTest {
try {
request = JSONRequest.load("{\"Request\" : {\"Category\": [{\"CategoryId\" : \"custom-category\", \"Attribute\" : [{" +
"\"Id\" : \"document-id\", " +
- "\"Value\" : [ \"10.221.43.58:12345\",11.22,\"10.221.43.58:12345\" ] " +
+ "\"Value\" : [ \"121.221.43.58:12345\",11.22,\"121.221.43.58:12345\" ] " +
"}] } ] }}");
- assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=10.221.43.58:12345}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=11.22}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=10.221.43.58:12345}],includeInResults=false}]}}]}", request.toString());
+ assertEquals("{returnPolicyIdList=false,combinedDecision=false,requestAttributes=[{super={category=custom-category,attributes=[{attributeId=document-id,category=custom-category,values=[{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=121.221.43.58:12345}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=11.22}{dataTypeId=http://www.w3.org/2001/XMLSchema#string,value=121.221.43.58:12345}],includeInResults=false}]}}]}", request.toString());
} catch (Exception e) {
fail ("Failed convert from JSON to object: " + e);
}
@@ -4165,10 +4165,4 @@ public class RequestCategoryTest {
}
}
-
-
-
-//TODO - Shorthand for CategoryId ????
-
-
}
diff --git a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/RequestConformanceTest.java b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/RequestConformanceTest.java
index 6c30cb481..7319da4f5 100644
--- a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/RequestConformanceTest.java
+++ b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/RequestConformanceTest.java
@@ -120,7 +120,90 @@ public class RequestConformanceTest {
//System.out.println(JSONRequest.toString(xmlRequest, false));
// generate JSON from the Request
- String jsonString = JSONRequest.toString(xmlRequest, false);
+ String jsonString = JSONRequest.toString(xmlRequest, false);
+
+
+// single-value elements
+//jsonString = "{\"Request\":{\"Category\":[{\"CategoryId\":\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\",\"Attribute\":["
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"Julius Hibbert\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"IncludeInResult\":\"true\",\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-id\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":123,\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-string\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"true\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#boolean\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-boolean\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"56\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#integer\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-integer\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"27.5\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#double\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-double\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"2002-03-22\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#date\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-date\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"2002-03-22T08:23:47-05:00\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#dateTime\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-dateTime\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"P50DT5H4M3S\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#dayTimeDuration\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-dayTimeDuration\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"-P5Y3M\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#yearMonthDuration\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-yearMonthDuration\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"0bf7a9876cde\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#hexBinary\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-hexBinary\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"c3VyZS4=\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#base64Binary\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-rfc822Name\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"j_hibbert@medico.com\",\"DataType\":\"urn:oasis:names:tc:xacml:1.0:data-type:rfc822Name\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-rfc822Name\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"CN=Julius Hibbert, O=Medi Corporation, C=US\",\"DataType\":\"urn:oasis:names:tc:xacml:1.0:data-type:x500Name\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-x500Name\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"122.45.38.245/255.255.255.64:8080-8080\",\"DataType\":\"urn:oasis:names:tc:xacml:2.0:data-type:ipAddress\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-ipAddress\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"some.host.name:147-874\",\"DataType\":\"urn:oasis:names:tc:xacml:2.0:data-type:dnsName\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-dnsName\"}"
+// + "]},"
+// + "{\"CategoryId\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"Attribute\":["
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":{\"Namespaces\":[{\"Namespace\":\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\"},{\"Namespace\":\"http://www.medico.com/schemas/record\",\"Prefix\":\"md\"},{\"Namespace\":\"http://www.w3.org/2001/XMLSchema-instance\",\"Prefix\":\"xsi\"}],\"XPathCategory\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"XPath\":\"//md:records/md:record\"},\"DataType\":\"urn:oasis:names:tc:xacml:3.0:data-type:xpathExpression\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:resource:xpathExpression\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"http://medico.com/record/patient/BartSimpson\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#anyURI\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\"}"
+// + "]},"
+// + "{\"CategoryId\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\",\"Attribute\":["
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"read\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:action:action-id\"}"
+// + "]},"
+// + "{\"CategoryId\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:environment\",\"Attribute\":["
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"08:23:47-05:00\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#time\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:environment:current-time\"}"
+// + "]}],\"ReturnPolicyIdList\":false,\"CombinedDecision\":false}}";
+
+
+
+
+
+
+// array attributes WITH explicit data types
+
+
+
+
+// String for testing Arrays of Attribute values
+//jsonString = "{\"Request\":{\"Category\":[{\"CategoryId\":\"urn:oasis:names:tc:xacml:1.0:subject-category:access-subject\",\"Attribute\":["
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":[\"test string\",\"Julius Hibbert\",\"Julius Hibbert as string\"],\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-id\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":[true, false],\"DataType\":\"http://www.w3.org/2001/XMLSchema#boolean\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-boolean\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":[56, 12],\"DataType\":\"http://www.w3.org/2001/XMLSchema#integer\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-integer\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":[27.12, 12112.344],\"DataType\":\"http://www.w3.org/2001/XMLSchema#double\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-double\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":[\"2002-03-22\",\"1256-11-11\"],\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-date\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":[\"2002-03-22T08:23:47-05:00\",\"1056-11-05T19:08:12-14:30\"],\"DataType\":\"http://www.w3.org/2001/XMLSchema#dateTime\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-dateTime\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":[\"P50DT5H4M3S\",\"P12DT148H18M21S\"],\"DataType\":\"http://www.w3.org/2001/XMLSchema#dayTimeDuration\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-dayTimeDuration\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"-P5Y3M\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#yearMonthDuration\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-yearMonthDuration\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"-P28Y7M\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#yearMonthDuration\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-yearMonthDuration\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"0bf7a9876cde\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#hexBinary\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-hexBinary\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"0fb8\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#hexBinary\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-hexBinary\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"c3VyZS4=\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#base64Binary\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-rfc822Name\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"YXN1cmUu\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#base64Binary\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-rfc822Name\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"j_hibbert@medico.com\",\"DataType\":\"urn:oasis:names:tc:xacml:1.0:data-type:rfc822Name\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-rfc822Name\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"c_clown@nose_medico.com\",\"DataType\":\"urn:oasis:names:tc:xacml:1.0:data-type:rfc822Name\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-rfc822Name\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"CN=Julius Hibbert, O=Medi Corporation, C=US\",\"DataType\":\"urn:oasis:names:tc:xacml:1.0:data-type:x500Name\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-x500Name\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"CN=Crusty Clown, O=Red Nose Corporation, C=US\",\"DataType\":\"urn:oasis:names:tc:xacml:1.0:data-type:x500Name\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-x500Name\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"122.45.38.245/255.255.255.64:8080-8080\",\"DataType\":\"urn:oasis:names:tc:xacml:2.0:data-type:ipAddress\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-ipAddress\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"35.123.111.56/255.64.32.255:9999-9999\",\"DataType\":\"urn:oasis:names:tc:xacml:2.0:data-type:ipAddress\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-ipAddress\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"some.host.name:147-874\",\"DataType\":\"urn:oasis:names:tc:xacml:2.0:data-type:dnsName\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-dnsName\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"a.different.host:-45\",\"DataType\":\"urn:oasis:names:tc:xacml:2.0:data-type:dnsName\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:subject:subject-dnsName\"}"
+// + "]},"
+// + "{\"CategoryId\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"Attribute\":["
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":{\"Namespaces\":[{\"Namespace\":\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\"},{\"Namespace\":\"http://www.medico.com/schemas/record\",\"Prefix\":\"md\"},{\"Namespace\":\"http://www.w3.org/2001/XMLSchema-instance\",\"Prefix\":\"xsi\"}],\"XPathCategory\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"XPath\":\"//md:records/md:record\"},\"DataType\":\"urn:oasis:names:tc:xacml:3.0:data-type:xpathExpression\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:resource:xpathExpression\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":{\"Namespaces\":[{\"Namespace\":\"urn:oasis:names:tc:xacml:3.0:core:schema:wd-17\"},{\"Namespace\":\"http://www.medico.com/schemas/record\",\"Prefix\":\"md\"},{\"Namespace\":\"http://www.w3.org/2001/XMLSchema-instance\",\"Prefix\":\"xsi\"}],\"XPathCategory\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:resource\",\"XPath\":\"//md:records/md:diagnosis_info\"},\"DataType\":\"urn:oasis:names:tc:xacml:3.0:data-type:xpathExpression\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:resource:xpathExpression\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"http://medico.com/record/patient/BartSimpson\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#anyURI\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"http://medico.com/record/patient/HomerSimpson\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#anyURI\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:resource:resource-id\"}"
+// + "],"
+// + "\"Content\":\"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?><md:records xmlns:md=\\\"http://www.medico.com/schemas/record\\\">\\r\\n \\t<md:record>\\r\\n \\t<md:patient_info>\\r\\n \\t<md:name>Bart Simpson</md:name>\\r\\n \\t<md:age>60</md:age>\\r\\n \\t<md:sex>male</md:sex>\\r\\n \\t<md:health_insurance>123456</md:health_insurance>\\r\\n \\t</md:patient_info>\\r\\n \\t<md:diagnosis_info>\\r\\n \\t<md:diagnosis>\\r\\n \\t<md:item type=\\\"primary\\\">Gastric Cancer</md:item>\\r\\n \\t<md:item type=\\\"secondary\\\">Hyper tension</md:item>\\r\\n \\t</md:diagnosis>\\r\\n \\t<md:pathological_diagnosis>\\r\\n \\t<md:diagnosis>\\r\\n \\t<md:item type=\\\"primary\\\">Well differentiated adeno carcinoma</md:item>\\r\\n \\t</md:diagnosis>\\r\\n \\t<md:date>2000-10-05</md:date>\\r\\n \\t<md:malignancy type=\\\"yes\\\"/>\\r\\n \\t</md:pathological_diagnosis>\\r\\n \\t</md:diagnosis_info> \\r\\n \\t</md:record>\\r\\n \\t<md:record>\\r\\n \\t<md:patient_info>\\r\\n \\t<md:name>Homer Simpson</md:name>\\r\\n \\t<md:age>80</md:age>\\r\\n \\t<md:sex>male</md:sex>\\r\\n \\t<md:health_insurance>123456</md:health_insurance>\\r\\n \\t</md:patient_info>\\r\\n \\t<md:diagnosis_info>\\r\\n \\t<md:diagnosis>\\r\\n \\t<md:item type=\\\"primary\\\">Gastric Cancer</md:item>\\r\\n \\t<md:item type=\\\"secondary\\\">Hyper tension</md:item>\\r\\n \\t</md:diagnosis>\\r\\n \\t<md:pathological_diagnosis>\\r\\n \\t<md:diagnosis>\\r\\n \\t<md:item type=\\\"primary\\\">Well differentiated adeno carcinoma</md:item>\\r\\n \\t</md:diagnosis>\\r\\n \\t<md:date>2000-10-05</md:date>\\r\\n \\t<md:malignancy type=\\\"yes\\\"/>\\r\\n \\t</md:pathological_diagnosis>\\r\\n \\t</md:diagnosis_info> \\r\\n \\t</md:record>\\r\\n\\t </md:records>\"},"
+// + "{\"CategoryId\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:action\",\"Attribute\":["
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"read\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:action:action-id\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"write\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#string\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:action:action-id\"}"
+// + "]},"
+// + "{\"CategoryId\":\"urn:oasis:names:tc:xacml:3.0:attribute-category:environment\",\"Attribute\":["
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"08:23:47-05:00\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#time\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:environment:current-time\"},"
+// + "{\"Issuer\":\"ConformanceTester\",\"Value\":\"22:12:10Z\",\"DataType\":\"http://www.w3.org/2001/XMLSchema#time\",\"IncludeInResult\":true,\"AttributeId\":\"urn:oasis:names:tc:xacml:1.0:environment:current-time\"}]}]"
+// + ",\"ReturnPolicyIdList\":false,\"CombinedDecision\":false}}";
+
+
+
// load JSON into a Request
jsonRequest = JSONRequest.load(jsonString);
@@ -250,4 +333,26 @@ public class RequestConformanceTest {
}
-} \ No newline at end of file
+}
+
+
+
+
+/*
+Place to dump very long trace/exception strings that need manual editing to understand
+
+
+
+
+
+
+ */
+
+
+
+
+
+
+
+
+
diff --git a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/ResponseTest.java b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/ResponseTest.java
index 12da12cbf..a950c3905 100644
--- a/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/ResponseTest.java
+++ b/ECOMP-XACML/src/test/java/org/openecomp/policy/xacml/test/json/ResponseTest.java
@@ -2268,30 +2268,5 @@ System.out.println(jsonResponse);
} catch (Exception e) {
fail("operation failed, e="+e);
}
- }
-
-
-//TODO - the JSON and XML spec imply that the Result Attributes may include the Content (It is part of the UML)
-
-
- // test indentation???
-
- // order does not matter??
-
-}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ }
+} \ No newline at end of file
diff --git a/ECOMP-XACML/src/test/resources/CSVPolicy.xml b/ECOMP-XACML/src/test/resources/CSVPolicy.xml
new file mode 100644
index 000000000..02a79b104
--- /dev/null
+++ b/ECOMP-XACML/src/test/resources/CSVPolicy.xml
@@ -0,0 +1,205 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<!--
+ ============LICENSE_START=======================================================
+ ECOMP-XACML
+ ================================================================================
+ Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ ================================================================================
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ ============LICENSE_END=========================================================
+ -->
+
+<Policy xmlns="urn:oasis:names:tc:xacml:3.0:core:schema:wd-17" PolicyId="urn:com:xacml:policy:id:fb9e6bed-b5dd-430c-acd4-1baed0c1f1cf" Version="1" RuleCombiningAlgId="urn:oasis:names:tc:xacml:3.0:rule-combining-algorithm:deny-unless-permit">
+ <Description>This Policy handles the Take action and Advice action operations. </Description>
+ <Target />
+ <!--<Target>
+ <AnyOf>
+ <AllOf>
+ <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">VM</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ </AnyOf>
+ </Target> -->
+ <VariableDefinition VariableId="doesItRequireNewVM">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:or">
+ <Description>Check the CPU Utilization or Network Load</Description>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than">
+ <Description>Load</Description>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="com:att:labs:ecomp:resource:vm:load" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="true"/>
+ </Apply>
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">95</AttributeValue>
+ <!--<Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <AttributeDesignator Category="com:att:research:xacml:test:pip:csv:category:server" AttributeId="com:att:research:xacml:test:pip:csv:server:loadval" DataType="http://www.w3.org/2001/XMLSchema#integer" Issuer="com:att:research:xacml:test:pip:csv" MustBePresent="false"/>
+ </Apply> -->
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-greater-than">
+ <Description>CPU</Description>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="com:att:labs:ecomp:resource:vm:cpu" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="true"/>
+ </Apply>
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#integer">95</AttributeValue>
+ <!-- <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <AttributeDesignator Category="com:att:research:xacml:test:pip:csv:category:server" AttributeId="com:att:research:xacml:test:pip:csv:server:cpuval" DataType="http://www.w3.org/2001/XMLSchema#integer" Issuer="com:att:research:xacml:test:pip:csv" MustBePresent="false"/>
+ </Apply> -->
+ </Apply>
+ </Apply>
+ </VariableDefinition>
+ <Rule RuleId="urn:com:xacml:rule:id:9f8e2241-8205-4656-b6f6-143637cc0c66" Effect="Permit">
+ <Description>Permit to create a new VM with Obligation</Description>
+ <Target />
+ <!--<Target>
+ <AnyOf>
+ <AllOf>
+ <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">create_Action</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ </AnyOf>
+ </Target> -->
+ <Condition>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-equal">
+ <Description>If the Requirement has met create the VM</Description>
+ <VariableReference VariableId="doesItRequireNewVM"/>
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#boolean">true</AttributeValue>
+ </Apply>
+ </Condition>
+ <ObligationExpressions>
+ <ObligationExpression ObligationId="com.att.research.nvp.test.obligation" FulfillOn="Permit">
+ <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.obligation.key" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Action_Info</AttributeValue>
+ </AttributeAssignmentExpression>
+ </ObligationExpression>
+ <ObligationExpression ObligationId="com.att.research.nvp.test.multiobligation" FulfillOn="Permit">
+ <AttributeAssignmentExpression AttributeId="com.att.research.nvp.obligation.value" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Create_NEW_VM</AttributeValue>
+ </AttributeAssignmentExpression>
+ </ObligationExpression>
+ </ObligationExpressions>
+ </Rule>
+ <Rule RuleId="urn:com:xacml:rule:id:6dd4c4b2-8864-4bae-b497-7472b464ffe7" Effect="Permit">
+ <Description>Permit to create a new VM with Advice</Description>
+ <Target>
+ <AnyOf>
+ <AllOf>
+ <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">create_adviceAction</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ </AnyOf>
+ </Target>
+ <Condition>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-equal">
+ <Description>If the Requirement has met create the VM</Description>
+ <VariableReference VariableId="doesItRequireNewVM"/>
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#boolean">true</AttributeValue>
+ </Apply>
+ </Condition>
+ <AdviceExpressions>
+ <AdviceExpression AdviceId="com.att.research.nvp.test.advice.multi" AppliesTo="Permit">
+ <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.key">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Action_Info</AttributeValue>
+ </AttributeAssignmentExpression>
+ </AdviceExpression>
+ <AdviceExpression AdviceId="com.att.research.nvp.test.advice.multiadvice" AppliesTo="Permit">
+ <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.multival">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Created New VM</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.val" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">http://localhost:8080/pdp/?type=hb</AttributeValue>
+ </AttributeAssignmentExpression>
+ </AdviceExpression>
+ </AdviceExpressions>
+ </Rule>
+ <VariableDefinition VariableId="removeVM">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-less-than">
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="com:att:research:xacml:test:pip:csv:resource:cpu" DataType="http://www.w3.org/2001/XMLSchema#integer" MustBePresent="true"/>
+ </Apply>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:integer-one-and-only">
+ <AttributeDesignator Category="com:att:research:xacml:test:pip:csv:category:server" AttributeId="com:att:research:xacml:test:pip:csv:server:minval" DataType="http://www.w3.org/2001/XMLSchema#integer" Issuer="com:att:research:xacml:test:pip:csv" MustBePresent="false"/>
+ </Apply>
+ </Apply>
+ </VariableDefinition>
+ <Rule RuleId="urn:com:xacml:rule:id:262fc3fd-f3f3-4aaa-8b9c-504f89be5ba2" Effect="Permit">
+ <Description>Permit to remove a VM with Obligation</Description>
+ <Target>
+ <AnyOf>
+ <AllOf>
+ <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">remove_Action</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ </AnyOf>
+ </Target>
+ <Condition>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-equal">
+ <Description>If the resource usage is low then remove the VM</Description>
+ <VariableReference VariableId="removeVM"/>
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#boolean">true</AttributeValue>
+ </Apply>
+ </Condition>
+ <ObligationExpressions>
+ <ObligationExpression ObligationId="com.att.research.nvp.test.obligation" FulfillOn="Permit">
+ <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.obligation.key" Category="urn:oasis:names:tc:xacml:1.0:subject-category:access-subject">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Action_Info</AttributeValue>
+ </AttributeAssignmentExpression>
+ </ObligationExpression>
+ <ObligationExpression ObligationId="com.att.research.nvp.test.multiobligation" FulfillOn="Permit">
+ <AttributeAssignmentExpression AttributeId="com.att.research.nvp.obligation.value" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:action">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Remove_VM</AttributeValue>
+ </AttributeAssignmentExpression>
+ </ObligationExpression>
+ </ObligationExpressions>
+ </Rule>
+ <Rule RuleId="urn:com:xacml:rule:id:6b17c532-6b43-4577-b499-30c862bc7df3" Effect="Permit">
+ <Description>Permit to remove a VM with Advice</Description>
+ <Target>
+ <AnyOf>
+ <AllOf>
+ <Match MatchId="urn:oasis:names:tc:xacml:1.0:function:string-equal">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">remove_adviceAction</AttributeValue>
+ <AttributeDesignator Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource" AttributeId="urn:oasis:names:tc:xacml:1.0:resource:resource-id" DataType="http://www.w3.org/2001/XMLSchema#string" MustBePresent="false"/>
+ </Match>
+ </AllOf>
+ </AnyOf>
+ </Target>
+ <Condition>
+ <Apply FunctionId="urn:oasis:names:tc:xacml:1.0:function:boolean-equal">
+ <Description>If the resource usage is low then remove the VM</Description>
+ <VariableReference VariableId="removeVM"/>
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#boolean">true</AttributeValue>
+ </Apply>
+ </Condition>
+ <AdviceExpressions>
+ <AdviceExpression AdviceId="com.att.research.nvp.test.advice.multi" AppliesTo="Permit">
+ <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.key">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Action_Info</AttributeValue>
+ </AttributeAssignmentExpression>
+ </AdviceExpression>
+ <AdviceExpression AdviceId="com.att.research.nvp.test.advice.multiadvice" AppliesTo="Permit">
+ <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.multival">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#string">Removed VM</AttributeValue>
+ </AttributeAssignmentExpression>
+ <AttributeAssignmentExpression AttributeId="com.att.research.nvp.test.advice.val" Category="urn:oasis:names:tc:xacml:3.0:attribute-category:resource">
+ <AttributeValue DataType="http://www.w3.org/2001/XMLSchema#anyURI">http://localhost:8080/pdp/?type=hb</AttributeValue>
+ </AttributeAssignmentExpression>
+ </AdviceExpression>
+ </AdviceExpressions>
+ </Rule>
+</Policy>
diff --git a/ECOMP-XACML/src/test/resources/logback.xml b/ECOMP-XACML/src/test/resources/logback.xml
index f2b70a01b..2f92f709b 100644
--- a/ECOMP-XACML/src/test/resources/logback.xml
+++ b/ECOMP-XACML/src/test/resources/logback.xml
@@ -44,14 +44,15 @@
<property name="defaultAuditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
<property name="defaultAuditPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{ElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
-->
- <property name="defaultAuditPattern" value="%X{TransactionBeginTimestamp}|%X{TransactionEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{PartnerName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{TransactionElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+ <property name="defaultAuditPattern" value="%X{TransactionBeginTimestamp}|%X{TransactionEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{statusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{instanceUuid}|%p|%X{severity}|%X{serverIpAddress}|%X{TransactionElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
<!-- M E T R I C
<property name="defaultMetricPattern" value="%X{BeginTimestamp}|%X{EndTimestamp}|%X{RequestId}|%X{ServiceInstanceId}|%thread|%X{ServerName}|%X{ServiceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%.-5level|%X{AlertSeverity}|%X{ServerIPAddress}|%X{ElapsedTime}|%X{ServerFQDN}|%X{RemoteHost}|%X{ClassName}||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
-->
- <property name="defaultMetricPattern" value="%X{MetricBeginTimestamp}|%X{MetricEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{PartnerName}|%X{TargetEntity}|%X{TargetServiceName}|%X{StatusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%p|%X{severity}|%X{serverIpAddress}|%X{MetricElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+ <property name="defaultMetricPattern" value="%X{MetricBeginTimestamp}|%X{MetricEndTimestamp}|%X{requestId}|%X{serviceInstanceId}|%t|%X{serverName}|%X{serviceName}|%X{partnerName}|%X{targetEntity}|%X{targetServiceName}|%X{statusCode}|%X{ResponseCode}|%X{ResponseDescription}|%X{InstanceUUID}|%p|%X{severity}|%X{serverIpAddress}|%X{MetricElapsedTime}|%X{server}|%X{clientIpAddress}|%c||%X{ProcessKey}|%X{TargetVirtualEntity}|%X{CustomField1}|%X{CustomField2}|%X{CustomField3}|%X{CustomField4}|%msg%n" />
+