summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--applications/common/pom.xml6
-rw-r--r--applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslator.java17
-rw-r--r--applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java18
-rw-r--r--applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequest.java4
-rw-r--r--applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java30
-rw-r--r--applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java11
-rw-r--r--applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java117
-rw-r--r--applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTranslator.java105
-rw-r--r--applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java6
-rw-r--r--applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java60
-rw-r--r--applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequestTest.java84
-rw-r--r--applications/optimization/src/test/resources/bad-subscriber-policies.yaml34
-rw-r--r--applications/optimization/src/test/resources/test-optimization-policies.yaml (renamed from applications/optimization/src/test/resources/vCPE.policies.optimization.input.tosca.yaml)1
13 files changed, 406 insertions, 87 deletions
diff --git a/applications/common/pom.xml b/applications/common/pom.xml
index dbde0ae1..5a359e67 100644
--- a/applications/common/pom.xml
+++ b/applications/common/pom.xml
@@ -7,9 +7,9 @@
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.
@@ -76,7 +76,7 @@
<dependency>
<groupId>com.att.research.xacml</groupId>
<artifactId>xacml-pdp</artifactId>
- <version>2.0.1</version>
+ <version>2.1.0</version>
</dependency>
</dependencies>
</project>
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslator.java
index 508bc245..34936b06 100644
--- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslator.java
+++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslator.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
@@ -22,6 +22,7 @@
package org.onap.policy.pdp.xacml.application.common.std;
+import com.att.research.xacml.api.Advice;
import com.att.research.xacml.api.Decision;
import com.att.research.xacml.api.Obligation;
import com.att.research.xacml.api.Request;
@@ -92,6 +93,10 @@ public abstract class StdBaseTranslator implements ToscaPolicyTranslator {
// Go through obligations
//
scanObligations(xacmlResult.getObligations(), decisionResponse);
+ //
+ // Go through advice
+ //
+ scanAdvice(xacmlResult.getAssociatedAdvice(), decisionResponse);
} else {
//
// TODO we have to return an ErrorResponse object instead
@@ -114,6 +119,16 @@ public abstract class StdBaseTranslator implements ToscaPolicyTranslator {
protected abstract void scanObligations(Collection<Obligation> obligations, DecisionResponse decisionResponse);
/**
+ * scanAdvice - scans the list of advice and make appropriate call to process the advice. This method
+ * can be overridden for each specific application as advice may have different expected attributes per
+ * application.
+ *
+ * @param advice Collection of Advice objects
+ * @param decisionResponse DecisionResponse object used to store any results from advice.
+ */
+ protected abstract void scanAdvice(Collection<Advice> advice, DecisionResponse decisionResponse);
+
+ /**
* From the TOSCA metadata section, pull in values that are needed into the XACML policy.
*
* @param policy Policy Object to store the metadata
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java
index bcd594fb..0a1ace2b 100644
--- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java
+++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdCombinedPolicyResultsTranslator.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
@@ -22,6 +22,7 @@
package org.onap.policy.pdp.xacml.application.common.std;
+import com.att.research.xacml.api.Advice;
import com.att.research.xacml.api.DataTypeException;
import com.att.research.xacml.api.Identifier;
import com.att.research.xacml.api.Obligation;
@@ -158,6 +159,21 @@ public class StdCombinedPolicyResultsTranslator extends StdBaseTranslator {
}
/**
+ * scanAdvice - not implemented in this class.
+ *
+ * @param advice Collection of advice objects
+ * @param DecisionResponse DecisionResponse object
+ */
+ @Override
+ protected void scanAdvice(Collection<Advice> advice, DecisionResponse decisionResponse) {
+ //
+ // By default there are no advice supported in this object. Please override and provide
+ // any needed functionality.
+ //
+ LOGGER.warn("Advice found - not supported in this class {}", this.getClass());
+ }
+
+ /**
* scanContentObligation - scans the specific obligation for policy-id and policy-content.
*
* @param obligation Obligation incoming obligation object
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequest.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequest.java
index 2d83b897..2cb82942 100644
--- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequest.java
+++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchablePolicyRequest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
@@ -92,7 +92,7 @@ public class StdMatchablePolicyRequest {
}
/**
- * Parses the DecisionRequest into a MonitoringRequest.
+ * Parses the DecisionRequest into a XAML request.
*
* @param decisionRequest Input DecisionRequest
* @return Request XACML Request object
diff --git a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
index 0d1daaa6..e84a9e77 100644
--- a/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
+++ b/applications/common/src/main/java/org/onap/policy/pdp/xacml/application/common/std/StdMatchableTranslator.java
@@ -22,6 +22,7 @@
package org.onap.policy.pdp.xacml.application.common.std;
+import com.att.research.xacml.api.Advice;
import com.att.research.xacml.api.Identifier;
import com.att.research.xacml.api.Obligation;
import com.att.research.xacml.api.Request;
@@ -84,6 +85,10 @@ public class StdMatchableTranslator extends StdBaseTranslator {
private static final Logger LOGGER = LoggerFactory.getLogger(StdMatchableTranslator.class);
private static final StandardYamlCoder standardYamlCoder = new StandardYamlCoder();
+ private static final String MSG_WEIGHT = "Weight is {}";
+ private static final String MSG_WEIGHT_LIST = "Weight list is {}";
+ private static final String MSG_WEIGHT_MAP = "Weight map is {}";
+
private final Map<ToscaPolicyTypeIdentifier, ToscaServiceTemplate> matchablePolicyTypes = new HashMap<>();
@Setter
private RestServerParameters apiRestParameters;
@@ -155,6 +160,10 @@ public class StdMatchableTranslator extends StdBaseTranslator {
);
}
+ protected void scanAdvice(Collection<Advice> advice, DecisionResponse decisionResponse) {
+ LOGGER.warn("scanAdvice not supported by {}", this.getClass());
+ }
+
/**
* scanClosestMatchObligation - scans for the obligation specifically holding policy
* contents and their details.
@@ -384,7 +393,7 @@ public class StdMatchableTranslator extends StdBaseTranslator {
//
int weight = generateMatchable(targetType, entrySet.getKey(), entrySet.getValue(),
property.getLeft(), property.getRight());
- LOGGER.info("Weight is {}", weight);
+ LOGGER.info(MSG_WEIGHT, weight);
totalWeight += weight;
} else {
//
@@ -394,12 +403,12 @@ public class StdMatchableTranslator extends StdBaseTranslator {
if ("list".equals(toscaProperty.getType())) {
int weight = findMatchablesInList(entrySet.getKey(), entrySet.getValue(), toscaProperty,
policyTemplate, targetType);
- LOGGER.info("Weight list is {}", weight);
+ LOGGER.info(MSG_WEIGHT_LIST, weight);
totalWeight += weight;
} else if ("map".equals(toscaProperty.getType())) {
int weight = findMatchablesInMap(entrySet.getKey(), entrySet.getValue(), toscaProperty,
policyTemplate, targetType);
- LOGGER.info("Weight map is {}", weight);
+ LOGGER.info(MSG_WEIGHT_MAP, weight);
totalWeight += weight;
}
}
@@ -460,7 +469,7 @@ public class StdMatchableTranslator extends StdBaseTranslator {
//
int weight = generateMatchable(targetType, entrySet.getKey(), entrySet.getValue(),
toscaProperty, listTemplate);
- LOGGER.info("Weight is {}", weight);
+ LOGGER.info(MSG_WEIGHT, weight);
totalWeight += weight;
} else {
//
@@ -470,12 +479,12 @@ public class StdMatchableTranslator extends StdBaseTranslator {
if ("list".equals(toscaProperty.getType())) {
int weight = findMatchablesInList(entrySet.getKey(), entrySet.getValue(), toscaProperty,
listTemplate, targetType);
- LOGGER.info("Weight list is {}", weight);
+ LOGGER.info(MSG_WEIGHT_LIST, weight);
totalWeight += weight;
} else if ("map".equals(toscaProperty.getType())) {
int weight = findMatchablesInMap(entrySet.getKey(), entrySet.getValue(), toscaProperty,
listTemplate, targetType);
- LOGGER.info("Weight map is {}", weight);
+ LOGGER.info(MSG_WEIGHT_MAP, weight);
totalWeight += weight;
}
}
@@ -529,7 +538,7 @@ public class StdMatchableTranslator extends StdBaseTranslator {
//
int weight = generateMatchable(targetType, entrySet.getKey(), entrySet.getValue(),
toscaProperty, mapTemplate);
- LOGGER.info("Weight is {}", weight);
+ LOGGER.info(MSG_WEIGHT, weight);
totalWeight += weight;
} else {
//
@@ -539,12 +548,12 @@ public class StdMatchableTranslator extends StdBaseTranslator {
if ("list".equals(toscaProperty.getType())) {
int weight = findMatchablesInList(entrySet.getKey(), entrySet.getValue(), toscaProperty,
mapTemplate, targetType);
- LOGGER.info("Weight list is {}", weight);
+ LOGGER.info(MSG_WEIGHT_LIST, weight);
totalWeight += weight;
} else if ("map".equals(toscaProperty.getType())) {
int weight = findMatchablesInMap(entrySet.getKey(), entrySet.getValue(), toscaProperty,
mapTemplate, targetType);
- LOGGER.info("Weight map is {}", weight);
+ LOGGER.info(MSG_WEIGHT_MAP, weight);
totalWeight += weight;
}
}
@@ -721,7 +730,8 @@ public class StdMatchableTranslator extends StdBaseTranslator {
int weight = 0;
if (isYamlType(toscaProperty.getEntrySchema().getType())) {
//
- // PLD TODO - this won't work
+ // PLD TODO - this won't work. Right now there are no maps being used to match.
+ // need to investigate whether we really can support that situation.
//
AnyOfType anyOf = generateMatches((Collection<Object>) value,
new IdentifierImpl(ToscaDictionary.ID_RESOURCE_MATCHABLE + key));
diff --git a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java
index a7391fab..8039a9cf 100644
--- a/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java
+++ b/applications/common/src/test/java/org/onap/policy/pdp/xacml/application/common/std/StdBaseTranslatorTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
@@ -28,6 +28,7 @@ import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
+import com.att.research.xacml.api.Advice;
import com.att.research.xacml.api.AttributeAssignment;
import com.att.research.xacml.api.Decision;
import com.att.research.xacml.api.IdReference;
@@ -249,6 +250,10 @@ public class StdBaseTranslatorTest {
protected void scanObligations(Collection<Obligation> obligations, DecisionResponse decisionResponse) {
}
+ @Override
+ protected void scanAdvice(Collection<Advice> advice, DecisionResponse decisionResponse) {
+ }
+
}
private class TestTranslator extends StdBaseTranslator {
@@ -259,6 +264,10 @@ public class StdBaseTranslatorTest {
}
@Override
+ protected void scanAdvice(Collection<Advice> advice, DecisionResponse decisionResponse) {
+ }
+
+ @Override
public PolicyType convertPolicy(ToscaPolicy toscaPolicy) throws ToscaPolicyConversionException {
PolicyType xacmlPolicy = new PolicyType();
this.fillMetadataSection(xacmlPolicy, metadata);
diff --git a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
index e921dce8..d0f4b1eb 100644
--- a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
+++ b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
@@ -52,6 +52,18 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
private static final Logger LOGGER = LoggerFactory.getLogger(OptimizationPdpApplication.class);
private static final String STRING_VERSION100 = "1.0.0";
private static final String RESOURCE_SUBSCRIBERNAME = "subscriberName";
+ private static final String RESOURCE_POLICYTYPE = "policy-type";
+ private static final String RESOURCE_SCOPE = "scope";
+
+ public static final String POLICYTYPE_AFFINITY = "onap.policies.optimization.resource.AffinityPolicy";
+ public static final String POLICYTYPE_SUBSCRIBER = "onap.policies.optimization.service.SubscriberPolicy";
+ public static final String POLICYTYPE_DISTANCE = "onap.policies.optimization.resource.DistancePolicy";
+ public static final String POLICYTYPE_HPA = "onap.policies.optimization.resource.HpaPolicy";
+ public static final String POLICYTYPE_OPTIMIZATION = "onap.policies.optimization.resource.OptimizationPolicy";
+ public static final String POLICYTYPE_PCI = "onap.policies.optimization.resource.PciPolicy";
+ public static final String POLICYTYPE_QUERY = "onap.policies.optimization.service.QueryPolicy";
+ public static final String POLICYTYPE_VIMFIT = "onap.policies.optimization.resource.Vim_fit";
+ public static final String POLICYTYPE_VNF = "onap.policies.optimization.resource.VnfPolicy";
private OptimizationPdpApplicationTranslator translator = new OptimizationPdpApplicationTranslator();
private List<ToscaPolicyTypeIdentifier> supportedPolicyTypes = new ArrayList<>();
@@ -60,24 +72,15 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
* Constructor.
*/
public OptimizationPdpApplication() {
- this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.resource.AffinityPolicy", STRING_VERSION100));
- this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.resource.DistancePolicy", STRING_VERSION100));
- this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.resource.HpaPolicy", STRING_VERSION100));
- this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.resource.OptimizationPolicy", STRING_VERSION100));
- this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.resource.PciPolicy", STRING_VERSION100));
- this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.service.QueryPolicy", STRING_VERSION100));
- this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.service.SubscriberPolicy", STRING_VERSION100));
- this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.resource.Vim_fit", STRING_VERSION100));
- this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.resource.VnfPolicy", STRING_VERSION100));
+ this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(POLICYTYPE_AFFINITY, STRING_VERSION100));
+ this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(POLICYTYPE_DISTANCE, STRING_VERSION100));
+ this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(POLICYTYPE_HPA, STRING_VERSION100));
+ this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(POLICYTYPE_OPTIMIZATION, STRING_VERSION100));
+ this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(POLICYTYPE_PCI, STRING_VERSION100));
+ this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(POLICYTYPE_QUERY, STRING_VERSION100));
+ this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(POLICYTYPE_SUBSCRIBER, STRING_VERSION100));
+ this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(POLICYTYPE_VIMFIT, STRING_VERSION100));
+ this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(POLICYTYPE_VNF, STRING_VERSION100));
}
@Override
@@ -133,6 +136,10 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
public Pair<DecisionResponse, Response> makeDecision(DecisionRequest request,
Map<String, String[]> requestQueryParams) {
//
+ // In case we have a subcriber policy
+ //
+ Response xacmlSubscriberResponse = null;
+ //
// Check if there are subject attributes for subscriber
//
if (hasSubscriberAttributes(request)) {
@@ -147,16 +154,16 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
//
// Override the PolicyType to ensure we are only looking at Subscriber Policies
//
- if (subscriberRequest.getResource().containsKey("policy-type")) {
- subscriberRequest.getResource().remove("policy-type");
+ if (subscriberRequest.getResource().containsKey(RESOURCE_POLICYTYPE)) {
+ subscriberRequest.getResource().remove(RESOURCE_POLICYTYPE);
}
- subscriberRequest.getResource().put("policy-type", "onap.policies.optimization.service.SubscriberPolicy");
+ subscriberRequest.getResource().put(RESOURCE_POLICYTYPE, POLICYTYPE_SUBSCRIBER);
//
// Convert to a XacmlRequest and get a decision
//
- Response xacmlResponse = null;
try {
- xacmlResponse = this.xacmlDecision(OptimizationSubscriberRequest.createInstance(subscriberRequest));
+ xacmlSubscriberResponse =
+ this.xacmlDecision(OptimizationSubscriberRequest.createInstance(subscriberRequest));
} catch (XacmlApplicationException e) {
LOGGER.error("Could not create subscriberName request {}", e);
}
@@ -164,12 +171,12 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
// Check the response for subscriber attributes and add them
// to the initial request.
//
- if (! addSubscriberAttributes(xacmlResponse, request)) {
- LOGGER.error("Failed to get subscriber attributes");
+ if (xacmlSubscriberResponse != null && ! addSubscriberAttributes(xacmlSubscriberResponse, request)) {
+ LOGGER.error("Failed to get subscriber role attributes");
//
// Convert to a DecisionResponse
//
- return Pair.of(this.getTranslator().convertResponse(xacmlResponse), xacmlResponse);
+ return Pair.of(this.getTranslator().convertResponse(xacmlSubscriberResponse), xacmlSubscriberResponse);
}
}
//
@@ -183,7 +190,15 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
//
// Convert to a DecisionResponse
//
- return Pair.of(this.getTranslator().convertResponse(xacmlResponse), xacmlResponse);
+ Pair<DecisionResponse, Response> returnPair = Pair.of(this.getTranslator().convertResponse(xacmlResponse),
+ xacmlResponse);
+ //
+ // Add back in advice from subscriber
+ //
+ if (xacmlSubscriberResponse != null) {
+ addSubscriberAdvice(xacmlSubscriberResponse, returnPair.getLeft());
+ }
+ return returnPair;
}
@Override
@@ -204,7 +219,9 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
private boolean addSubscriberAttributes(Response xacmlResponse, DecisionRequest initialRequest) {
//
- // Should only be one result
+ // This has multiple results right now because of how the attributes were added to the
+ // request. That will have to be fixed in the future, for now find the Permit result
+ // and add the role attributes as they will be used in the next request.
//
for (Result result : xacmlResponse.getResults()) {
//
@@ -216,7 +233,7 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
//
scanAdvice(result.getAssociatedAdvice(), initialRequest);
//
- // PLD this is an assumption
+ // PLD this is an assumption that all is good
//
return true;
} else {
@@ -226,6 +243,21 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
return false;
}
+ private void addSubscriberAdvice(Response xacmlResponse, DecisionResponse response) {
+ //
+ // Again find the Permit result
+ //
+ for (Result result : xacmlResponse.getResults()) {
+ //
+ // Check the result
+ //
+ if (result.getStatus().isOk() && Decision.PERMIT.equals(result.getDecision())) {
+ this.translator.scanAdvice(result.getAssociatedAdvice(), response);
+ }
+ }
+ }
+
+
@SuppressWarnings("unchecked")
private void scanAdvice(Collection<Advice> adviceCollection, DecisionRequest initialRequest) {
//
@@ -235,20 +267,21 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
//
// Look for the optimization specific advice
//
- if (ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER.equals(advice.getId())) {
+ if (! ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER.equals(advice.getId())) {
+ LOGGER.error("Unsupported advice id {}", advice.getId());
+ continue;
+ }
+ //
+ // Get the attributes and add them
+ //
+ for (AttributeAssignment attribute : advice.getAttributeAssignments()) {
//
- // Get the attributes and add them
- for (AttributeAssignment attribute : advice.getAttributeAssignments()) {
- //
- // If this is subscriber role
- //
- if (ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER_ROLE.equals(attribute.getAttributeId())) {
- ((List<String>) initialRequest.getResource().get("scope")).add(attribute.getAttributeValue()
- .getValue().toString());
- }
+ // If this is subscriber role
+ //
+ if (ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER_ROLE.equals(attribute.getAttributeId())) {
+ ((List<String>) initialRequest.getResource().get(RESOURCE_SCOPE))
+ .add(attribute.getAttributeValue().getValue().toString());
}
- } else {
- LOGGER.error("Unsupported advice id {}", advice.getId());
}
}
}
diff --git a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTranslator.java b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTranslator.java
index 7ec8f676..d56b73ae 100644
--- a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTranslator.java
+++ b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTranslator.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
@@ -22,12 +22,17 @@
package org.onap.policy.xacml.pdp.application.optimization;
+import com.att.research.xacml.api.Advice;
+import com.att.research.xacml.api.AttributeAssignment;
+import com.att.research.xacml.api.Identifier;
import com.att.research.xacml.api.XACML3;
import com.att.research.xacml.util.XACMLPolicyWriter;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.AdviceExpressionType;
@@ -40,6 +45,7 @@ import oasis.names.tc.xacml._3_0.core.schema.wd_17.MatchType;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.ObjectFactory;
import oasis.names.tc.xacml._3_0.core.schema.wd_17.PolicyType;
import org.apache.commons.lang3.StringUtils;
+import org.onap.policy.models.decisions.concepts.DecisionResponse;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.pdp.xacml.application.common.ToscaDictionary;
import org.onap.policy.pdp.xacml.application.common.ToscaPolicyConversionException;
@@ -54,6 +60,9 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator
private static final String OPTIMIZATION_POLICYTYPE_SUBSCRIBER =
"onap.policies.optimization.service.SubscriberPolicy";
+ private static final String FIELD_SUBSCRIBER_ROLE = "subscriberRole";
+ private static final String FIELD_PROV_STATUS = "provStatus";
+
@SuppressWarnings("unchecked")
@Override
public PolicyType convertPolicy(ToscaPolicy toscaPolicy) throws ToscaPolicyConversionException {
@@ -81,7 +90,7 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator
//
// Add subscriber advice
//
- policy.setAdviceExpressions(generateSubscriberAdvice(toscaPolicy, subscriberProperties));
+ policy.setAdviceExpressions(generateSubscriberAdvice(subscriberProperties));
//
// Dump our revised policy out
//
@@ -95,6 +104,49 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator
return policy;
}
+ @Override
+ protected void scanAdvice(Collection<Advice> advice, DecisionResponse decisionResponse) {
+ for (Advice adv : advice) {
+ if (! ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER.equals(adv.getId())) {
+ LOGGER.warn("Unknown advice id {}", adv.getId());
+ continue;
+ }
+ //
+ // Get the existing advice if any, we are appending to it.
+ //
+ Map<String, Object> mapAdvice = decisionResponse.getAdvice();
+ //
+ // If there's nothing, create a map
+ //
+ if (mapAdvice == null) {
+ mapAdvice = new HashMap<>();
+ }
+ for (AttributeAssignment assignment : adv.getAttributeAssignments()) {
+ if (ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER_ROLE.equals(assignment.getAttributeId())) {
+ addValuesToMap(assignment.getAttributeValue().getValue(), FIELD_SUBSCRIBER_ROLE, mapAdvice);
+ } else if (ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER_STATUS.equals(
+ assignment.getAttributeId())) {
+ addValuesToMap(assignment.getAttributeValue().getValue(), FIELD_PROV_STATUS, mapAdvice);
+ }
+ }
+ if (! mapAdvice.isEmpty()) {
+ decisionResponse.setAdvice(mapAdvice);
+ }
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ private static void addValuesToMap(Object values, String key, Map<String, Object> mapAdvice) {
+ if (values instanceof Collection) {
+ List<String> valueList = new ArrayList<>();
+ ((Collection<Object>) values).forEach(val -> valueList.add(val.toString()));
+ mapAdvice.put(key, valueList);
+ } else {
+ mapAdvice.put(key, values.toString());
+ }
+
+ }
+
@SuppressWarnings("unchecked")
private static PolicyType addSubscriberNameIntoTarget(PolicyType policy,
Map<String, Object> subscriberProperties) throws ToscaPolicyConversionException {
@@ -132,50 +184,63 @@ public class OptimizationPdpApplicationTranslator extends StdMatchableTranslator
}
@SuppressWarnings("unchecked")
- private static AdviceExpressionsType generateSubscriberAdvice(ToscaPolicy toscaPolicy,
- Map<String, Object> subscriberProperties) throws ToscaPolicyConversionException {
+ private static AdviceExpressionsType generateSubscriberAdvice(Map<String, Object> subscriberProperties)
+ throws ToscaPolicyConversionException {
//
// Get the subscriber role
//
- Object role = subscriberProperties.get("subscriberRole");
+ Object role = subscriberProperties.get(FIELD_SUBSCRIBER_ROLE);
if (role == null || StringUtils.isBlank(role.toString())) {
throw new ToscaPolicyConversionException("Missing subscriberRole");
}
//
- // Get the provision status
- // TODO
- //
- // Our subscriber Advice expression holds all the attribute assignments
+ // Create our subscriber advice expression
//
AdviceExpressionType adviceExpression = new AdviceExpressionType();
adviceExpression.setAppliesTo(EffectType.PERMIT);
adviceExpression.setAdviceId(ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER.stringValue());
//
- // Add in subscriber role
+ // Add in subscriber role advice attributes
+ //
+ generateSubscriberAdviceAttributes(
+ adviceExpression,
+ ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER_ROLE,
+ role instanceof Collection ? (List<Object>) role : Arrays.asList(role));
+ //
+ // Get the provision status
+ //
+ Object provision = subscriberProperties.get(FIELD_PROV_STATUS);
+ if (provision == null || StringUtils.isBlank(provision.toString())) {
+ throw new ToscaPolicyConversionException("Missing provStatus");
+ }
+ adviceExpression = generateSubscriberAdviceAttributes(
+ adviceExpression,
+ ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER_STATUS,
+ role instanceof Collection ? (List<Object>) provision : Arrays.asList(role));
+ //
+ // Add it to the overall expressions
//
- generateSubscriberRoleAdvice(adviceExpression, role instanceof Collection ? (List<Object>) role :
- Arrays.asList(role));
-
AdviceExpressionsType adviceExpressions = new AdviceExpressionsType();
adviceExpressions.getAdviceExpression().add(adviceExpression);
-
+ //
+ // Done return our advice expressions
+ //
return adviceExpressions;
}
- private static AdviceExpressionType generateSubscriberRoleAdvice(AdviceExpressionType adviceExpression,
- Collection<Object> subscriberRoles) {
- for (Object subscriberRole : subscriberRoles) {
+ private static AdviceExpressionType generateSubscriberAdviceAttributes(AdviceExpressionType adviceExpression,
+ Identifier attributeId, Collection<Object> adviceAttribute) {
+ for (Object attribute : adviceAttribute) {
AttributeValueType value = new AttributeValueType();
value.setDataType(XACML3.ID_DATATYPE_STRING.stringValue());
- value.getContent().add(subscriberRole.toString());
+ value.getContent().add(attribute.toString());
AttributeAssignmentExpressionType assignment = new AttributeAssignmentExpressionType();
- assignment.setAttributeId(ToscaDictionary.ID_ADVICE_OPTIMIZATION_SUBSCRIBER_ROLE.stringValue());
+ assignment.setAttributeId(attributeId.stringValue());
assignment.setCategory(XACML3.ID_SUBJECT_CATEGORY_ACCESS_SUBJECT.stringValue());
assignment.setExpression(new ObjectFactory().createAttributeValue(value));
adviceExpression.getAttributeAssignmentExpression().add(assignment);
-
}
//
// Return for convenience
diff --git a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java
index b1028e89..263c6540 100644
--- a/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java
+++ b/applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 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.
@@ -72,6 +72,10 @@ public class OptimizationSubscriberRequest extends StdMatchablePolicyRequest {
Map<String, Object> contexts = decisionRequest.getContext();
for (Entry<String, Object> entrySet : contexts.entrySet()) {
try {
+ //
+ // Should always be a collection, but in case someone changes
+ // the class without checking this repo.
+ //
if (entrySet.getValue() instanceof Collection) {
addSubject(contextAttributes, (Collection) entrySet.getValue(),
ToscaDictionary.ID_SUBJECT_OPTIMIZATION_SUBSCRIBER_NAME);
diff --git a/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
index e457e2f2..85541f18 100644
--- a/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
+++ b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java
@@ -2,7 +2,7 @@
* ============LICENSE_START=======================================================
* ONAP
* ================================================================================
- * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2019-2020 AT&T Intellectual Property. All rights reserved.
Modifications Copyright (C) 2019 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -24,6 +24,7 @@
package org.onap.policy.xacml.pdp.application.optimization;
import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
@@ -50,11 +51,15 @@ import org.junit.runners.MethodSorters;
import org.onap.policy.common.endpoints.parameters.RestServerParameters;
import org.onap.policy.common.utils.coder.CoderException;
import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.coder.StandardYamlCoder;
import org.onap.policy.common.utils.resources.ResourceUtils;
import org.onap.policy.common.utils.resources.TextFileUtils;
import org.onap.policy.models.decisions.concepts.DecisionRequest;
import org.onap.policy.models.decisions.concepts.DecisionResponse;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicy;
import org.onap.policy.models.tosca.authorative.concepts.ToscaPolicyTypeIdentifier;
+import org.onap.policy.models.tosca.authorative.concepts.ToscaServiceTemplate;
+import org.onap.policy.models.tosca.simple.concepts.JpaToscaServiceTemplate;
import org.onap.policy.pdp.xacml.application.common.XacmlApplicationException;
import org.onap.policy.pdp.xacml.application.common.XacmlApplicationServiceProvider;
import org.onap.policy.pdp.xacml.application.common.XacmlPolicyUtils;
@@ -214,7 +219,10 @@ public class OptimizationPdpApplicationTest {
//
// Now load all the optimization policies
//
- TestUtils.loadPolicies("src/test/resources/vCPE.policies.optimization.input.tosca.yaml", service);
+ List<ToscaPolicy> loadedPolicies = TestUtils.loadPolicies("src/test/resources/test-optimization-policies.yaml",
+ service);
+ assertThat(loadedPolicies).isNotNull();
+ assertThat(loadedPolicies).hasSize(14);
//
// Ask for a decision for available default policies
//
@@ -337,7 +345,6 @@ public class OptimizationPdpApplicationTest {
//
// Add gold as a scope
//
- //((List<String>)baseRequest.getResource().get("scope")).add("gold");
((List<String>)baseRequest.getContext().get("subscriberName")).add("subscriber_a");
//
// Ask for a decision for specific US vCPE vG gold
@@ -345,7 +352,8 @@ public class OptimizationPdpApplicationTest {
DecisionResponse response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(6);
+ assertThat(response.getPolicies()).hasSize(6);
+ assertThat(response.getAdvice()).hasSize(2);
//
// Validate it
//
@@ -369,7 +377,8 @@ public class OptimizationPdpApplicationTest {
DecisionResponse response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(8);
+ assertThat(response.getPolicies()).hasSize(8);
+ assertThat(response.getAdvice()).hasSize(2);
//
// Validate it
//
@@ -448,6 +457,47 @@ public class OptimizationPdpApplicationTest {
validateDecision(response, baseRequest);
}
+ @Test
+ public void test999BadSubscriberPolicies() throws Exception {
+ final StandardYamlCoder yamlCoder = new StandardYamlCoder();
+ //
+ // Decode it
+ //
+ String policyYaml = ResourceUtils.getResourceAsString("src/test/resources/bad-subscriber-policies.yaml");
+ //
+ // Serialize it into a class
+ //
+ ToscaServiceTemplate serviceTemplate;
+ try {
+ serviceTemplate = yamlCoder.decode(policyYaml, ToscaServiceTemplate.class);
+ } catch (CoderException e) {
+ throw new XacmlApplicationException("Failed to decode policy from resource file", e);
+ }
+ //
+ // Make sure all the fields are setup properly
+ //
+ JpaToscaServiceTemplate jtst = new JpaToscaServiceTemplate();
+ jtst.fromAuthorative(serviceTemplate);
+ ToscaServiceTemplate completedJtst = jtst.toAuthorative();
+ //
+ // Get the policies
+ //
+ for (Map<String, ToscaPolicy> policies : completedJtst.getToscaTopologyTemplate().getPolicies()) {
+ for (ToscaPolicy policy : policies.values()) {
+ if ("missing-subscriberProperties".equals(policy.getName())) {
+ assertThatExceptionOfType(XacmlApplicationException.class).isThrownBy(() ->
+ service.loadPolicy(policy));
+ } else if ("missing-subscriberName".equals(policy.getName())) {
+ assertThatExceptionOfType(XacmlApplicationException.class).isThrownBy(() ->
+ service.loadPolicy(policy));
+ } else if ("missing-subscriberRole".equals(policy.getName())) {
+ assertThatExceptionOfType(XacmlApplicationException.class).isThrownBy(() ->
+ service.loadPolicy(policy));
+ }
+ }
+ }
+ }
+
private DecisionResponse makeDecision() {
Pair<DecisionResponse, Response> decision = service.makeDecision(baseRequest, null);
LOGGER.info("Request Resources {}", baseRequest.getResource());
diff --git a/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequestTest.java b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequestTest.java
new file mode 100644
index 00000000..3fd9e44b
--- /dev/null
+++ b/applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationSubscriberRequestTest.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP
+ * ================================================================================
+ * Copyright (C) 2020 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.
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.policy.xacml.pdp.application.optimization;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+import com.att.research.xacml.api.Request;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import org.junit.Before;
+import org.junit.Test;
+import org.onap.policy.common.utils.coder.StandardCoder;
+import org.onap.policy.common.utils.resources.TextFileUtils;
+import org.onap.policy.models.decisions.concepts.DecisionRequest;
+
+public class OptimizationSubscriberRequestTest {
+ private static StandardCoder gson = new StandardCoder();
+ private DecisionRequest request;
+
+ /**
+ * setupLoadDecision loads the decision request object for testing.
+ *
+ * @throws Exception Exception if unable to load
+ */
+ @Before
+ public void setupLoadDecision() throws Exception {
+ request = gson.decode(
+ TextFileUtils
+ .getTextFileAsString(
+ "src/test/resources/decision.optimization.input.json"),
+ DecisionRequest.class);
+
+ assertThat(request).isNotNull();
+ }
+
+ @Test
+ public void testDecisionRequest() throws Exception {
+ //
+ // Add context
+ //
+ Map<String, Object> context = new HashMap<>();
+ context.put("subscriberRole", "role1");
+ request.setContext(context);
+ //
+ // Check the return object
+ //
+ Request xacml = OptimizationSubscriberRequest.createInstance(request);
+
+ assertThat(xacml).isNotNull();
+ assertThat(xacml.getRequestAttributes()).hasSize(4);
+
+ List<String> roles = new ArrayList<>();
+ roles.add("role-A");
+ roles.add("role-B");
+ context.put("subscriberRole", "role1");
+ request.setContext(context);
+
+ xacml = OptimizationSubscriberRequest.createInstance(request);
+ assertThat(xacml).isNotNull();
+ assertThat(xacml.getRequestAttributes()).hasSize(4);
+ }
+}
diff --git a/applications/optimization/src/test/resources/bad-subscriber-policies.yaml b/applications/optimization/src/test/resources/bad-subscriber-policies.yaml
new file mode 100644
index 00000000..db638fb8
--- /dev/null
+++ b/applications/optimization/src/test/resources/bad-subscriber-policies.yaml
@@ -0,0 +1,34 @@
+tosca_definitions_version: tosca_simple_yaml_1_0_0
+topology_template:
+ policies:
+ -
+ missing-subscriberProperties:
+ type: onap.policies.optimization.service.SubscriberPolicy
+ version: 1.0.0
+ type_version: 1.0.0
+ properties:
+ scope: []
+ services: [vCPE]
+ identity: subscriber_vCPE
+ -
+ missing-subscriberName:
+ type: onap.policies.optimization.service.SubscriberPolicy
+ version: 1.0.0
+ type_version: 1.0.0
+ properties:
+ scope: []
+ services: [vCPE]
+ identity: subscriber_vCPE
+ subscriberProperties:
+ missingName: foo
+ -
+ missing-subscriberRole:
+ type: onap.policies.optimization.service.SubscriberPolicy
+ version: 1.0.0
+ type_version: 1.0.0
+ properties:
+ scope: []
+ services: [vCPE]
+ identity: subscriber_vCPE
+ subscriberProperties:
+ subscriberName: foo \ No newline at end of file
diff --git a/applications/optimization/src/test/resources/vCPE.policies.optimization.input.tosca.yaml b/applications/optimization/src/test/resources/test-optimization-policies.yaml
index fb848637..f893158b 100644
--- a/applications/optimization/src/test/resources/vCPE.policies.optimization.input.tosca.yaml
+++ b/applications/optimization/src/test/resources/test-optimization-policies.yaml
@@ -255,7 +255,6 @@ topology_template:
properties:
scope: []
services: [vCPE]
-# resources: [vGMuxInfra, vG]
geography: [US, INTERNATIONAL]
identity: vCPE_Query_Policy
queryProperties: