summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2020-04-28 07:10:13 -0500
committerjhh <jorge.hernandez-herrero@att.com>2020-04-28 14:31:38 -0500
commitc86d6a6645af95d76a8b2b59f24433c616bf49fe (patch)
treeef4282528d6efca83e580f8c689a4d8337b1f324
parent5fa88515bf3039903225721dbd88540d92e6a525 (diff)
modifications in example sdnc naming policy
Issue-ID: POLICY-2525 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I7c6880b63b3ff8f986fb0de27656eda8f6e596a2 Signed-off-by: jhh <jorge.hernandez-herrero@att.com>
-rw-r--r--models-examples/src/main/resources/policies/sdnc.policy.naming.input.tosca.yaml15
-rw-r--r--models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java16
2 files changed, 17 insertions, 14 deletions
diff --git a/models-examples/src/main/resources/policies/sdnc.policy.naming.input.tosca.yaml b/models-examples/src/main/resources/policies/sdnc.policy.naming.input.tosca.yaml
index bb1f6d3ef..bb9022512 100644
--- a/models-examples/src/main/resources/policies/sdnc.policy.naming.input.tosca.yaml
+++ b/models-examples/src/main/resources/policies/sdnc.policy.naming.input.tosca.yaml
@@ -1,24 +1,26 @@
tosca_definitions_version: tosca_simple_yaml_1_1_0
topology_template:
policies:
- - SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP:
+ - SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP:
type: onap.policies.Naming
version: 1.0.0
type_version: 1.0.0
properties:
- policy-instance-name: ONAP_VNF_NAMING_TIMESTAMP
+ policy-instance-name: ONAP_NF_NAMING_TIMESTAMP
naming-models:
- naming-type: VNF
naming-recipe: AIC_CLOUD_REGION|DELIMITER|CONSTANT|DELIMITER|TIMESTAMP
+ name-operation: 'to_lower_case()'
naming-properties:
- property-name: AIC_CLOUD_REGION
- property-name: CONSTANT
- property-value: ONAP-NF
+ property-value: onap-nf
- property-name: TIMESTAMP
- - property-value: _
+ - property-value: '-'
property-name: DELIMITER
- naming-type: VNFC
naming-recipe: VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE
+ name-operation: 'to_lower_case()'
naming-properties:
- property-name: VNF_NAME
- property-name: SEQUENCE
@@ -30,13 +32,14 @@ topology_template:
increment: '1'
sequence-type: alpha-numeric
- property-name: NFC_NAMING_CODE
- - property-value: _
+ - property-value: '-'
property-name: DELIMITER
- naming-type: VF-MODULE
naming-recipe: VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE
+ name-operation: 'to_lower_case()'
naming-properties:
- property-name: VNF_NAME
- - property-value: _
+ - property-value: '-'
property-name: DELIMITER
- property-name: VF_MODULE_LABEL
- property-name: VF_MODULE_TYPE
diff --git a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
index 05dda76d1..b7145d00e 100644
--- a/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
+++ b/models-provider/src/test/java/org/onap/policy/models/provider/impl/PolicyToscaPersistenceTest.java
@@ -149,7 +149,7 @@ public class PolicyToscaPersistenceTest {
long getStartTime = System.currentTimeMillis();
ToscaServiceTemplate namingServiceTemplate =
- databaseProvider.getPolicies("SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP", "1.0.0");
+ databaseProvider.getPolicies("SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP", "1.0.0");
LOGGER.trace("Naming policy normal get time (ms): {}", System.currentTimeMillis() - getStartTime);
assertEquals(1, namingServiceTemplate.getToscaTopologyTemplate().getPoliciesAsMap().size());
@@ -158,7 +158,7 @@ public class PolicyToscaPersistenceTest {
getStartTime = System.currentTimeMillis();
ToscaPolicyFilter filter =
- ToscaPolicyFilter.builder().name("SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP").version("1.0.0").build();
+ ToscaPolicyFilter.builder().name("SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP").version("1.0.0").build();
namingServiceTemplate = databaseProvider.getFilteredPolicies(filter);
LOGGER.trace("Naming policy filtered get time (ms): {}", System.currentTimeMillis() - getStartTime);
@@ -167,7 +167,7 @@ public class PolicyToscaPersistenceTest {
assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size());
getStartTime = System.currentTimeMillis();
- filter = ToscaPolicyFilter.builder().name("SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP").build();
+ filter = ToscaPolicyFilter.builder().name("SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP").build();
namingServiceTemplate = databaseProvider.getFilteredPolicies(filter);
LOGGER.trace("Naming policy filtered name only get time (ms): {}", System.currentTimeMillis() - getStartTime);
@@ -176,7 +176,7 @@ public class PolicyToscaPersistenceTest {
assertEquals(3, namingServiceTemplate.getDataTypesAsMap().size());
long deleteStartTime = System.currentTimeMillis();
- databaseProvider.deletePolicy("SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP", "1.0.0");
+ databaseProvider.deletePolicy("SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP", "1.0.0");
LOGGER.trace("Naming policy delete time (ms): {}", System.currentTimeMillis() - deleteStartTime);
}
@@ -207,25 +207,25 @@ public class PolicyToscaPersistenceTest {
for (int i = 1; i < 22; i++) {
ToscaServiceTemplate namingServiceTemplate =
- databaseProvider.getPolicies("SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP", i + ".0.0");
+ databaseProvider.getPolicies("SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP", i + ".0.0");
assertEquals(i + ".0.0", namingServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).values()
.iterator().next().getVersion());
ToscaPolicyFilter policyFilter =
- ToscaPolicyFilter.builder().name("SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP").version(i + ".0.0").build();
+ ToscaPolicyFilter.builder().name("SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP").version(i + ".0.0").build();
namingServiceTemplate = databaseProvider.getFilteredPolicies(policyFilter);
assertEquals(i + ".0.0", namingServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).values()
.iterator().next().getVersion());
}
- ToscaPolicyFilter policyFilter = ToscaPolicyFilter.builder().name("SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP")
+ ToscaPolicyFilter policyFilter = ToscaPolicyFilter.builder().name("SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP")
.version(ToscaPolicyFilter.LATEST_VERSION).build();
ToscaServiceTemplate namingServiceTemplate = databaseProvider.getFilteredPolicies(policyFilter);
assertEquals("21.0.0", namingServiceTemplate.getToscaTopologyTemplate().getPolicies().get(0).values().iterator()
.next().getVersion());
for (int i = 1; i < 22; i++) {
- databaseProvider.deletePolicy("SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP", i + ".0.0");
+ databaseProvider.deletePolicy("SDNC_Policy.ONAP_NF_NAMING_TIMESTAMP", i + ".0.0");
}
}