summaryrefslogtreecommitdiffstats
path: root/applications/optimization
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-04-01 10:53:12 -0400
committerPamela Dragosh <pdragosh@research.att.com>2020-04-01 10:53:16 -0400
commita9cc8a51269cb27dff98a24205961c29bea79ca4 (patch)
treea7aee6ac9f0782820c650b08ec8d120fd00730d6 /applications/optimization
parentfb5c730d87e9dfeafac06495b8fce567b4544036 (diff)
Fix optimization supported types
To support 5G slicing use cases, we will support any policy type that derives from onap.policies.optimization Similar in functionality to monitoring Issue-ID: POLICY-2460 Change-Id: I48b071a64b917cea44eb64149539875ba33e2ef5 Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
Diffstat (limited to 'applications/optimization')
-rw-r--r--applications/optimization/src/main/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplication.java10
-rw-r--r--applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java2
2 files changed, 7 insertions, 5 deletions
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 5a8978f7..8d337e47 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
@@ -63,6 +63,7 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
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";
+ public static final String ONAP_OPTIMIZATION_DERIVED_POLICY_TYPE = "onap.policies.optimization.";
private OptimizationPdpApplicationTranslator translator = new OptimizationPdpApplicationTranslator();
private List<ToscaPolicyTypeIdentifier> supportedPolicyTypes = new ArrayList<>();
@@ -118,17 +119,16 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
// For the time being, restrict this if the version isn't known.
// Could be too difficult to support changing of versions dynamically.
//
- //
- // For the time being, restrict this if the version isn't known.
- // Could be too difficult to support changing of versions dynamically.
- //
for (ToscaPolicyTypeIdentifier supported : this.supportedPolicyTypes) {
if (policyTypeId.equals(supported)) {
LOGGER.info("optimization can support {}", supported);
return true;
}
}
- return false;
+ //
+ // Support derived types
+ //
+ return policyTypeId.getName().startsWith(ONAP_OPTIMIZATION_DERIVED_POLICY_TYPE);
}
@Override
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 85541f18..031ef33c 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
@@ -188,6 +188,8 @@ public class OptimizationPdpApplicationTest {
assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier(
"onap.policies.optimization.service.SubscriberPolicy", "1.0.0"))).isTrue();
assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier(
+ "onap.policies.optimization.service.CustomUseCase", "1.0.0"))).isTrue();
+ assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier(
"onap.foobar", "1.0.0"))).isFalse();
}