From ee7c0061f4fcacd80875c8b4b1f1c3e3f64dae65 Mon Sep 17 00:00:00 2001 From: bt2983 Date: Sun, 1 Mar 2020 16:30:26 -0700 Subject: 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 Change-Id: Ie35df3bebac958b50c2c4635080c06d68f887a8e Naming m-s -- upgrade to spring-boot 1.5.2 Issue-ID: CCSDK-1307 Signed-off-by: bt2983 Change-Id: Id685b44dc8703baa4371fdabf999aa8b5eaa6ea0 --- ms/neng/pom.xml | 1 + .../scripts/rel_18_10/create_base_tables.sql | 6 +- .../src/test/resources/application-test.properties | 2 +- .../src/test/sanity/add-policy-decision-format.sh | 48 +++++++++++ ms/neng/src/test/sanity/add-policy-vnf-2.sh | 0 ms/neng/src/test/sanity/add-policy-vnf-ts-2.sh | 0 ms/neng/src/test/sanity/add-policy-vnf-ts.sh | 0 ms/neng/src/test/sanity/add-policy-vnf-uuid.sh | 0 ms/neng/src/test/sanity/add-policy-vnf.sh | 0 ms/neng/src/test/sanity/add-policy.sh | 0 ms/neng/src/test/sanity/env.sh | 0 .../src/test/sanity/gen-name-decision-format.sh | 59 +++++++++++++ ms/neng/src/test/sanity/gen-name-vnf-2.sh | 0 .../src/test/sanity/gen-name-vnf-ts-2-update.sh | 0 ms/neng/src/test/sanity/gen-name-vnf-ts-2.sh | 0 ms/neng/src/test/sanity/gen-name-vnf-ts.sh | 0 ms/neng/src/test/sanity/gen-name-vnf-uuid.sh | 0 ms/neng/src/test/sanity/gen-name-vnf.sh | 0 ms/neng/src/test/sanity/gen-name.sh | 0 ms/neng/src/test/sanity/get-policy.sh | 0 ms/neng/src/test/sanity/hello.sh | 0 ms/neng/src/test/sanity/policy-decision-api.json | 97 ++++++++++++++++++++++ ms/neng/src/test/sanity/release-name.sh | 0 ms/neng/src/test/sanity/suite.sh | 2 + 24 files changed, 211 insertions(+), 4 deletions(-) create mode 100755 ms/neng/src/test/sanity/add-policy-decision-format.sh mode change 100644 => 100755 ms/neng/src/test/sanity/add-policy-vnf-2.sh mode change 100644 => 100755 ms/neng/src/test/sanity/add-policy-vnf-ts-2.sh mode change 100644 => 100755 ms/neng/src/test/sanity/add-policy-vnf-ts.sh mode change 100644 => 100755 ms/neng/src/test/sanity/add-policy-vnf-uuid.sh mode change 100644 => 100755 ms/neng/src/test/sanity/add-policy-vnf.sh mode change 100644 => 100755 ms/neng/src/test/sanity/add-policy.sh mode change 100644 => 100755 ms/neng/src/test/sanity/env.sh create mode 100755 ms/neng/src/test/sanity/gen-name-decision-format.sh mode change 100644 => 100755 ms/neng/src/test/sanity/gen-name-vnf-2.sh mode change 100644 => 100755 ms/neng/src/test/sanity/gen-name-vnf-ts-2-update.sh mode change 100644 => 100755 ms/neng/src/test/sanity/gen-name-vnf-ts-2.sh mode change 100644 => 100755 ms/neng/src/test/sanity/gen-name-vnf-ts.sh mode change 100644 => 100755 ms/neng/src/test/sanity/gen-name-vnf-uuid.sh mode change 100644 => 100755 ms/neng/src/test/sanity/gen-name-vnf.sh mode change 100644 => 100755 ms/neng/src/test/sanity/gen-name.sh mode change 100644 => 100755 ms/neng/src/test/sanity/get-policy.sh mode change 100644 => 100755 ms/neng/src/test/sanity/hello.sh create mode 100644 ms/neng/src/test/sanity/policy-decision-api.json mode change 100644 => 100755 ms/neng/src/test/sanity/release-name.sh mode change 100644 => 100755 ms/neng/src/test/sanity/suite.sh (limited to 'ms') diff --git a/ms/neng/pom.xml b/ms/neng/pom.xml index ba27a870..bd98f3c6 100644 --- a/ms/neng/pom.xml +++ b/ms/neng/pom.xml @@ -18,6 +18,7 @@ * limitations under the License. * ============LICENSE_END========================================================= --> + 4.0.0 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 6150eaf8..afb37437 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_TIME DATETIME DEFAULT CURRENT_TIMESTAMP, 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_TIME DATETIME DEFAULT CURRENT_TIMESTAMP, 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 @@ CREATE TABLE POLICY_MAN_SIM (POLICY_ID INTEGER PRIMARY KEY AUTO_INCREMENT(0,100) 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 5aacbbaa..a75b5288 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 00000000..5de85024 --- /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 00000000..40ee3b09 --- /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 00000000..3804ff45 --- /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 79d5b414..7050a28e --- a/ms/neng/src/test/sanity/suite.sh +++ b/ms/neng/src/test/sanity/suite.sh @@ -28,4 +28,6 @@ EXTERNAL_KEY=$(date +%s)$RANDOM ./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 -- cgit 1.2.3-korg