aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPamela Dragosh <pdragosh@research.att.com>2020-04-16 18:42:05 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-16 18:42:05 +0000
commit955b479749ef6127a63498dcc147aa4c387137aa (patch)
treee0f73eab2f20c65c64c8df9f6f91a21796687bc6
parent96924e42a3e7ec817b29b2de268b1d60205ea729 (diff)
parentd3f7c6e9cf6bad3fc295fd35283e1d79e6166f3d (diff)
Merge "Add version to example yaml files"
-rw-r--r--models-examples/src/main/resources/policies/vCPE.policy.monitoring.output.tosca.yaml11
-rw-r--r--models-examples/src/main/resources/policies/vCPE.policy.operational.output.tosca.yaml7
-rw-r--r--models-examples/src/main/resources/policies/vDNS.policy.monitoring.output.tosca.yaml1
-rw-r--r--models-examples/src/main/resources/policies/vDNS.policy.operational.input.tosca.yaml1
-rw-r--r--models-examples/src/main/resources/policies/vDNS.policy.operational.output.tosca.yaml1
-rw-r--r--models-examples/src/main/resources/policies/vFirewall.policy.monitoring.output.tosca.yaml1
-rw-r--r--models-examples/src/main/resources/policies/vFirewall.policy.operational.input.tosca.yaml1
-rw-r--r--models-examples/src/main/resources/policies/vFirewall.policy.operational.output.tosca.yaml5
-rw-r--r--models-examples/src/main/resources/policies/vFirewallCDS.policy.operational.input.tosca.yaml1
-rw-r--r--models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyFilterTest.java29
10 files changed, 26 insertions, 32 deletions
diff --git a/models-examples/src/main/resources/policies/vCPE.policy.monitoring.output.tosca.yaml b/models-examples/src/main/resources/policies/vCPE.policy.monitoring.output.tosca.yaml
index eae1cd4dc..4928bbe80 100644
--- a/models-examples/src/main/resources/policies/vCPE.policy.monitoring.output.tosca.yaml
+++ b/models-examples/src/main/resources/policies/vCPE.policy.monitoring.output.tosca.yaml
@@ -4,6 +4,7 @@ topology_template:
-
onap.restart.tca:
type: onap.policies.monitoring.cdap.tca.hi.lo.app
+ type_version: 1.0.0
version: 1.0.0
metadata:
policy-id: onap.restart.tca
@@ -11,15 +12,15 @@ topology_template:
properties:
tca_policy:
domain: measurementsForVfScaling
- metricsPerEventName:
- -
+ metricsPerEventName:
+ -
eventName: Measurement_vGMUX
controlLoopSchemaType: VNF
policyScope: DCAE
policyName: "DCAE.Config_tca-hi-lo"
policyVersion: "v0.0.1"
- thresholds:
- -
+ thresholds:
+ -
closedLoopControlName: "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e"
version: "1.0.2"
fieldPath: "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value"
@@ -27,7 +28,7 @@ topology_template:
direction: EQUAL
severity: MAJOR
closedLoopEventStatus: ABATED
- -
+ -
closedLoopControlName: "ControlLoop-vCPE-48f0c2c3-a172-4192-9ae3-052274181b6e"
version: "1.0.2"
fieldPath: "$.event.measurementsForVfScalingFields.additionalMeasurements[*].arrayOfFields[0].value"
diff --git a/models-examples/src/main/resources/policies/vCPE.policy.operational.output.tosca.yaml b/models-examples/src/main/resources/policies/vCPE.policy.operational.output.tosca.yaml
index 3381c4b10..1d8927d25 100644
--- a/models-examples/src/main/resources/policies/vCPE.policy.operational.output.tosca.yaml
+++ b/models-examples/src/main/resources/policies/vCPE.policy.operational.output.tosca.yaml
@@ -2,10 +2,11 @@ tosca_definitions_version: tosca_simple_yaml_1_1_0
topology_template:
policies:
-
- operational.restart:
+ operational.restart:
type: onap.policies.controlloop.Operational
+ type_version: 1.0.0
version: 1.0.0
- metadata:
+ metadata:
policy-id: operational.restart
policy-version: 1
properties:
@@ -15,7 +16,7 @@ topology_template:
trigger_policy: unique-policy-id-1-restart
timeout: 3600
abatement: true
-
+
policies:
- id: unique-policy-id-1-restart
name: Restart the VM
diff --git a/models-examples/src/main/resources/policies/vDNS.policy.monitoring.output.tosca.yaml b/models-examples/src/main/resources/policies/vDNS.policy.monitoring.output.tosca.yaml
index 963e193d3..b49571c26 100644
--- a/models-examples/src/main/resources/policies/vDNS.policy.monitoring.output.tosca.yaml
+++ b/models-examples/src/main/resources/policies/vDNS.policy.monitoring.output.tosca.yaml
@@ -4,6 +4,7 @@ topology_template:
-
onap.scaleout.tca:
type: onap.policies.monitoring.cdap.tca.hi.lo.app
+ type_version: 1.0.0
version: 1.0.0
metadata:
policy-id: onap.scaleout.tca
diff --git a/models-examples/src/main/resources/policies/vDNS.policy.operational.input.tosca.yaml b/models-examples/src/main/resources/policies/vDNS.policy.operational.input.tosca.yaml
index c7bafc66f..abe6b2193 100644
--- a/models-examples/src/main/resources/policies/vDNS.policy.operational.input.tosca.yaml
+++ b/models-examples/src/main/resources/policies/vDNS.policy.operational.input.tosca.yaml
@@ -4,6 +4,7 @@ topology_template:
- operational.scaleout:
type: onap.policies.controlloop.operational.common.Drools
type_version: 1.0.0
+ version: 1.0.0
metadata:
policy-id: operational.scaleout
properties:
diff --git a/models-examples/src/main/resources/policies/vDNS.policy.operational.output.tosca.yaml b/models-examples/src/main/resources/policies/vDNS.policy.operational.output.tosca.yaml
index 8bd8de782..1fe2132df 100644
--- a/models-examples/src/main/resources/policies/vDNS.policy.operational.output.tosca.yaml
+++ b/models-examples/src/main/resources/policies/vDNS.policy.operational.output.tosca.yaml
@@ -4,6 +4,7 @@ topology_template:
- operational.scaleout:
type: onap.policies.controlloop.operational.common.Drools
type_version: 1.0.0
+ version: 1.0.0
metadata:
policy-id: operational.scaleout
properties:
diff --git a/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.output.tosca.yaml b/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.output.tosca.yaml
index 750a84ca0..62a470596 100644
--- a/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.output.tosca.yaml
+++ b/models-examples/src/main/resources/policies/vFirewall.policy.monitoring.output.tosca.yaml
@@ -4,6 +4,7 @@ topology_template:
-
onap.vfirewall.tca:
type: onap.policy.monitoring.cdap.tca.hi.lo.app
+ type_version: 1.0.0
version: 1.0.0
metadata:
policy-id: onap.vfirewall.tca
diff --git a/models-examples/src/main/resources/policies/vFirewall.policy.operational.input.tosca.yaml b/models-examples/src/main/resources/policies/vFirewall.policy.operational.input.tosca.yaml
index d2bf8c42f..5ad7ef613 100644
--- a/models-examples/src/main/resources/policies/vFirewall.policy.operational.input.tosca.yaml
+++ b/models-examples/src/main/resources/policies/vFirewall.policy.operational.input.tosca.yaml
@@ -4,6 +4,7 @@ topology_template:
- operational.modifyconfig:
type: onap.policies.controlloop.operational.common.Drools
type_version: 1.0.0
+ version: 1.0.0
metadata:
policy-id: operational.modifyconfig
properties:
diff --git a/models-examples/src/main/resources/policies/vFirewall.policy.operational.output.tosca.yaml b/models-examples/src/main/resources/policies/vFirewall.policy.operational.output.tosca.yaml
index 923bc7d75..22aced815 100644
--- a/models-examples/src/main/resources/policies/vFirewall.policy.operational.output.tosca.yaml
+++ b/models-examples/src/main/resources/policies/vFirewall.policy.operational.output.tosca.yaml
@@ -4,8 +4,9 @@ topology_template:
-
operational.modifyconfig:
type: onap.policies.controlloop.Operational
+ type_version: 1.0.0
version: 1.0.0
- metadata:
+ metadata:
policy-id: operational.modifyconfig
policy-version: 1
properties:
@@ -15,7 +16,7 @@ topology_template:
trigger_policy: unique-policy-id-1-modifyConfig
timeout: 1200
abatement: false
-
+
policies:
- id: unique-policy-id-1-modifyConfig
name: modify packet gen config
diff --git a/models-examples/src/main/resources/policies/vFirewallCDS.policy.operational.input.tosca.yaml b/models-examples/src/main/resources/policies/vFirewallCDS.policy.operational.input.tosca.yaml
index 7784b1c1e..91d73350b 100644
--- a/models-examples/src/main/resources/policies/vFirewallCDS.policy.operational.input.tosca.yaml
+++ b/models-examples/src/main/resources/policies/vFirewallCDS.policy.operational.input.tosca.yaml
@@ -4,6 +4,7 @@ topology_template:
- operational.modifyconfig.cds:
type: onap.policies.controlloop.operational.common.Drools
type_version: 1.0.0
+ version: 1.0.0
metadata:
policy-id: operational.modifyconfig.cds
properties:
diff --git a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyFilterTest.java b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyFilterTest.java
index a02147cdd..933221c98 100644
--- a/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyFilterTest.java
+++ b/models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyFilterTest.java
@@ -60,17 +60,13 @@ public class ToscaPolicyFilterTest {
// @formatter:off
private static final String[] policyResourceNames = {
"policies/vCPE.policies.optimization.input.tosca.yaml",
- "policies/vCPE.policy.monitoring.input.tosca.json",
"policies/vCPE.policy.monitoring.input.tosca.yaml",
"policies/vCPE.policy.operational.input.tosca.yaml",
- "policies/vDNS.policy.monitoring.input.tosca.json",
"policies/vDNS.policy.monitoring.input.tosca.yaml",
"policies/vDNS.policy.operational.input.tosca.yaml",
"policies/vDNS.policy.guard.frequencylimiter.input.tosca.yaml",
"policies/vDNS.policy.guard.minmaxvnfs.input.tosca.yaml",
- "policies/vFirewall.policy.monitoring.input.tosca.json",
"policies/vFirewall.policy.monitoring.input.tosca.yaml",
- "policies/vFirewall.policy.operational.input.tosca.json",
"policies/vFirewall.policy.operational.input.tosca.yaml"
};
// @formatter:on
@@ -151,7 +147,7 @@ public class ToscaPolicyFilterTest {
assertEquals(VERSION_100, filteredList.get(7).getVersion());
assertEquals(VERSION_100, filteredList.get(12).getVersion());
- assertEquals(23, policyList.size());
+ assertEquals(22, policyList.size());
assertEquals(22, filteredList.size());
//
@@ -177,8 +173,6 @@ public class ToscaPolicyFilterTest {
assertThat(policy.getVersion()).isEqualTo("2.0.0");
} else if ("operational.modifyconfig".equals(policy.getName())) {
assertThat(policy.getVersion()).isEqualTo("3.4.5");
- } else if ("operational.scaleout".equals(policy.getName())) {
- assertThat(policy.getVersion()).isEqualTo(VERSION_000);
} else {
assertThat(policy.getVersion()).isEqualTo(VERSION_100);
}
@@ -202,23 +196,14 @@ public class ToscaPolicyFilterTest {
//
// Assert that the correct versions are returned
//
- policyList.forEach(policy -> {
- //
- // Should we fix this to be 1.0.0??
- //
- if ("operational.scaleout".equals(policy.getName())) {
- assertThat(policy.getVersion()).isEqualTo(VERSION_000);
- } else {
- assertThat(policy.getVersion()).isEqualTo(VERSION_100);
- }
- });
+ policyList.forEach(policy -> assertThat(policy.getVersion()).isEqualTo(VERSION_100));
}
@Test
public void testFilterNameVersion() {
ToscaPolicyFilter filter = ToscaPolicyFilter.builder().name("operational.modifyconfig").build();
List<ToscaPolicy> filteredList = filter.filter(policyList);
- assertEquals(2, filteredList.size());
+ assertEquals(1, filteredList.size());
filter = ToscaPolicyFilter.builder().name("guard.frequency.scaleout").build();
filteredList = filter.filter(policyList);
@@ -238,7 +223,7 @@ public class ToscaPolicyFilterTest {
filter = ToscaPolicyFilter.builder().name("operational.modifyconfig").version(VERSION_100).build();
filteredList = filter.filter(policyList);
- assertEquals(2, filteredList.size());
+ assertEquals(1, filteredList.size());
}
@Test
@@ -246,11 +231,11 @@ public class ToscaPolicyFilterTest {
// null pattern
ToscaPolicyFilter filter = ToscaPolicyFilter.builder().versionPrefix(null).build();
List<ToscaPolicy> filteredList = filter.filter(policyList);
- assertEquals(23, filteredList.size());
+ assertEquals(22, filteredList.size());
filter = ToscaPolicyFilter.builder().versionPrefix("1.").build();
filteredList = filter.filter(policyList);
- assertEquals(21, filteredList.size());
+ assertEquals(22, filteredList.size());
filter = ToscaPolicyFilter.builder().versionPrefix("100.").build();
filteredList = filter.filter(policyList);
@@ -269,7 +254,7 @@ public class ToscaPolicyFilterTest {
filter = ToscaPolicyFilter.builder().type("onap.policies.controlloop.operational.common.Drools").build();
filteredList = filter.filter(policyList);
- assertEquals(4, filteredList.size());
+ assertEquals(3, filteredList.size());
filter = ToscaPolicyFilter.builder().type("onap.policies.monitoring.cdap.tca.hi.lo.app").build();
filteredList = filter.filter(policyList);