From: MD IRSHAD SHEIKH Date: Mon, 22 Mar 2021 12:48:37 +0000 (+0530) Subject: Added CSIT for Macroflow with HEAT X-Git-Tag: 7.0.1 X-Git-Url: https://gerrit.onap.org/r/gitweb?p=integration%2Fcsit.git;a=commitdiff_plain;h=refs%2Fheads%2Fguilin Added CSIT for Macroflow with HEAT Issue-ID: SO-3533 Signed-off-by: MD IRSHAD SHEIKH Change-Id: Id23cd64850ffcdf165d4a5ea031d6778fd0011be --- diff --git a/plans/so/integration-etsi-testing/config/apply-workarounds.sh b/plans/so/integration-etsi-testing/config/apply-workarounds.sh index 21a3aeb8..4ecf880f 100755 --- a/plans/so/integration-etsi-testing/config/apply-workarounds.sh +++ b/plans/so/integration-etsi-testing/config/apply-workarounds.sh @@ -109,6 +109,8 @@ mysql -h $DB_HOST -uroot -p$MYSQL_ROOT_PASSWORD $CATALOG_DB << EOF UPDATE orchestration_status_state_transition_directive SET FLOW_DIRECTIVE='CONTINUE' WHERE RESOURCE_TYPE='VNF' AND ORCHESTRATION_STATUS='CREATED' AND TARGET_ACTION='ACTIVATE' AND FLOW_DIRECTIVE='FAIL'; + insert into cloud_sites(ID, REGION_ID, IDENTITY_SERVICE_ID, CLOUD_VERSION, CLLI, ORCHESTRATOR) values("EtsiCloudRegion", "EtsiCloudRegion", "DEFAULT_KEYSTONE", "2.5", "clli2", "multicloud"); + COMMIT; EOF diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/GenericVnfsController.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/GenericVnfsController.java index 43fe47da..22209fc8 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/GenericVnfsController.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/GenericVnfsController.java @@ -22,6 +22,7 @@ package org.onap.so.aaisimulator.controller; import static org.onap.so.aaisimulator.utils.Constants.APPLICATION_MERGE_PATCH_JSON; import static org.onap.so.aaisimulator.utils.Constants.BI_DIRECTIONAL_RELATIONSHIP_LIST_URL; import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNF; +import static org.onap.so.aaisimulator.utils.Constants.VF_MODULE; import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNFS_URL; import static org.onap.so.aaisimulator.utils.Constants.RELATIONSHIP_LIST_RELATIONSHIP_URL; import static org.onap.so.aaisimulator.utils.Constants.X_HTTP_METHOD_OVERRIDE; @@ -35,6 +36,8 @@ import javax.ws.rs.core.MediaType; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.Relationship; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VfModules; import org.onap.so.aaisimulator.service.providers.GenericVnfCacheServiceProvider; import org.onap.so.aaisimulator.utils.HttpServiceUtils; import org.onap.so.aaisimulator.utils.RequestErrorResponseUtils; @@ -47,6 +50,7 @@ import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PatchMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PutMapping; @@ -211,5 +215,65 @@ public class GenericVnfsController { return getRequestErrorResponseEntity(request, GENERIC_VNF); } + + + @GetMapping(value = "/generic-vnf/{vnf-id}/vf-modules/vf-module/{vf-module-id}", produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity getVfModule(@PathVariable("vnf-id") final String vnfId, @PathVariable("vf-module-id") final String vfModuleId, + @RequestParam(name = "depth", required = false) final Integer depth, + @RequestParam(name = "resultIndex", required = false) final Integer resultIndex, + @RequestParam(name = "resultSize", required = false) final Integer resultSize, + @RequestParam(name = "format", required = false) final String format, final HttpServletRequest request) { + LOGGER.info( + "Will get VfModule for 'vf-module-id': {} with depth: {}, resultIndex: {}, resultSize:{}, format: {} ...", + vnfId, vfModuleId, depth, resultIndex, resultSize, format); + + final Optional optional = cacheServiceProvider.getVfModule(vnfId, vfModuleId); + + if (optional.isPresent()) { + final VfModule vfModule = optional.get(); + LOGGER.info("found VfModule {} in cache", vfModule); + return ResponseEntity.ok(vfModule); + } + + LOGGER.error( + "Unable to find VfModule in cache for 'vf-module-id': {} with depth: {}, resultIndex: {}, resultSize:{}, format:{} ...", + vnfId, vfModuleId, depth, resultIndex, resultSize, format); + return getRequestErrorResponseEntity(request, VF_MODULE); + + } + + + @PutMapping(value = "/generic-vnf/{vnf-id}/vf-modules/vf-module/{vf-module-id}", consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, + produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity putVfModule(@RequestBody final VfModule vfModule, + @PathVariable("vnf-id") final String vnfId, @PathVariable("vf-module-id") final String vfModuleId, final HttpServletRequest request) { + LOGGER.info("Will add VfModule to cache with 'vf-module-id': {} ...", vfModuleId); + + cacheServiceProvider.putVfModule(vnfId, vfModuleId, vfModule); + return ResponseEntity.accepted().build(); + } + + @PostMapping(value = "/generic-vnf/{vnf-id}/vf-modules/vf-module/{vf-module-id}", + consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML, APPLICATION_MERGE_PATCH_JSON}, + produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity patchVfModule(@RequestBody final VfModule vfModule, + @PathVariable("vnf-id") final String vnfId, @PathVariable("vf-module-id") final String vfModuleId, + @RequestHeader(value = X_HTTP_METHOD_OVERRIDE, required = false) final String xHttpHeaderOverride, + final HttpServletRequest request) { + + LOGGER.info("Will post VfModule to cache with 'vf-module-id': {} and '{}': {} ...", vfModuleId, X_HTTP_METHOD_OVERRIDE, + xHttpHeaderOverride); + + if (HttpMethod.PATCH.toString().equalsIgnoreCase(xHttpHeaderOverride)) { + if (cacheServiceProvider.patchVfModule(vnfId, vfModuleId, vfModule)) { + return ResponseEntity.accepted().build(); + } + LOGGER.error("Unable to apply patch to VmModule using 'vf-module-id': {} ... ", vfModule); + return getRequestErrorResponseEntity(request, VF_MODULE); + } + LOGGER.error("{} not supported ... ", xHttpHeaderOverride); + + return getRequestErrorResponseEntity(request, VF_MODULE); + } } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProvider.java index 901c2594..5570381b 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProvider.java @@ -23,6 +23,7 @@ import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.Relationship; +import org.onap.aai.domain.yang.VfModule; import org.springframework.http.HttpHeaders; /** @@ -49,5 +50,9 @@ public interface GenericVnfCacheServiceProvider extends Clearable { boolean deleteGenericVnf(final String vnfId, final String resourceVersion); + void putVfModule(final String vnfId, final String vfModuleId, final VfModule vfModule); + Optional getVfModule(final String vnfId, final String vfModuleId); + + boolean patchVfModule(final String vnfId, final String vfModuleId, final VfModule vfModule); } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProviderImpl.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProviderImpl.java index e7a42106..42b2d872 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProviderImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/GenericVnfCacheServiceProviderImpl.java @@ -37,6 +37,8 @@ import org.onap.aai.domain.yang.RelatedToProperty; import org.onap.aai.domain.yang.Relationship; import org.onap.aai.domain.yang.RelationshipData; import org.onap.aai.domain.yang.RelationshipList; +import org.onap.aai.domain.yang.VfModule; +import org.onap.aai.domain.yang.VfModules; import org.onap.so.aaisimulator.utils.ShallowBeanCopy; import org.onap.so.simulator.cache.provider.AbstractCacheServiceProvider; import org.slf4j.Logger; @@ -58,6 +60,7 @@ public class GenericVnfCacheServiceProviderImpl extends AbstractCacheServiceProv private static final Logger LOGGER = LoggerFactory.getLogger(GenericVnfCacheServiceProviderImpl.class); private final HttpRestServiceProvider httpRestServiceProvider; + //final VfModules vfModules = new VfModules(); @Autowired public GenericVnfCacheServiceProviderImpl(final CacheManager cacheManager, @@ -255,4 +258,64 @@ public class GenericVnfCacheServiceProviderImpl extends AbstractCacheServiceProv clearCache(GENERIC_VNF_CACHE.getName()); } + @Override + public Optional getVfModule(final String vnfId, final String vfModuleId) { + LOGGER.info("Getting vfModule from cache for vnfId: {} and vfModuleId: {}", + vnfId, vfModuleId); + final Optional genericVnfOptional = getGenericVnf(vnfId); + final GenericVnf value = genericVnfOptional.get(); + final VfModules vfmodules = value.getVfModules(); + if (vfmodules != null) { + for (VfModule vfModule : vfmodules.getVfModule()) { + if (vfModule.getVfModuleId().equalsIgnoreCase(vfModuleId)){ + return Optional.of(vfModule); + } + } + } + return Optional.empty(); + } + + + @Override + public void putVfModule(final String vnfId, final String vfModuleId, final VfModule vfModule) { + LOGGER.info("Adding vfModule for vnfId: {} and vfModuleId: {}", + vnfId, vfModuleId); + final Optional genericVnfOptional = getGenericVnf(vnfId); + final Cache cache = getCache(GENERIC_VNF_CACHE.getName()); + if (genericVnfOptional.isPresent()) { + final GenericVnf genericVnf = genericVnfOptional.get(); + VfModules vfModules = null; + if(genericVnf.getVfModules()==null){ + vfModules = new VfModules(); + genericVnf.setVfModules(vfModules); + } else { + vfModules = genericVnf.getVfModules(); + } + + vfModules.getVfModule().add(vfModule); + cache.put(vfModuleId, vfModule); + } + } + + @Override + public boolean patchVfModule(final String vnfId, final String vfModuleId, final VfModule vfModule) { + final Optional genericVnfOptional = getGenericVnf(vnfId); + LOGGER.info("Create vfModule for vnfId: {} and vfModuleId: {}", + vnfId, vfModuleId); + if (genericVnfOptional.isPresent()) { + final GenericVnf cachedGenericVnf = genericVnfOptional.get(); + final VfModules vfmodules = cachedGenericVnf.getVfModules(); + LOGGER.info("vfModuleId is Matched"); + try { + vfmodules.getVfModule().stream().filter(tempVfModule -> + tempVfModule.getVfModuleId().equalsIgnoreCase(vfModuleId)).forEach(tempVfModule -> + tempVfModule.setOrchestrationStatus(vfModule.getOrchestrationStatus())); + return true; + } catch (final Exception exception) { + LOGGER.error("Unable to update VfModule for vfModuleId: {}", vfModule, exception); + } + } + LOGGER.error("Unable to find VfModule ..."); + return false; + } } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java index 4099c2a0..4cd5b25a 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/utils/Constants.java @@ -89,6 +89,8 @@ public class Constants { public static final String COMPOSED_OF = "org.onap.relationships.inventory.ComposedOf"; public static final String GENERIC_VNF = "generic-vnf"; + + public static final String VF_MODULE = "vf-module"; public static final String PLATFORM = "platform"; diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/HELP.md b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/HELP.md new file mode 100644 index 00000000..c8c1987d --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/HELP.md @@ -0,0 +1,9 @@ +# Getting Started + +### Reference Documentation +For further reference, please consider the following sections: + +* [Official Apache Maven documentation](https://maven.apache.org/guides/index.html) +* [Spring Boot Maven Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.4.2/maven-plugin/reference/html/) +* [Create an OCI image](https://docs.spring.io/spring-boot/docs/2.4.2/maven-plugin/reference/html/#build-image) + diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/mvnw b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/mvnw new file mode 100755 index 00000000..a16b5431 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/mvnw @@ -0,0 +1,310 @@ +#!/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 +# +# https://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. +# ---------------------------------------------------------------------------- + +# ---------------------------------------------------------------------------- +# Maven 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 Mingw, 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)`" +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 + +########################################################################################## +# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +# This allows using the maven wrapper in projects that prohibit checking in binary data. +########################################################################################## +if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found .mvn/wrapper/maven-wrapper.jar" + fi +else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." + fi + if [ -n "$MVNW_REPOURL" ]; then + jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + else + jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + fi + while IFS="=" read key value; do + case "$key" in (wrapperUrl) jarUrl="$value"; break ;; + esac + done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" + if [ "$MVNW_VERBOSE" = true ]; then + echo "Downloading from: $jarUrl" + fi + wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" + if $cygwin; then + wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` + fi + + if command -v wget > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found wget ... using wget" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + wget "$jarUrl" -O "$wrapperJarPath" + else + wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" + fi + elif command -v curl > /dev/null; then + if [ "$MVNW_VERBOSE" = true ]; then + echo "Found curl ... using curl" + fi + if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then + curl -o "$wrapperJarPath" "$jarUrl" -f + else + curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f + fi + + else + if [ "$MVNW_VERBOSE" = true ]; then + echo "Falling back to using Java to download" + fi + javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" + # For Cygwin, switch paths to Windows format before running javac + if $cygwin; then + javaClass=`cygpath --path --windows "$javaClass"` + fi + if [ -e "$javaClass" ]; then + if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Compiling MavenWrapperDownloader.java ..." + fi + # Compiling the Java class + ("$JAVA_HOME/bin/javac" "$javaClass") + fi + if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then + # Running the downloader + if [ "$MVNW_VERBOSE" = true ]; then + echo " - Running MavenWrapperDownloader.java ..." + fi + ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") + fi + fi + fi +fi +########################################################################################## +# End of extension +########################################################################################## + +export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} +if [ "$MVNW_VERBOSE" = true ]; then + echo $MAVEN_PROJECTBASEDIR +fi +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 + +# Provide a "standardized" way to retrieve the CLI args that will +# work with both Windows and non-Windows executions. +MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" +export MAVEN_CMD_LINE_ARGS + +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/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/mvnw.cmd b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/mvnw.cmd new file mode 100644 index 00000000..c8d43372 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/mvnw.cmd @@ -0,0 +1,182 @@ +@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 https://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 Maven 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 keystroke 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 set title of command window +title %0 +@REM enable echoing by 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 + +set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + +FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( + IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B +) + +@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central +@REM This allows using the maven wrapper in projects that prohibit checking in binary data. +if exist %WRAPPER_JAR% ( + if "%MVNW_VERBOSE%" == "true" ( + echo Found %WRAPPER_JAR% + ) +) else ( + if not "%MVNW_REPOURL%" == "" ( + SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" + ) + if "%MVNW_VERBOSE%" == "true" ( + echo Couldn't find %WRAPPER_JAR%, downloading it ... + echo Downloading from: %DOWNLOAD_URL% + ) + + powershell -Command "&{"^ + "$webclient = new-object System.Net.WebClient;"^ + "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ + "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ + "}"^ + "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ + "}" + if "%MVNW_VERBOSE%" == "true" ( + echo Finished downloading %WRAPPER_JAR% + ) +) +@REM End of extension + +@REM Provide a "standardized" way to retrieve the CLI args that will +@REM work with both Windows and non-Windows executions. +set MAVEN_CMD_LINE_ARGS=%* + +%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/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/pom.xml b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/pom.xml new file mode 100644 index 00000000..80e21746 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/pom.xml @@ -0,0 +1,86 @@ + + + 4.0.0 + + org.onap.so.simulators + so-simulators + 1.0-SNAPSHOT + + multicloud-simulator + ${project.artifactId} + MultiCloud Simulator + + 11 + 1.1 + 3.2.0 + 3.2.0 + 1.7.1-SNAPSHOT + 2.1.1.RELEASE + + + + ${project.parent.groupId} + common + ${project.version} + + + org.springframework.boot + spring-boot-starter + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-tomcat + + + + + com.googlecode.json-simple + json-simple + ${json-simple.version} + + + org.onap.so.adapters + mso-adapters-rest-interface + ${mso-adapters.version} + + + org.springframework.security.oauth.boot + spring-security-oauth2-autoconfigure + ${spring-security.version} + + + + + + org.springframework.boot + spring-boot-maven-plugin + + org.onap.so.multicloudsimulator.MultiCloudSimulatorApplication + + + + + repackage + + + + + + org.springframework.boot + spring-boot-maven-plugin + + + + + \ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplication.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplication.java new file mode 100644 index 00000000..479c4810 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplication.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author Md Irshad Sheikh (md.irshad.sheikh@huawei.com) + * + */ +@SpringBootApplication(scanBasePackages = { "org.onap" }) +public class MultiCloudSimulatorApplication { + + public static void main(String[] args) { + SpringApplication.run(MultiCloudSimulatorApplication.class, args); + + } + +} \ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceNameOutput.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceNameOutput.java new file mode 100644 index 00000000..1bf902a2 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceNameOutput.java @@ -0,0 +1,77 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.beans; + +import com.fasterxml.jackson.databind.JsonNode; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.io.ClassPathResource; +import org.springframework.stereotype.Component; +import java.io.IOException; +import java.io.InputStream; + +@Component +@PropertySource(value = "data/InstanceNameOutput.json") +@ConfigurationProperties +public class InstanceNameOutput { + private String template_type; + private String workload_id; + private String workload_status; + public JsonNode workload_status_reason; + + public String getTemplate_type() { + return template_type; + } + + public void setTemplate_type(final String template_type) { + this.template_type = template_type; + } + + public String getWorkload_id() { + return workload_id; + } + + public void setWorkload_id(final String workload_id) { + this.workload_id = workload_id; + } + + public String getWorkload_status() { + return workload_status; + } + + public void setWorkload_status(final String workload_status) { + this.workload_status = workload_status; + } + + public JsonNode getWorkload_status_reason() { + return workload_status_reason; + } + + public void setWorkload_status_reason(final JsonNode workload_status_reason) { + this.workload_status_reason = workload_status_reason; + } + + public final static InputStream getFile(final String file) throws IOException { + return new ClassPathResource(file).getInputStream(); + } + + public final static InputStream getInstanceName() throws Exception, IOException { + return getFile("data/InstanceNameOutput.json"); + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceOutput.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceOutput.java new file mode 100644 index 00000000..2cb1fcac --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceOutput.java @@ -0,0 +1,79 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.beans; + +import com.fasterxml.jackson.databind.JsonNode; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.PropertySource; +import org.springframework.core.io.ClassPathResource; +import org.springframework.stereotype.Component; +import java.io.IOException; +import java.io.InputStream; + +@Component +@PropertySource(value = "data/InstanceOutput.json") +@ConfigurationProperties +public class InstanceOutput { + private static final Logger LOGGER = LoggerFactory.getLogger(InstanceOutput.class); + private String template_type; + private String workload_id; + private String workload_status; + public JsonNode workload_status_reason; + + public JsonNode getWorkload_status_reason() { + return workload_status_reason; + } + + public void setWorkload_status_reason(final JsonNode workload_status_reason) { + this.workload_status_reason = workload_status_reason; + } + + public String getTemplate_type() { + return template_type; + } + + public void setTemplate_type(final String template_type) { + this.template_type = template_type; + } + + public String getWorkload_id() { + return workload_id; + } + + public void setWorkload_id(final String workload_id) { + this.workload_id = workload_id; + } + + public String getWorkload_status() { + return workload_status; + } + + public void setWorkload_status(final String workload_status) { + this.workload_status = workload_status; + } + + public static InputStream getFile(final String file) throws IOException { + return new ClassPathResource(file).getInputStream(); + } + + public static InputStream getInstance() throws Exception, IOException { + return getFile("data/InstanceOutput.json"); + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceResponse.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceResponse.java new file mode 100644 index 00000000..c8a58210 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/InstanceResponse.java @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.beans; + +import java.util.List; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "id", "request", "namespace", "resources" }) +@JsonIgnoreProperties(value = "true") +public class InstanceResponse extends Response { + + @JsonProperty("id") + private String id; + @JsonProperty("request") + private MulticloudInstanceRequest request; + @JsonProperty("namespace") + private String namespace; + @JsonProperty("resources") + private List resources = null; + + public InstanceResponse(final String errorMsg) { + super(errorMsg); + } + + public InstanceResponse() { + super(""); + } + + public String getId() { + return id; + } + + public void setId(final String id) { + this.id = id; + } + + public MulticloudInstanceRequest getRequest() { + return request; + } + + public void setRequest(final MulticloudInstanceRequest request) { + this.request = request; + } + + public String getNamespace() { + return namespace; + } + + public void setNamespace(final String namespace) { + this.namespace = namespace; + } + + public List getResources() { + return resources; + } + + public void setResources(final List resources) { + this.resources = resources; + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudCreateResponse.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudCreateResponse.java new file mode 100644 index 00000000..0182fd55 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudCreateResponse.java @@ -0,0 +1,106 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.beans; + +import java.io.Serializable; +import org.apache.commons.lang3.builder.ToStringBuilder; +import com.fasterxml.jackson.annotation.JsonCreator; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.JsonNode; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonIgnoreProperties(ignoreUnknown = true) +@JsonPropertyOrder({ "template_type", "workload_id", "template_response", "workload_status_reason", "workload_status" }) +public class MulticloudCreateResponse implements Serializable { + private static final long serialVersionUID = -5215028275577848311L; + + @JsonProperty("template_type") + private String templateType; + @JsonProperty("workload_id") + private String workloadId; + @JsonProperty("template_response") + private JsonNode templateResponse; + @JsonProperty("workload_status_reason") + private JsonNode workloadStatusReason; + @JsonProperty("workload_status") + private String workloadStatus; + + @JsonCreator + public MulticloudCreateResponse(@JsonProperty("template_type") String templateType, + @JsonProperty("workload_id") String workloadId, + @JsonProperty("template_response") JsonNode templateResponse) { + this.templateType = templateType; + this.workloadId = workloadId; + this.templateResponse = templateResponse; + } + + public MulticloudCreateResponse() { + + } + + public String getTemplateType() { + return templateType; + } + + public void setTemplateType(final String templateType) { + this.templateType = templateType; + } + + public String getWorkloadId() { + return workloadId; + } + + public void setWorkloadId(final String workloadId) { + this.workloadId = workloadId; + } + + public void setTemplateResponse(final JsonNode templateResponse) { + this.templateResponse = templateResponse; + } + + public JsonNode getTemplateResponse() { + return templateResponse; + } + + public void setWorkloadStatusReason(final JsonNode workloadStatusReason) { + this.workloadStatusReason = workloadStatusReason; + } + + public JsonNode getWorkloadStatusReason() { + return workloadStatusReason; + } + + public String getWorkloadSstatus() { + return workloadStatus; + } + + public void setWorkloadStatus(final String workloadStatus) { + this.workloadStatus = workloadStatus; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("templateType", templateType).append("workloadId", workloadId) + .append("templateResponse", templateResponse) + .append("workload_status_reason", workloadStatusReason.toString()) + .append("workload_status", workloadStatus).toString(); + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudInstanceRequest.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudInstanceRequest.java new file mode 100644 index 00000000..b645b9bf --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudInstanceRequest.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.beans; + +import java.util.Map; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; + +@JsonIgnoreProperties(value = "true") +public class MulticloudInstanceRequest { + + @JsonProperty(value = "cloud-region") + private String cloudRegion; + + @JsonProperty(value = "rb-name") + private String rbName; + + @JsonProperty(value = "rb-version") + private String rbVersion; + + @JsonProperty(value = "profile-name") + private String profileName; + + @JsonProperty(value = "labels") + private Map labels; + + @JsonProperty(value = "override-values") + private Map overrideValues; + + @JsonProperty(value = "release-name") + private String vfModuleUuid; + + public String getCloudRegion() { + return cloudRegion; + } + + public void setCloudRegion(final String cloudRegion) { + this.cloudRegion = cloudRegion; + } + + public String getRbName() { + return rbName; + } + + public void setRbName(final String rbName) { + this.rbName = rbName; + } + + public String getRbVersion() { + return rbVersion; + } + + public void setRbVersion(final String rbVersion) { + this.rbVersion = rbVersion; + } + + public String getProfileName() { + return profileName; + } + + public void setProfileName(final String profileName) { + this.profileName = profileName; + } + + public Map getLabels() { + return labels; + } + + public void setLabels(Map labels) { + this.labels = labels; + } + + public Map getOverrideValues() { + return overrideValues; + } + + public void setOverrideValues(Map overrideValues) { + this.overrideValues = overrideValues; + } + + public String getVfModuleUuid() { + return vfModuleUuid; + } + + public void setVfModuleUuid(final String vfModuleUuid) { + this.vfModuleUuid = vfModuleUuid; + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudRequest.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudRequest.java new file mode 100644 index 00000000..baeebded --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/MulticloudRequest.java @@ -0,0 +1,158 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.beans; + +import java.io.Serializable; +import org.apache.commons.lang3.builder.ToStringBuilder; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; +import com.fasterxml.jackson.databind.JsonNode; +import com.woorea.openstack.heat.model.CreateStackParam; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "generic-vnf-id", "vf-module-id", "vf-module-model-invariant-id", "vf-module-model-version-id", + "vf-module-model-customization-id", "oof_directives", "sdnc_directives", "user_directives", "template_type", + "template_data" }) +public class MulticloudRequest implements Serializable { + private static final long serialVersionUID = -5215028275577848311L; + + @JsonProperty("generic-vnf-id") + private String genericVnfId; + + @JsonProperty("vf-module-id") + private String vfModuleId; + + @JsonProperty("vf-module-model-invariant-id") + private String vfModuleModelInvariantId; + + @JsonProperty("vf-module-model-version-id") + private String vfModuleModelVersionId; + + @JsonProperty("vf-module-model-customization-id") + private String vfModuleModelCustomizationId; + + @JsonProperty("oof_directives") + private JsonNode oofDirectives; + + @JsonProperty("sdnc_directives") + private JsonNode sdncDirectives; + + @JsonProperty("user_directives") + private JsonNode userDirectives; + + @JsonProperty("template_type") + private String templateType; + + @JsonProperty("template_data") + private CreateStackParam templateData; + + public String getGenericVnfId() { + return genericVnfId; + } + + public void setGenericVnfId(final String genericVnfId) { + this.genericVnfId = genericVnfId; + } + + public String getVfModuleId() { + return vfModuleId; + } + + public void setVfModuleId(final String vfModuleId) { + this.vfModuleId = vfModuleId; + } + + public String getVfModuleModelInvariantId() { + return vfModuleModelInvariantId; + } + + public void setVfModuleModelInvariantId(final String vfModuleModelInvariantId) { + this.vfModuleModelInvariantId = vfModuleModelInvariantId; + } + + public String getVfModuleModelVersionId() { + return vfModuleModelVersionId; + } + + public void setVfModuleModelVersionId(final String vfModuleModelVersionId) { + this.vfModuleModelVersionId = vfModuleModelVersionId; + } + + public String getVfModuleModelCustomizationId() { + return vfModuleModelCustomizationId; + } + + @JsonProperty("vf-module-model-customization-id") + public void setVfModuleModelCustomizationId(final String vfModuleModelCustomizationId) { + this.vfModuleModelCustomizationId = vfModuleModelCustomizationId; + } + + public JsonNode getOofDirectives() { + return oofDirectives; + } + + public void setOofDirectives(final JsonNode oofDirectives) { + this.oofDirectives = oofDirectives; + } + + public JsonNode getSdncDirectives() { + return sdncDirectives; + } + + public void setSdncDirectives(final JsonNode sdncDirectives) { + this.sdncDirectives = sdncDirectives; + } + + public JsonNode getUserDirectives() { + return userDirectives; + } + + public void setUserDirectives(final JsonNode userDirectives) { + this.userDirectives = userDirectives; + } + + public String getTemplateType() { + return templateType; + } + + public void setTemplateType(final String templateType) { + this.templateType = templateType; + } + + public CreateStackParam getTemplateData() { + return templateData; + } + + public void setTemplateData(CreateStackParam templateData) { + this.templateData = templateData; + } + + @Override + public String toString() { + return new ToStringBuilder(this).append("genericVnfId", genericVnfId).append("vfModuleId", vfModuleId) + .append("vfModuleModelInvariantId", vfModuleModelInvariantId) + .append("vfModuleModelVersionId", vfModuleModelVersionId) + .append("vfModuleModelCustomizationId", vfModuleModelCustomizationId) + .append("oofDirectives", oofDirectives).append("sdncDirectives", sdncDirectives) + .append("userDirectives", userDirectives).append("templateType", templateType) + .append("templateData", templateData).toString(); + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Resource.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Resource.java new file mode 100644 index 00000000..666cbe03 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Resource.java @@ -0,0 +1,51 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.beans; + +import com.fasterxml.jackson.annotation.JsonInclude; +import com.fasterxml.jackson.annotation.JsonProperty; +import com.fasterxml.jackson.annotation.JsonPropertyOrder; + +@JsonInclude(JsonInclude.Include.NON_NULL) +@JsonPropertyOrder({ "resource-type", "resource-link" }) +public class Resource { + + @JsonProperty("resource-type") + private String resourceType; + + @JsonProperty("resource-link") + private String resourceLink; + + @JsonProperty("resource-type") + public String getResourceType() { + return resourceType; + } + + public void setResourceType(final String resourceType) { + this.resourceType = resourceType; + } + + public String getResourceLink() { + return resourceLink; + } + + public void setResourceLink(final String resourceLink) { + this.resourceLink = resourceLink; + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Response.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Response.java new file mode 100644 index 00000000..8f0713ea --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/beans/Response.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.beans; + +public class Response { + + private String errorMsg; + + public Response(final String errorMsg) { + this.errorMsg = errorMsg; + } + + public Response() { + } + + public String getErrorMsg() { + return errorMsg; + } + + public void setErrorMsg(final String errorMsg) { + this.errorMsg = errorMsg; + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configuration/ApplicationConfiguration.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configuration/ApplicationConfiguration.java new file mode 100644 index 00000000..365710e3 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configuration/ApplicationConfiguration.java @@ -0,0 +1,42 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.configuration; + +import static org.onap.so.multicloudsimulator.utils.Constants.MULTICLOUD_CACHE; +import java.util.Arrays; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; +import org.springframework.cache.concurrent.ConcurrentMapCache; +import org.springframework.cache.support.SimpleCacheManager; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; + +@Configuration +public class ApplicationConfiguration { + + @Bean + public CacheManager cacheManager() { + final SimpleCacheManager manager = new SimpleCacheManager(); + manager.setCaches(Arrays.asList(getCache(MULTICLOUD_CACHE))); + return manager; + } + + private Cache getCache(final String name) { + return new ConcurrentMapCache(name); + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configuration/WebSecurityConfigImpl.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configuration/WebSecurityConfigImpl.java new file mode 100644 index 00000000..b1d0984a --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/configuration/WebSecurityConfigImpl.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.configuration; + +import static org.onap.so.multicloudsimulator.utils.Constants.OPERATIONS_URL; +import org.onap.so.simulator.configuration.SimulatorSecurityConfigurer; +import org.onap.so.simulator.model.UserCredentials; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; + +@Configuration +@EnableWebSecurity +public class WebSecurityConfigImpl extends SimulatorSecurityConfigurer { + + @Autowired + public WebSecurityConfigImpl(final UserCredentials userCredentials) { + super(userCredentials.getUsers()); + } + + @Override + protected void configure(final HttpSecurity http) throws Exception { + http.csrf().disable().authorizeRequests().antMatchers(OPERATIONS_URL + "/**/**").authenticated().and() + .httpBasic(); + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/controller/MultiCloudController.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/controller/MultiCloudController.java new file mode 100644 index 00000000..c99e246e --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/controller/MultiCloudController.java @@ -0,0 +1,128 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.controller; + +import javax.servlet.http.HttpServletRequest; +import javax.ws.rs.core.MediaType; +import org.apache.commons.io.IOUtils; +import org.onap.so.multicloudsimulator.beans.InstanceOutput; +import org.onap.so.multicloudsimulator.beans.MulticloudCreateResponse; +import org.onap.so.multicloudsimulator.beans.MulticloudInstanceRequest; +import org.onap.so.multicloudsimulator.beans.InstanceResponse; +import org.onap.so.multicloudsimulator.beans.InstanceNameOutput; +import org.onap.so.multicloudsimulator.beans.MulticloudRequest; + +import org.springframework.http.ResponseEntity; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestHeader; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.io.IOException; +import java.io.InputStream; + +import static org.onap.so.multicloudsimulator.utils.Constants.BASE_URL; + +@RestController +@RequestMapping(path = BASE_URL) +public class MultiCloudController { + + public static final String X_HTTP_METHOD_OVERRIDE = "X-HTTP-Method-Override"; + private static final Logger LOGGER = LoggerFactory.getLogger(MultiCloudController.class); + + @PostMapping(value = "/v1/instance") + public ResponseEntity createInstance(@RequestBody MulticloudInstanceRequest req) { + System.out.println("MultiCloud createInstance "); + final InstanceResponse InstanceResponse = new InstanceResponse(); + + LOGGER.info("Calling createInstance"); + return ResponseEntity.ok(InstanceResponse); + } + + @GetMapping(value = "/{cloud-owner}/{cloud-region-id}/infra_workload", produces = { MediaType.APPLICATION_JSON }) + public ResponseEntity getInstance(@PathVariable("cloud-owner") String cloudOwner, + @PathVariable("cloud-region-id") String cloudRegionId, + @RequestParam(value = "depth", required = false, defaultValue = "0") Integer depth, + @RequestParam(name = "format", required = false) final String name, final HttpServletRequest request) + throws Exception { + + LOGGER.info("found CloudOwner {}", cloudOwner); + LOGGER.info("found cloudRegionId {}", cloudRegionId); + LOGGER.info("found name {}", name); + final InputStream instanceOutput = InstanceOutput.getInstance(); + final String output = IOUtils.toString(instanceOutput, "utf-8"); + + return ResponseEntity.ok(output); + } + + @PostMapping(value = "/{cloud-owner}/{cloud-region-id}/infra_workload", consumes = { MediaType.APPLICATION_JSON, + MediaType.APPLICATION_XML }, produces = { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public ResponseEntity postCreateInstance(@RequestBody final MulticloudCreateResponse inputRequest, + @PathVariable("cloud-owner") final String cloudOwner, + @PathVariable("cloud-region-id") final String cloudRegionId, + @RequestHeader(value = X_HTTP_METHOD_OVERRIDE, required = false) final String xHttpHeaderOverride, + final HttpServletRequest request) throws IOException { + + LOGGER.info("Calling postCreateInstance"); + inputRequest.setWorkloadStatusReason(null); + + inputRequest.setWorkloadId("sad_sammet"); + inputRequest.setTemplateType("heat"); + inputRequest.setWorkloadStatus("CREATE_COMPLETE"); + + return ResponseEntity.status(201).body(inputRequest); + } + + @GetMapping(value = "/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}", produces = { + MediaType.APPLICATION_JSON }) + public ResponseEntity getInstanceName(@PathVariable("cloud-owner") final String cloudOwner, + @PathVariable("cloud-region-id") final String cloudRegionId, @PathVariable("workload-id") final String workloadId, + @RequestParam(value = "depth", required = false, defaultValue = "0") final Integer depth, + @RequestParam(name = "format", required = false) final String name, final HttpServletRequest request) + throws Exception { + + LOGGER.info("Calling getInstanceName"); + LOGGER.info("found CloudOwner {}", cloudOwner); + LOGGER.info("found cloudRegionId {}", cloudRegionId); + LOGGER.info("found name {}", name); + final InputStream instanceNameOutput = InstanceNameOutput.getInstanceName(); + final String output = IOUtils.toString(instanceNameOutput, "utf-8"); + + return ResponseEntity.ok(output); + } + + @PostMapping(value = "/{cloud-owner}/{cloud-region-id}/infra_workload/{workload-id}", consumes = { + MediaType.APPLICATION_JSON, + MediaType.APPLICATION_XML }, produces = { MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML }) + public ResponseEntity postCreateInstanceName(@RequestBody final MulticloudRequest inputRequest, + @PathVariable("cloud-owner") final String cloudOwner, @PathVariable("workload-id") String workloadId, + @PathVariable("cloud-region-id") final String cloudRegionId, + @RequestHeader(value = X_HTTP_METHOD_OVERRIDE, required = false) final String xHttpHeaderOverride, + final HttpServletRequest request) throws IOException { + + LOGGER.info("Calling postCreateInstanceName"); + + return ResponseEntity.status(405).build(); + } +} \ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/utils/Constants.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/utils/Constants.java new file mode 100644 index 00000000..e104d235 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/java/org/onap/so/multicloudsimulator/utils/Constants.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator.utils; + +public class Constants { + + public static final String BASE_URL = "/api/multicloud/v1"; + + public static final String OPERATIONS_URL = BASE_URL + "/operations"; + + public static final String MULTICLOUD_CACHE = "multicloud-cache"; + + private Constants() { + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.properties b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.properties new file mode 100644 index 00000000..e507a12f --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.properties @@ -0,0 +1 @@ +security.ignored=/** diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.yaml b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.yaml new file mode 100644 index 00000000..393d1b7b --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/application.yaml @@ -0,0 +1,16 @@ +server: + port: 9996 + tomcat: + max-threads: 4 +ssl-enable: false +spring: + security: + users: + - username: mso + password: $2a$04$f8SB6cW/VI26QvYM6z.GXu7hlEmwnFtePenD8zF18mS3Atu3QNqr2 + role: VID + - username: admin + password: $2a$04$f8SB6cW/VI26QvYM6z.GXu7hlEmwnFtePenD8zF18mS3Atu3QNqr2 + role: VID + main: + allow-bean-definition-overriding: true \ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/data/InstanceNameOutput.json b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/data/InstanceNameOutput.json new file mode 100644 index 00000000..8c0e88f4 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/data/InstanceNameOutput.json @@ -0,0 +1,6 @@ +{ + "workload_status_reason": null, + "template_type": "heat", + "workload_id": "sad_sammet", + "workload_status": "CREATE_COMPLETE" +} \ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/data/InstanceOutput.json b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/data/InstanceOutput.json new file mode 100644 index 00000000..e47ffb43 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/main/resources/data/InstanceOutput.json @@ -0,0 +1,8 @@ +{ + "workload_status_reason": { + "stacks": "NOTFOUND" + }, + "template_type": "heat", + "workload_id": "", + "workload_status": "GET_COMPLETE" +} diff --git a/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/test/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplicationTests.java b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/test/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplicationTests.java new file mode 100644 index 00000000..d9b10d45 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/multicloud-simulator/src/test/java/org/onap/so/multicloudsimulator/MultiCloudSimulatorApplicationTests.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.multicloudsimulator; + +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.multicloudsimulator.utils.Constants; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.context.annotation.Configuration; +import org.springframework.http.ResponseEntity; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; + +import static org.junit.Assert.assertEquals; + +@RunWith(SpringJUnit4ClassRunner.class) +@ActiveProfiles("test") +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT) +@Configuration +class MultiCloudSimulatorApplicationTests { + @LocalServerPort + private int port; + + @Autowired + private TestRestTemplate restTemplate; + + @Test + public void test_createInstance() { + final String url = "http://localhost:" + port + Constants.BASE_URL + "/operations"; + + final ResponseEntity object = restTemplate.getForEntity(url, String.class); + + assertEquals(Constants.OPERATIONS_URL, object.getBody()); + + } + +} \ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml b/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml index 9334a095..98c341e4 100644 --- a/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/package/docker/pom.xml @@ -99,6 +99,29 @@ + + simulators/multicloud-simulator + + try + docker-files + Dockerfile.multicloud-simulator-base-image + + ${project.version} + + + + + + + org.onap.so.simulators:multicloud-simulator + + app.jar + + + + + + simulators/vnfm-simulator @@ -170,6 +193,11 @@ sdnc-simulator ${project.version} + + ${project.parent.groupId} + multicloud-simulator + ${project.version} + org.onap.so.simulators.vnfm vnfm-service diff --git a/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.multicloud-simulator-base-image b/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.multicloud-simulator-base-image new file mode 100644 index 00000000..abffd9fb --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.multicloud-simulator-base-image @@ -0,0 +1,34 @@ +FROM adoptopenjdk/openjdk11:jre-11.0.9.1_1-alpine + +ARG http_proxy +ARG https_proxy +ENV HTTP_PROXY=$http_proxy +ENV HTTPS_PROXY=$https_proxy +ENV http_proxy=$HTTP_PROXY +ENV https_proxy=$HTTPS_PROXY + +# Update the package list and upgrade installed packages +RUN apk update && apk upgrade + +# Install commonly needed tools +RUN apk --no-cache add curl netcat-openbsd sudo nss + +# Create 'so' user +RUN addgroup -g 1000 so && adduser -S -u 1000 -G so -s /bin/sh so + +RUN mkdir /app && mkdir /app/config && mkdir /app/logs && mkdir /app/ca-certificates + +COPY maven/app.jar /app +COPY configs/logging/logback-spring.xml /app +COPY scripts/start-app.sh /app + +RUN chown -R so:so /app && chmod 700 /app/*.sh + +# Springboot configuration (required) +VOLUME /app/config + +# CA certificates +VOLUME /app/ca-certificates + +WORKDIR /app +CMD ["/app/start-app.sh"] diff --git a/plans/so/integration-etsi-testing/so-simulators/pom.xml b/plans/so/integration-etsi-testing/so-simulators/pom.xml index 4be20c66..6de1d886 100644 --- a/plans/so/integration-etsi-testing/so-simulators/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/pom.xml @@ -18,6 +18,7 @@ common + multicloud-simulator sdc-simulator aai-simulator sdnc-simulator diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/ConfigController.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/ConfigController.java new file mode 100644 index 00000000..7282e051 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/ConfigController.java @@ -0,0 +1,94 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright 2021 Huawei Technologies Co., Ltd. + * ================================================================================ + * 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 org.onap.so.sdncsimulator.controller; + +import static org.onap.so.sdncsimulator.utils.Constants.BASE_URL; +import java.util.Optional; +import javax.ws.rs.core.MediaType; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfTopology; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleTopology; + +import org.onap.so.sdncsimulator.providers.ServiceOperationsCacheServiceProvider; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.RequestMapping; + +/** + * @author Md Irshad Sheikh (md.irshad.sheikh@huawei.com) + * + */ +@Controller +@RequestMapping(path = BASE_URL) +public class ConfigController { + private static final String HTTP_STATUS_OK = HttpStatus.OK.value() + ""; + + private static final Logger LOGGER = LoggerFactory.getLogger(OperationsController.class); + + private final ServiceOperationsCacheServiceProvider cacheServiceProvider; + + @Autowired + public ConfigController(final ServiceOperationsCacheServiceProvider cacheServiceProvider) { + this.cacheServiceProvider = cacheServiceProvider; + } + + @GetMapping(value = "/config/GENERIC-RESOURCE-API:services/service/{service-id}/service-data/vnfs/vnf/{vnf-id}/vnf-data/vnf-topology/") + public ResponseEntity getVNf(@PathVariable("service-id") String serviceId, + @PathVariable("vnf-id") String vnfId) { + + LOGGER.info("Get vnf-topology with serviceId {} and vnfId {}",serviceId, vnfId); + final Optional optional = + cacheServiceProvider.getGenericResourceApiVnfTopology(vnfId); + if (optional.isPresent()) { + final GenericResourceApiVnfTopology genericVnfTopology = optional.get(); + LOGGER.info("found VnfTopology {} in cache", genericVnfTopology); + return ResponseEntity.ok(genericVnfTopology); + } + + LOGGER.error( + "Unable to find VnfTopology in cache "); + + return ResponseEntity.badRequest().build(); + } + + @GetMapping(value = "/config/GENERIC-RESOURCE-API:services/service/{service-id}/service-data/vnfs/vnf/{vnf-id}/vnf-data/vf-modules/vf-module/{vf-module-id}/vf-module-data/vf-module-topology/", produces = { + MediaType.APPLICATION_JSON }) + public ResponseEntity getVFmodule(@PathVariable("service-id") String serviceId, + @PathVariable("vnf-id") String vnfId, @PathVariable("vf-module-id") String vfModuleId) { + LOGGER.info("Get vfModule-topology with serviceId {}, vnfId {} and vfModuleId {}",serviceId, vnfId,vfModuleId); + + final Optional optional = + cacheServiceProvider.getGenericResourceApiVfModuleTopology(vfModuleId); + + if (optional.isPresent()) { + final GenericResourceApiVfModuleTopology vfModuleTopology = optional.get(); + LOGGER.info("found vfModuleTopology {} in cache", vfModuleTopology); + return ResponseEntity.ok(vfModuleTopology); + } + + LOGGER.error( + "Unable to find VfModuleTopology in cache for "); + + return ResponseEntity.badRequest().build(); + } +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java index 2f24ef69..58f90382 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/controller/OperationsController.java @@ -31,6 +31,7 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheader import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; import org.onap.so.sdncsimulator.models.InputRequest; import org.onap.so.sdncsimulator.models.Output; import org.onap.so.sdncsimulator.models.OutputRequest; @@ -147,4 +148,36 @@ public class OperationsController { return cacheServiceProvider.putVnfOperationInformation(apiVnfOperationInformation); } + @PostMapping(value = "/GENERIC-RESOURCE-API:vf-module-topology-operation/", + consumes = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}, + produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity postVfModuleOperationInformation( + @RequestBody final InputRequest inputRequest, + final HttpServletRequest request) { + LOGGER.info("Request Received for VfModule : {} ...", inputRequest); + + final GenericResourceApiVfModuleOperationInformation apiVfModuleOperationInformation = inputRequest.getInput(); + if (apiVfModuleOperationInformation == null) { + LOGGER.error("Invalid input request: {}", inputRequest); + return ResponseEntity.badRequest().build(); + } + + final Output output = getOutput(apiVfModuleOperationInformation); + final OutputRequest outputRequest = new OutputRequest(output); + + if (output.getResponseCode().equals(HTTP_STATUS_OK)) { + LOGGER.info("Sucessfully executed request vnf sending response: {}", outputRequest); + return ResponseEntity.ok(outputRequest); + } + + LOGGER.error("Unable to execute input request: {}, will send OutputRequest: {}", inputRequest, outputRequest); + return ResponseEntity.badRequest().body(outputRequest); + + } + + private Output getOutput(final GenericResourceApiVfModuleOperationInformation apiVfModuleOperationInformation) { + + return cacheServiceProvider.putVfModuleOperationInformation(apiVfModuleOperationInformation); + } + } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java index d64b0b0c..7cc0bdaf 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/models/Output.java @@ -48,7 +48,10 @@ public class Output implements Serializable { private GenericResourceApiInstanceReference serviceResponseInformation = null; @JsonProperty("vnf-response-information") - private GenericResourceApiInstanceReference vnfResponseInformation = null; + private GenericResourceApiInstanceReference vnfResponseInformation = null; + + @JsonProperty("vf-module-response-information") + private GenericResourceApiInstanceReference vfModuleResponseInformation = null; /** * @return the responseMessage @@ -164,6 +167,11 @@ public class Output implements Serializable { this.vnfResponseInformation = vnfResponseInformation; return this; + } + public Output vfModuleResponseInformation(final GenericResourceApiInstanceReference vfModuleResponseInformation) { + this.vfModuleResponseInformation = vfModuleResponseInformation; + return this; + } @JsonIgnore @@ -177,6 +185,7 @@ public class Output implements Serializable { sb.append(" responseCode: ").append(responseCode).append("\n"); sb.append(" serviceResponseInformation: ").append(serviceResponseInformation).append("\n"); sb.append(" vnfResponseInformation: ").append(vnfResponseInformation).append("\n"); + sb.append(" vfModuleResponseInformation: ").append(vfModuleResponseInformation).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java index c3a80ec3..c04097bb 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProvider.java @@ -20,9 +20,8 @@ package org.onap.so.sdncsimulator.providers; import java.util.Optional; -import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; -import org.onap.sdnc.northbound.client.model.GenericResourceApiServicemodelinfrastructureService; -import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; + +import org.onap.sdnc.northbound.client.model.*; import org.onap.so.sdncsimulator.models.Output; /** @@ -44,6 +43,12 @@ public interface ServiceOperationsCacheServiceProvider { Output deleteVnfOperationInformation(final GenericResourceApiVnfOperationInformation apiVnfOperationInformation); + Output putVfModuleOperationInformation(final GenericResourceApiVfModuleOperationInformation apiVfModuleOperationInformation); + + public Optional getGenericResourceApiVfModuleTopology(final String vfModueId); + + public Optional getGenericResourceApiVnfTopology(final String vnfId); + void clearAll(); } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java index 88db4c13..24017b6b 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/providers/ServiceOperationsCacheServiceProviderimpl.java @@ -60,7 +60,19 @@ import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnf import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfrequestinputVnfRequestInput; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnftopologyVnfTopology; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnftopologyidentifierstructureVnfTopologyIdentifierStructure; + +import org.onap.sdnc.northbound.client.model.GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfmoduleVfModuleData; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleTopology; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfTopology; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyVfModuleTopology; +import org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduletopologyidentifierVfModuleTopologyIdentifier; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParam; +import org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam; + import org.onap.so.sdncsimulator.models.Output; +import org.onap.so.sdncsimulator.utils.Constants; import org.onap.so.simulator.cache.provider.AbstractCacheServiceProvider; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -198,7 +210,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ if (ifVnfNotExists(vnfId, svcAction, vnfsList)) { vnfsList.add(getGenericResourceApiServicedataVnf(serviceInstanceId, vnfId, input)); - + setVnfsData(vnfsList); final GenericResourceApiServicestatusServiceStatus serviceStatus = service.getServiceStatus(); return new Output().ackFinalIndicator(serviceStatus.getFinalIndicator()) @@ -507,4 +519,158 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ } + @Override + public Output putVfModuleOperationInformation( + final GenericResourceApiVfModuleOperationInformation input) { + + final GenericResourceApiServiceinformationServiceInformation serviceInformation = input.getServiceInformation(); + final GenericResourceApiVnfinformationVnfInformation vnfInformation = input.getVnfInformation(); + final GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = input.getVfModuleInformation(); + // Call getVfModule to make a vfList for get the vf-module-information while GET reqest + getVfModule(input); + + final GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = input.getSdncRequestHeader(); + final String svcRequestId = getSvcRequestId(requestHeader); + + if (serviceInformation != null && isValid(serviceInformation.getServiceInstanceId()) && vnfInformation != null + && isValid(vnfInformation.getVnfId()) && vfModuleInformation !=null && isValid(vfModuleInformation.getVfModuleId())) { + + + final String serviceInstanceId = serviceInformation.getServiceInstanceId(); + final String vnfId = vnfInformation.getVnfId(); + final String vfModuleId = vfModuleInformation.getVfModuleId(); + + final Optional optional = + getGenericResourceApiServicemodelinfrastructureService(serviceInstanceId); + if (optional.isPresent()) { + final GenericResourceApiServicemodelinfrastructureService service = optional.get(); + final GenericResourceApiServicedataServiceData serviceData = service.getServiceData(); + if (serviceData != null) { + + final GenericResourceApiServicestatusServiceStatus serviceStatus = service.getServiceStatus(); + + return new Output().ackFinalIndicator(serviceStatus.getFinalIndicator()) + .responseCode(serviceStatus.getResponseCode()) + .responseMessage(serviceStatus.getResponseMessage()).svcRequestId(svcRequestId) + .serviceResponseInformation(new GenericResourceApiInstanceReference() + .instanceId(serviceInstanceId).objectPath(getObjectPath(serviceInstanceId))) + .vnfResponseInformation(new GenericResourceApiInstanceReference().instanceId(vnfId) + .objectPath(getObjectPath(serviceInstanceId, vnfId))) + .vfModuleResponseInformation(new GenericResourceApiInstanceReference().instanceId(vfModuleId) + .objectPath(getObjectPath(vnfId, vfModuleId))); + } + } + LOGGER.error( + "Unable to find existing GenericResourceApiServiceModelInfrastructure in cache using service instance id: {}", + serviceInstanceId); + } + LOGGER.error( + "Unable to add GenericResourceApiServiceOperationInformation in cache due to invalid input: {}... ", + input); + return new Output().ackFinalIndicator(YES).responseCode(HTTP_STATUS_BAD_REQUEST) + .responseMessage("Unable to add vfModule").svcRequestId(svcRequestId); + } + + private void getVfModule + (final GenericResourceApiVfModuleOperationInformation input) { + + final GenericResourceApiVfmoduletopologyVfModuleTopology apiVfModuletopologyVfModuleTopology = + new GenericResourceApiVfmoduletopologyVfModuleTopology(); + + final GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfmoduleVfModuleData vfModuleData = + new GenericResourceApiServicedataServicedataVnfsVnfVnfdataVfmodulesVfmoduleVfModuleData(); + + final String vfModuleId = input.getVfModuleInformation().getVfModuleId(); + + vfModuleData.setVfModuleInformation(input.getVfModuleInformation()); + vfModuleData.setVfModuleRequestInput(input.getVfModuleRequestInput()); + + final GenericResourceApiVfmoduletopologyVfModuleTopology vfModuleTopology = + new GenericResourceApiVfmoduletopologyVfModuleTopology(); + + vfModuleTopology.setSdncGeneratedCloudResources(true); + final GenericResourceApiParam vfModuleParametersData = new GenericResourceApiParam(); + final List params = new ArrayList(); + final GenericResourceApiParamParam param = new GenericResourceApiParamParam(); + param.setName("k8s-rb-profile-name"); + param.setValue("k8s-rb-profile-value"); + + params.add(param); + vfModuleParametersData.setParam(params); + vfModuleTopology.setVfModuleParameters(vfModuleParametersData); + + vfModuleTopology.setOnapModelInformation(vfModuleData.getVfModuleInformation().getOnapModelInformation()); + vfModuleTopology.setVfModuleParameters(vfModuleData.getVfModuleRequestInput().getVfModuleInputParameters()); + vfModuleTopology.setAicClli(vfModuleData.getVfModuleRequestInput().getAicClli()); + vfModuleTopology.setAicCloudRegion(vfModuleData.getVfModuleRequestInput().getAicCloudRegion()); + vfModuleTopology.setCloudOwner(vfModuleData.getVfModuleRequestInput().getCloudOwner()); + + apiVfModuletopologyVfModuleTopology.vfModuleTopologyIdentifier(getVfModuleTopologyIdentifierStructure(input)); + + vfModuleTopology.setVfModuleTopologyIdentifier(apiVfModuletopologyVfModuleTopology.getVfModuleTopologyIdentifier()); + vfModuleTopology.setTenant(vfModuleData.getVfModuleRequestInput().getTenant()); + + final GenericResourceApiVfModuleTopology genericResourceApiVfModuleTopology = new GenericResourceApiVfModuleTopology(); + genericResourceApiVfModuleTopology.setVfModuleTopology(vfModuleTopology); + + final Cache cache = getCache(Constants.SERVICE_TOPOLOGY_OPERATION_CACHE); + cache.put(vfModuleId, genericResourceApiVfModuleTopology); + } + + @Override + public Optional getGenericResourceApiVfModuleTopology(final String vfModueId) { + LOGGER.info("getting GenericResourceApiVfModuleTopology from cache using key: {}", vfModueId); + final Cache cache = getCache(Constants.SERVICE_TOPOLOGY_OPERATION_CACHE); + final GenericResourceApiVfModuleTopology value = + cache.get(vfModueId, GenericResourceApiVfModuleTopology.class); + if (value != null) { + return Optional.of(value); + } + LOGGER.error("Unable to find GenericResourceApiVfModuleTopology ..."); + return Optional.empty(); + } + + private GenericResourceApiVfmoduletopologyidentifierVfModuleTopologyIdentifier getVfModuleTopologyIdentifierStructure( + @Valid final GenericResourceApiVfModuleOperationInformation input) { + + final GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = input.getVfModuleInformation(); + return new GenericResourceApiVfmoduletopologyidentifierVfModuleTopologyIdentifier() + .vfModuleId(vfModuleInformation.getVfModuleId()).vfModuleType(vfModuleInformation.getVfModuleType()).vfModuleName(input.getVfModuleRequestInput().getVfModuleName()); + } + + + public void setVnfsData(List vnfsList) { + + final GenericResourceApiVnftopologyVnfTopology vnfTopology = new GenericResourceApiVnftopologyVnfTopology(); + LOGGER.info(String.valueOf(vnfsList)); + final String vnfId = vnfsList.get(0).getVnfId(); + vnfTopology.setOnapModelInformation(vnfsList.get(0).getVnfData().getVnfInformation().getOnapModelInformation()); + vnfTopology.setAicClli(String.valueOf(vnfsList.get(0).getVnfData().getVnfRequestInput().getAicClli())); + vnfTopology.setAicCloudRegion(String.valueOf(vnfsList.get(0).getVnfData().getVnfRequestInput().getAicCloudRegion())); + vnfTopology.setCloudOwner(String.valueOf(vnfsList.get(0).getVnfData().getVnfRequestInput().getCloudOwner())); + vnfTopology.setTenant(String.valueOf(vnfsList.get(0).getVnfData().getVnfRequestInput().getTenant())); + vnfTopology.setVnfResourceAssignments(vnfsList.get(0).getVnfData().getVnfTopology().getVnfResourceAssignments()); + vnfTopology.setVnfTopologyIdentifierStructure(vnfsList.get(0).getVnfData().getVnfTopology().getVnfTopologyIdentifierStructure()); + vnfTopology.setVnfParametersData(vnfsList.get(0).getVnfData().getVnfTopology().getVnfParametersData()); + vnfTopology.setSdncGeneratedCloudResources(vnfsList.get(0).getVnfData().getVnfTopology().getSdncGeneratedCloudResources()); + + final GenericResourceApiVnfTopology genericResourceApiVnfTopology = new GenericResourceApiVnfTopology(); + genericResourceApiVnfTopology.setVnfTopology(vnfTopology); + + final Cache cache = getCache(Constants.SERVICE_TOPOLOGY_OPERATION_CACHE); + cache.put(vnfId, genericResourceApiVnfTopology); + } + + @Override + public Optional getGenericResourceApiVnfTopology(final String vnfId) { + LOGGER.info("getting GenericResourceApiVnfTopology from cache using key: {}", vnfId); + final Cache cache = getCache(Constants.SERVICE_TOPOLOGY_OPERATION_CACHE); + final GenericResourceApiVnfTopology value = + cache.get(vnfId, GenericResourceApiVnfTopology.class); + if (value != null) { + return Optional.of(value); + } + LOGGER.error("Unable to find GenericResourceApiVnfTopology ..."); + return Optional.empty(); + } } diff --git a/plans/so/macroflow/config/distribution-test-zip/macro_zipped_sdc_csar.tar.gz b/plans/so/macroflow/config/distribution-test-zip/macro_zipped_sdc_csar.tar.gz new file mode 100755 index 00000000..f826c2eb Binary files /dev/null and b/plans/so/macroflow/config/distribution-test-zip/macro_zipped_sdc_csar.tar.gz differ diff --git a/plans/so/macroflow/config/env b/plans/so/macroflow/config/env index f0ed0d09..47798ead 100644 --- a/plans/so/macroflow/config/env +++ b/plans/so/macroflow/config/env @@ -1,2 +1,7 @@ +NEXUS_DOCKER_REPO_MSO=nexus3.onap.org:10001 +DOCKER_ENVIRONMENT=remote +TAG=1.7.11 +TIME_OUT_DEFAULT_VALUE_SEC=1200 PROJECT_NAME=macroflowintegrationtesting DEFAULT_NETWORK_NAME=macroflowintegrationtesting_default +MARIADB_VERSION=10.1.11 diff --git a/plans/so/macroflow/config/override-files/api-handler-infra/onapheat/override.yaml b/plans/so/macroflow/config/override-files/api-handler-infra/onapheat/override.yaml new file mode 100644 index 00000000..bdf5c4de --- /dev/null +++ b/plans/so/macroflow/config/override-files/api-handler-infra/onapheat/override.yaml @@ -0,0 +1,133 @@ +server: + port: 8080 + tomcat: + max-threads: 50 +ssl-enable: false + +mso: + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + logPath: logs + site-name: onapheat + adapters: + requestDb: + endpoint: http://request-db-adapter:8083 + auth: Basic YnBlbDpwYXNzd29yZDEk + catalog: + db: + spring: + endpoint: http://catalog-db-adapter:8082 + db: + auth: Basic YnBlbDpwYXNzd29yZDEk + config: + path: /src/main/resources/ + infra: + default: + alacarte: + orchestrationUri: /mso/async/services/ALaCarteOrchestrator + recipeTimeout: 180 + testApi: VNF_API + service: + macro: + default: + testApi: GR_API + camundaURL: http://bpmn-infra:8081 + camundaAuth: AE2E9BE6EF9249085AF98689C4EE087736A5500629A72F35068FFB88813A023581DD6E765071F1C04075B36EA4213A + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + sdc: + client: + auth: F3473596C526938329DF877495B494DC374D1C4198ED3AD305EA3ADCBBDA1862 + activate: + instanceid: test + userid: cs0008 + endpoint: http://c1.vm1.mso.simpledemo.onap.org:28090 + tenant: + isolation: + retry: + count: 3 + aai: + endpoint: https://aai-simulator:9993 + auth: 221187EFA3AD4E33600DE0488F287099934CE65C3D0697BCECC00BB58E784E07CD74A24581DC31DBC086FF63DF116378776E9BE3D1325885 + extApi: + endpoint: http://nbi.onap:8080/nbi/api/v3 + so: + operational-environment: + dmaap: + username: testuser + password: VjR5NDcxSzA= + host: http://c1.vm1.mso.simpledemo.onap.org:28090 + auth: 51EA5414022D7BE536E7516C4D1A6361416921849B72C0D6FC1C7F262FD9F2BBC2AD124190A332D9845A188AD80955567A4F975C84C221EEA8243BFD92FFE6896CDD1EA16ADD34E1E3D47D4A + publisher: + topic: com.att.ecomp.mso.operationalEnvironmentEvent + health: + auth: Basic bXNvX2FkbWlufHBhc3N3b3JkMSQ= + endpoints: + - subsystem: apih + uri: http://bpmn-infra:8081 + - subsystem: catalogdb + uri: http://catalog-db-adapter:8082 + +spring: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/catalogdb + username: cataloguser + password: catalog123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: catdb-pool + registerMbeans: true + jpa: + show-sql: true + hibernate: + dialect: org.hibernate.dialect.MySQL5Dialect + ddl-auto: validate + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + jersey: + type: filter + + security: + usercredentials: + - + username: sitecontrol + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: SiteControl-Client + - + username: gui + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: GUI-Client + - + username: infraportal + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: InfraPortal-Client + - + username: InfraPortalClient + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: InfraPortal-Client + - + username: bpel + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + - + username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR + +request: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/requestdb + username: requestuser + password: request123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: reqdb-pool + registerMbeans: true +org: + onap: + so: + cloud-owner: CloudOwner + adapters: + network: + encryptionKey: 07a7159d3bf51a0e53be7a8f89699be7 diff --git a/plans/so/macroflow/config/override-files/bpmn-infra/onapheat/override.yaml b/plans/so/macroflow/config/override-files/bpmn-infra/onapheat/override.yaml new file mode 100644 index 00000000..3ca554df --- /dev/null +++ b/plans/so/macroflow/config/override-files/bpmn-infra/onapheat/override.yaml @@ -0,0 +1,366 @@ +aai: + auth: 221187EFA3AD4E33600DE0488F287099934CE65C3D0697BCECC00BB58E784E07CD74A24581DC31DBC086FF63DF116378776E9BE3D1325885 + dme2: + timeout: '30000' + endpoint: https://aai-simulator:9993 + workflowAaiDistributionDelay: PT30S + pnfEntryNotificationTimeout: P14D +cds: + endpoint: blueprints-processor + port: 9111 + auth: Basic Y2NzZGthcHBzOmNjc2RrYXBwcw== + timeout: 60 +camunda: + bpm: + admin-user: + id: admin + password: so_Admin123 + history-level: full + job-execution: + max-pool-size: 30 + core-pool-size: 3 +entitymanager: + packagesToScan: com +pnf: + dmaap: + host: message-router + port: 3904 + protocol: http + uriPathPrefix: events + topicName: unauthenticated.PNF_READY + consumerGroup: consumerGroup + consumerId: consumerId + topicListenerDelayInSeconds: 5 +bpelURL: http://bpmn-infra:8081 +msb-ip: msb-iag +msb-port: 80 +mso: + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + config: + path: /var/csar/ + correlation: + timeout: 60 + logPath: logs + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + aai: + endpoint: https://aai-simulator:9993 + adapters: + completemsoprocess: + endpoint: http://bpmn-infra:8081/CompleteMsoProcess + requestDb: + endpoint: http://request-db-adapter:8083 + auth: Basic YnBlbDpwYXNzd29yZDEk + db: + auth: 33293332AEC4930F655D8E2E8BB08937 + password: wLg4sjrAFUS8rfVfdvTXeQ== + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8083/services/RequestsDbAdapter + spring: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8083 + network: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/NetworkAdapter + rest: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/rest/v1/networks + openecomp: + db: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8083/services/RequestsDbAdapter + po: + auth: 33293332AEC4930F655D8E2E8BB08937 + password: B8EBDE0311F0AF355CF3F2FD505A8CAD + sdnc: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8086/adapters/SDNCAdapter + rest: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8086/adapters/rest/v1/sdnc + timeout: PT60M + tenant: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/TenantAdapter + vnf: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/VnfAdapter + rest: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/rest/v1/vnfs + volume-groups: + rest: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/rest/v1/volume-groups + vnf-async: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8087/services/VnfAdapterAsync + vfc: + rest: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8084/services/v1/vfcadapter + workflow: + message: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8081/mso/WorkflowMessage + bpmn: + process: + historyTimeToLive: '30' + callbackRetryAttempts: '5' + catalog: + db: + endpoint: http://catalog-db-adapter:8082/ecomp/mso/catalog + spring: + endpoint: http://catalog-db-adapter:8082 + db: + auth: Basic YnBlbDpwYXNzd29yZDEk + default: + adapter: + namespace: http://org.onap.mso + healthcheck: + log: + debug: 'false' + infra: + customer: + id: testCustIdInfra + po: + timeout: PT60M + request: + db: + endpoint: http://c1.vm1.mso.simpledemo.onap.org:8083/ + rollback: 'true' + sdnc: + password: 3141634BF7E070AA289CF2892C986C0B + service: + agnostic: + sniro: + endpoint: /sniro/api/v2/placement + host: http://c1.vm1.mso.simpledemo.onap.org:30253 + site-name: CamundaEngine + sniro: + auth: test:testpwd + callback: http://c1.vm1.mso.simpledemo.onap.org:8086/adapters/rest/SDNCNotify + endpoint: http://replaceme:28090/optimizationInstance/V1/create + timeout: PT30M + oof: + auth: test:testpwd + callbackEndpoint: http://bpmn-infra:8081/mso/WorkflowMessage + endpoint: http://oof.api.simpledemo.openecomp.org:8698/api/oof/v1/placement + timeout: PT30M + workflow: + CreateGenericVNFV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + default: + aai: + version: '14' + cloud-region: + version: '14' + generic-vnf: + version: '14' + v14: + customer: + uri: /aai/v14/business/customers/customer + generic-query: + uri: /aai/v14/search/generic-query + generic-vnf: + uri: /aai/v14/network/generic-vnfs/generic-vnf + l3-network: + uri: /aai/v14/network/l3-networks/l3-network + network-policy: + uri: /aai/v14/network/network-policies/network-policy + nodes-query: + uri: /aai/v14/search/nodes-query + route-table-reference: + uri: /aai/v14/network/route-table-references/route-table-reference + tenant: + uri: /aai/v14/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant + vce: + uri: /aai/v14/network/vces/vce + vpn-binding: + uri: /aai/v14/network/vpn-bindings/vpn-binding + sp-partner: + uri: /aai/v14/business/sp-partners/sp-partner + device: + uri: /aai/v14/network/devices/device + v11: + customer: + uri: /aai/v11/business/customers/customer + generic-query: + uri: /aai/v11/search/generic-query + generic-vnf: + uri: /aai/v11/network/generic-vnfs/generic-vnf + l3-network: + uri: /aai/v11/network/l3-networks/l3-network + network-policy: + uri: /aai/v11/network/network-policies/network-policy + nodes-query: + uri: /aai/v11/search/nodes-query + route-table-reference: + uri: /aai/v11/network/route-table-references/route-table-reference + tenant: + uri: /aai/v11/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant + vce: + uri: /aai/v11/network/vces/vce + vpn-binding: + uri: /aai/v11/network/vpn-bindings/vpn-binding + v8: + configuration: + uri: /aai/v11/network/configurations/configuration + customer: + uri: /aai/v8/business/customers/customer + generic-query: + uri: /aai/v8/search/generic-query + l3-network: + uri: /aai/v8/network/l3-networks/l3-network + network-policy: + uri: /aai/v8/network/network-policies/network-policy + nodes-query: + uri: /aai/v8/search/nodes-query + route-table-reference: + uri: /aai/v8/network/route-table-references/route-table-reference + tenant: + uri: /aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RegionOne/tenants/tenant + vce: + uri: /aai/v8/network/vces/vce + vpn-binding: + uri: /aai/v8/network/vpn-bindings/vpn-binding + v9: + cloud-region: + uri: /aai/v9/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner + generic-vnf: + uri: /aai/v9/network/generic-vnfs/generic-vnf + retry: + attempts: '1' + deleteCinderVolumeV1: + aai: + volume-group: + uri: /aai/v6/cloud-infrastructure/volume-groups/volume-group + global: + default: + aai: + namespace: http://org.onap.aai.inventory/ + version: 14 + message: + endpoint: http://bpmn-infra:8081/mso/WorkflowMessage + notification: + name: GenericNotificationServiceATT + sdnc: + replication: + delay: PT60S + sdncadapter: + callback: http://bpmn-infra:8081/mso/SDNCAdapterCallbackService + vnfadapter: + create: + callback: http://c1.vm1.mso.simpledemo.onap.org:8087/mso/vnfAdapterNotify + delete: + callback: http://c1.vm1.mso.simpledemo.onap.org:8087/mso/vnfAdapterNotify + query: + callback: http://c1.vm1.mso.simpledemo.onap.org:8087/mso/vnfAdapterNotify + rollback: + callback: http://c1.vm1.mso.simpledemo.onap.org:8087/mso/vnfAdapterNotify + use: + qualified: + host: false + global: + dmaap: + username: testuser + password: alRyMzJ3NUNeakxl + host: http://10.42.111.36:904 + publisher: + topic: replaceme + naming: + endpoint: http://naming.demo.onap.com:8081/web/service/v1/genNetworkElementName + auth: Basic bTA0NzY4QG5vbi1wcm9kLm1zby5lY29tcC5hdHQuY29tOkF0dG0wNDc2OExpZmUhQA== +policy: + auth: Basic dGVzdHBkcDphbHBoYTEyMw== + default: + disposition: Skip + client: + auth: Basic bTAzNzQzOnBvbGljeVIwY2sk + endpoint: https://localhost:8081/pdp/api/ + environment: TEST +sdnc: + auth: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ== + host: http://sdnc-simulator:9994 + path: /restconf/operations/GENERIC-RESOURCE-API + si: + svc: + types: PORT-MIRROR,PPROBE + dmaap: + host: ueb1.simpledemo.onap.org:3904 + timeout: 30000 + lcm: + path: '/restconf/operations/LCM:' + actionTimeout: 300000 + dmapp: + readTopic: SDNC-LCM-WRITE + writeTopic: SDNC-LCM-READ +appc: + client: + topic: + read: + name: APPC-LCM-WRITE + timeout: 360000 + write: APPC-LCM-READ + sdnc: + read: SDNC-LCM-WRITE + write: SDNC-LCM-READ + response: + timeout: 360000 + key: VIlbtVl6YLhNUrtU + secret: 64AG2hF4pYeG2pq7CT6XwUOT + service: ueb + poolMembers: ueb1.simpledemo.onap.org:3904,ueb2.simpledemo.onap.org:3904 +sniro: + conductor: + enabled: true + host: http://sniro-emulator:80 + uri: /v1/release-orders + headers.auth: Basic dGVzdDp0ZXN0cHdk + manager: + timeout: PT30M + host: http://sniro-emulator:80 + uri.v1: /sniro/api/v2/placement + uri.v2: /sniro/api/placement/v2 + headers.auth: Basic dGVzdDp0ZXN0cHdk + headers.patchVersion: 1 + headers.minorVersion: 1 + headers.latestVersion: 2 +server: + port: 8081 + tomcat: + max-threads: 50 +spring: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/camundabpmn + username: camundauser + password: camunda123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: bpmn-pool + registerMbeans: true + security: + usercredentials: + - + username: apihBpmn + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPMN-Client + - + username: sdncaBpmn + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPMN-Client + - + username: poBpmn + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPMN-Client + - + username: wmaBpmn + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPMN-Client + - + username: sniro + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: SNIRO-Client + - + username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR +so: + vnfm: + adapter: + url: http://so-vnfm-adapter:9092/so/vnfm-adapter/v1/ + auth: Basic dm5mbTpwYXNzd29yZDEk +org: + onap: + so: + cloud-owner: CloudOwner diff --git a/plans/so/macroflow/config/override-files/catalog-db-adapter/onapheat/override.yaml b/plans/so/macroflow/config/override-files/catalog-db-adapter/onapheat/override.yaml new file mode 100644 index 00000000..934e8fbd --- /dev/null +++ b/plans/so/macroflow/config/override-files/catalog-db-adapter/onapheat/override.yaml @@ -0,0 +1,103 @@ +server: + port: 8082 + tomcat: + max-threads: 50 +ssl-enable: false +mso: + logPath: logs + site-name: onapheat + catalog: + db: + spring: + endpoint: http://catalog-db-adapter:8082 + db: + auth: Basic YnBlbDpwYXNzd29yZDEk +spring: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/catalogdb + username: cataloguser + password: catalog123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: catdb-pool + registerMbeans: true + flyway: + baseline-on-migrate: false + url: jdbc:mariadb://mariadb:3306/catalogdb + user: cataloguser + password: catalog123 + outOfOrder: true + validateOnMigrate: false + jpa: + generate-ddl: false + show-sql: false + hibernate: + ddl-auto: validate + naming-strategy: org.hibernate.cfg.ImprovedNamingStrategy + enable-lazy-load-no-trans: true + database-platform: org.hibernate.dialect.MySQL5InnoDBDialect + security: + usercredentials: + - + username: bpel + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + - + username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR +#Actuator +management: + context-path: /manage +cloud_config: + identity_services: + RAX_KEYSTONE: + identity_url: "https://identity.api.rackspacecloud.com/v2.0" + mso_id: "RACKSPACE_ACCOUNT_ID" + mso_pass: "RACKSPACE_ACCOUNT_APIKEY" + admin_tenant: "dummy" + member_role: "admin" + tenant_metadata: true + identity_server_type: "KEYSTONE" + identity_authentication_type: "RACKSPACE_APIKEY" + project_domain_name: "PROJECT_DOMAIN_NAME" + user_domain_name: "USER_DOMAIN_NAME" + DEFAULT_KEYSTONE: + identity_url: "dummy" + mso_id: "dummy" + mso_pass: "dummy" + admin_tenant: "dummy" + member_role: "admin" + tenant_metadata: true + identity_server_type: "KEYSTONE" + identity_authentication_type: "USERNAME_PASSWORD" + project_domain_name: "dummy" + user_domain_name: "dummy" + cloud_sites: + Dallas: + region_id: "DFW" + clli: "DFW" + aic_version: "2.5" + identity_service_id: "RAX_KEYSTONE" + Northern Virginia: + region_id: "IAD" + clli: "IAD" + aic_version: "2.5" + identity_service_id: "RAX_KEYSTONE" + Chicago: + region_id: "ORD" + clli: "ORD" + aic_version: "2.5" + identity_service_id: "RAX_KEYSTONE" + RegionOne: + region_id: "RegionOne" + clli: "RegionOne" + aic_version: "2.5" + identity_service_id: "DEFAULT_KEYSTONE" + DEFAULT: + region_id: "dummyRegionId" + clli: "dummyClli" + aic_version: "2.5" + identity_service_id: "DEFAULT_KEYSTONE" + + diff --git a/plans/so/macroflow/config/override-files/openstack-adapter/onapheat/override.yaml b/plans/so/macroflow/config/override-files/openstack-adapter/onapheat/override.yaml new file mode 100644 index 00000000..7e2afa85 --- /dev/null +++ b/plans/so/macroflow/config/override-files/openstack-adapter/onapheat/override.yaml @@ -0,0 +1,147 @@ +server: + port: 8087 + +spring: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/catalogdb + username: cataloguser + password: catalog123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: catdb-pool + registerMbeans: false + + security: + usercredentials: + - + username: sdnc + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: SDNC-Client + - + username: sitecontrol + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: SiteControl-Client + - + username: bpel + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + - + username: sniro + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: SNIRO-Client + - + username: apih + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: MSO-Client + - + username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR + + +org: + onap: + so: + adapters: + default_keystone_url_version: /v2.0 + default_keystone_reg_ex: "/[vV][0-9]" + vnf: + bpelauth: D1A67FA93B6A6419132D0F83CC771AF774FD3C60853C50C22C8C6FC5088CC79E9E81EDE9EA39F22B2F66A0068E + checkRequiredParameters: true + addGetFilesOnVolumeReq: false + sockettimeout: 30 + connecttimeout: 30 + retrycount: 5 + retryinterval: -15 + retrylist: 408,429,500,502,503,504,900 + valet_enabled: false + fail_requests_on_valet_failure: false + network: + bpelauth: D1A67FA93B6A6419132D0F83CC771AF774FD3C60853C50C22C8C6FC5088CC79E9E81EDE9EA39F22B2F66A0068E + sockettimeout: 5 + connecttimeout: 5 + retrycount: 5 + retryinterval: -15 + retrylist: 408,429,500,502,503,504,900 + encryptionKey: 07a7159d3bf51a0e53be7a8f89699be7 + tenant: + default_keystone_url_version: /v2.0 + default_keystone_reg_ex: "/[vV][0-9]" + default_tenant_description: Tenant + default_region_type: single + default_user_role: admin + default_success_status_string: Success + default_no_regions_status_string: no regions + default_quota_value: 10 + set_default_quota: false + +ecomp: + mso: + adapters: + po: + retryCodes: 504 + retryDelay: 5 + retryCount: 3 + pollTimeout: 7500 + pollInterval: 15 + +mso: + adapters: + requestDb: + endpoint: http://so-request-db-adapter.onap:8083 + auth: Basic YnBlbDpwYXNzd29yZDEk + auth: BEA8637716A7EB617DF472BA6552D22F68C1CB17B0D094D77DDA562F4ADAAC4457CAB848E1A4 + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + logPath: ./logs/openstack + msb-ip: multicloud-simulator + msb-port: 9996 + msb-scheme: http + workflow: + endpoint: http://bpmn-infra:8081/sobpmnengine + config: + cadi: + aafId: poBpmn + catalog: + db: + spring: + endpoint: http://catalog-db-adapter:8082 + db: + auth: Basic YnBlbDpwYXNzd29yZDEk + site-name: localDevEnv + async: + core-pool-size: 50 + max-pool-size: 50 + queue-capacity: 500 + +cloud_config: + identity_services: + RAX_KEYSTONE: + identity_url: "https://identity.api.rackspacecloud.com/v2.0" + mso_id: "RACKSPACE_ACCOUNT_ID" + mso_pass: "RACKSPACE_ACCOUNT_APIKEY" + admin_tenant: "service" + member_role: "admin" + tenant_metadata: true + identity_server_type: "KEYSTONE" + identity_authentication_type: "RACKSPACE_APIKEY" + cloud_sites: + Dallas: + region_id: "DFW" + clli: "DFW" + aic_version: "2.5" + identity_service_id: "RAX_KEYSTONE" + Northern Virginia: + region_id: "IAD" + clli: "IAD" + aic_version: "2.5" + identity_service_id: "RAX_KEYSTONE" + Chicago: + region_id: "ORD" + clli: "ORD" + aic_version: "2.5" + identity_service_id: "RAX_KEYSTONE" + DEFAULT: + region_id: "DFW" + clli: "DFW" + aic_version: "2.5" + identity_service_id: "RAX_KEYSTONE" diff --git a/plans/so/macroflow/config/override-files/sdc-controller/onapheat/override.yaml b/plans/so/macroflow/config/override-files/sdc-controller/onapheat/override.yaml new file mode 100644 index 00000000..ed8bd43f --- /dev/null +++ b/plans/so/macroflow/config/override-files/sdc-controller/onapheat/override.yaml @@ -0,0 +1,81 @@ +aai: + auth: 2A11B07DB6214A839394AA1EC5844695F5114FC407FF5422625FB00175A3DCB8A1FF745F22867EFA72D5369D599BBD88DA8BED4233CF5586 +server: + port: 8085 + +spring: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/catalogdb + username: cataloguser + password: catalog123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: catdb-pool + registerMbeans: false + + security: + usercredentials: + - + username: asdc + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: Asdc-Client + - + username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR + +request: + datasource: + hikari: + jdbcUrl: jdbc:mariadb://mariadb:3306/requestdb + username: requestuser + password: request123 + driver-class-name: org.mariadb.jdbc.Driver + pool-name: reqdb-pool + registerMbeans: false + +mso: + msoKey: 07a7159d3bf51a0e53be7a8f89699be7 + logPath: ./logs/asdc + catalog: + db: + spring: + endpoint: http://catalog-db-adapter:8082 + db: + auth: Basic YnBlbDpwYXNzd29yZDEk + site-name: onapheat + camundaURL: http://bpmn-infra:8081/ + adapters: + requestDb: + endpoint: http://request-db-adapter:8083 + auth: Basic YnBlbDpwYXNzd29yZDEk + aai: + endpoint: https://aai.api.simpledemo.onap.org:8443 + asdc-connections: + asdc-controller1: + user: mso + consumerGroup: SO-OpenSource-Env11 + consumerId: SO-COpenSource-Env11 + environmentName: AUTO + asdcAddress: c2.vm1.sdc.simpledemo.onap.org:8443 + password: 76966BDD3C7414A03F7037264FF2E6C8EEC6C28F2B67F2840A1ED857C0260FEE731D73F47F828E5527125D29FD25D3E0DE39EE44C058906BF1657DE77BF897EECA93BDC07FA64F + pollingInterval: 60 + pollingTimeout: 60 + relevantArtifactTypes: HEAT,HEAT_ENV,HEAT_VOL + useHttpsWithDmaap: false + activateServerTLSAuth: false + keyStorePassword: + keyStorePath: + watchDogTimeout: 100 + isFitlerInEmptyResources: true + messageBusAddress: vm1.mr.simpledemo.onap.org,vm1.mr.simpledemo.onap.org + asdc: + config: + activity: + endpoint: http://sdc-wfd-be:8080 + key: 566B754875657232314F5548556D3665 + components: + count: 0, + componentNames: + scheduling: + enabled: false diff --git a/plans/so/macroflow/config/override-files/so-monitoring/onapheat/override.yaml b/plans/so/macroflow/config/override-files/so-monitoring/onapheat/override.yaml new file mode 100644 index 00000000..7e61c7d0 --- /dev/null +++ b/plans/so/macroflow/config/override-files/so-monitoring/onapheat/override.yaml @@ -0,0 +1,24 @@ +server: + port: 30224 + tomcat: + max-threads: 4 +ssl-enable: false +camunda: + rest: + api: + url: http://bpmn-infra:8081/sobpmnengine/engine/ + engine: default + auth: Basic YXBpaEJwbW46cGFzc3dvcmQxJA== +mso: + database: + rest: + api: + url: http://request-db-adapter:8083/infraActiveRequests/ + auth: Basic YnBlbDpwYXNzd29yZDEk +spring: + security: + usercredentials: + - + username: gui + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: GUI-Client diff --git a/plans/so/macroflow/config/override-files/so-vnfm-adapter/onapheat/override.yaml b/plans/so/macroflow/config/override-files/so-vnfm-adapter/onapheat/override.yaml new file mode 100644 index 00000000..b029bd7e --- /dev/null +++ b/plans/so/macroflow/config/override-files/so-vnfm-adapter/onapheat/override.yaml @@ -0,0 +1,33 @@ +server: + port: 9092 + tomcat: + max-threads: 4 +aai: + auth: 221187EFA3AD4E33600DE0488F287099934CE65C3D0697BCECC00BB58E784E07CD74A24581DC31DBC086FF63DF116378776E9BE3D1325885 + version: v15 + endpoint: https://aai-simulator:9993 +spring: + security: + usercredentials: + - username: vnfm + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + - username: mso_admin + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: ACTUATOR +mso: + key: 07a7159d3bf51a0e53be7a8f89699be7 + site-name: localSite + logPath: ./logs/vnfm-adapter +sdc: + username: mso + password: 76966BDD3C7414A03F7037264FF2E6C8EEC6C28F2B67F2840A1ED857C0260FEE731D73F47F828E5527125D29FD25D3E0DE39EE44C058906BF1657DE77BF897EECA93BDC07FA64F + key: 566B754875657232314F5548556D3665 + endpoint: http://sdc-simulator:9991/ + toscametapath: Artifacts/Deployment/OTHER/TOSCA.meta +vnfmadapter: + endpoint: http://so-vnfm-adapter:9092 +etsi-catalog-manager: + vnfpkgm: + endpoint: http://modeling-etsicatalog:8806/api/vnfpkgm/v1 + diff --git a/plans/so/macroflow/config/override-files/vnfm-simulator/onapheat/override.yaml b/plans/so/macroflow/config/override-files/vnfm-simulator/onapheat/override.yaml new file mode 100644 index 00000000..05cb1e56 --- /dev/null +++ b/plans/so/macroflow/config/override-files/vnfm-simulator/onapheat/override.yaml @@ -0,0 +1,56 @@ +spring: + h2: + console: + enabled: true + path: console + datasource: + url: jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE + username: admin + password: admin + http: + converters: + preferred-json-mapper: gson + security: + usercredentials: + - username: vnfm + password: '$2a$10$Fh9ffgPw2vnmsghsRD3ZauBL1aKXebigbq3BB1RPWtE62UDILsjke' + role: BPEL-Client + +server: + port: 9093 + tomcat: + max-threads: 50 + ssl: + client-auth: need + key-alias: so@so.onap.org + key--store-password: '7Em3&j4.19xYiMelhD5?xbQ.' + key-store: classpath:so-vnfm-simulator.p12 + key-store-type: PKCS12 + request: + grant: + auth: twowaytls + dns: + name: so-vnfm-simulator + +vnfds: + vnfdlist: + - vnfdid: sgsn-mme_12df452s04131 + vnfclist: + - vnfcid: VNFC1 + resourceTemplateId: vnfd1_vnfc1 + vduId: vnfd1_vduForVnfc1 + type: COMPUTE + - vnfcid: VNFC2 + resourceTemplateId: vnfd1_vnfc2 + vduId: vnfd1_vduForVnfc2 + type: COMPUTE + - vnfdid: 2 + vnfclist: + - vnfcid: VNFC3 + resourceTemplateId: vnfd2_vnfc3 + vduId: vnfd2_vduForVnfc3 + type: COMPUTE + - vnfcid: VNFC4 + resourceTemplateId: vnfd2_vnfc4 + vduId: vnfd2_vduForVnfc4 + type: COMPUTE diff --git a/plans/so/macroflow/docker-compose.local.yml b/plans/so/macroflow/docker-compose.local.yml new file mode 100644 index 00000000..281a5162 --- /dev/null +++ b/plans/so/macroflow/docker-compose.local.yml @@ -0,0 +1,30 @@ +version: '3' +services: +################################################################################ + mariadb: + image: mariadb:${MARIADB_VERSION} +################################################################################ + catalog-db-adapter: + image: onap/so/catalog-db-adapter:${TAG} +################################################################################ + request-db-adapter: + image: onap/so/request-db-adapter:${TAG} +################################################################################ + sdnc-adapter: + image: onap/so/sdnc-adapter:${TAG} +################################################################################ + openstack-adapter: + image: onap/so/openstack-adapter:${TAG} +################################################################################ + sdc-controller: + image: onap/so/sdc-controller:${TAG} +################################################################################ + bpmn-infra: + image: onap/so/bpmn-infra:${TAG} +################################################################################ + api-handler-infra: + image: onap/so/api-handler-infra:${TAG} +############################################################################# + so-monitoring: + image: onap/so/so-monitoring:${TAG} +################################################################################ diff --git a/plans/so/macroflow/docker-compose.yml b/plans/so/macroflow/docker-compose.yml index 9df89d03..8cc1c7b6 100644 --- a/plans/so/macroflow/docker-compose.yml +++ b/plans/so/macroflow/docker-compose.yml @@ -1,5 +1,264 @@ version: '3' services: +################################################################################ + mariadb: + image: ${NEXUS_DOCKER_REPO_MSO}/mariadb:${MARIADB_VERSION} + ports: + - "3306:3306" + volumes: + - ${TEST_LAB_DIR}/volumes/mariadb/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d + - ${TEST_LAB_DIR}/volumes/mariadb/conf.d:/etc/mysql/conf.d + environment: + - MYSQL_ROOT_PASSWORD=password + hostname: + mariadb.so.testlab.onap.org + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" +################################################################################ + catalog-db-adapter: + image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/catalog-db-adapter:${TAG} + ports: + - "8082:8082" + volumes: + - ${TEST_LAB_DIR}/volumes/so/ca-certificates/onapheat:/app/ca-certificates + - ${CONFIG_DIR_PATH_MACRO}/override-files/catalog-db-adapter/onapheat:/app/config + environment: + - APP=catalog-db-adapter + - JVM_ARGS=-Xms64m -Xmx512m + - DB_HOST=mariadb + - DB_PORT=3306 + - DB_USERNAME=so_user + - DB_PASSWORD=so_User123 + - DB_ADMIN_USERNAME=so_admin + - DB_ADMIN_PASSWORD=so_Admin123 + hostname: + catalog-db-adapter.so.testlab.onap.org + depends_on: + - mariadb + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + user: root + entrypoint: /bin/sh -c '/app/wait-for.sh -q -t "300" mariadb:3306 -- "/app/start-app.sh"' +################################################################################ + request-db-adapter: + image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/request-db-adapter:${TAG} + ports: + - "8083:8083" + volumes: + - ${TEST_LAB_DIR}/volumes/so/ca-certificates/onapheat:/app/ca-certificates + - ${TEST_LAB_DIR}/volumes/so/config/request-db-adapter/onapheat:/app/config + environment: + - APP=request-db-adapter + - JVM_ARGS=-Xms64m -Xmx512m + - DB_HOST=mariadb + - DB_PORT=3306 + - DB_USERNAME=so_user + - DB_PASSWORD=so_User123 + - DB_ADMIN_USERNAME=so_admin + - DB_ADMIN_PASSWORD=so_Admin123 + hostname: + request-db-adapter.so.testlab.onap.org + depends_on: + - mariadb + - catalog-db-adapter + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + user: root + entrypoint: /bin/sh -c '/app/wait-for.sh -q -t "300" catalog-db-adapter:8082 -- "/app/start-app.sh"' +################################################################################ + sdnc-adapter: + image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/sdnc-adapter:${TAG} + ports: + - "8086:8086" + volumes: + - ${TEST_LAB_DIR}/volumes/so/ca-certificates/onapheat:/app/ca-certificates + - ${TEST_LAB_DIR}/volumes/so/config/sdnc-adapter/onapheat:/app/config + environment: + - APP=sdnc-adapter + - JVM_ARGS=-Xms64m -Xmx512m + - DB_HOST=mariadb + - DB_PORT=3306 + - DB_USERNAME=so_user + - DB_PASSWORD=so_User123 + - DB_ADMIN_USERNAME=so_admin + - DB_ADMIN_PASSWORD=so_Admin123 + hostname: + sdnc-adapter.so.testlab.onap.org + depends_on: + - mariadb + - catalog-db-adapter + - request-db-adapter + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + user: root + entrypoint: /bin/sh -c '/app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' +################################################################################ + openstack-adapter: + image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/openstack-adapter:${TAG} + ports: + - "8087:8087" + volumes: + - ${TEST_LAB_DIR}/volumes/so/ca-certificates/onapheat:/app/ca-certificates + - ${CONFIG_DIR_PATH_MACRO}/override-files/openstack-adapter/onapheat:/app/config + environment: + - APP=openstack-adapter + - JVM_ARGS=-Xms64m -Xmx512m + - DB_HOST=mariadb + - DB_PORT=3306 + - DB_USERNAME=so_user + - DB_PASSWORD=so_User123 + - DB_ADMIN_USERNAME=so_admin + - DB_ADMIN_PASSWORD=so_Admin123 + hostname: + openstack-adapter.so.testlab.onap.org + depends_on: + - mariadb + - catalog-db-adapter + - request-db-adapter + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + user: root + entrypoint: /bin/sh -c '/app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' +################################################################################ + sdc-controller: + image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/sdc-controller:${TAG} + ports: + - "8085:8085" + volumes: + - ${TEST_LAB_DIR}/volumes/so/ca-certificates/onapheat:/app/ca-certificates + - ${CONFIG_DIR_PATH_MACRO}/distribution-test-zip:/distribution-test-zip + - ${CONFIG_DIR_PATH_MACRO}/override-files/sdc-controller/onapheat:/app/config + environment: + - APP=sdc-controller + - JVM_ARGS=-Xms64m -Xmx512m + - DB_HOST=mariadb + - DB_PORT=3306 + - DB_USERNAME=so_user + - DB_PASSWORD=so_User123 + - DB_ADMIN_USERNAME=so_admin + - DB_ADMIN_PASSWORD=so_Admin123 + hostname: + sdc-controller.so.testlab.onap.org + depends_on: + - mariadb + - catalog-db-adapter + - request-db-adapter + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + user: root + entrypoint: /bin/sh -c 'mkdir -p /distribution-test-zip/unzipped && tar -xvzf /distribution-test-zip/macro_zipped_sdc_csar.tar.gz -C /distribution-test-zip/unzipped && chmod 777 -R /distribution-test-zip/ && /app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' +################################################################################ + bpmn-infra: + image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/bpmn-infra:${TAG} + ports: + - "8081:8081" + volumes: + - ${CONFIG_DIR_PATH_MACRO}/override-files/bpmn-infra/onapheat:/app/config + - ${CONFIG_DIR_PATH}/certificates/bpmn-infra-certs:/app/bpmn-infra-certs + - ${CONFIG_DIR_PATH}/certificates/truststore/root-ca.crt:/app/ca-certificates/root-ca.crt + environment: + - APP=bpmn-infra + - JVM_ARGS=-Xms64m -Xmx512m + - DB_HOST=mariadb + - DB_PORT=3306 + - DB_USERNAME=so_user + - DB_PASSWORD=so_User123 + - DB_ADMIN_USERNAME=so_admin + - DB_ADMIN_PASSWORD=so_Admin123 + hostname: + bpmn-infra.so.testlab.onap.org + depends_on: + - mariadb + - catalog-db-adapter + - request-db-adapter + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + user: root + entrypoint: /bin/sh -c '/app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' +################################################################################ + api-handler-infra: + image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/api-handler-infra:${TAG} + ports: + - "8080:8080" + volumes: + - ${CONFIG_DIR_PATH_MACRO}/override-files/api-handler-infra/onapheat:/app/config + - ${CONFIG_DIR_PATH}/certificates/truststore/root-ca.crt:/app/ca-certificates/root-ca.crt + environment: + - APP=api-handler-infra + - JVM_ARGS=-Xms64m -Xmx512m + - DB_HOST=mariadb + - DB_PORT=3306 + - DB_USERNAME=so_user + - DB_PASSWORD=so_User123 + - DB_ADMIN_USERNAME=so_admin + - DB_ADMIN_PASSWORD=so_Admin123 + hostname: + api-handler-infra.so.testlab.onap.org + depends_on: + - mariadb + - catalog-db-adapter + - request-db-adapter + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" + user: root + entrypoint: /bin/sh -c '/app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' +############################################################################# + so-monitoring: + image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/so-monitoring:${TAG} + ports: + - "30224:30224" + volumes: + - ${CONFIG_DIR_PATH_MACRO}/override-files/so-monitoring/onapheat:/app/config + environment: + - APP=so-monitoring + - JVM_ARGS=-Xms64m -Xmx512m + hostname: + so-monitoring.so.testlab.onap.org + depends_on: + - mariadb + - catalog-db-adapter + - request-db-adapter +################################################################################ + sdc-simulator: + image: simulators/sdc-simulator:latest + ports: + - "9991:9991" + environment: + - APP=SDC-SIMULATOR + - JVM_ARGS=-Xms64m -Xmx512m + hostname: + sdc-simulator + depends_on: + - mariadb + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" ################################################################################ aai-simulator: image: simulators/aai-simulator:latest @@ -10,9 +269,78 @@ services: - JVM_ARGS=-Xms64m -Xmx512m hostname: aai-simulator + depends_on: + - mariadb logging: driver: "json-file" options: max-size: "30m" max-file: "5" +################################################################################ + workaround-config: + image: jobs/workaround-job-container:latest + ports: + - "9990:9990" + volumes: + - ${CONFIG_DIR_PATH}/apply-workarounds.sh:/config/apply-workarounds.sh + environment: + - MYSQL_ROOT_PASSWORD=password + - DB_HOST=mariadb + - DB_PORT=3306 + - CATALOG_DB=catalogdb + depends_on: + - mariadb + command: + - "/config/apply-workarounds.sh" +################################################################################# + sdnc-simulator: + image: simulators/sdnc-simulator:latest + ports: + - "9994:9994" + environment: + - APP=SDNC-SIMULATOR + - JVM_ARGS=-Xms64m -Xmx512m + hostname: + sdnc-simulator + depends_on: + - mariadb + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" +################################################################################# + multicloud-simulator: + image: simulators/multicloud-simulator:latest + ports: + - "9996:9996" + environment: + - APP=MULTICLOUD-SIMULATOR + - JVM_ARGS=-Xms64m -Xmx512m + hostname: + multicloud-simulator + depends_on: + - mariadb + logging: + driver: "json-file" + options: + max-size: "30m" + max-file: "5" +################################################################################ + populate-aai-config: + image: jobs/workaround-job-container:latest + ports: + - "9995:9995" + volumes: + - ${CONFIG_DIR_PATH}/populate-aai-simulator.sh:/config/populate-aai-simulator.sh + - ${CONFIG_DIR_PATH}/wait-for.sh:/config/wait-for.sh + - ${CONFIG_DIR_PATH}/aai-simulator-populate-data:/config/aai-simulator-populate-data/ + environment: + - AAI_SIMULATOR_HOST=aai-simulator + - AAI_SIMULATOR_PORT=9993 + - TIMEOUT_IN_SECONDS=300 #5 mins + depends_on: + - aai-simulator + command: + - "/config/populate-aai-simulator.sh" ################################################################################ diff --git a/plans/so/macroflow/setup.sh b/plans/so/macroflow/setup.sh index 1f8c8b86..5bb94f75 100644 --- a/plans/so/macroflow/setup.sh +++ b/plans/so/macroflow/setup.sh @@ -1,38 +1,41 @@ #!/bin/bash # # ============LICENSE_START======================================================= -# Copyright (C) 2021 Nordix Foundation. -# ================================================================================ -# 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 +# Copyright 2021 Huawei Technologies Co., Ltd. # -# http://www.apache.org/licenses/LICENSE-2.0 +# 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 # -# 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. +# 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. # # SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -# @author Waqas Ikram (waqas.ikram@est.tech) - MAVEN_VERSION_DIR="apache-maven-3.3.9" MAVEN_TAR_FILE="$MAVEN_VERSION_DIR-bin.tar.gz" MAVEN_TAR_LOCATION="https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/$MAVEN_TAR_FILE" +# Macroflow SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SCRIPT_NAME=$(basename $0) -CONFIG_DIR=$SCRIPT_HOME/config -ENV_FILE=$CONFIG_DIR/env -TEMP_DIR_PATH=$SCRIPT_HOME/temp - +CONFIG_DIR_MACRO=$SCRIPT_HOME/config +ENV_FILE=$CONFIG_DIR_MACRO/env +SQL_PATH=$SCRIPT_HOME/cloud_owner_sql DOCKER_COMPOSE_FILE_PATH=$SCRIPT_HOME/docker-compose.yml +DOCKER_COMPOSE_LOCAL_OVERRIDE_FILE=$SCRIPT_HOME/docker-compose.local.yml TEAR_DOWN_SCRIPT=$SCRIPT_HOME/teardown.sh +TEMP_DIR_PATH=$SCRIPT_HOME/temp +TEST_LAB_DIR_PATH=$TEMP_DIR_PATH/test_lab + +# INTEGRATION_ETSI INTEGRATION_ETSI_TESTING_DIR=$WORKSPACE/plans/so/integration-etsi-testing INTEGRATION_ETSI_TESTING_CONFIG_DIR=$INTEGRATION_ETSI_TESTING_DIR/config @@ -43,13 +46,15 @@ MVN_VERSION="$MVN -v" MVN_SETTINGS_XML="$INTEGRATION_ETSI_TESTING_DIR/settings.xml" MVN_CLEAN_INSTALL="$MVN clean install" SIMULATOR_MAVEN_PROJECT_POM="$INTEGRATION_ETSI_TESTING_DIR/so-simulators/pom.xml" +WAIT_FOR_WORKAROUND_SCRIPT=$INTEGRATION_ETSI_TESTING_CONFIG_DIR/"wait-for-workaround-job.sh" +WAIT_FOR_POPULATE_AAI_SCRIPT=$INTEGRATION_ETSI_TESTING_CONFIG_DIR/"wait-for-aai-config-job.sh" WAIT_FOR_CONTAINER_SCRIPT=$INTEGRATION_ETSI_TESTING_CONFIG_DIR/"wait-for-container.sh" echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..." export $(egrep -v '^#' $ENV_FILE | xargs) -MANDATORY_VARIABLES_NAMES=( "PROJECT_NAME" "DEFAULT_NETWORK_NAME" ) +MANDATORY_VARIABLES_NAMES=( "NEXUS_DOCKER_REPO_MSO" "DOCKER_ENVIRONMENT" "TAG" "TIME_OUT_DEFAULT_VALUE_SEC" "PROJECT_NAME" "DEFAULT_NETWORK_NAME") for var in "${MANDATORY_VARIABLES_NAMES[@]}" do @@ -125,21 +130,70 @@ if [ $? -ne 0 ]; then exit 1 fi -docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME up -d +echo "Will clone docker-config project ... " -echo "Sleeping for 1m" -sleep 1m -AAI_SIMULATOR_CONTAINER_NAME="aai-simulator" -echo "Will execute $WAIT_FOR_CONTAINER_SCRIPT to wait for $AAI_SIMULATOR_CONTAINER_NAME container to start up" -$WAIT_FOR_CONTAINER_SCRIPT -c "$AAI_SIMULATOR_CONTAINER_NAME" -t "300" -n "$DEFAULT_NETWORK_NAME" +if [[ -d "$TEST_LAB_DIR_PATH" ]]; then + echo "$TEST_LAB_DIR_PATH already exists" + echo "Removing $TEST_LAB_DIR_PATH directory ..." + rm -rf $TEST_LAB_DIR_PATH +fi + +git clone http://gerrit.onap.org/r/so/docker-config.git $TEST_LAB_DIR_PATH + +export TEST_LAB_DIR=$TEST_LAB_DIR_PATH +export CONFIG_DIR_PATH=$INTEGRATION_ETSI_TESTING_CONFIG_DIR +export CONFIG_DIR_PATH_MACRO=$CONFIG_DIR_MACRO + +if [ "$DOCKER_ENVIRONMENT" == "remote" ]; then + echo "Starting docker containers with remote images ..." + docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME up -d +elif [ "$DOCKER_ENVIRONMENT" == "local" ]; then + echo "Starting docker containers with local images ..." + docker-compose -f $DOCKER_COMPOSE_FILE_PATH -f $DOCKER_COMPOSE_LOCAL_OVERRIDE_FILE -p $PROJECT_NAME up -d +else + echo "DOCKER_ENVIRONMENT not set correctly in $ENV_FILE. Allowed values: local | remote" + exit 1 +fi + +echo "Sleeping for 3m" +sleep 3m + +echo "Will execute $WAIT_FOR_WORKAROUND_SCRIPT script" +$WAIT_FOR_WORKAROUND_SCRIPT + if [ $? -ne 0 ]; then - echo "ERROR: $WAIT_FOR_CONTAINER_SCRIPT failed" + echo "ERROR: $WAIT_FOR_WORKAROUND_SCRIPT failed" echo "Will stop running docker containers . . ." $TEAR_DOWN_SCRIPT exit 1 fi +echo "Will execute $WAIT_FOR_POPULATE_AAI_SCRIPT script" +$WAIT_FOR_POPULATE_AAI_SCRIPT + +if [ $? -ne 0 ]; then + echo "ERROR: $WAIT_FOR_POPULATE_AAI_SCRIPT failed" + echo "Will stop running docker containers . . ." + $TEAR_DOWN_SCRIPT + exit 1 +fi + +PODS_NAMES=( "api-handler-infra" "bpmn-infra" "sdc-controller") + +for pod in "${PODS_NAMES[@]}" + do + echo "Will execute $WAIT_FOR_CONTAINER_SCRIPT to wait for $pod container to start up" + $WAIT_FOR_CONTAINER_SCRIPT -c "$pod" -t "300" -n "$DEFAULT_NETWORK_NAME" + + if [ $? -ne 0 ]; then + echo "ERROR: $WAIT_FOR_CONTAINER_SCRIPT for pod: $pod failed" + echo "Will stop running docker containers . . ." + $TEAR_DOWN_SCRIPT + exit 1 + fi +done + REPO_IP='127.0.0.1' ROBOT_VARIABLES="-v REPO_IP:${REPO_IP}" diff --git a/plans/so/macroflow/teardown.sh b/plans/so/macroflow/teardown.sh index 34d72544..ee7f6e41 100644 --- a/plans/so/macroflow/teardown.sh +++ b/plans/so/macroflow/teardown.sh @@ -1,13 +1,13 @@ #!/bin/bash # # ============LICENSE_START======================================================= -# Copyright (C) 2021 Nordix Foundation. -# ================================================================================ +# Copyright 2021 Huawei Technologies Co., Ltd. +# # 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 +# 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, @@ -15,21 +15,42 @@ # See the License for the specific language governing permissions and # limitations under the License. # -# SPDX-License-Identifier: Apache-2.0 +# SPDX-License-Identifier: Apache-2.0 # ============LICENSE_END========================================================= -# -# @author Waqas Ikram (waqas.ikram@est.tech) +INTEGRATION_ETSI_TESTING_DIR=$WORKSPACE/plans/so/integration-etsi-testing +INTEGRATION_ETSI_TESTING_CONFIG_DIR=$INTEGRATION_ETSI_TESTING_DIR/config +# Macroflow Path SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" SCRIPT_NAME=$(basename $0) -CONFIG_DIR=$SCRIPT_HOME/config -ENV_FILE=$CONFIG_DIR/env +CONFIG_DIR_MACRO=$SCRIPT_HOME/config +ENV_FILE=$CONFIG_DIR_MACRO/env DOCKER_COMPOSE_FILE_PATH=$SCRIPT_HOME/docker-compose.yml +DOCKER_COMPOSE_LOCAL_OVERRIDE_FILE=$SCRIPT_HOME/docker-compose.local.yml + +TEMP_DIR_PATH=$MACRO_HOME/temp +TEST_LAB_DIR_PATH=$TEMP_DIR_PATH/test_lab + + echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..." export $(egrep -v '^#' $ENV_FILE | xargs) +export TEST_LAB_DIR=$TEST_LAB_DIR_PATH +export CONFIG_DIR_PATH=$INTEGRATION_ETSI_TESTING_CONFIG_DIR +export CONFIG_DIR_PATH_MACRO=$CONFIG_DIR_MACRO + + +if [ "$DOCKER_ENVIRONMENT" == "remote" ]; then + echo "Tearing down docker containers from remote images ..." + docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME down +elif [ "$DOCKER_ENVIRONMENT" == "local" ]; then + echo "Tearing down docker containers from local images ..." + docker-compose -f $DOCKER_COMPOSE_FILE_PATH -f $DOCKER_COMPOSE_LOCAL_OVERRIDE_FILE -p $PROJECT_NAME down +else + echo "Couldn't find valid property for DOCKER_ENVIRONMENT in $ENV_FILE." + echo "Attempting normal teardown ..." + docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME down +fi -echo "Tearing down docker containers ..." -docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME down echo "Finished executing $SCRIPT_HOME/$SCRIPT_NAME" diff --git a/tests/so/sanity-check/data/macroflow.json b/tests/so/sanity-check/data/macroflow.json new file mode 100644 index 00000000..87f782a4 --- /dev/null +++ b/tests/so/sanity-check/data/macroflow.json @@ -0,0 +1,161 @@ +{ + "requestDetails": { + "requestInfo": { + "suppressRollback": false, + "productFamilyId": "1234", + "requestorId": "demo", + "instanceName": "CsitEtsiInstance", + "source": "VID" + }, + "modelInfo": { + "modelType": "service", + "modelInvariantId": "b9202a74-4c16-4245-83ad-1cd53c813214", + "modelVersionId": "6f2c7614-571c-4482-aa2c-5eac0308aa16", + "modelName": "vfw_k8s_demo_CNF", + "modelVersion": "1.0" + }, + "cloudConfiguration": { + "tenantId": "693c7729b2364a26a3ca602e6f66187d", + "cloudOwner": "CloudOwner", + "lcpCloudRegionId": "EtsiCloudRegion" + }, + "subscriberInfo": { + "globalSubscriberId": "DemoCustomer" + }, + "requestParameters": { + "subscriptionServiceType": "vCPE", + "userParams": [{ + "Homing_Solution": "none" + }, { + "service": { + "instanceParams": [], + "instanceName": "CsitEtsiInstance", + "resources": { + "vnfs": [ + { + "modelInfo": { + "modelName": "VF_vfw_k8s_demo_CNF", + "modelVersionId": "daeb6a5c-3a8a-40b0-a575-8cca71dd0b7c", + "modelInvariantUuid": "517403c8-fab8-4cfe-9bc5-d94f5e34b257", + "modelVersion": "1.0", + "modelCustomizationId": "8b8b67bd-01a4-42f7-b0fc-1d3a0f2765fd", + "modelInstanceName": "VF_vfw_k8s_demo_CNF 0" + }, + "cloudConfiguration": { + "tenantId": "693c7729b2364a26a3ca602e6f66187d", + "cloudOwner": "CloudOwner", + "lcpCloudRegionId": "EtsiCloudRegion" + }, + "platform": { + "platformName": "test" + }, + "lineOfBusiness": { + "lineOfBusinessName": "LOB-Demonstration" + }, + "productFamilyId": "1234", + "instanceName": "VF_frankfurt_vfw_k8s_demo_final", + "instanceParams": [{ + "sdnc_model_name": "vFW_CNF_CDS", + "sdnc_model_version": "1.0.45", + "sdnc_artifact_name": "vnf" + } + ], + "vfModules": [ + { + "modelInfo": { + "modelName": "VfVfwK8sDemoCnf..base_template..module-0", + "modelVersionId": "86224a10-c17e-42c9-9809-f3c31ba1b781", + "modelInvariantUuid": "2bc34946-d57d-4053-9e9f-d60587c9aa12", + "modelVersion": "1", + "modelCustomizationId": "905ffa63-7011-4cbe-943c-237f303b4e9f" + }, + "instanceName": "vf_frankfurt_vfw_k8s_demo_final0..VfFrankfurtVfwK8sDemoFinal..base_template..module-0", + "instanceParams": [{ + "k8s-rb-profile-name": "vfw-cnf-cds-base-profile", + "k8s-rb-profile-namespace": "test-vfw1", + "sdnc_model_name": "vFW_CNF_CDS", + "sdnc_model_version": "1.0.45", + "vf_module_label": "base_template" + } + ] + }, + { + "modelInfo": { + "modelName": "VfVfwK8sDemoCnf..vsn..module-1", + "modelVersionId": "3c50323b-5f8c-4b31-938f-8e996a2e0001", + "modelInvariantUuid": "11e50367-a4c9-4203-a838-518446ec816a", + "modelVersion": "1", + "modelCustomizationId": "1812807a-9f6b-42e4-b78c-814c3fea5a4c" + }, + "instanceName": "vf_frankfurt_vfw_k8s_demo_final0..VfFrankfurtVfwK8sDemoFinal..vsn..module-1", + "instanceParams": [{ + "k8s-rb-profile-name": "vfw-cnf-cds-base-profile", + "k8s-rb-profile-namespace": "vfirewall", + "sdnc_model_name": "vFW_CNF_CDS", + "sdnc_model_version": "7.0.0", + "vf_module_label": "vsn" + } + ] + }, + { + "modelInfo": { + "modelName": "VfVfwK8sDemoCnf..vpkg..module-2", + "modelVersionId": "104e8b4e-d404-4a5b-9beb-f92a217fd6ee", + "modelInvariantUuid": "1782dcdb-2a4c-4665-8d04-be6b989fea8e", + "modelVersion": "1", + "modelCustomizationId": "02fb0319-f37d-4e8b-9009-263fffdb2549" + }, + "instanceName": "vf_frankfurt_vfw_k8s_demo_final0..VfFrankfurtVfwK8sDemoFinal..vpkg..module-2", + "instanceParams": [{ + "k8s-rb-profile-name": "vfw-cnf-cds-base-profile", + "k8s-rb-profile-namespace": "vfirewall", + "sdnc_model_name": "vFW_CNF_CDS", + "sdnc_model_version": "7.0.0", + "vf_module_label": "vpkg" + } + ] + }, + { + "modelInfo": { + "modelName": "VfVfwK8sDemoCnf..vfw..module-3", + "modelVersionId": "a5f678db-2e5f-47be-8fab-1540bc7482d8", + "modelInvariantUuid": "c0869243-7667-4434-b9cc-84791f07a13a", + "modelVersion": "1", + "modelCustomizationId": "f144c7c8-da93-4e06-ba93-d26e69eba509" + }, + "instanceName": "vf_frankfurt_vfw_k8s_demo_final0..VfFrankfurtVfwK8sDemoFinal..vfw..module-3", + "instanceParams": [{ + "k8s-rb-profile-name": "vfw-cnf-cds-base-profile", + "k8s-rb-profile-namespace": "vfirewall", + "sdnc_model_name": "vFW_CNF_CDS", + "sdnc_model_version": "7.0.0", + "vf_module_label": "vfw" + } + ] + } + + ] + } + ] + }, + "modelInfo": { + "modelVersion": "1.0", + "modelVersionId": "6f2c7614-571c-4482-aa2c-5eac0308aa16", + "modelInvariantId": "b9202a74-4c16-4245-83ad-1cd53c813214", + "modelName": "vfw_k8s_demo_CNF", + "modelType": "service" + } + } + } + ], + "aLaCarte": false + }, + "project": { + "projectName": "etsiCsitProject" + }, + "owningEntity": { + "owningEntityId": "f2e1071e-3d47-4a65-94d4-e473ec03326a", + "owningEntityName": "OE-Demonstration" + } + } +} diff --git a/tests/so/sanity-check/data/serviceBasicVfCnfnotification.json b/tests/so/sanity-check/data/serviceBasicVfCnfnotification.json new file mode 100644 index 00000000..02485e18 --- /dev/null +++ b/tests/so/sanity-check/data/serviceBasicVfCnfnotification.json @@ -0,0 +1,294 @@ +{ + "distributionID": "2d6c5aa8-b644-4f30-a632-5577801ef959", + "serviceName": "vfw_k8s_demo_CNF", + "serviceVersion": "1.0", + "serviceUUID": "6f2c7614-571c-4482-aa2c-5eac0308aa16", + "serviceDescription": "service", + "serviceInvariantUUID": "b9202a74-4c16-4245-83ad-1cd53c813214", + "resources": [ + { + "resourceInstanceName": "VF_vfw_k8s_demo_CNF 0", + "resourceName": "VF_vfw_k8s_demo_CNF", + "resourceVersion": "1.0", + "resoucreType": "VF", + "resourceUUID": "daeb6a5c-3a8a-40b0-a575-8cca71dd0b7c", + "resourceInvariantUUID": "517403c8-fab8-4cfe-9bc5-d94f5e34b257", + "resourceCustomizationUUID": "8b8b67bd-01a4-42f7-b0fc-1d3a0f2765fd", + "category": "Generic", + "subcategory": "Abstract", + "artifacts": [{ + "artifactName": "vf_vfw_k8s_demo_cnf0_modules.json", + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "/unzipped_sdc_csar/vf_vfw_k8s_demo_cnf0_modules.json", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "86224a10-c17e-42c9-9809-f3c31ba1b781", + "artifactVersion": "1" + }, +{ + "artifactName": "vf_vfw_k8s_demo_cnf1_modules.json", + "artifactType": "VF_MODULES_METADATA", + "artifactURL": "/unzipped_sdc_csar/vf_vfw_k8s_demo_cnf0_modules.json", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "3c50323b-5f8c-4b31-938f-8e996a2e0001", + "artifactVersion": "1" + }, + +{ + "artifactName": "base_template.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/base_template.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "ede4c2de-133f-49e3-9daa-8c56b65b5c6b", + "artifactVersion": "1" + }, +{ + "artifactName": "base_template_cloudtech_k8s_charts.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/base_template_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "6833f47d-e91b-4887-8b55-f68ef25bccf3", + "artifactVersion": "1" + }, + +{ + "artifactName": "base_template.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/base_template.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "7f1dbc99-849e-4af8-bdcb-6c214f939428", + "artifactVersion": "1" + }, +{ + "artifactName": "base_template_cloudtech_k8s_charts.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/base_template_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "71607418-af27-4712-8e0c-cfe992b95a38", + "artifactVersion": "1" + }, +{ + "artifactName": "vfw.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/vfw.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "406fe9df-aa4c-42c1-8f83-c7ac11169fd4", + "artifactVersion": "1" + }, +{ + "artifactName": "vfw_cloudtech_k8s_charts.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/vfw_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "33f7aab2-3324-4523-b37a-625b0cf77dfe", + "artifactVersion": "1" + }, +{ + "artifactName": "vpkg_cloudtech_k8s_charts.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/vpkg_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "8ab17b5a-3fbd-4142-a75f-c55ffd4c5af5", + "artifactVersion": "1" + }, +{ + "artifactName": "vsn.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/vsn.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "e17c1e60-f7da-4767-9a0e-02c8ff9c0f2e", + "artifactVersion": "1" + }, +{ + "artifactName": "vsn_cloudtech_k8s_charts.env", + "artifactType": "HEAT_ENV", + "artifactURL": "/unzipped_sdc_csar/vsn_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "989dbc01-2fa5-463b-abaa-cf73996ea12b", + "artifactVersion": "1" + }, +{ + "artifactName": "base_template_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/base_template_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "406fe9df-aa4c-42c1-8f83-c7ac11169fd4", + "artifactVersion": "1" + }, +{ + "artifactName": "vfw_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/vfw_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "6833f47d-e91b-4887-8b55-f68ef25bccf3", + "artifactVersion": "1" + }, +{ + "artifactName": "vpkg_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/vpkg_cloudtech_k8s_charts.env", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "406fe9df-aa4c-42c1-8f83-c7ac11169fd4", + "artifactVersion": "1" + }, +{ + "artifactName": "vsn_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/vsn_cloudtech_k8s_charts.tgz", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "8ab17b5a-3fbd-4142-a75f-c55ffd4c5af5", + "artifactVersion": "1" + } + +, +{ + "artifactName": "vsn_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/vsn_cloudtech_k8s_charts.tgz", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "aaeee885-5821-4e08-8da6-0bb3b74f24e9", + "artifactVersion": "1" + }, +{ + "artifactName": "vsn_cloudtech_k8s_charts.tgz", + "artifactType": "CLOUD_TECHNOLOGY_SPECIFIC_ARTIFACT", + "artifactURL": "/unzipped_sdc_csar/vsn_cloudtech_k8s_charts.tgz", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "b4510b34-e39c-4239-bacc-7dd2f3c2a418", + "artifactVersion": "1" + } + +, +{ + "artifactName": "base_template.yaml", + "artifactType": "HEAT", + "artifactURL": "/unzipped_sdc_csar/base_template.yaml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "33f7aab2-3324-4523-b37a-625b0cf77dfe", + "artifactVersion": "1" + } + +, +{ + "artifactName": "vfw.yaml", + "artifactType": "HEAT", + "artifactURL": "/unzipped_sdc_csar/vfw.yaml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "6833f47d-e91b-4887-8b55-f68ef25bccf3", + "artifactVersion": "1" + } + +, +{ + "artifactName": "vpkg.yaml", + "artifactType": "HEAT", + "artifactURL": "/unzipped_sdc_csar/vpkg.yaml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "42b80d18-69ec-4233-8844-f0df6ebb6e3d", + "artifactVersion": "1" + } +, +{ + "artifactName": "vsn.yaml", + "artifactType": "HEAT", + "artifactURL": "/unzipped_sdc_csar/vsn.yaml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "406fe9df-aa4c-42c1-8f83-c7ac11169fd4", + "artifactVersion": "1" + } + +, +{ + "artifactName": "vendor-license-model.xml", + "artifactType": "VENDOR_LICENSE", + "artifactURL": "/unzipped_sdc_csar/vendor-license-model.xml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "6e1dbc99-849e-4af8-bdcb-6c214f939491", + "artifactVersion": "1" + } + +, +{ + "artifactName": "vf-license-model.xml", + "artifactType": "VF_LICENSE", + "artifactURL": "/unzipped_sdc_csar/vf-license-model.xml", + "artifactChecksum": "MDJkYjNmNjEzM2Y1ZDgzNzZiZWUxMjZkMzA3YzkwZDI\u003d", + "artifactDescription": "Auto-generated VF Modules information artifact", + "artifactTimeout": 120, + "artifactUUID": "ede4c2de-133f-49e3-9daa-8c56b65b5c6b", + "artifactVersion": "1" + } + +] + } + + + ], + "serviceArtifacts": [ + { + "artifactName": "service-VfwK8sDemoCnf-template.yml", + "artifactType": "TOSCA_TEMPLATE", + "artifactURL": "/unzipped_sdc_csar/service-VfwK8sDemoCnf-template.yml", + "artifactChecksum": "NTUzMDU5YzM3MTk4OGNiNjQ2OGRlMWY2YjU3MjE2YjM\u003d", + "artifactDescription": "TOSCA representation of the asset", + "artifactTimeout": 0, + "artifactUUID": "6f2c7614-571c-4482-aa2c-5eac0308aa16", + "artifactVersion": "1" + }, + { + "artifactName": "service-VfwK8sDemoCnf-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/unzipped_sdc_csar/service-VfwK8sDemoCnf-csar.csar", + "artifactChecksum": "ZTRhOGI0M2UxN2ZhYjQ0ODI5ZDZhZTExZTFkMGU3N2Y\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactUUID": "6f2c7614-571c-4482-aa2c-5eac0308aa16", + "artifactVersion": "1" + } + ], + "workloadContext": "Production" +} + diff --git a/tests/so/sanity-check/macroflow.robot b/tests/so/sanity-check/macroflow.robot index 149797a1..cd3a5b55 100644 --- a/tests/so/sanity-check/macroflow.robot +++ b/tests/so/sanity-check/macroflow.robot @@ -4,12 +4,26 @@ Library RequestsLibrary Library OperatingSystem Library json +*** Variables *** +${SLEEP_INTERVAL_SEC}= 60 + *** Test Cases *** -Healthcheck - [Documentation] Runs AAI SIMULATOR Health check - Create Session aai_simulator_session https://${REPO_IP}:9993 - &{headers}= Create Dictionary Accept=text/plain - ${resp}= Get Request aai_simulator_session /aai/v19/healthcheck headers=${headers} - log to console Received response from AAI SIMULATOR ${resp.text} +Distribute Service Template + Create Session sdc_controller_session http://${REPO_IP}:8085 + ${data}= Get Binary File ${CURDIR}${/}data${/}serviceBasicVfCnfnotification.json + &{headers}= Create Dictionary Authorization=Basic bXNvX2FkbWluOnBhc3N3b3JkMSQ= resource-location=/distribution-test-zip/unzipped/ Content-Type=application/json Accept=application/json + ${resp}= Post Request sdc_controller_session /test/treatNotification/v1 data=${data} headers=${headers} + Log To Console Received status code: ${resp.status_code} + Run Keyword If '${resp.status_code}' == '200' log to console \nexecuted with expected result Should Be Equal As Strings '${resp.status_code}' '200' - Should Be Equal As Strings '${resp.text}' 'healthy' + + +Macroflow + Create Session api_handler_session http://${REPO_IP}:8080 + ${data}= Get Binary File ${CURDIR}${/}data${/}macroflow.json + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + ${service_instantiation_request}= Post Request api_handler_session /onap/so/infra/serviceInstantiation/v7/serviceInstances data=${data} headers=${headers} + Log To Console Received status code: ${service_instantiation_request.status_code} + Run Keyword If '${service_instantiation_request.status_code}' == '202' log to console \nexecuted with expected result + Should Be Equal As Strings '${service_instantiation_request.status_code}' '202' + SLEEP ${SLEEP_INTERVAL_SEC}s