diff options
author | yufei_zhou <yufei.zhou@nokia-sbell.com> | 2017-09-30 16:54:00 +0800 |
---|---|---|
committer | yufei_zhou <yufei.zhou@nokia-sbell.com> | 2017-09-30 16:54:00 +0800 |
commit | 358611bc1303a4e114ea862a3437947fc2f5caf6 (patch) | |
tree | 879ff1a8a33df542c75415c697aebe94d71b9a12 /nokia/vnfmdriver/vfcadaptorservice | |
parent | 47fd33356d8ae5d709fdb1759a3fcfdb3a8c06a2 (diff) |
Modify database part in the deployment
Change-Id: I9a058bdfb76b293b740107cb2c11a39fe2387533
Issue-ID: VFC-53
Signed-off-by: yufei_zhou <yufei.zhou@nokia-sbell.com>
Diffstat (limited to 'nokia/vnfmdriver/vfcadaptorservice')
25 files changed, 252 insertions, 182 deletions
diff --git a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/README.txt b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/README.txt index 6681c16a..3ed3afbf 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/README.txt +++ b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/README.txt @@ -16,6 +16,7 @@ Installation steps: - CATALINIA_BASE: Set to the location, where this service installer is unzipped, its optional - PATH: Update it with the location of command 'mysql' + - MSB_ADDR: set Microservices Service Bus address <ip>:<port> - In command console, cd to 'bin' directory under the location, where this service installer is unzipped and @@ -27,10 +28,6 @@ Installation steps: Configuration steps: ==================== - Update the db credetials in 'application.properties' under webapps directory. - - Update the MSB address in 'application.properties' under webapps directory. - - Update the VNFM address in 'application.properties' under webapps directory. - - Update the Catalog address in 'application.properties' under webapps directory. - - Update the NSLCM address in 'application.properties' under webapps directory. - Update the MSB address in $PATH/etc/conf/restclient.json - Update the vnfmadapter service ip address in $PATH/etc/adapterInfo/vnfmadapterinfo.json diff --git a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/bin/init_db.sh b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/bin/init_db.sh index 63e7800d..8b77e28d 100755 --- a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/bin/init_db.sh +++ b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/bin/init_db.sh @@ -42,7 +42,7 @@ then fi echo -echo "DB-INIT [vnfmdb] : START" +echo "DB-INIT [vnfm_db] : START" mysql -u$1 -p$2 -h$3 -P$4 <$(cd `dirname $0`; pwd)/db/mysql/db-schema.sql @@ -51,10 +51,10 @@ if [ $? != 0 ] ; then exit 1 fi -echo "DB-INIT [vnfmdb] : PASSED" +echo "DB-INIT [vnfm_db] : PASSED" echo echo "*************************************************************" -echo "CAUTION: Existing vnfmdb will be cleaned before" +echo "CAUTION: Existing vnfm_db will be cleaned before" echo "initializing the schema, so please take a back-up of it" echo "before executing it next time." echo "*************************************************************" diff --git a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql index 26252227..1b2b6027 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql +++ b/nokia/vnfmdriver/vfcadaptorservice/deployment/src/main/release/db/mysql/db-schema.sql @@ -24,11 +24,11 @@ FLUSH PRIVILEGES; /******************create new database and user***************************/ create database vnfm_db CHARACTER SET utf8; -GRANT ALL PRIVILEGES ON vnfm_db.* TO 'vnfm'@'%' IDENTIFIED BY 'vnfm' WITH GRANT OPTION; -GRANT ALL PRIVILEGES ON mysql.* TO 'vnfm'@'%' IDENTIFIED BY 'vnfm' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON vnfm_db.* TO 'vnfm'@'%' IDENTIFIED BY 'vnfmpass' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON mysql.* TO 'vnfm'@'%' IDENTIFIED BY 'vnfmpass' WITH GRANT OPTION; -GRANT ALL PRIVILEGES ON vnfm_db.* TO 'vnfm'@'localhost' IDENTIFIED BY 'vnfm' WITH GRANT OPTION; -GRANT ALL PRIVILEGES ON mysql.* TO 'vnfm'@'localhost' IDENTIFIED BY 'vnfm' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON vnfm_db.* TO 'vnfm'@'localhost' IDENTIFIED BY 'vnfmpass' WITH GRANT OPTION; +GRANT ALL PRIVILEGES ON mysql.* TO 'vnfm'@'localhost' IDENTIFIED BY 'vnfmpass' WITH GRANT OPTION; FLUSH PRIVILEGES; use vnfm_db; @@ -47,7 +47,7 @@ CREATE TABLE `vnfm_job_execution_record` ( DROP TABLE IF EXISTS vnfm_resource_record; -CREATE TABLE `vnfm_resource` ( +CREATE TABLE `vnfm_resource_record` ( `id` int(11) auto_increment primary key, `type` enum ('VDU','VL','CP','Storage') DEFAULT NULL, `resourceDefinitionId` varchar(60) DEFAULT NULL, diff --git a/nokia/vnfmdriver/vfcadaptorservice/docker/build_image.sh b/nokia/vnfmdriver/vfcadaptorservice/docker/build_image.sh index 8eb43b0b..914f5f6f 100755 --- a/nokia/vnfmdriver/vfcadaptorservice/docker/build_image.sh +++ b/nokia/vnfmdriver/vfcadaptorservice/docker/build_image.sh @@ -1,4 +1,20 @@ #!/bin/bash +# +# Copyright 2017, Nokia Corporation +# +# 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. +# + DIRNAME=`dirname $0` DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd` echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}" diff --git a/nokia/vnfmdriver/vfcadaptorservice/docker/build_image.sh.bak b/nokia/vnfmdriver/vfcadaptorservice/docker/build_image.sh.bak new file mode 100644 index 00000000..cf567be3 --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/docker/build_image.sh.bak @@ -0,0 +1,54 @@ +#!/bin/bash +# +# Copyright 2017, Nokia Corporation +# +# 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. +# +# +# This file was auto-generated by gen-all-dockerfiles.sh; do not modify manually. +# +# nfvo-driver-vnfm-nokia/target/docker-entrypoint.sh +# +DIRNAME=`dirname $0` +DOCKER_BUILD_DIR=`cd $DIRNAME/; pwd` +echo "DOCKER_BUILD_DIR=${DOCKER_BUILD_DIR}" +cd ${DOCKER_BUILD_DIR} + +BUILD_ARGS="--no-cache" +ORG="onap" +VERSION="1.0.0-SNAPSHOT" +PROJECT="vfc" +IMAGE="nfvo/svnfm/nokia" +DOCKER_REPOSITORY="nexus3.onap.org:10003" +IMAGE_NAME="${DOCKER_REPOSITORY}/${ORG}/${PROJECT}/${IMAGE}" + +if [ $HTTP_PROXY ]; then + BUILD_ARGS+=" --build-arg HTTP_PROXY=${HTTP_PROXY}" +fi +if [ $HTTPS_PROXY ]; then + BUILD_ARGS+=" --build-arg HTTPS_PROXY=${HTTPS_PROXY}" +fi + +function build_image { + echo "Start build docker image: ${IMAGE_NAME}" + docker build ${BUILD_ARGS} -t ${IMAGE_NAME}:${VERSION} -t ${IMAGE_NAME}:latest . +} + +function push_image { + echo "Start push docker image: ${IMAGE_NAME}" + docker push ${IMAGE_NAME}:${VERSION} + docker push ${IMAGE_NAME}:latest +} + +build_image +push_image diff --git a/nokia/vnfmdriver/vfcadaptorservice/docker/docker-entrypoint.sh b/nokia/vnfmdriver/vfcadaptorservice/docker/docker-entrypoint.sh index 1d235f61..ee6cb2d4 100755 --- a/nokia/vnfmdriver/vfcadaptorservice/docker/docker-entrypoint.sh +++ b/nokia/vnfmdriver/vfcadaptorservice/docker/docker-entrypoint.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2017 Huawei Technologies Co., Ltd. +# Copyright 2017, Nokia Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -15,10 +15,6 @@ # limitations under the License. # # -# This file was auto-generated by gen-all-dockerfiles.sh; do not modify manually. -# -# nfvo-driver-vnfm-huawei/target/docker-entrypoint.sh -# if [ -z "$SERVICE_IP" ]; then export SERVICE_IP=`hostname -i` diff --git a/nokia/vnfmdriver/vfcadaptorservice/docker/instance-config.sh b/nokia/vnfmdriver/vfcadaptorservice/docker/instance-config.sh index ce9d31db..94f8d5bc 100755 --- a/nokia/vnfmdriver/vfcadaptorservice/docker/instance-config.sh +++ b/nokia/vnfmdriver/vfcadaptorservice/docker/instance-config.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2017 Huawei Technologies Co., Ltd. +# Copyright 2017, Nokia Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/nokia/vnfmdriver/vfcadaptorservice/docker/instance-init.sh b/nokia/vnfmdriver/vfcadaptorservice/docker/instance-init.sh index 3975b5ad..39e85026 100755 --- a/nokia/vnfmdriver/vfcadaptorservice/docker/instance-init.sh +++ b/nokia/vnfmdriver/vfcadaptorservice/docker/instance-init.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2017 Huawei Technologies Co., Ltd. +# Copyright 2017, Nokia Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -16,8 +16,6 @@ # # Config mysql credentials -#sed -i "s|rootpass|rootpass|" webapps/ROOT/WEB-INF/classes/spring/Vnfmadapter/services.xml - # Initialize MySQL schema cd bin -./init_db.sh root rootpass 127.0.0.1 3306 +./init_db.sh vnfm vnfmpass 127.0.0.1 3306 diff --git a/nokia/vnfmdriver/vfcadaptorservice/docker/instance-run.sh b/nokia/vnfmdriver/vfcadaptorservice/docker/instance-run.sh index 5078e636..c6eda6d4 100755 --- a/nokia/vnfmdriver/vfcadaptorservice/docker/instance-run.sh +++ b/nokia/vnfmdriver/vfcadaptorservice/docker/instance-run.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2016-2017 Huawei Technologies Co., Ltd. +# Copyright 2016-2017, Nokia Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,7 @@ # Start microservice cd bin ./startup.sh -while [ ! -e ../logs/vnfmadapterservice.log ]; do +while [ ! -e ../logs/vfcadaptor.log ]; do sleep 1 done -tail -F ../logs/vnfmadapterservice.log +tail -F ../logs/vfcadaptor.log diff --git a/nokia/vnfmdriver/vfcadaptorservice/docker/instance-workaround.sh b/nokia/vnfmdriver/vfcadaptorservice/docker/instance-workaround.sh index d9637aea..24c3a7ae 100755 --- a/nokia/vnfmdriver/vfcadaptorservice/docker/instance-workaround.sh +++ b/nokia/vnfmdriver/vfcadaptorservice/docker/instance-workaround.sh @@ -1,6 +1,6 @@ #!/bin/bash # -# Copyright 2017 CMCC Technologies Co., Ltd. +# Copyright 2017, Nokia Corporation # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml index 67503b3b..e6ada4e0 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/pom.xml @@ -41,20 +41,6 @@ <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> -<!-- - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-data-rest</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-hateoas</artifactId> - </dependency> - <dependency> - <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-integration</artifactId> - </dependency> ---> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> @@ -62,22 +48,18 @@ <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> + <!-- <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> - <!-- https://mvnrepository.com/artifact/com.vaadin.external.google/android-json --> - <exclusion> - <groupId>com.vaadin.external.google</groupId> - <artifactId>android-json</artifactId> - </exclusion> - </exclusions> + --> </dependency> - <dependency> + <dependency> <groupId>org.springframework.boot</groupId> - <artifactId>spring-boot-starter-log4j2</artifactId> + <artifactId>spring-boot-starter-logging</artifactId> </dependency> <dependency> @@ -104,26 +86,27 @@ <dependency> <groupId>org.apache.httpcomponents</groupId> <artifactId>httpclient</artifactId> - <!-- - <version>4.5.2</version> - --> </dependency> <dependency> <groupId>com.google.code.gson</groupId> <artifactId>gson</artifactId> - <!-- - <version>2.8.2</version> - --> </dependency> <dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> - <version>20170516</version> </dependency> - + + <dependency> + <groupId>org.onap.msb.java-sdk</groupId> + <artifactId>msb-java-sdk</artifactId> + <version>1.0.0-SNAPSHOT</version> + </dependency> + <dependency> + <groupId>io.dropwizard</groupId> + <artifactId>dropwizard-core</artifactId> + <version>0.8.0</version> + </dependency> </dependencies> - - <build> <plugins> <plugin> diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java index 09aa8193..eeac57bd 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/VfcadaptorApplication.java @@ -18,8 +18,10 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; +import org.springframework.context.support.PropertySourcesPlaceholderConfigurer; @Configuration @SpringBootApplication @@ -27,7 +29,14 @@ import org.springframework.context.annotation.Configuration; @ComponentScan public class VfcadaptorApplication { - public static void main(String[] args) { + public final static void main(String[] args) { SpringApplication.run(VfcadaptorApplication.class, args); } + + @Bean + public static PropertySourcesPlaceholderConfigurer placeholderConfigurer() { + PropertySourcesPlaceholderConfigurer c = new PropertySourcesPlaceholderConfigurer(); + c.setIgnoreUnresolvablePlaceholders(true); + return c; + } } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java index 954ab6b1..76a97d71 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/InstantiateVnfContinueRunnable.java @@ -21,8 +21,8 @@ import java.util.ArrayList; import java.util.List; import org.apache.http.client.ClientProtocolException; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.inf.CatalogMgmrInf; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMInstantiateVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMInstantiateVnfResponse; @@ -42,7 +42,7 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.InstantiateVnfRequest; public class InstantiateVnfContinueRunnable implements Runnable { - private static final Logger logger = LogManager.getLogger("InstantiateVnfContinueRunnable"); + private static final Logger logger = LoggerFactory.getLogger(InstantiateVnfContinueRunnable.class); private CbamMgmrInf cbamMgmr; private CatalogMgmrInf catalogMgmr; private NslcmMgmrInf nslcmMgmr; diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java index ba7663d9..4485ad18 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/TerminateVnfContinueRunnable.java @@ -21,14 +21,15 @@ import java.util.ArrayList; import java.util.List; import org.apache.http.client.ClientProtocolException; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMTerminateVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMTerminateVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.inf.CbamMgmrInf; import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants; import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum; import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonEnum.LifecycleOperation; +import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.bean.VnfmJobExecutionInfo; import org.onap.vfc.nfvo.driver.vnfm.svnfm.db.repository.VnfmJobExecutionRepository; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmGrantVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.nslcm.bo.NslcmGrantVnfResponse; @@ -40,7 +41,7 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.TerminateVnfRequest; public class TerminateVnfContinueRunnable implements Runnable { - private static final Logger logger = LogManager.getLogger("TerminateVnfContinueRunnable"); + private static final Logger logger = LoggerFactory.getLogger(TerminateVnfContinueRunnable.class); private CbamMgmrInf cbamMgmr; private NslcmMgmrInf nslcmMgmr; @@ -48,7 +49,7 @@ public class TerminateVnfContinueRunnable implements Runnable { private TerminateVnfRequest driverRequest; private String vnfInstanceId; private String jobId; - private VnfmJobExecutionRepository jobDbManager; + private VnfmJobExecutionRepository jobDbMgmr; private Driver2CbamRequestConverter requestConverter; @@ -61,7 +62,7 @@ public class TerminateVnfContinueRunnable implements Runnable { this.cbamMgmr = cbamMgmr; this.requestConverter = requestConverter; this.jobId = jobId; - this.jobDbManager = dbManager; + this.jobDbMgmr = dbManager; } public void run() { @@ -72,6 +73,7 @@ public class TerminateVnfContinueRunnable implements Runnable { CBAMTerminateVnfRequest cbamRequest = requestConverter.terminateReqConvert(driverRequest); CBAMTerminateVnfResponse cbamResponse = cbamMgmr.terminateVnf(cbamRequest, vnfInstanceId); + handleCbamInstantiateResponse(cbamResponse, jobId); cbamMgmr.deleteVnf(vnfInstanceId); @@ -86,6 +88,13 @@ public class TerminateVnfContinueRunnable implements Runnable { } + private void handleCbamInstantiateResponse(CBAMTerminateVnfResponse cbamResponse, String jobId) { + VnfmJobExecutionInfo jobInfo = jobDbMgmr.findOne(Long.getLong(jobId)); + + jobInfo.setVnfmExecutionId(cbamResponse.getId()); + jobDbMgmr.save(jobInfo); + } + private NslcmGrantVnfRequest buildNslcmGrantVnfRequest() { NslcmGrantVnfRequest request = new NslcmGrantVnfRequest(); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrIml.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java index fa274fee..59fad026 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrIml.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/adaptor/VnfmDriverMgmrImpl.java @@ -16,19 +16,14 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.adaptor; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - import org.apache.http.HttpStatus; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.inf.CatalogMgmrInf; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMCreateVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMCreateVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMHealVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMHealVnfResponse; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMOperExecutVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMQueryOperExecutionResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMQueryVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMScaleVnfRequest; @@ -50,16 +45,14 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.ScaleVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.ScaleVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.TerminateVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.TerminateVnfResponse; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.ResponseDescriptor; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.entity.ResponseHistoryList; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.inf.VnfmDriverMgmrInf; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; @Component -public class VnfmDriverMgmrIml implements VnfmDriverMgmrInf{ - private static final Logger logger = LogManager.getLogger("VnfmDriverMgmrIml"); +public class VnfmDriverMgmrImpl implements VnfmDriverMgmrInf{ + private static final Logger logger = LoggerFactory.getLogger(VnfmDriverMgmrImpl.class); @Autowired Driver2CbamRequestConverter requestConverter; diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java index 186a1720..b00f61c7 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/impl/CatalogMgmrImpl.java @@ -20,8 +20,8 @@ import java.io.IOException; import org.apache.http.client.ClientProtocolException; import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.bo.CatalogQueryVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.inf.CatalogMgmrInf; import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv; @@ -36,7 +36,7 @@ import com.google.gson.Gson; @Component public class CatalogMgmrImpl implements CatalogMgmrInf{ - private static final Logger logger = LogManager.getLogger("CatalogMgmrImpl"); + private static final Logger logger = LoggerFactory.getLogger(CatalogMgmrImpl.class); private Gson gson = new Gson(); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/inf/ICatalogServiceClient.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/inf/ICatalogServiceClient.java new file mode 100644 index 00000000..d58eb7df --- /dev/null +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/catalog/inf/ICatalogServiceClient.java @@ -0,0 +1,26 @@ +/* + * Copyright 2016-2017, Nokia Corporation + * + * 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. + */ + +package org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.inf; + +//import org.onap.msb.sdk.httpclient.annotaion.ServiceHttpEndPoint; +// +//@ServiceHttpEndPoint(serviceName = "catalog", serviceVersion = "v1") +public interface ICatalogServiceClient { + //TODO +// @GET("vnfpackages/{vnfPkgId}") +// Call<Animal> queryAnimal(@Path("vnfPkgId") String vnfPkgId); +} diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/controller/CbamController.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/controller/CbamController.java index 9578e75f..0e772a4b 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/controller/CbamController.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/controller/CbamController.java @@ -20,24 +20,19 @@ import java.io.IOException; import org.apache.http.client.ClientProtocolException; import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.apache.log4j.Logger; import org.onap.vfc.nfvo.driver.vnfm.svnfm.catalog.bo.CatalogQueryVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMCreateVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMHealVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMHealVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMInstantiateVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMInstantiateVnfResponse; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMOperExecutVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMOperExecutVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMQueryVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMScaleVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMScaleVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMTerminateVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMTerminateVnfResponse; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.OperationExecution; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.ProblemDetails; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.entity.VnfInfo; import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv; import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants; import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpRequestProcessor; @@ -54,7 +49,7 @@ import com.google.gson.Gson; @Controller @RequestMapping(value = "/vnfm/lcm/v3") public class CbamController { - private static final Logger logger = LogManager.getLogger("CbamController"); + private static final Logger logger = Logger.getLogger(CbamController.class); @Autowired private AdaptorEnv adaptorEnv; diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java index bb56fc18..1e2cecf7 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/cbam/impl/CbamMgmrImpl.java @@ -20,8 +20,7 @@ import java.io.IOException; import org.apache.http.client.ClientProtocolException; import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.apache.log4j.Logger; import org.json.JSONException; import org.json.JSONObject; import org.onap.vfc.nfvo.driver.vnfm.svnfm.cbam.bo.CBAMCreateVnfRequest; @@ -49,14 +48,14 @@ import com.google.gson.Gson; @Component public class CbamMgmrImpl implements CbamMgmrInf { - private static final Logger logger = LogManager.getLogger("CbamMgmrImpl"); + private static final Logger logger = Logger.getLogger(CbamMgmrImpl.class); private Gson gson = new Gson(); @Autowired private AdaptorEnv adaptorEnv; @Autowired - private HttpClientBuilder httpClientBuilder; + private HttpClientBuilder httpClientBuilder;// = HttpClientUtils.createHttpClientBuilder(); private String retrieveToken() throws ClientProtocolException, IOException, JSONException { String result = null; diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java index e3ed0c82..7f6a0006 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/http/client/HttpClientUtils.java @@ -36,13 +36,17 @@ import org.apache.http.impl.client.HttpClientBuilder; import org.apache.http.impl.conn.PoolingHttpClientConnectionManager; import org.apache.http.ssl.SSLContextBuilder; import org.apache.http.ssl.TrustStrategy; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.context.annotation.Bean; +import org.springframework.stereotype.Service; import org.springframework.web.bind.annotation.RequestMethod; +@EnableAutoConfiguration +@Service public class HttpClientUtils { - private static final Logger logger = LogManager.getLogger("HttpClientUtils"); + private static final Logger logger = LoggerFactory.getLogger(HttpClientUtils.class); @Bean public static HttpClientBuilder createHttpClientBuilder() { diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java index ed85fcfc..cb93b0be 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/impl/MsbMgmrImpl.java @@ -23,74 +23,75 @@ import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; -import org.apache.http.client.ClientProtocolException; -import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants; -import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpRequestProcessor; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.json.JSONException; +import org.json.JSONObject; +import org.onap.msb.sdk.discovery.common.RouteException; +import org.onap.msb.sdk.discovery.entity.MicroServiceFullInfo; +import org.onap.msb.sdk.discovery.entity.MicroServiceInfo; +import org.onap.msb.sdk.discovery.entity.RouteResult; +import org.onap.msb.sdk.httpclient.msb.MSBServiceClient; import org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.inf.IMsbMgmr; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.http.MediaType; import org.springframework.stereotype.Component; -import org.springframework.util.ResourceUtils; -import org.springframework.web.bind.annotation.RequestMethod; + +import com.google.gson.Gson; @Component public class MsbMgmrImpl implements IMsbMgmr { - private static final Logger logger = LogManager.getLogger("MsbMgmrImpl"); - @Autowired - private HttpClientBuilder httpClientBuilder; - - @Autowired - private AdaptorEnv adaptorEnv; - - @Value("${serviceName}") - private String serviceName; - - @Value("${version}") - private String version; + private static final Logger logger = LoggerFactory.getLogger(MsbMgmrImpl.class); - @Value("${url}") - private String url; + private Gson gson = new Gson(); - @Value("${protocol}") - private String protocol; + private String msb_ip; - @Value("${visualRange}") - private String visualRange; + private int msb_port; - @Value("${ip}") - private String ip; - - @Value("${port}") - private String port; - - @Value("${ttl}") - private String ttl; - @Override public void register() { - String httpPath = CommonConstants.MSB_REGISTER_SERVICE_PATH; - RequestMethod method = RequestMethod.POST; - try { - String jsonStr = readVfcAdaptorInfoFromJsonFile(); - String registerResponse = operateHttpTask(jsonStr, httpPath, method); - logger.info("registerResponse is ", registerResponse); + String msbInfoJsonStr = readMsbInfoFromJsonFile(); + JSONObject totalJsonObj = new JSONObject(msbInfoJsonStr); + JSONObject serverJsonObj = totalJsonObj.getJSONObject("defaultServer"); + msb_ip = serverJsonObj.getString("host"); + msb_port = serverJsonObj.getInt("port"); + + String vfcAdaptorInfoJsonStr = readVfcAdaptorInfoFromJsonFile(); + MicroServiceInfo msinfo = gson.fromJson(vfcAdaptorInfoJsonStr, MicroServiceInfo.class); + + MSBServiceClient msbClient = new MSBServiceClient(msb_ip, msb_port); + MicroServiceFullInfo microServiceInfo = msbClient.registerMicroServiceInfo(msinfo); + logger.info("Registered service response info is " + microServiceInfo.toString()); + } catch (IOException e) { logger.error("Failed to read vfcadaptor info! ", e); + } catch (RouteException e) { + logger.error("Failed to register nokia vnfm driver! ", e); + } catch (JSONException e) { + logger.error("Failed to retrieve json info! ", e); } } - public String readVfcAdaptorInfoFromJsonFile() throws IOException { - InputStream ins = null; + private String readMsbInfoFromJsonFile() throws IOException { + String filePath = "/etc/conf/restclient.json"; + String fileContent = getJsonStrFromFile(filePath); + + return fileContent; + } + + private String readVfcAdaptorInfoFromJsonFile() throws IOException { + String filePath = "/etc/adapterInfo/vnfmadapterinfo.json"; + String fileContent = getJsonStrFromFile(filePath); + + return fileContent; + } + + public String getJsonStrFromFile(String filePath) throws IOException { + InputStream ins = null; BufferedInputStream bins = null; String fileContent = ""; - String fileName = getAppRoot() + "/etc/adapterInfo/vnfmadapterinfo.json"; + String fileName = getAppRoot() + filePath; try { ins = new FileInputStream(fileName); @@ -112,35 +113,24 @@ public class MsbMgmrImpl implements IMsbMgmr { bins.close(); } } - - return fileContent; - } + return fileContent; + } @Override public void unregister() { - String httpPath = String.format(CommonConstants.MSB_UNREGISTER_SERVICE_PATH, serviceName, version, ip, port); - RequestMethod method = RequestMethod.DELETE; - try { String jsonStr = readVfcAdaptorInfoFromJsonFile(); - String registerResponse = operateHttpTask(jsonStr, httpPath, method); - logger.info("unregisterResponse is ", registerResponse); + MicroServiceInfo msinfo = gson.fromJson(jsonStr, MicroServiceInfo.class); + + MSBServiceClient msbClient = new MSBServiceClient(msb_ip, msb_port); + RouteResult routeResult = msbClient.cancelMicroServiceInfo(msinfo.getServiceName(), msinfo.getVersion()); + logger.info("unregistered service response info is " + routeResult.toString()); + } catch (IOException e) { - logger.error("Failed to unregister! ", e); + logger.error("Failed to read vfcadaptor info! ", e); + } catch (RouteException e) { + logger.error("Failed to register nokia vnfm driver! ", e); } - - } - - public String operateHttpTask(String httpBodyObj, String httpPath, RequestMethod method) throws ClientProtocolException, IOException { - String url=adaptorEnv.getMsbApiUriFront() + httpPath; - HttpRequestProcessor processor = new HttpRequestProcessor(httpClientBuilder, method); - processor.addHdeader(CommonConstants.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE); - - processor.addPostEntity(httpBodyObj); - - String responseStr = processor.process(url); - - return responseStr; } public String getAppRoot() { diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/service/MsgServiceRegister.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/service/MsbServiceRegister.java index 5f52297d..d9a36e08 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/service/MsgServiceRegister.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/msb/service/MsbServiceRegister.java @@ -16,8 +16,8 @@ package org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.service; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.onap.vfc.nfvo.driver.vnfm.svnfm.msb.inf.IMsbMgmr; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.ApplicationArguments; @@ -25,14 +25,15 @@ import org.springframework.boot.ApplicationRunner; import org.springframework.stereotype.Component; @Component -public class MsgServiceRegister implements ApplicationRunner{ - private static final Logger logger = LogManager.getLogger("MsgServiceRegister"); +public class MsbServiceRegister implements ApplicationRunner{ + private static final Logger logger = LoggerFactory.getLogger(MsbServiceRegister.class); @Autowired private IMsbMgmr msbMgmr; @Override public void run(ApplicationArguments arg0) { + logger.info("Start to register nokia vnfm driver service."); msbMgmr.register(); logger.info("nokia vnfm driver successfully registered on the MSB"); } diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java index 94be8d21..eb14023c 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/nslcm/impl/NslcmMgmrImpl.java @@ -20,8 +20,8 @@ import java.io.IOException; import org.apache.http.client.ClientProtocolException; import org.apache.http.impl.client.HttpClientBuilder; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.onap.vfc.nfvo.driver.vnfm.svnfm.common.bo.AdaptorEnv; import org.onap.vfc.nfvo.driver.vnfm.svnfm.constant.CommonConstants; import org.onap.vfc.nfvo.driver.vnfm.svnfm.http.client.HttpRequestProcessor; @@ -39,7 +39,7 @@ import com.google.gson.Gson; @Component public class NslcmMgmrImpl implements NslcmMgmrInf{ - private static final Logger logger = LogManager.getLogger("NslcmMgmrImpl"); + private static final Logger logger = LoggerFactory.getLogger(NslcmMgmrImpl.class); @Autowired private AdaptorEnv adaptorEnv; @@ -56,7 +56,7 @@ public class NslcmMgmrImpl implements NslcmMgmrInf{ String responseStr = operateNslcmHttpTask(null, httpPath, method); - logger.info("NslcmMgmrImpl->queryVnfm, the vnfmInfo is " + responseStr); + logger.info("NslcmMgmrImpl->queryVnfm, the vnfmInfo is {}", responseStr); VnfmInfo response = gson.fromJson(responseStr, VnfmInfo.class); @@ -69,7 +69,7 @@ public class NslcmMgmrImpl implements NslcmMgmrInf{ String responseStr = operateNslcmHttpTask(driverRequest, httpPath, method); - logger.info("NslcmMgmrImpl->grantVnf, the NslcmGrantVnfResponse is " + responseStr); + logger.info("NslcmMgmrImpl->grantVnf, the NslcmGrantVnfResponse is {}", responseStr); NslcmGrantVnfResponse response = gson.fromJson(responseStr, NslcmGrantVnfResponse.class); diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java index 39b6b3f6..2336c941 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/java/org/onap/vfc/nfvo/driver/vnfm/svnfm/vnfmdriver/controller/VnfmDriverController.java @@ -21,8 +21,6 @@ import java.io.IOException; import javax.servlet.http.HttpServletResponse; import org.apache.http.HttpStatus; -import org.apache.logging.log4j.LogManager; -import org.apache.logging.log4j.Logger; import org.onap.vfc.nfvo.driver.vnfm.svnfm.exception.VnfmDriverException; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.HealVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.HealVnfResponse; @@ -35,6 +33,8 @@ import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.ScaleVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.TerminateVnfRequest; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.bo.TerminateVnfResponse; import org.onap.vfc.nfvo.driver.vnfm.svnfm.vnfmdriver.inf.VnfmDriverMgmrInf; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.stereotype.Controller; @@ -49,7 +49,7 @@ import com.google.gson.Gson; @Controller @RequestMapping(value = "/api/nokiavnfmdriver/v1") public class VnfmDriverController { - private static final Logger logger = LogManager.getLogger("VnfmDriverController"); + private static final Logger logger = LoggerFactory.getLogger(VnfmDriverController.class); @Autowired private VnfmDriverMgmrInf vnfmDriverMgmr; diff --git a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/application.properties b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/application.properties index 225b04ad..f3d6c7fd 100644 --- a/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/application.properties +++ b/nokia/vnfmdriver/vfcadaptorservice/vfcadaptor/src/main/resources/application.properties @@ -16,19 +16,19 @@ server.error.whitelabel.enabled=false ## for MySql Database begin ## -spring.datasource.url=jdbc:mysql://135.251.208.57:5029/aware_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=round -spring.datasource.username=root -spring.datasource.password=123456 +spring.datasource.username=vnfm +spring.datasource.password=vnfmpass +spring.datasource.url=jdbc:mysql://127.0.0.1:3306/vnfm_db?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=round&useSSL=false spring.datasource.driver-class-name=com.mysql.jdbc.Driver spring.datasource.tomcat.max-wait=30000 -spring.datasource.tomcat.max-active=50 +spring.datasource.tomcat.max-active=20 spring.datasource.tomcat.test-on-borrow=true ## for MySql Database end ## ## for logging begin ## com.fasterxml.jackson.core=jackson-databind -logging.file=D:/VfcadaptorApplication.log +logging.file=${catalina.base}/logs/vfcadaptor.log logging.level.org.springframework.web=DEBUG logging.level.org.hibernate=ERROR ## for logging end ## |