aboutsummaryrefslogtreecommitdiffstats
path: root/applications/optimization
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2019-12-08 07:32:33 -0500
committerPamela Dragosh <pdragosh@research.att.com>2019-12-08 20:09:04 -0500
commitda84eeaaf7fa8edb999f60b707139f11ea0cb644 (patch)
tree4738afc024bb4926233470ddecb7733373843174 /applications/optimization
parent54a5c3dab62f2b0b0c1e3da2a525fb2e5c20ae2d (diff)
Changes for optimization refactoring
Companion review to https://gerrit.onap.org/r/c/policy/models/+/99288 The policy types for optimization were refactored, so the xacml optimization application tests need to accomodate that. Issue-ID: POLICY-2066 Change-Id: Ibc03b0652e771175a2fa38f5c3a3d81c7e371147 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.java18
-rw-r--r--applications/optimization/src/test/java/org/onap/policy/xacml/pdp/application/optimization/OptimizationPdpApplicationTest.java36
-rw-r--r--applications/optimization/src/test/resources/vCPE.policies.optimization.input.tosca.yaml30
3 files changed, 45 insertions, 39 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 e2ab00c6..c5a9e7cf 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
@@ -49,23 +49,23 @@ public class OptimizationPdpApplication extends StdXacmlApplicationServiceProvid
*/
public OptimizationPdpApplication() {
this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.AffinityPolicy", STRING_VERSION100));
+ "onap.policies.optimization.resource.AffinityPolicy", STRING_VERSION100));
this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.DistancePolicy", STRING_VERSION100));
+ "onap.policies.optimization.resource.DistancePolicy", STRING_VERSION100));
this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.HpaPolicy", STRING_VERSION100));
+ "onap.policies.optimization.resource.HpaPolicy", STRING_VERSION100));
this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.OptimizationPolicy", STRING_VERSION100));
+ "onap.policies.optimization.resource.OptimizationPolicy", STRING_VERSION100));
this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.PciPolicy", STRING_VERSION100));
+ "onap.policies.optimization.resource.PciPolicy", STRING_VERSION100));
this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.QueryPolicy", STRING_VERSION100));
+ "onap.policies.optimization.service.QueryPolicy", STRING_VERSION100));
this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.SubscriberPolicy", STRING_VERSION100));
+ "onap.policies.optimization.service.SubscriberPolicy", STRING_VERSION100));
this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.Vim_fit", STRING_VERSION100));
+ "onap.policies.optimization.resource.Vim_fit", STRING_VERSION100));
this.supportedPolicyTypes.add(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.VnfPolicy", STRING_VERSION100));
+ "onap.policies.optimization.resource.VnfPolicy", STRING_VERSION100));
}
@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 b77f301f..1cb8f32a 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
@@ -76,15 +76,17 @@ public class OptimizationPdpApplicationTest {
private static RestServerParameters clientParams;
private static String[] listPolicyTypeFiles = {
"onap.policies.Optimization",
- "onap.policies.optimization.AffinityPolicy",
- "onap.policies.optimization.DistancePolicy",
- "onap.policies.optimization.HpaPolicy",
- "onap.policies.optimization.OptimizationPolicy",
- "onap.policies.optimization.PciPolicy",
- "onap.policies.optimization.QueryPolicy",
- "onap.policies.optimization.SubscriberPolicy",
- "onap.policies.optimization.Vim_fit",
- "onap.policies.optimization.VnfPolicy"};
+ "onap.policies.optimization.Resource",
+ "onap.policies.optimization.Service",
+ "onap.policies.optimization.resource.AffinityPolicy",
+ "onap.policies.optimization.resource.DistancePolicy",
+ "onap.policies.optimization.resource.HpaPolicy",
+ "onap.policies.optimization.resource.OptimizationPolicy",
+ "onap.policies.optimization.resource.PciPolicy",
+ "onap.policies.optimization.service.QueryPolicy",
+ "onap.policies.optimization.service.SubscriberPolicy",
+ "onap.policies.optimization.resource.Vim_fit",
+ "onap.policies.optimization.resource.VnfPolicy"};
@ClassRule
public static final TemporaryFolder policyFolder = new TemporaryFolder();
@@ -176,7 +178,9 @@ public class OptimizationPdpApplicationTest {
// can support the correct policy types.
//
assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier(
- "onap.policies.optimization.AffinityPolicy", "1.0.0"))).isTrue();
+ "onap.policies.optimization.resource.AffinityPolicy", "1.0.0"))).isTrue();
+ assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier(
+ "onap.policies.optimization.service.SubscriberPolicy", "1.0.0"))).isTrue();
assertThat(service.canSupportPolicyType(new ToscaPolicyTypeIdentifier(
"onap.foobar", "1.0.0"))).isFalse();
}
@@ -221,7 +225,7 @@ public class OptimizationPdpApplicationTest {
//
// Add in policy type
//
- List<String> policyTypes = Lists.newArrayList("onap.policies.optimization.HpaPolicy");
+ List<String> policyTypes = Lists.newArrayList("onap.policies.optimization.resource.HpaPolicy");
baseRequest.getResource().put("policy-type", policyTypes);
//
// Ask for a decision for default HPA policy
@@ -231,7 +235,8 @@ public class OptimizationPdpApplicationTest {
assertThat(response).isNotNull();
assertThat(response.getPolicies().size()).isEqualTo(1);
response.getPolicies().forEach((key, value) -> {
- assertThat(((Map<String, Object>) value).get("type")).isEqualTo(("onap.policies.optimization.HpaPolicy"));
+ assertThat(((Map<String, Object>) value).get("type"))
+ .isEqualTo(("onap.policies.optimization.resource.HpaPolicy"));
});
//
// Validate it
@@ -275,7 +280,7 @@ public class OptimizationPdpApplicationTest {
DecisionResponse response = makeDecision();
assertThat(response).isNotNull();
- assertThat(response.getPolicies().size()).isEqualTo(4);
+ assertThat(response.getPolicies().size()).isEqualTo(5);
//
// Validate it
//
@@ -367,7 +372,7 @@ public class OptimizationPdpApplicationTest {
//
// Add in policy type
//
- List<String> policyTypes = Lists.newArrayList("onap.policies.optimization.AffinityPolicy");
+ List<String> policyTypes = Lists.newArrayList("onap.policies.optimization.resource.AffinityPolicy");
baseRequest.getResource().put("policy-type", policyTypes);
//
// Ask for a decision for default
@@ -388,7 +393,8 @@ public class OptimizationPdpApplicationTest {
//
// Add in another policy type
//
- ((List<String>) baseRequest.getResource().get("policy-type")).add("onap.policies.optimization.HpaPolicy");
+ ((List<String>) baseRequest.getResource().get("policy-type"))
+ .add("onap.policies.optimization.resource.HpaPolicy");
//
// Ask for a decision for default
//
diff --git a/applications/optimization/src/test/resources/vCPE.policies.optimization.input.tosca.yaml b/applications/optimization/src/test/resources/vCPE.policies.optimization.input.tosca.yaml
index 093156c6..3eedac95 100644
--- a/applications/optimization/src/test/resources/vCPE.policies.optimization.input.tosca.yaml
+++ b/applications/optimization/src/test/resources/vCPE.policies.optimization.input.tosca.yaml
@@ -3,7 +3,7 @@ topology_template:
policies:
-
OSDF_CASABLANCA.Affinity_Default:
- type: onap.policies.optimization.AffinityPolicy
+ type: onap.policies.optimization.resource.AffinityPolicy
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -21,7 +21,7 @@ topology_template:
category: complex
-
OSDF_CASABLANCA.Affinity_Default_US:
- type: onap.policies.optimization.AffinityPolicy
+ type: onap.policies.optimization.resource.AffinityPolicy
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -39,7 +39,7 @@ topology_template:
category: complex
-
OSDF_CASABLANCA.Affinity_Default_vCPE_US_0:
- type: onap.policies.optimization.AffinityPolicy
+ type: onap.policies.optimization.resource.AffinityPolicy
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -57,7 +57,7 @@ topology_template:
category: complex
-
OSDF_CASABLANCA.Affinity_vCPE_US_Gold_1:
- type: onap.policies.optimization.AffinityPolicy
+ type: onap.policies.optimization.resource.AffinityPolicy
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -75,7 +75,7 @@ topology_template:
category: availabilityZone
-
OSDF_CASABLANCA.Affinity_vCPE_US_Platinum_1:
- type: onap.policies.optimization.AffinityPolicy
+ type: onap.policies.optimization.resource.AffinityPolicy
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -93,7 +93,7 @@ topology_template:
category: availabilityZone
-
OSDF_CASABLANCA.Capacity_vG_1:
- type: onap.policies.optimization.Vim_fit
+ type: onap.policies.optimization.resource.Vim_fit
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -111,7 +111,7 @@ topology_template:
request: "{\"vCPU\": 10, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"GB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}"
-
OSDF_CASABLANCA.Capacity_vG_2:
- type: onap.policies.optimization.Vim_fit
+ type: onap.policies.optimization.resource.Vim_fit
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -129,7 +129,7 @@ topology_template:
request: "{\"vCPU\": 15, \"Memory\": {\"quantity\": {\"get_param\": \"REQUIRED_MEM\"}, \"unit\": \"MB\"}, \"Storage\": {\"quantity\": {\"get_param\": \"REQUIRED_DISK\"}, \"unit\": \"GB\"}}"
-
OSDF_CASABLANCA.Distance_vG_1:
- type: onap.policies.optimization.DistancePolicy
+ type: onap.policies.optimization.resource.DistancePolicy
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -150,7 +150,7 @@ topology_template:
unit: km
-
OSDF_CASABLANCA.hpa_policy_Default:
- type: onap.policies.optimization.HpaPolicy
+ type: onap.policies.optimization.resource.HpaPolicy
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -198,7 +198,7 @@ topology_template:
unit: ""
-
OSDF_CASABLANCA.hpa_policy_vG_1:
- type: onap.policies.optimization.HpaPolicy
+ type: onap.policies.optimization.resource.HpaPolicy
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -246,7 +246,7 @@ topology_template:
unit: ""
-
OSDF_CASABLANCA.queryPolicy_vCPE:
- type: onap.policies.optimization.QueryPolicy
+ type: onap.policies.optimization.service.QueryPolicy
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -255,7 +255,7 @@ topology_template:
properties:
scope: []
services: [vCPE]
- resources: [vGMuxInfra, vG]
+# resources: [vGMuxInfra, vG]
geography: [US, INTERNATIONAL]
identity: vCPE_Query_Policy
queryProperties:
@@ -281,7 +281,7 @@ topology_template:
value: 2.2
-
OSDF_CASABLANCA.SubscriberPolicy_v1:
- type: onap.policies.optimization.SubscriberPolicy
+ type: onap.policies.optimization.service.SubscriberPolicy
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -297,7 +297,7 @@ topology_template:
provStatus: [CAPPED]
-
OSDF_CASABLANCA.SubscriberPolicy_v2:
- type: onap.policies.optimization.SubscriberPolicy
+ type: onap.policies.optimization.service.SubscriberPolicy
version: 1.0.0
type_version: 1.0.0
metadata:
@@ -313,7 +313,7 @@ topology_template:
provStatus: [CAPPED]
-
OSDF_CASABLANCA.vnfPolicy_vG:
- type: onap.policies.optimization.VnfPolicy
+ type: onap.policies.optimization.resource.VnfPolicy
version: 1.0.0
type_version: 1.0.0
metadata: