Upgrade new tcagen2 policy type 27/111427/1
authorPamela Dragosh <pdragosh@research.att.com>
Wed, 19 Aug 2020 15:18:39 +0000 (11:18 -0400)
committerPamela Dragosh <pdragosh@research.att.com>
Wed, 19 Aug 2020 15:18:44 +0000 (11:18 -0400)
The old cdap policy type is deprecated by DCAE. Thus,
we are simply replacing with the new tcagen2 policy type.

Issue-ID: POLICY-2772
Change-Id: I1442340729b5f820f2e265b9b86f6f6f84f49bca
Signed-off-by: Pamela Dragosh <pdragosh@research.att.com>
17 files changed:
models-examples/src/main/resources/policies/vCPE.policy.monitoring.input.tosca.json
models-examples/src/main/resources/policies/vCPE.policy.monitoring.input.tosca.yaml
models-examples/src/main/resources/policies/vCPE.policy.monitoring.output.tosca.yaml
models-examples/src/main/resources/policies/vDNS.policy.monitoring.input.tosca.json
models-examples/src/main/resources/policies/vDNS.policy.monitoring.input.tosca.yaml
models-examples/src/main/resources/policies/vDNS.policy.monitoring.output.tosca.yaml
models-examples/src/main/resources/policies/vFirewall.policy.monitoring.input.tosca.json
models-examples/src/main/resources/policies/vFirewall.policy.monitoring.input.tosca.yaml
models-examples/src/main/resources/policies/vFirewall.policy.monitoring.output.tosca.yaml
models-examples/src/main/resources/policytypes/onap.policies.monitoring.tcagen2.yaml [moved from models-examples/src/main/resources/policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml with 98% similarity]
models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyFilterTest.java
models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/concepts/ToscaPolicyTypeFilterTest.java
models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/AuthorativeToscaProviderPolicyTest.java
models-tosca/src/test/java/org/onap/policy/models/tosca/authorative/provider/ToscaServiceTemplateMappingTest.java
models-tosca/src/test/java/org/onap/policy/models/tosca/simple/provider/SimpleToscaProviderTest.java
models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicySerializationTest.java
models-tosca/src/test/java/org/onap/policy/models/tosca/simple/serialization/MonitoringPolicyTypeSerializationTest.java

index d8bd4d4..4015595 100644 (file)
@@ -4,7 +4,7 @@
         "policies": [
             {
                 "onap.restart.tca": {
-                    "type": "onap.policies.monitoring.cdap.tca.hi.lo.app",
+                    "type": "onap.policies.monitoring.tcagen2",
                     "type_version": "1.0.0",
                     "version": "1.0.0",
                     "name": "onap.restart.tca",
@@ -13,7 +13,7 @@
                         "policy-version": 1
                     },
                     "properties": {
-                        "tca_policy" : {
+                        "tca.policy" : {
                             "domain": "measurementsForVfScaling",
                             "metricsPerEventName": [
                                 {
index 51fcd32..b15ab77 100644 (file)
@@ -3,7 +3,7 @@ topology_template:
    policies:
      -
        onap.restart.tca:
-           type: onap.policies.monitoring.cdap.tca.hi.lo.app
+           type: onap.policies.monitoring.tcagen2
            type_version: 1.0.0
            version: 1.0.0
            name: onap.restart.tca
@@ -11,7 +11,7 @@ topology_template:
              policy-id: onap.restart.tca
              policy-version: 1
            properties:
-             tca_policy:
+             tca.policy:
                 domain: measurementsForVfScaling
                 metricsPerEventName:
                   -
index 51fcd32..b15ab77 100644 (file)
@@ -3,7 +3,7 @@ topology_template:
    policies:
      -
        onap.restart.tca:
-           type: onap.policies.monitoring.cdap.tca.hi.lo.app
+           type: onap.policies.monitoring.tcagen2
            type_version: 1.0.0
            version: 1.0.0
            name: onap.restart.tca
@@ -11,7 +11,7 @@ topology_template:
              policy-id: onap.restart.tca
              policy-version: 1
            properties:
-             tca_policy:
+             tca.policy:
                 domain: measurementsForVfScaling
                 metricsPerEventName:
                   -
index f17f32f..47cf06d 100644 (file)
@@ -7,7 +7,7 @@
             {
                 "onap.scaleout.tca":
                 {
-                    "type": "onap.policies.monitoring.cdap.tca.hi.lo.app",
+                    "type": "onap.policies.monitoring.tcagen2",
                     "type_version": "1.0.0",
                     "version": "1.0.0",
                     "name": "onap.scaleout.tca",
@@ -18,7 +18,7 @@
 
                     "properties":
                     {
-                        "tca_policy":
+                        "tca.policy":
                         {
                             "domain": "measurementsForVfScaling",
                             "metricsPerEventName":
index d2a28f6..3775bf5 100644 (file)
@@ -3,14 +3,14 @@ topology_template:
    policies:
       -
          onap.scaleout.tca:
-            type: onap.policies.monitoring.cdap.tca.hi.lo.app
+            type: onap.policies.monitoring.tcagen2
             type_version: 1.0.0
             version: 1.0.0
             name: onap.scaleout.tca
             metadata:
                policy-id: onap.scaleout.tca
             properties:
-               tca_policy:
+               tca.policy:
                   domain: measurementsForVfScaling
                   metricsPerEventName:
                      -
index ce37151..ed86170 100644 (file)
@@ -3,7 +3,7 @@ topology_template:
    policies:
       -
          onap.scaleout.tca:
-            type: onap.policies.monitoring.cdap.tca.hi.lo.app
+            type: onap.policies.monitoring.tcagen2
             type_version: 1.0.0
             version: 1.0.0
             name: onap.scaleout.tca
@@ -11,7 +11,7 @@ topology_template:
                policy-id: onap.scaleout.tca
                policy-version: 1
             properties:
-               tca_policy:
+               tca.policy:
                   domain: measurementsForVfScaling
                   metricsPerEventName:
                      -
index ffb5c25..012ee25 100644 (file)
@@ -7,7 +7,7 @@
             {
                 "onap.vfirewall.tca":
                 {
-                    "type": "onap.policies.monitoring.cdap.tca.hi.lo.app",
+                    "type": "onap.policies.monitoring.tcagen2",
                     "type_version": "1.0.0",
                     "version": "1.0.0",
                     "name": "onap.vfirewall.tca",
@@ -18,7 +18,7 @@
 
                     "properties":
                     {
-                        "tca_policy":
+                        "tca.policy":
                         {
                             "domain": "measurementsForVfScaling",
                             "metricsPerEventName":
index 7831380..3847558 100644 (file)
@@ -3,14 +3,14 @@ topology_template:
   policies:
     -
       onap.vfirewall.tca:
-        type: onap.policies.monitoring.cdap.tca.hi.lo.app
+        type: onap.policies.monitoring.tcagen2
         type_version: 1.0.0
         version: 1.0.0
         name: onap.vfirewall.tca
         metadata:
            policy-id: onap.vfirewall.tca
         properties:
-           tca_policy:
+           tca.policy:
               domain: measurementsForVfScaling
               metricsPerEventName:
               -
index c52ddac..8108dab 100644 (file)
@@ -3,7 +3,7 @@ topology_template:
   policies:
     -
       onap.vfirewall.tca:
-        type: onap.policy.monitoring.cdap.tca.hi.lo.app
+        type: onap.policy.monitoring.tcagen2
         type_version: 1.0.0
         version: 1.0.0
         name: onap.vfirewall.tca
@@ -11,7 +11,7 @@ topology_template:
            policy-id: onap.vfirewall.tca
            policy-version: 1
         properties:
-           tca_policy:
+           tca.policy:
               domain: measurementsForVfScaling
               metricsPerEventName:
               -
@@ -5,12 +5,12 @@ policy_types:
       version: 1.0.0
       name: onap.policies.Monitoring
       description: a base policy type for all policies that govern monitoring provisioning
-   onap.policies.monitoring.cdap.tca.hi.lo.app:
+   onap.policies.monitoring.tcagen2:
       derived_from: onap.policies.Monitoring
       version: 1.0.0
-      name: onap.policies.monitoring.cdap.tca.hi.lo.app
+      name: onap.policies.monitoring.tcagen2
       properties:
-         tca_policy:
+         tca.policy:
             type: onap.datatypes.monitoring.tca_policy
             description: TCA Policy JSON
             required: true
index dd19c6c..01c5ff8 100644 (file)
@@ -254,7 +254,7 @@ public class ToscaPolicyFilterTest {
         filteredList = filter.filter(policyList);
         assertEquals(3, filteredList.size());
 
-        filter = ToscaPolicyFilter.builder().type("onap.policies.monitoring.cdap.tca.hi.lo.app").build();
+        filter = ToscaPolicyFilter.builder().type("onap.policies.monitoring.tcagen2").build();
         filteredList = filter.filter(policyList);
         assertEquals(3, filteredList.size());
 
index 82f100e..cba6078 100644 (file)
@@ -72,7 +72,7 @@ public class ToscaPolicyTypeFilterTest {
         "policytypes/onap.policies.controlloop.guard.common.FrequencyLimiter.yaml",
         "policytypes/onap.policies.controlloop.guard.coordination.FirstBlocksSecond.yaml",
         "policytypes/onap.policies.Optimization.yaml",
-        "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml"
+        "policytypes/onap.policies.monitoring.tcagen2.yaml"
     };
     // @formatter:on
 
@@ -171,7 +171,7 @@ public class ToscaPolicyTypeFilterTest {
         List<ToscaPolicyType> filteredList = filter.filter(typeList);
         assertEquals(1, filteredList.size());
 
-        filter = ToscaPolicyTypeFilter.builder().name("onap.policies.monitoring.cdap.tca.hi.lo.app").build();
+        filter = ToscaPolicyTypeFilter.builder().name("onap.policies.monitoring.tcagen2").build();
         filteredList = filter.filter(typeList);
         assertEquals(1, filteredList.size());
 
index efb5bf0..969e240 100644 (file)
@@ -411,7 +411,7 @@ public class AuthorativeToscaProviderPolicyTest {
     @Test
     public void testEntityMaps() throws CoderException, PfModelException {
         Object yamlObject = new Yaml().load(
-                ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml"));
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.tcagen2.yaml"));
         String yamlAsJsonString = new StandardCoder().encode(yamlObject);
 
         ToscaServiceTemplate toscaServiceTemplatePolicyType =
@@ -453,7 +453,7 @@ public class AuthorativeToscaProviderPolicyTest {
 
     private void createPolicyTypes() throws CoderException, PfModelException {
         Object yamlObject = new Yaml().load(
-                ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml"));
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.tcagen2.yaml"));
         String yamlAsJsonString = new StandardCoder().encode(yamlObject);
 
         ToscaServiceTemplate toscaServiceTemplatePolicyType =
index a1a080d..cd35f71 100644 (file)
@@ -56,7 +56,7 @@ public class ToscaServiceTemplateMappingTest {
     @Test
     public void testPlainToscaPolicies() throws Exception {
         String policyTypeInputJson =
-                ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml");
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.tcagen2.yaml");
         ToscaServiceTemplate plainPolicyTypes =
                 yamlJsonTranslator.fromYaml(policyTypeInputJson, ToscaServiceTemplate.class);
 
@@ -85,7 +85,7 @@ public class ToscaServiceTemplateMappingTest {
     public void testPlainToscaPolicyTypes() throws Exception {
         Yaml yaml = new Yaml();
         String inputYaml =
-                ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml");
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.tcagen2.yaml");
         Object yamlObject = yaml.load(inputYaml);
         String yamlAsJsonString = standardCoder.encode(yamlObject);
 
index 92c0f82..c597cd4 100644 (file)
@@ -842,7 +842,7 @@ public class SimpleToscaProviderTest {
 
     private void createPolicyTypes() throws CoderException, PfModelException {
         Object yamlObject = new Yaml()
-            .load(ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml"));
+            .load(ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.tcagen2.yaml"));
         String yamlAsJsonString = new StandardCoder().encode(yamlObject);
 
         ToscaServiceTemplate toscaServiceTemplatePolicyType =
index fb01d5e..a4b3de3 100644 (file)
@@ -61,7 +61,7 @@ public class MonitoringPolicySerializationTest {
 
     private static final String TOPOLOGY_TEMPLATE = "topology_template";
 
-    private static final String TCA_POLICY = "tca_policy";
+    private static final String TCA_POLICY = "tca.policy";
 
     private static final String PROPERTIES2 = "properties";
 
@@ -75,7 +75,7 @@ public class MonitoringPolicySerializationTest {
 
     private static final String POLICY1 = "onap.restart.tca";
 
-    private static final String TYPE1 = "onap.policies.monitoring.cdap.tca.hi.lo.app";
+    private static final String TYPE1 = "onap.policies.monitoring.tcagen2";
 
     private static final String METADATA = "metadata";
 
@@ -96,7 +96,7 @@ public class MonitoringPolicySerializationTest {
     @Test
     public void testDeserialization() throws Exception {
         String policyTypeInputJson =
-                ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml");
+                ResourceUtils.getResourceAsString("policytypes/onap.policies.monitoring.tcagen2.yaml");
         ToscaServiceTemplate plainPolicyTypes =
                 yamlJsonTranslator.fromYaml(policyTypeInputJson, ToscaServiceTemplate.class);
 
index 8061d1a..14d3a19 100644 (file)
@@ -73,7 +73,7 @@ public class MonitoringPolicyTypeSerializationTest {
 
     private static final Logger LOGGER = LoggerFactory.getLogger(MonitoringPolicyTypeSerializationTest.class);
 
-    private static final String MONITORING_TCA_YAML = "policytypes/onap.policies.monitoring.cdap.tca.hi.lo.app.yaml";
+    private static final String MONITORING_TCA_YAML = "policytypes/onap.policies.monitoring.tcagen2.yaml";
     private static final String MONITORING_COLLECTORS_YAML =
             "policytypes/onap.policies.monitoring.dcaegen2.collectors.datafile.datafile-app-server.yaml";
 
@@ -159,15 +159,15 @@ public class MonitoringPolicyTypeSerializationTest {
                 firstPolicyType.getValue().getDescription());
 
         Entry<PfConceptKey, JpaToscaPolicyType> secondPolicyType = policyTypesIter.next();
-        assertEquals("onap.policies.monitoring.cdap.tca.hi.lo.app", secondPolicyType.getKey().getName());
+        assertEquals("onap.policies.monitoring.tcagen2", secondPolicyType.getKey().getName());
         assertEquals(VERSION_100, secondPolicyType.getKey().getVersion());
         assertEquals(MONITORING, secondPolicyType.getValue().getDerivedFrom().getName());
         assertTrue(secondPolicyType.getValue().getProperties().size() == 1);
 
         JpaToscaProperty property = secondPolicyType.getValue().getProperties().values().iterator().next();
-        assertEquals("onap.policies.monitoring.cdap.tca.hi.lo.app", property.getKey().getParentKeyName());
+        assertEquals("onap.policies.monitoring.tcagen2", property.getKey().getParentKeyName());
         assertEquals(VERSION_100, property.getKey().getParentKeyVersion());
-        assertEquals("tca_policy", property.getKey().getLocalName());
+        assertEquals("tca.policy", property.getKey().getLocalName());
         assertEquals(TCA, property.getType().getName());
         assertEquals("TCA Policy JSON", property.getDescription());