Naming micro-service - upgrade to spring-boot-2.
This contains all the changes to upgrade this micro-service to spring-boot-2 and spring-5, and is a pre-requisite for the changes related to policy.
Issue-ID: CCSDK-1307
Signed-off-by: bt2983 <bt2983@att.com>
Change-Id: Ie35df3bebac958b50c2c4635080c06d68f887a8e
Naming m-s -- upgrade to spring-boot 1.5.2
Issue-ID: CCSDK-1307
Signed-off-by: bt2983 <bt2983@att.com>
Change-Id: Id685b44dc8703baa4371fdabf999aa8b5eaa6ea0
diff --git a/ms/neng/pom.xml b/ms/neng/pom.xml
index ba27a87..bd98f3c 100644
--- a/ms/neng/pom.xml
+++ b/ms/neng/pom.xml
@@ -18,6 +18,7 @@
* limitations under the License.
* ============LICENSE_END=========================================================
-->
+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
diff --git a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/create_base_tables.sql b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/create_base_tables.sql
index 6150eaf..afb3743 100644
--- a/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/create_base_tables.sql
+++ b/ms/neng/src/main/resources/db/changelog/scripts/rel_18_10/create_base_tables.sql
@@ -23,7 +23,7 @@
CREATED_BY VARCHAR(50),
LAST_UPDATED_TIME DATETIME,
LAST_UPDATED_BY VARCHAR(50)
-) ;
+);
CREATE TABLE IDENTIFIER_MAP (IDENTIFIER_MAP_ID INTEGER PRIMARY KEY AUTO_INCREMENT(0,100),
POLICY_FN_NAME VARCHAR(500) COMMENT 'Function name in policy manager' NOT NULL,
@@ -32,7 +32,7 @@
CREATED_BY VARCHAR(50),
LAST_UPDATED_TIME DATETIME,
LAST_UPDATED_BY VARCHAR(50)
-) ;
+);
CREATE TABLE EXTERNAL_INTERFACE (EXTERNAL_INTERFACE_ID INTEGER PRIMARY KEY AUTO_INCREMENT(0,100),
@@ -49,4 +49,4 @@
POLICY_NAME VARCHAR(500) COMMENT 'Policy name' NOT NULL,
POLICY_RESPONSE VARCHAR(10000) COMMENT 'Policy value',
CREATED_TIME DATETIME DEFAULT CURRENT_TIMESTAMP
-) ;
+);
diff --git a/ms/neng/src/test/resources/application-test.properties b/ms/neng/src/test/resources/application-test.properties
index 5aacbba..a75b528 100644
--- a/ms/neng/src/test/resources/application-test.properties
+++ b/ms/neng/src/test/resources/application-test.properties
@@ -6,7 +6,7 @@
#=========================================================================
datasource.db.driver-class-name=org.h2.Driver
-datasource.db.url=jdbc:h2:mem:tests;DB_CLOSE_DELAY=-1;
+datasource.db.url=jdbc:h2:mem:tests;DB_CLOSE_DELAY=-1;MODE=MySQL;DATABASE_TO_LOWER=TRUE;CASE_INSENSITIVE_IDENTIFIERS=TRUE;
datasource.db.username=none
datasource.db.password=none
diff --git a/ms/neng/src/test/sanity/add-policy-decision-format.sh b/ms/neng/src/test/sanity/add-policy-decision-format.sh
new file mode 100755
index 0000000..5de8502
--- /dev/null
+++ b/ms/neng/src/test/sanity/add-policy-decision-format.sh
@@ -0,0 +1,48 @@
+#!/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.
+#
+# This supports the decision API format
+#==================================================================================
+
+. ./env.sh
+URL=web/service/v1/addPolicy
+TEMP_FILE=/tmp/add-policy.$$.$RANDOM
+EXTERNAL_KEY=${1:-123456789}
+
+printf '{ ' > $TEMP_FILE
+printf '"policyName": "vnf-policy-decision-api' >> $TEMP_FILE
+printf '", "policyValue" : "' >> $TEMP_FILE
+cat ./policy-decision-api.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-2.sh b/ms/neng/src/test/sanity/add-policy-vnf-2.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/add-policy-vnf-ts-2.sh b/ms/neng/src/test/sanity/add-policy-vnf-ts-2.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/add-policy-vnf-ts.sh b/ms/neng/src/test/sanity/add-policy-vnf-ts.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/add-policy-vnf-uuid.sh b/ms/neng/src/test/sanity/add-policy-vnf-uuid.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/add-policy-vnf.sh b/ms/neng/src/test/sanity/add-policy-vnf.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/add-policy.sh b/ms/neng/src/test/sanity/add-policy.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/env.sh b/ms/neng/src/test/sanity/env.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/gen-name-decision-format.sh b/ms/neng/src/test/sanity/gen-name-decision-format.sh
new file mode 100755
index 0000000..40ee3b0
--- /dev/null
+++ b/ms/neng/src/test/sanity/gen-name-decision-format.sh
@@ -0,0 +1,59 @@
+#!/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.
+#
+# This exercises the new policy API (decision API)
+#==================================================================================
+
+. ./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-decision-api", "NF_NAMING_CODE": "me9", "COMPLEX": "dlstxa", ' >> $TEMP_FILE
+printf '"resource-name": "VNF", "naming-type": "VNF", "AIC_CLOUD_REGION": "aicr" } ] }' >> $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-2.sh b/ms/neng/src/test/sanity/gen-name-vnf-2.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/gen-name-vnf-ts-2-update.sh b/ms/neng/src/test/sanity/gen-name-vnf-ts-2-update.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/gen-name-vnf-ts-2.sh b/ms/neng/src/test/sanity/gen-name-vnf-ts-2.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/gen-name-vnf-ts.sh b/ms/neng/src/test/sanity/gen-name-vnf-ts.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/gen-name-vnf-uuid.sh b/ms/neng/src/test/sanity/gen-name-vnf-uuid.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/gen-name-vnf.sh b/ms/neng/src/test/sanity/gen-name-vnf.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/gen-name.sh b/ms/neng/src/test/sanity/gen-name.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/get-policy.sh b/ms/neng/src/test/sanity/get-policy.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/hello.sh b/ms/neng/src/test/sanity/hello.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/policy-decision-api.json b/ms/neng/src/test/sanity/policy-decision-api.json
new file mode 100644
index 0000000..3804ff4
--- /dev/null
+++ b/ms/neng/src/test/sanity/policy-decision-api.json
@@ -0,0 +1,97 @@
+{
+ "policies": {
+ "SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP": {
+ "type": "onap.policies.Naming",
+ "type_version": "1.0.0",
+ "properties": {
+ "policy-instance-name": "ONAP_VNF_NAMING_TIMESTAMP",
+ "naming-models": [
+ {
+ "naming-type": "VNF",
+ "naming-recipe": "AIC_CLOUD_REGION|DELIMITER|CONSTANT|DELIMITER|TIMESTAMP",
+ "naming-properties": [
+ {
+ "property-name": "AIC_CLOUD_REGION"
+ },
+ {
+ "property-name": "CONSTANT",
+ "property-value": "ONAP-NF"
+ },
+ {
+ "property-name": "TIMESTAMP"
+ },
+ {
+ "property-value": "_",
+ "property-name": "DELIMITER"
+ }
+ ]
+ },
+ {
+ "naming-type": "VNFC",
+ "naming-recipe": "VNF_NAME|DELIMITER|NFC_NAMING_CODE|DELIMITER|SEQUENCE",
+ "naming-properties": [
+ {
+ "property-name": "VNF_NAME"
+ },
+ {
+ "property-name": "SEQUENCE",
+ "increment-sequence": {
+ "max": "zzz",
+ "scope": "ENTIRETY",
+ "start-value": 1.0,
+ "length": 3.0,
+ "increment": 1.0,
+ "sequence-type": "alpha-numeric"
+ }
+ },
+ {
+ "property-name": "NFC_NAMING_CODE"
+ },
+ {
+ "property-value": "_",
+ "property-name": "DELIMITER"
+ }
+ ]
+ },
+ {
+ "naming-type": "VF-MODULE",
+ "naming-recipe": "VNF_NAME|DELIMITER|VF_MODULE_LABEL|DELIMITER|VF_MODULE_TYPE|DELIMITER|SEQUENCE",
+ "naming-properties": [
+ {
+ "property-name": "VNF_NAME"
+ },
+ {
+ "property-value": "_",
+ "property-name": "DELIMITER"
+ },
+ {
+ "property-name": "VF_MODULE_LABEL"
+ },
+ {
+ "property-name": "VF_MODULE_TYPE"
+ },
+ {
+ "property-name": "SEQUENCE",
+ "increment-sequence": {
+ "max": "zzz",
+ "scope": "PRECEEDING",
+ "start-value": 1.0,
+ "length": 3.0,
+ "increment": 1.0,
+ "sequence-type": "alpha-numeric"
+ }
+ }
+ ]
+ }
+ ]
+ },
+ "name": "SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP",
+ "version": "1.0.0",
+ "metadata": {
+ "policy-id": "SDNC_Policy.ONAP_VNF_NAMING_TIMESTAMP",
+ "policy-version": "1"
+ }
+ }
+ }
+}
+
diff --git a/ms/neng/src/test/sanity/release-name.sh b/ms/neng/src/test/sanity/release-name.sh
old mode 100644
new mode 100755
diff --git a/ms/neng/src/test/sanity/suite.sh b/ms/neng/src/test/sanity/suite.sh
old mode 100644
new mode 100755
index 79d5b41..7050a28
--- a/ms/neng/src/test/sanity/suite.sh
+++ b/ms/neng/src/test/sanity/suite.sh
@@ -28,4 +28,6 @@
./get-policy.sh $EXTERNAL_KEY
./gen-name.sh Y $EXTERNAL_KEY
./release-name.sh Y $EXTERNAL_KEY
+./add-policy-decision-format.sh $EXTERNAL_KEY
+./gen-name-decision-format.sh Y $EXTERNAL_KEY