summaryrefslogtreecommitdiffstats
path: root/ms/neng/src/test
diff options
context:
space:
mode:
authorBT2983 <BT2983@att.com>2018-09-16 21:30:20 -0600
committerTimoney, Dan (dt5972) <dt5972@att.com>2018-09-17 12:35:14 -0400
commit9783a8b7515eaaec310e404650d0dd9092eb90a8 (patch)
tree90101018aa23a5e91c0d9f85aec0fa5ff407e184 /ms/neng/src/test
parent4f44000fef9608150811e0b9f9b140c580f5822b (diff)
naming micro-service updates.
More tests, changes for maria DB, support for UUID and timestamp etc. Change-Id: I17bdf3acbe970ef4104f2ec0d59d5777c0a9928e Issue-ID: CCSDK-342 Signed-off-by: BT2983 <BT2983@att.com>
Diffstat (limited to 'ms/neng/src/test')
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/SequenceFormatterTest.java17
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReaderTest.java59
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequenceTest.java43
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java24
-rw-r--r--ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java6
-rw-r--r--ms/neng/src/test/sanity/add-policy-vnf-ts.sh46
-rw-r--r--ms/neng/src/test/sanity/add-policy-vnf-uuid.sh46
-rw-r--r--ms/neng/src/test/sanity/add-policy-vnf.sh46
-rw-r--r--ms/neng/src/test/sanity/gen-name-vnf-ts.sh57
-rw-r--r--ms/neng/src/test/sanity/gen-name-vnf-uuid.sh57
-rw-r--r--ms/neng/src/test/sanity/gen-name-vnf.sh57
-rw-r--r--ms/neng/src/test/sanity/policy-vnf-ts.json33
-rw-r--r--ms/neng/src/test/sanity/policy-vnf-uuid.json33
-rw-r--r--ms/neng/src/test/sanity/policy-vnf.json33
14 files changed, 542 insertions, 15 deletions
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/SequenceFormatterTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/SequenceFormatterTest.java
index 5a161319..86f418ac 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/SequenceFormatterTest.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/gen/SequenceFormatterTest.java
@@ -33,8 +33,7 @@ public class SequenceFormatterTest {
private PolicySequence poly;
@Before
- public void setUp()
- {
+ public void setUp() {
poly = new PolicySequence();
}
@@ -60,31 +59,27 @@ public class SequenceFormatterTest {
}
@Test
- public void testGetSetIncrement()
- {
+ public void testGetSetIncrement() {
poly.setIncrement(1L);
assertEquals(1L, poly.getIncrement());
}
@Test
- public void testGetSetMaxValue()
- {
+ public void testGetSetMaxValue() {
poly.setMaxValue(1L);
assertEquals(1L, poly.getMaxValue());
}
@Test
- public void testGetSetKey()
- {
+ public void testGetSetKey() {
poly.setKey("testKey");
assertEquals("testKey", poly.getKey());
}
@Test
- public void testGetSetLastReleaseSeqNumTried()
- {
+ public void testGetSetLastReleaseSeqNumTried() {
poly.setLastReleaseSeqNumTried(1L);
- Long expected=1L;
+ Long expected = 1L;
assertEquals(expected, poly.getLastReleaseSeqNumTried());
}
}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReaderTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReaderTest.java
index 30fc6e45..b439c610 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReaderTest.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicyReaderTest.java
@@ -21,9 +21,15 @@
package org.onap.ccsdk.apps.ms.neng.core.policy;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
import static org.onap.ccsdk.apps.ms.neng.core.policy.PolicyReader.namingModels;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
import java.util.Map;
+
import org.junit.Test;
public class PolicyReaderTest {
@@ -41,4 +47,57 @@ public class PolicyReaderTest {
assertEquals("VNF", PolicyReader.relaxedNamingType("vnf-name"));
assertEquals("VNF", PolicyReader.relaxedNamingType("vnf_name"));
}
+
+ @Test
+ public void testNamingProperty() throws Exception {
+ List<Map<String, ?>> namingModels = PolicyReader.namingModels(buildPolicyResponse_withoutContent());
+ assertNotNull(namingModels);
+ assertNull(PolicyReader.namingProperty(namingModels.get(0), "TEST"));
+ namingModels = PolicyReader.namingModels(buildPolicyResponse_withoutContent());
+ assertNull(PolicyReader.namingProperty(namingModels.get(0), "TEST"));
+ }
+
+ @Test
+ public void testNamingModelRelaxed() throws Exception {
+ List<Map<String, ?>> namingModels = PolicyReader.namingModels(buildPolicyResponse_withoutContent());
+ assertNotNull(PolicyReader.namingModelRelaxed(namingModels, "VNF"));
+ }
+
+ @Test
+ public void testDependentNamingModel() throws Exception {
+ List<Map<String, ?>> namingModels = PolicyReader.namingModels(buildPolicyResponse_withoutContent());
+ assertNotNull(PolicyReader.dependentNamingModel(namingModels, "VNF"));
+ assertNotNull(PolicyReader.dependentNamingModel(namingModels, "VNF_NAME"));
+ assertNull(PolicyReader.dependentNamingModel(namingModels, "VNFC_NAME"));
+ }
+
+ @Test
+ public void testNumber() throws Exception {
+ assertEquals(100, PolicyReader.number("10G", 100L));
+ }
+
+ private Map<String, ?> buildPolicyResponse_withoutContent() {
+ Map<String, Object> policyDataMap = new HashMap<>();
+ policyDataMap.put("policy-instance-name", "SDNC_Policy.Config_MS_VNFCNamingPolicy");
+
+ Map<String, Object> namingModelMap = new HashMap<>();
+ namingModelMap.put("nf-role", "vPE");
+ namingModelMap.put("naming-type", "VNF");
+ namingModelMap.put("naming-recipe", "COMPLEX|NF-NAMING-CODE|Field2|Field3|Field4");
+
+ Map<String, Object> namingPropertyMap = new HashMap<>();
+ Map<String, Object> propertyMap1 = new HashMap<>();
+ propertyMap1.put("property-name", "COMPLEX");
+ Map<String, Object> propertyMap2 = new HashMap<>();
+ propertyMap2.put("property-name", "NF-NAMING-CODE");
+ namingPropertyMap.put("", Arrays.asList(new Object[] {propertyMap1, propertyMap2}));
+
+ namingModelMap.put("naming-properties", Arrays.asList(new Object[] {propertyMap1, propertyMap2}));
+
+ policyDataMap.put("naming-models", Arrays.asList(new Object[] {namingModelMap}));
+
+ Map<String, Object> configMap = new HashMap<>();
+ configMap.put("config", policyDataMap);
+ return configMap;
+ }
}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequenceTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequenceTest.java
new file mode 100644
index 00000000..9a0bbbd3
--- /dev/null
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/policy/PolicySequenceTest.java
@@ -0,0 +1,43 @@
+package org.onap.ccsdk.apps.ms.neng.core.policy;
+
+import static org.junit.Assert.assertEquals;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.runners.MockitoJUnitRunner;
+
+@RunWith(MockitoJUnitRunner.class)
+public class PolicySequenceTest {
+
+ @Test
+ public void testGetMaxValue() throws Exception {
+ PolicySequence seq = new PolicySequence();
+ seq.setMaxValueString("0AB");
+ seq.setType(PolicySequence.Type.ALPHA);
+ assertEquals(371L, seq.getMaxValue());
+ }
+
+ @Test
+ public void testGetMaxValue_Exp() throws Exception {
+ PolicySequence seq = new PolicySequence();
+ seq.setMaxValueString("0AB");
+ seq.setType(PolicySequence.Type.NUMERIC);
+ assertEquals(999, seq.getMaxValue());
+ }
+
+ @Test
+ public void testGetMaxValue_Numeric() throws Exception {
+ PolicySequence seq = new PolicySequence();
+ seq.setMaxValueString("011");
+ seq.setType(PolicySequence.Type.NUMERIC);
+ assertEquals(11, seq.getMaxValue());
+ }
+
+ @Test
+ public void testGetMaxValue_null_maxvalue() throws Exception {
+ PolicySequence seq = new PolicySequence();
+ seq.setLength(3);
+ seq.setType(PolicySequence.Type.NUMERIC);
+ assertEquals(999, seq.getMaxValue());
+ }
+}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java
index c3815f43..aca0a533 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceIntTest.java
@@ -20,6 +20,7 @@
package org.onap.ccsdk.apps.ms.neng.core.service;
+import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doReturn;
@@ -44,8 +45,10 @@ import org.onap.ccsdk.apps.ms.neng.core.persistence.NamePersister;
import org.onap.ccsdk.apps.ms.neng.core.resource.model.NameGenRequest;
import org.onap.ccsdk.apps.ms.neng.core.resource.model.NameGenResponse;
import org.onap.ccsdk.apps.ms.neng.core.service.rs.RestServiceImpl;
+import org.onap.ccsdk.apps.ms.neng.persistence.entity.ExternalInterface;
import org.onap.ccsdk.apps.ms.neng.persistence.entity.GeneratedName;
import org.onap.ccsdk.apps.ms.neng.persistence.entity.PolicyDetails;
+import org.onap.ccsdk.apps.ms.neng.persistence.repository.ExternalInterfaceRespository;
import org.onap.ccsdk.apps.ms.neng.persistence.repository.PolicyDetailsRepository;
import org.onap.ccsdk.apps.ms.neng.persistence.repository.ServiceParameterRepository;
import org.onap.ccsdk.apps.ms.neng.service.extinf.impl.AaiServiceImpl;
@@ -85,6 +88,8 @@ public class SpringServiceIntTest {
AaiServiceImpl aaiServiceImpl;
@Autowired
RestServiceImpl restServiceImpl;
+ @Autowired
+ ExternalInterfaceRespository extIntRepo;
@Before
public void setup() {
@@ -215,4 +220,23 @@ public class SpringServiceIntTest {
doThrow(new NengException("")).when(springService).addPolicy(policy);
restServiceImpl.addPolicyToDb(policy);
}
+
+ @Test
+ public void testExternalInterfaceRepo() throws Exception {
+ ExternalInterface extInt = new ExternalInterface();
+ extInt.setCreatedBy("user");
+ extInt.setCreatedTime(null);
+ extInt.setExternalInteraceId(100);
+ extInt.setLastUpdatedBy("user");
+ extInt.setParam("VNF");
+ extInt.setSystem("AAI");
+ extInt.setUrlSuffix("nodes/generic-vnfs?vnf-name=");
+
+ extIntRepo.save(extInt);
+ ExternalInterface extIntDb = extIntRepo.findOne(100);
+
+ assertNotNull(extIntDb);
+ assertEquals("nodes/generic-vnfs?vnf-name=",extIntDb.getUrlSuffix());
+ }
+
}
diff --git a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java
index b4821a21..7ea63e61 100644
--- a/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java
+++ b/ms/neng/src/test/java/org/onap/ccsdk/apps/ms/neng/core/service/SpringServiceTest.java
@@ -110,14 +110,12 @@ public class SpringServiceTest {
}
@Test
- public void testGetQuickHello()
- {
+ public void testGetQuickHello() {
Assert.assertTrue(springserviceImpl.getQuickHello("testMessage") instanceof HelloWorld);
}
@Test
- public void testGetQuickHelloForNullMessage()
- {
+ public void testGetQuickHelloForNullMessage() {
Assert.assertTrue(springserviceImpl.getQuickHello("") instanceof HelloWorld);
}
}
diff --git a/ms/neng/src/test/sanity/add-policy-vnf-ts.sh b/ms/neng/src/test/sanity/add-policy-vnf-ts.sh
new file mode 100644
index 00000000..4119d88a
--- /dev/null
+++ b/ms/neng/src/test/sanity/add-policy-vnf-ts.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#============LICENSE_END=========================================================
+
+#==================================================================================
+# This script does a sanity test on the add-policy API of the micro-service.
+#==================================================================================
+
+. ./env.sh
+URL=web/service/v1/addPolicy
+TEMP_FILE=/tmp/add-policy.$$.$RANDOM
+EXTERNAL_KEY=${1:-123456789}
+
+printf '{ ' > $TEMP_FILE
+printf '"policyName": "vnf-policy-ts-1' >> $TEMP_FILE
+printf '", "policyValue" : "' >> $TEMP_FILE
+cat ./policy-vnf-ts.json | sed 's/\"/\\\"/g' | tr '\n' ' ' | tr '\r' ' ' >> $TEMP_FILE
+echo '"}' >> $TEMP_FILE
+
+echo "==================================================="
+echo "====== Adding Policy: ==========================="
+cat $TEMP_FILE
+echo ""
+echo "==================================================="
+
+echo "==================================================="
+curl -vi -H "Content-Type: application/json" --data @$TEMP_FILE $PROTOCOL://$HOST:$PORT/$URL
+echo "==================================================="
+
+rm -f $TEMP_FILE
+
diff --git a/ms/neng/src/test/sanity/add-policy-vnf-uuid.sh b/ms/neng/src/test/sanity/add-policy-vnf-uuid.sh
new file mode 100644
index 00000000..020dd6e4
--- /dev/null
+++ b/ms/neng/src/test/sanity/add-policy-vnf-uuid.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#============LICENSE_END=========================================================
+
+#==================================================================================
+# This script does a sanity test on the add-policy API of the micro-service.
+#==================================================================================
+
+. ./env.sh
+URL=web/service/v1/addPolicy
+TEMP_FILE=/tmp/add-policy.$$.$RANDOM
+EXTERNAL_KEY=${1:-123456789}
+
+printf '{ ' > $TEMP_FILE
+printf '"policyName": "vnf-policy-uuid-1' >> $TEMP_FILE
+printf '", "policyValue" : "' >> $TEMP_FILE
+cat ./policy-vnf-uuid.json | sed 's/\"/\\\"/g' | tr '\n' ' ' | tr '\r' ' ' >> $TEMP_FILE
+echo '"}' >> $TEMP_FILE
+
+echo "==================================================="
+echo "====== Adding Policy: ==========================="
+cat $TEMP_FILE
+echo ""
+echo "==================================================="
+
+echo "==================================================="
+curl -vi -H "Content-Type: application/json" --data @$TEMP_FILE $PROTOCOL://$HOST:$PORT/$URL
+echo "==================================================="
+
+rm -f $TEMP_FILE
+
diff --git a/ms/neng/src/test/sanity/add-policy-vnf.sh b/ms/neng/src/test/sanity/add-policy-vnf.sh
new file mode 100644
index 00000000..b10cf57f
--- /dev/null
+++ b/ms/neng/src/test/sanity/add-policy-vnf.sh
@@ -0,0 +1,46 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#============LICENSE_END=========================================================
+
+#==================================================================================
+# This script does a sanity test on the add-policy API of the micro-service.
+#==================================================================================
+
+. ./env.sh
+URL=web/service/v1/addPolicy
+TEMP_FILE=/tmp/add-policy.$$.$RANDOM
+EXTERNAL_KEY=${1:-123456789}
+
+printf '{ ' > $TEMP_FILE
+printf '"policyName": "vnf-policy-1' >> $TEMP_FILE
+printf '", "policyValue" : "' >> $TEMP_FILE
+cat ./policy-vnf.json | sed 's/\"/\\\"/g' | tr '\n' ' ' | tr '\r' ' ' >> $TEMP_FILE
+echo '"}' >> $TEMP_FILE
+
+echo "==================================================="
+echo "====== Adding Policy: ==========================="
+cat $TEMP_FILE
+echo ""
+echo "==================================================="
+
+echo "==================================================="
+curl -vi -H "Content-Type: application/json" --data @$TEMP_FILE $PROTOCOL://$HOST:$PORT/$URL
+echo "==================================================="
+
+rm -f $TEMP_FILE
+
diff --git a/ms/neng/src/test/sanity/gen-name-vnf-ts.sh b/ms/neng/src/test/sanity/gen-name-vnf-ts.sh
new file mode 100644
index 00000000..abd3c79c
--- /dev/null
+++ b/ms/neng/src/test/sanity/gen-name-vnf-ts.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#============LICENSE_END=========================================================
+
+#==================================================================================
+# This script does a sanity test on the generate-name API of this micro-service.
+#==================================================================================
+
+. ./env.sh
+URL=web/service/v1/genNetworkElementName
+TEMP_FILE=/tmp/gen-name.$$.$RANDOM
+EXTERNAL_KEY=$RANDOM
+
+USE_DB=${1:-'Y'}
+USE_DB_BOOL=$([ "$USE_DB" == "Y" ] && echo "true" || echo "false")
+
+printf '{ "UseDb": "' > $TEMP_FILE
+printf $USE_DB_BOOL >> $TEMP_FILE
+printf '", "elements": [ { "external-key": "sanity-' >> $TEMP_FILE
+printf $EXTERNAL_KEY >> $TEMP_FILE
+printf '", "policy-instance-name": "vnf-policy-ts-1", "NF_NAMING_CODE": "me9", "COMPLEX": "dlstxa", ' >> $TEMP_FILE
+printf '"resource-name": "VNF", "naming-type": "VNF" } ] }' >> $TEMP_FILE
+
+echo "==================================================="
+echo "======== Generating name with request: ============"
+echo ""
+echo ""
+cat $TEMP_FILE
+echo ""
+echo ""
+echo ""
+echo "==================================================="
+
+echo "==================================================="
+curl -vi -H "Content-Type: application/json" --data @$TEMP_FILE $PROTOCOL://$HOST:$PORT/$URL
+echo ""
+echo ""
+echo "==================================================="
+
+rm -f $TEMP_FILE
+
+
diff --git a/ms/neng/src/test/sanity/gen-name-vnf-uuid.sh b/ms/neng/src/test/sanity/gen-name-vnf-uuid.sh
new file mode 100644
index 00000000..9b98bd92
--- /dev/null
+++ b/ms/neng/src/test/sanity/gen-name-vnf-uuid.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#============LICENSE_END=========================================================
+
+#==================================================================================
+# This script does a sanity test on the generate-name API of this micro-service.
+#==================================================================================
+
+. ./env.sh
+URL=web/service/v1/genNetworkElementName
+TEMP_FILE=/tmp/gen-name.$$.$RANDOM
+EXTERNAL_KEY=$RANDOM
+
+USE_DB=${1:-'Y'}
+USE_DB_BOOL=$([ "$USE_DB" == "Y" ] && echo "true" || echo "false")
+
+printf '{ "UseDb": "' > $TEMP_FILE
+printf $USE_DB_BOOL >> $TEMP_FILE
+printf '", "elements": [ { "external-key": "sanity-' >> $TEMP_FILE
+printf $EXTERNAL_KEY >> $TEMP_FILE
+printf '", "policy-instance-name": "vnf-policy-uuid-1", "NF_NAMING_CODE": "me9", "COMPLEX": "dlstxa", ' >> $TEMP_FILE
+printf '"resource-name": "VNF", "naming-type": "VNF" } ] }' >> $TEMP_FILE
+
+echo "==================================================="
+echo "======== Generating name with request: ============"
+echo ""
+echo ""
+cat $TEMP_FILE
+echo ""
+echo ""
+echo ""
+echo "==================================================="
+
+echo "==================================================="
+curl -vi -H "Content-Type: application/json" --data @$TEMP_FILE $PROTOCOL://$HOST:$PORT/$URL
+echo ""
+echo ""
+echo "==================================================="
+
+rm -f $TEMP_FILE
+
+
diff --git a/ms/neng/src/test/sanity/gen-name-vnf.sh b/ms/neng/src/test/sanity/gen-name-vnf.sh
new file mode 100644
index 00000000..5c4c3ec5
--- /dev/null
+++ b/ms/neng/src/test/sanity/gen-name-vnf.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+#============LICENSE_START=======================================================
+# ONAP : CCSDK.apps
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#============LICENSE_END=========================================================
+
+#==================================================================================
+# This script does a sanity test on the generate-name API of this micro-service.
+#==================================================================================
+
+. ./env.sh
+URL=web/service/v1/genNetworkElementName
+TEMP_FILE=/tmp/gen-name.$$.$RANDOM
+EXTERNAL_KEY=$RANDOM
+
+USE_DB=${1:-'Y'}
+USE_DB_BOOL=$([ "$USE_DB" == "Y" ] && echo "true" || echo "false")
+
+printf '{ "UseDb": "' > $TEMP_FILE
+printf $USE_DB_BOOL >> $TEMP_FILE
+printf '", "elements": [ { "external-key": "sanity-' >> $TEMP_FILE
+printf $EXTERNAL_KEY >> $TEMP_FILE
+printf '", "policy-instance-name": "vnf-policy-1", "NF_NAMING_CODE": "me9", "COMPLEX": "dlstxa", ' >> $TEMP_FILE
+printf '"resource-name": "VNF", "naming-type": "VNF" } ] }' >> $TEMP_FILE
+
+echo "==================================================="
+echo "======== Generating name with request: ============"
+echo ""
+echo ""
+cat $TEMP_FILE
+echo ""
+echo ""
+echo ""
+echo "==================================================="
+
+echo "==================================================="
+curl -vi -H "Content-Type: application/json" --data @$TEMP_FILE $PROTOCOL://$HOST:$PORT/$URL
+echo ""
+echo ""
+echo "==================================================="
+
+rm -f $TEMP_FILE
+
+
diff --git a/ms/neng/src/test/sanity/policy-vnf-ts.json b/ms/neng/src/test/sanity/policy-vnf-ts.json
new file mode 100644
index 00000000..ff6303dd
--- /dev/null
+++ b/ms/neng/src/test/sanity/policy-vnf-ts.json
@@ -0,0 +1,33 @@
+[
+ {
+ "config": {
+ "content": {
+ "naming-models":[
+ {
+ "naming-properties":[
+ { "property-name" : "COMPLEX", "property-operation" : "substr(5)" },
+ { "property-name" : "SEQUENCE", "increment-sequence":{
+ "max" : "zzz" , "scope" : "ENTIRETY" , "start-value" : "001" , "length" : "3",
+ "increment" : "1" , "sequence-type" : "alpha-numeric"}
+ },
+ {"property-name" : "NF_NAMING_CODE"}
+ ],
+ "naming-type" : "VNF",
+ "nfRole" : "vPE",
+ "naming-recipe" : "COMPLEX|SEQUENCE|NF_NAMING_CODE|TIMESTAMP"
+ },
+ {
+ "naming-properties":[
+ {"property-name" : "NF_NAMING_CODE"}
+ ],
+ "naming-type" : "VNF",
+ "nfRole" : "VNF",
+ "naming-recipe" : "NF_NAMING_CODE"
+ }
+ ]
+ }
+ },
+ "policyName": "vnf-policy-1"
+ }
+]
+
diff --git a/ms/neng/src/test/sanity/policy-vnf-uuid.json b/ms/neng/src/test/sanity/policy-vnf-uuid.json
new file mode 100644
index 00000000..4a44cc8d
--- /dev/null
+++ b/ms/neng/src/test/sanity/policy-vnf-uuid.json
@@ -0,0 +1,33 @@
+[
+ {
+ "config": {
+ "content": {
+ "naming-models":[
+ {
+ "naming-properties":[
+ { "property-name" : "COMPLEX", "property-operation" : "substr(5)" },
+ { "property-name" : "SEQUENCE", "increment-sequence":{
+ "max" : "zzz" , "scope" : "ENTIRETY" , "start-value" : "001" , "length" : "3",
+ "increment" : "1" , "sequence-type" : "alpha-numeric"}
+ },
+ {"property-name" : "NF_NAMING_CODE"}
+ ],
+ "naming-type" : "VNF",
+ "nfRole" : "vPE",
+ "naming-recipe" : "COMPLEX|SEQUENCE|NF_NAMING_CODE|UUID"
+ },
+ {
+ "naming-properties":[
+ {"property-name" : "NF_NAMING_CODE"}
+ ],
+ "naming-type" : "VNF",
+ "nfRole" : "VNF",
+ "naming-recipe" : "NF_NAMING_CODE"
+ }
+ ]
+ }
+ },
+ "policyName": "vnf-policy-1"
+ }
+]
+
diff --git a/ms/neng/src/test/sanity/policy-vnf.json b/ms/neng/src/test/sanity/policy-vnf.json
new file mode 100644
index 00000000..314e3f39
--- /dev/null
+++ b/ms/neng/src/test/sanity/policy-vnf.json
@@ -0,0 +1,33 @@
+[
+ {
+ "config": {
+ "content": {
+ "naming-models":[
+ {
+ "naming-properties":[
+ { "property-name" : "COMPLEX", "property-operation" : "substr(5)" },
+ { "property-name" : "SEQUENCE", "increment-sequence":{
+ "max" : "zzz" , "scope" : "ENTIRETY" , "start-value" : "001" , "length" : "3",
+ "increment" : "1" , "sequence-type" : "alpha-numeric"}
+ },
+ {"property-name" : "NF_NAMING_CODE"}
+ ],
+ "naming-type" : "VNF",
+ "nfRole" : "vPE",
+ "naming-recipe" : "COMPLEX|SEQUENCE|NF_NAMING_CODE"
+ },
+ {
+ "naming-properties":[
+ {"property-name" : "NF_NAMING_CODE"}
+ ],
+ "naming-type" : "VNF",
+ "nfRole" : "VNF",
+ "naming-recipe" : "NF_NAMING_CODE"
+ }
+ ]
+ }
+ },
+ "policyName": "vnf-policy-1"
+ }
+]
+