diff options
Diffstat (limited to 'adapters/mso-openstack-adapters')
21 files changed, 84 insertions, 467 deletions
diff --git a/adapters/mso-openstack-adapters/mvnw b/adapters/mso-openstack-adapters/mvnw deleted file mode 100644 index 5bf251c077..0000000000 --- a/adapters/mso-openstack-adapters/mvnw +++ /dev/null @@ -1,225 +0,0 @@ -#!/bin/sh -# ---------------------------------------------------------------------------- -# Licensed to the Apache Software Foundation (ASF) under one -# or more contributor license agreements. See the NOTICE file -# distributed with this work for additional information -# regarding copyright ownership. The ASF licenses this file -# to you 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. -# ---------------------------------------------------------------------------- - -# ---------------------------------------------------------------------------- -# Maven2 Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir -# -# Optional ENV vars -# ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files -# ---------------------------------------------------------------------------- - -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi - - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi - -fi - -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" - fi - fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` - fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" - - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi - done - - saveddir=`pwd` - - M2_HOME=`dirname "$PRG"`/.. - - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` - - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi - -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi - -# For Migwn, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" - # TODO classpath? -fi - -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi - -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi -fi - -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi - -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." -fi - -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher - -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { - - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi - - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break - fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` - fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" - fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; -fi - -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -echo $MAVEN_PROJECTBASEDIR -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` -fi - -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" diff --git a/adapters/mso-openstack-adapters/mvnw.cmd b/adapters/mso-openstack-adapters/mvnw.cmd deleted file mode 100644 index 019bd74d76..0000000000 --- a/adapters/mso-openstack-adapters/mvnw.cmd +++ /dev/null @@ -1,143 +0,0 @@ -@REM ---------------------------------------------------------------------------- -@REM Licensed to the Apache Software Foundation (ASF) under one -@REM or more contributor license agreements. See the NOTICE file -@REM distributed with this work for additional information -@REM regarding copyright ownership. The ASF licenses this file -@REM to you under the Apache License, Version 2.0 (the -@REM "License"); you may not use this file except in compliance -@REM with the License. You may obtain a copy of the License at -@REM -@REM http://www.apache.org/licenses/LICENSE-2.0 -@REM -@REM Unless required by applicable law or agreed to in writing, -@REM software distributed under the License is distributed on an -@REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -@REM KIND, either express or implied. See the License for the -@REM specific language governing permissions and limitations -@REM under the License. -@REM ---------------------------------------------------------------------------- - -@REM ---------------------------------------------------------------------------- -@REM Maven2 Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir -@REM -@REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files -@REM ---------------------------------------------------------------------------- - -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" - -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% diff --git a/adapters/mso-openstack-adapters/pom.xml b/adapters/mso-openstack-adapters/pom.xml index db25f5c721..743c50dc75 100644 --- a/adapters/mso-openstack-adapters/pom.xml +++ b/adapters/mso-openstack-adapters/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.onap.so</groupId> <artifactId>adapters</artifactId> - <version>1.3.0-SNAPSHOT</version> + <version>1.4.0-SNAPSHOT</version> </parent> <artifactId>mso-openstack-adapters</artifactId> <packaging>jar</packaging> @@ -188,10 +188,6 @@ </exclusions> </dependency> <dependency> - <groupId>org.apache.commons</groupId> - <artifactId>commons-dbcp2</artifactId> - </dependency> - <dependency> <groupId>org.apache.cxf</groupId> <artifactId>cxf-spring-boot-starter-jaxws</artifactId> <version>${cxf.version}</version> diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java index 3ec02bfb0e..10dbbf1396 100644 --- a/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java +++ b/adapters/mso-openstack-adapters/src/main/java/db/migration/R__CloudConfigMigration.java @@ -53,6 +53,11 @@ public class R__CloudConfigMigration implements JdbcMigration , MigrationInfoPro private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, R__CloudConfigMigration.class); @JsonProperty("cloud_config") private CloudConfig cloudConfig; + + @Override + public boolean isUndo(){ + return false; + } @Override public void migrate(Connection connection) throws Exception { diff --git a/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java b/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java deleted file mode 100644 index 6c6366904f..0000000000 --- a/adapters/mso-openstack-adapters/src/main/java/db/migration/V4_2__DummyMigration.java +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - * Copyright (C) 2017 - 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========================================================= - */ - -package db.migration; - -import org.flywaydb.core.api.migration.jdbc.JdbcMigration; - -import java.sql.Connection; - -public class V4_2__DummyMigration implements JdbcMigration { - @Override - public void migrate(Connection connection) throws Exception { - //does nothing - } -} diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java index cf11ab94c1..6c646f3e63 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/BpelRestClient.java @@ -69,7 +69,7 @@ public class BpelRestClient { private static final String RETRY_COUNT_PROPERTY = PROPERTY_DOMAIN+".retrycount"; private static final String RETRY_INTERVAL_PROPERTY = PROPERTY_DOMAIN+".retryinterval"; private static final String RETRY_LIST_PROPERTY = PROPERTY_DOMAIN+".retrylist"; - private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + private static final String ENCRYPTION_KEY_PROP = PROPERTY_DOMAIN + ".encryptionKey"; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, BpelRestClient.class); @Autowired @@ -123,7 +123,7 @@ public class BpelRestClient { retryCount = env.getProperty(RETRY_COUNT_PROPERTY, Integer.class, DEFAULT_RETRY_COUNT); retryInterval = env.getProperty(RETRY_INTERVAL_PROPERTY, Integer.class, DEFAULT_RETRY_INTERVAL); setRetryList(env.getProperty(RETRY_LIST_PROPERTY, DEFAULT_RETRY_LIST)); - credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, ENCRYPTION_KEY); + credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, env.getProperty(ENCRYPTION_KEY_PROP)); } public int getSocketTimeout() { diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java index b47905d134..6578912b9a 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/network/MsoNetworkAdapterAsyncImpl.java @@ -65,14 +65,14 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,MsoNetworkAdapterAsyncImpl.class); private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.network.bpelauth"; - private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; private static final String NETWORK_EXCEPTION_MSG="Got a NetworkException on createNetwork: "; private static final String CREATE_NETWORK_ERROR_MSG="Error sending createNetwork notification "; private static final String CREATE_NETWORK_EXCEPTON_MSG="Exception sending createNetwork notification"; private static final String MSO_INTERNAL_ERROR_MSG="MsoInternalError"; @Autowired private Environment environment; - + @Autowired private MsoNetworkAdapter networkAdapter; /** @@ -619,7 +619,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { Map <String, Object> reqCtx = bp.getRequestContext (); Map <String, List <String>> headers = new HashMap <> (); - String userCredentials = this.getEncryptedProperty (BPEL_AUTH_PROP, "", ENCRYPTION_KEY); + String userCredentials = this.getEncryptedProperty (BPEL_AUTH_PROP, "", ENCRYPTION_KEY_PROP); String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ()); reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers); @@ -635,7 +635,7 @@ public class MsoNetworkAdapterAsyncImpl implements MsoNetworkAdapterAsync { public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { try { - return CryptoUtils.decrypt(this.environment.getProperty(key), encryptionKey); + return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey)); } catch (GeneralSecurityException e) { LOGGER.debug("Exception while decrypting property: " + this.environment.getProperty(key), e); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java index 6383f57693..5fa21c64b1 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/BpelRestClient.java @@ -68,7 +68,7 @@ public class BpelRestClient { private static final String RETRY_COUNT_PROPERTY = PROPERTY_DOMAIN+".retrycount"; private static final String RETRY_INTERVAL_PROPERTY = PROPERTY_DOMAIN+".retryinterval"; private static final String RETRY_LIST_PROPERTY = PROPERTY_DOMAIN+".retrylist"; - private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, BpelRestClient.class); /** Default socket timeout (in seconds) */ @@ -122,7 +122,7 @@ public class BpelRestClient { retryCount = env.getProperty(RETRY_COUNT_PROPERTY, Integer.class, DEFAULT_RETRY_COUNT); retryInterval = env.getProperty(RETRY_INTERVAL_PROPERTY, Integer.class, DEFAULT_RETRY_INTERVAL); setRetryList(env.getProperty(RETRY_LIST_PROPERTY, DEFAULT_RETRY_LIST)); - credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, ENCRYPTION_KEY); + credentials = getEncryptedProperty(BPEL_AUTH_PROPERTY, DEFAULT_CREDENTIALS, ENCRYPTION_KEY_PROP); } public int getSocketTimeout() { @@ -285,7 +285,7 @@ public class BpelRestClient { private String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { if (env.getProperty(key) != null) { try { - return CryptoUtils.decrypt(env.getProperty(key), encryptionKey); + return CryptoUtils.decrypt(env.getProperty(key), env.getProperty(encryptionKey)); } catch (GeneralSecurityException e) { LOGGER.debug("Exception while decrypting property: " + env.getProperty(key), e); } diff --git a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java index 95135f579d..bd0dc378d2 100644 --- a/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java +++ b/adapters/mso-openstack-adapters/src/main/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImpl.java @@ -62,7 +62,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, MsoVnfAdapterAsyncImpl.class); private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger (); private static final String BPEL_AUTH_PROP = "org.onap.so.adapters.vnf.bpelauth"; - private static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f"; + private static final String ENCRYPTION_KEY_PROP = "org.onap.so.adapters.network.encryptionKey"; @Autowired private Environment environment; @@ -640,7 +640,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { Map <String, Object> reqCtx = bp.getRequestContext (); Map <String, List <String>> headers = new HashMap <> (); - String userCredentials = this.getEncryptedProperty(BPEL_AUTH_PROP, "", ENCRYPTION_KEY); + String userCredentials = this.getEncryptedProperty(BPEL_AUTH_PROP, "", ENCRYPTION_KEY_PROP); String basicAuth = "Basic " + DatatypeConverter.printBase64Binary (userCredentials.getBytes ()); reqCtx.put (MessageContext.HTTP_REQUEST_HEADERS, headers); @@ -655,7 +655,7 @@ public class MsoVnfAdapterAsyncImpl implements MsoVnfAdapterAsync { public String getEncryptedProperty(String key, String defaultValue, String encryptionKey) { try { - return CryptoUtils.decrypt(this.environment.getProperty(key), encryptionKey); + return CryptoUtils.decrypt(this.environment.getProperty(key), this.environment.getProperty(encryptionKey)); } catch (GeneralSecurityException e) { LOGGER.debug("Exception while decrypting property: " + this.environment.getProperty(key), e); } diff --git a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml index 469744d2de..e07492e56c 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application-local.yaml @@ -7,7 +7,7 @@ org: default_keystone_url_version: /v2.0 default_keystone_reg_ex: "/[vV][0-9]" vnf: - bpelauth: d95a1aa9bd4d39f3ec23cb5ed2358f5f75fa14bc8c978664355661c0858d2505 + bpelauth: 1DDAD7A55A230BB446AA2125053EFB46455F43E48B60155E1C53236E175DFC722A6BE120F6DB390C60034C7564AEB653EA checkRequiredParameters: true addGetFilesOnVolumeReq: false sockettimeout: 30 @@ -16,12 +16,13 @@ org: retryinterval: -15 retrylist: 408,429,500,502,503,504,900 network: - bpelauth: d95a1aa9bd4d39f3ec23cb5ed2358f5f75fa14bc8c978664355661c0858d2505 + bpelauth: 1DDAD7A55A230BB446AA2125053EFB46455F43E48B60155E1C53236E175DFC722A6BE120F6DB390C60034C7564AEB653EA sockettimeout: 5 connecttimeout: 5 retrycount: 5 retryinterval: -15 retrylist: 408,429,500,502,503,504,900 + encryptionKey: aa3871669d893c7fb8abbcda31b88b4f tenant: default_x_aic_orm_client_string: ECOMP-MSO default_keystone_url_version: /v2.0 @@ -66,7 +67,7 @@ mso: # H2 spring: datasource: - url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1; + jdbc-url: jdbc:h2:mem:test;DB_CLOSE_DELAY=-1; username: sa password: sa driver-class-name: org.h2.Driver @@ -110,9 +111,6 @@ spring: password: '$2a$12$tidKuu.h88E2nuL95pTVY.ZOYMN/1dp29A9b1o.0GFDsVVSYlMkHa' role: ACTUATOR -#Actuator -management: - context-path: /manage flyway: outOfOrder: true diff --git a/adapters/mso-openstack-adapters/src/main/resources/application.yaml b/adapters/mso-openstack-adapters/src/main/resources/application.yaml index 4b2cf8eb60..88099be07f 100644 --- a/adapters/mso-openstack-adapters/src/main/resources/application.yaml +++ b/adapters/mso-openstack-adapters/src/main/resources/application.yaml @@ -17,15 +17,10 @@ mso: # CatalogDB spring: datasource: - url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb + jdbc-url: jdbc:mariadb://${DB_HOST}:${DB_PORT}/catalogdb username: ${DB_USERNAME} password: ${DB_PASSWORD} driver-class-name: org.mariadb.jdbc.Driver - dbcp2: - initial-size: 5 - max-total: 20 - validation-query: select 1 - test-on-borrow: true jpa: show-sql: true hibernate: @@ -36,11 +31,30 @@ spring: #Actuator -management: - context-path: /manage +management: + endpoints: + web: + base-path: /manage + server: + servlet: + context-path: /manage + metrics: + se-global-registry: false + export: + prometheus: + enabled: true # Whether exporting of metrics to Prometheus is enabled. + step: 1m # Step size (i.e. reporting frequency) to use. + flyway: outOfOrder: true ignoreMissingMigrations: true baseline-on-migrate: true validate-on-migrate: false + +org: + onap: + so: + adapters: + network: + encryptionKey: aa3871669d893c7fb8abbcda31b88b4f diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java index f1ee0eae78..d552f8d893 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/msoopenstackadapters/EmbeddedMariaDbConfig.java @@ -23,7 +23,7 @@ import ch.vorburger.exec.ManagedProcessException; import ch.vorburger.mariadb4j.DBConfigurationBuilder; import ch.vorburger.mariadb4j.springframework.MariaDB4jSpringService; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder; +import org.springframework.boot.jdbc.DataSourceBuilder; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Profile; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java index 845155f7f0..02a5f25b41 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/network/BpelRestClientTest.java @@ -28,7 +28,7 @@ import org.junit.Test; import org.onap.so.adapters.vnf.BaseRestTestUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.web.server.LocalServerPort; public class BpelRestClientTest extends BaseRestTestUtils { diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java index 8a55177f1e..df7e415724 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/tenant/MsoTenantAdapterImplTest.java @@ -28,7 +28,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Spy; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.tenantrest.TenantRollback; import org.onap.so.cloud.CloudConfig; import org.onap.so.entity.MsoRequest; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java index 9ead28b577..017aa26758 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BaseRestTestUtils.java @@ -37,7 +37,7 @@ import org.onap.so.db.catalog.beans.ServerType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.beans.factory.annotation.Value; -import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.web.server.LocalServerPort; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.cloud.contract.wiremock.AutoConfigureWireMock; @@ -61,7 +61,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; @SpringBootTest(classes = MsoOpenstackAdaptersApplication.class, webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) @ActiveProfiles("test") @AutoConfigureWireMock(port = 0) -public class BaseRestTestUtils { +public abstract class BaseRestTestUtils { @Value("${wiremock.server.port}") protected int wireMockPort; @Autowired diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java index 1038299190..20a3e62ade 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/BpelRestClientTest.java @@ -27,7 +27,7 @@ import javax.inject.Provider; import org.junit.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; -import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.web.server.LocalServerPort; public class BpelRestClientTest extends BaseRestTestUtils{ diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java index d0425371bb..4f1c2c8707 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfAdapterAsyncImplTest.java @@ -43,7 +43,7 @@ import static com.github.tomakehurst.wiremock.client.WireMock.stubFor; import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.urlPathEqualTo; import static com.github.tomakehurst.wiremock.client.WireMock.verify; -import static org.mockito.Matchers.any; +import static org.mockito.ArgumentMatchers.any; import static org.mockito.Mockito.doThrow; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackGetStackVfModule_200; import static org.onap.so.bpmn.mock.StubOpenStack.mockOpenStackResponseAccess; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java index b6f1ad1dcd..f958a5b140 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/MsoVnfMulticloudAdapterImplTest.java @@ -32,7 +32,7 @@ import org.onap.so.cloud.CloudConfig; import org.onap.so.db.catalog.beans.CloudSite; import org.onap.so.entity.MsoRequest; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.context.embedded.LocalServerPort; +import org.springframework.boot.web.server.LocalServerPort; import javax.xml.ws.Holder; import java.util.HashMap; diff --git a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java index d6cdbdfccd..2740e254e1 100644 --- a/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java +++ b/adapters/mso-openstack-adapters/src/test/java/org/onap/so/adapters/vnf/QueryTest.java @@ -37,7 +37,7 @@ import org.junit.runner.RunWith; import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; -import org.mockito.runners.MockitoJUnitRunner; +import org.mockito.junit.MockitoJUnitRunner; import org.onap.so.adapters.vnf.exceptions.VnfException; import org.onap.so.openstack.beans.HeatStatus; import org.onap.so.openstack.beans.StackInfo; diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml index c508b6e2d6..95b48cd8aa 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml +++ b/adapters/mso-openstack-adapters/src/test/resources/application-nomigrate.yaml @@ -7,7 +7,7 @@ org: default_keystone_url_version: /v2.0 default_keystone_reg_ex: "/[vV][0-9]" vnf: - bpelauth: 481E6A95CE97E393A53363750D5E1E75 + bpelauth: 4771D91C24BB25366730561D630B131818CD9FF8D686AA8807F4CB30E1324C46ED16197C07 checkRequiredParameters: true addGetFilesOnVolumeReq: false sockettimeout: 30 @@ -16,7 +16,7 @@ org: retryinterval: -15 retrylist: 408,429,500,502,503,504,900 network: - bpelauth: 481E6A95CE97E393A53363750D5E1E75 + bpelauth: 4771D91C24BB25366730561D630B131818CD9FF8D686AA8807F4CB30E1324C46ED16197C07 sockettimeout: 5 connecttimeout: 5 retrycount: 5 @@ -81,12 +81,11 @@ mso: queue-capacity: 500 spring: datasource: - url: jdbc:mariadb://localhost:3307/catalogdb + jdbc-url: jdbc:mariadb://localhost:3307/catalogdb username: root password: password driver-class-name: org.mariadb.jdbc.Driver - initialize: true - initialization-mode: never + initialization-mode: always jpa: generate-ddl: false show-sql: false @@ -95,6 +94,10 @@ spring: naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy enable-lazy-load-no-trans: true database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + flyway: + baseline-on-migrate: true + out-of-order: true + ignore-missing-migrations: true security: usercredentials: - @@ -115,8 +118,3 @@ management: endpoint: info: enabled: true - -flyway: - baseline-on-migrate: true - outOfOrder: true - ignoreMissingMigrations: true
\ No newline at end of file diff --git a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml index d15978357a..58bde2ef14 100644 --- a/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml +++ b/adapters/mso-openstack-adapters/src/test/resources/application-test.yaml @@ -7,7 +7,7 @@ org: default_keystone_url_version: /v2.0 default_keystone_reg_ex: "/[vV][0-9]" vnf: - bpelauth: 481E6A95CE97E393A53363750D5E1E75 + bpelauth: 4771D91C24BB25366730561D630B131818CD9FF8D686AA8807F4CB30E1324C46ED16197C07 checkRequiredParameters: true addGetFilesOnVolumeReq: false sockettimeout: 30 @@ -16,13 +16,14 @@ org: retryinterval: -15 retrylist: 408,429,500,502,503,504,900 network: - bpelauth: 481E6A95CE97E393A53363750D5E1E75 + bpelauth: 4771D91C24BB25366730561D630B131818CD9FF8D686AA8807F4CB30E1324C46ED16197C07 sockettimeout: 5 connecttimeout: 5 retrycount: 5 retryinterval: -15 retrylist: 408,429,500,502,503,504,900 - tenant: + encryptionKey: aa3871669d893c7fb8abbcda31b88b4f + tenant: default_x_aic_orm_client_string: ONAP-SO default_keystone_url_version: /v2.0 default_keystone_reg_ex: "/[vV][0-9]" @@ -81,20 +82,21 @@ mso: queue-capacity: 500 spring: datasource: - url: jdbc:mariadb://localhost:3307/catalogdb + jdbc-url: jdbc:mariadb://localhost:3307/catalogdb username: root password: password driver-class-name: org.mariadb.jdbc.Driver - initialize: true - initialization-mode: never + initialization-mode: always jpa: generate-ddl: false show-sql: false hibernate: ddl-auto: none - naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy - enable-lazy-load-no-trans: true database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + flyway: + baseline-on-migrate: true + out-of-order: true + ignore-missing-migrations: true security: usercredentials: - @@ -109,12 +111,20 @@ mariaDB4j: #Actuator -management: +management: endpoints: - enabled-by-default: false - endpoint: - info: - enabled: true + web: + base-path: /manage + server: + servlet: + context-path: /manage + metrics: + se-global-registry: false + export: + prometheus: + enabled: true # Whether exporting of metrics to Prometheus is enabled. + step: 1m # Step size (i.e. reporting frequency) to use. + cloud_config: identity_services: @@ -148,7 +158,3 @@ cloud_config: version: "2.0" -flyway: - baseline-on-migrate: true - outOfOrder: true - ignoreMissingMigrations: true
\ No newline at end of file |