diff options
81 files changed, 2283 insertions, 239 deletions
diff --git a/plans/dcaegen2-collectors-datafile/Functional-suite/setup.sh b/plans/dcaegen2-collectors-datafile/Functional-suite/setup.sh index 2d276e51..bdee34ee 100644 --- a/plans/dcaegen2-collectors-datafile/Functional-suite/setup.sh +++ b/plans/dcaegen2-collectors-datafile/Functional-suite/setup.sh @@ -12,8 +12,7 @@ cd $WORKSPACE/archives/dfc if [ -z "$SIM_ROOT" ] then - #git clone --depth 1 https://gerrit.onap.org/r/integration -b master - git clone https://github.com/yanhuanwang/integration.git + git clone --depth 1 https://gerrit.onap.org/r/integration -b master #Location of all individual simulators for DFC echo "Determine SIM_ROOT based on the WORKSPACE" SIM_ROOT=$WORKSPACE/archives/dfc/integration/test/mocks/datafilecollector-testharness diff --git a/plans/dcaegen2-collectors-datafile/Functional-suite/teardown.sh b/plans/dcaegen2-collectors-datafile/Functional-suite/teardown.sh index 0dc2af18..81d85fe5 100644 --- a/plans/dcaegen2-collectors-datafile/Functional-suite/teardown.sh +++ b/plans/dcaegen2-collectors-datafile/Functional-suite/teardown.sh @@ -1,7 +1,9 @@ #!/usr/bin/env bash -running_containers=$(docker ps --filter name=dfc_ -q) - +running_containers=$(docker ps --filter name=dfc_ -qa) +running_images=$(docker images -q) +docker exec dfc_app0 cat /var/log/ONAP/application.log >> $WORKSPACE/archives/dfc_app0_application.log +docker logs dfc_mr-sim >> $WORKSPACE/archives/dfc_mr-sim.log if [ -z "$running_containers" ] then @@ -10,5 +12,6 @@ else echo "Stopping and removing containers" docker stop $running_containers docker rm $running_containers + docker rmi $running_images fi diff --git a/plans/dcaegen2-collectors-datafile/ManagementInterface-suite/teardown.sh b/plans/dcaegen2-collectors-datafile/ManagementInterface-suite/teardown.sh index d8877fbc..23581a02 100644 --- a/plans/dcaegen2-collectors-datafile/ManagementInterface-suite/teardown.sh +++ b/plans/dcaegen2-collectors-datafile/ManagementInterface-suite/teardown.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash set +e -docker exec -it dfc_app0 cat /var/log/ONAP/application.log > $WORKSPACE/archives/dfc_app0_application.log +docker exec dfc_app0 cat /var/log/ONAP/application.log > $WORKSPACE/archives/dfc_app0_application.log kill-instance.sh dfc_app0 set -e exit 0 diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml b/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml index eb61db97..4b184d38 100644 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/docker-compose.yml @@ -84,7 +84,7 @@ services: - hv-ves-default config-binding-service: - image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:2.2.4 + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding:2.5.2 ports: - "10000:10000" environment: diff --git a/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh b/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh index 08bbb61e..940c757f 100755 --- a/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh +++ b/plans/dcaegen2-collectors-hv-ves/testsuites/env.sh @@ -39,7 +39,7 @@ export HV_VES_GROUP_ID="org.onap.dcaegen2.collectors.hv-ves" export HV_VES_HOSTNAME="dcae-hv-ves-collector" export HV_VES_COLLECTOR_NAMESPACE="onap" export HV_VES_HEALTHCHECK_CMD="curl --request GET --fail --silent --show-error localhost:6060/health/ready && nc -vz localhost 6061" -export HV_VES_VERSION="1.2-SNAPSHOT" +export HV_VES_VERSION="latest" export HV_VES_IMAGE="hv-collector-main" export DCAE_APP_SIMULATOR_IMAGE="hv-collector-dcae-app-simulator" export XNF_SIMULATOR_IMAGE="hv-ves-collector-xnf-simulator" diff --git a/plans/policy/apex-pdp/setup.sh b/plans/policy/apex-pdp/setup.sh index 22e813df..16621241 100644 --- a/plans/policy/apex-pdp/setup.sh +++ b/plans/policy/apex-pdp/setup.sh @@ -49,8 +49,12 @@ fi # bring down maven mkdir maven cd maven -curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz -tar -xzvf apache-maven-3.3.9-bin.tar.gz +# download maven from automatically selected mirror server +curl -vLO "https://www.apache.org/dyn/mirrors/mirrors.cgi?cca2=us&preferred=http://apache.claz.org/&action=download&filename=maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" +if ! tar -xzvf apache-maven-3.3.9-bin.tar.gz ; then + echo "Installation of maven has failed!" + exit 1 +fi ls -l export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v diff --git a/plans/policy/distribution/setup.sh b/plans/policy/distribution/setup.sh index 399df0e6..18cb88ed 100644 --- a/plans/policy/distribution/setup.sh +++ b/plans/policy/distribution/setup.sh @@ -50,8 +50,12 @@ fi # bring down maven mkdir maven cd maven -curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz -tar -xzvf apache-maven-3.3.9-bin.tar.gz +# download maven from automatically selected mirror server +curl -vLO "https://www.apache.org/dyn/mirrors/mirrors.cgi?cca2=us&preferred=http://apache.claz.org/&action=download&filename=maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" +if ! tar -xzvf apache-maven-3.3.9-bin.tar.gz ; then + echo "Installation of maven has failed!" + exit 1 +fi ls -l export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v diff --git a/plans/policy/xacml-pdp/setup.sh b/plans/policy/xacml-pdp/setup.sh index 1d4325bd..9a2e92fe 100644 --- a/plans/policy/xacml-pdp/setup.sh +++ b/plans/policy/xacml-pdp/setup.sh @@ -47,8 +47,12 @@ fi # bring down maven mkdir maven cd maven -curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz -tar -xzvf apache-maven-3.3.9-bin.tar.gz +# download maven from automatically selected mirror server +curl -vLO "https://www.apache.org/dyn/mirrors/mirrors.cgi?cca2=us&preferred=http://apache.claz.org/&action=download&filename=maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" +if ! tar -xzvf apache-maven-3.3.9-bin.tar.gz ; then + echo "Installation of maven has failed!" + exit 1 +fi ls -l export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v diff --git a/plans/sdc/sanity/setup.sh b/plans/sdc/sanity/setup.sh index 0e652f86..20a8eac3 100644 --- a/plans/sdc/sanity/setup.sh +++ b/plans/sdc/sanity/setup.sh @@ -15,4 +15,26 @@ # limitations under the License. # +# By default all images are from remote upstream registry, this option +# provides the chance to test locally built images +export SDC_LOCAL_IMAGES="${SDC_LOCAL_IMAGES:-false}" + +# For this to take effect SDC_LOCAL_IMAGES must be enabled... +# +# The path to the local sdc git repo from which the local images have +# been built - it also affects the tag used - if left empty *AND* +# local images are used *AND* SDC_LOCAL_TAG is unset then the tag +# will be set to: 'latest' +# +# BEWARE: Using local images with an incorrect git repo could lead to +# problems...set SDC_LOCAL_GITREPO or GERRIT_BRANCH properly... +export SDC_LOCAL_GITREPO="${SDC_LOCAL_GITREPO}" + +# For this to take effect SDC_LOCAL_IMAGES must be enabled... +# +# This will set the tag for local images - leaving this empty *AND* +# with unset SDC_LOCAL_GITREPO the local images will fallback to the +# tag: 'latest' +export SDC_LOCAL_TAG="${SDC_LOCAL_TAG}" + source ${WORKSPACE}/scripts/sdc/setup_sdc_for_sanity.sh tad diff --git a/plans/sdc/uiSanity/setup.sh b/plans/sdc/uiSanity/setup.sh index 3d315098..b02cd7be 100644 --- a/plans/sdc/uiSanity/setup.sh +++ b/plans/sdc/uiSanity/setup.sh @@ -13,5 +13,28 @@ # 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. +# + +# By default all images are from remote upstream registry, this option +# provides the chance to test locally built images +export SDC_LOCAL_IMAGES="${SDC_LOCAL_IMAGES:-false}" + +# For this to take effect SDC_LOCAL_IMAGES must be enabled... +# +# The path to the local sdc git repo from which the local images have +# been built - it also affects the tag used - if left empty *AND* +# local images are used *AND* SDC_LOCAL_TAG is unset then the tag +# will be set to: 'latest' +# +# BEWARE: Using local images with an incorrect git repo could lead to +# problems...set SDC_LOCAL_GITREPO or GERRIT_BRANCH properly... +export SDC_LOCAL_GITREPO="${SDC_LOCAL_GITREPO}" + +# For this to take effect SDC_LOCAL_IMAGES must be enabled... +# +# This will set the tag for local images - leaving this empty *AND* +# with unset SDC_LOCAL_GITREPO the local images will fallback to the +# tag: 'latest' +export SDC_LOCAL_TAG="${SDC_LOCAL_TAG}" source ${WORKSPACE}/scripts/sdc/setup_sdc_for_sanity.sh tud diff --git a/plans/so/integration-etsi-testing/config/distribution-test-zip/distributionTestZip.zip b/plans/so/integration-etsi-testing/config/distribution-test-zip/distributionTestZip.zip Binary files differdeleted file mode 100644 index ac96bd94..00000000 --- a/plans/so/integration-etsi-testing/config/distribution-test-zip/distributionTestZip.zip +++ /dev/null diff --git a/plans/so/integration-etsi-testing/config/distribution-test-zip/zipped_sdc_csar.tar.gz b/plans/so/integration-etsi-testing/config/distribution-test-zip/zipped_sdc_csar.tar.gz Binary files differnew file mode 100644 index 00000000..fcf828c8 --- /dev/null +++ b/plans/so/integration-etsi-testing/config/distribution-test-zip/zipped_sdc_csar.tar.gz diff --git a/plans/so/integration-etsi-testing/config/env b/plans/so/integration-etsi-testing/config/env index 61603aac..583be0af 100644 --- a/plans/so/integration-etsi-testing/config/env +++ b/plans/so/integration-etsi-testing/config/env @@ -1,4 +1,5 @@ NEXUS_DOCKER_REPO_MSO=nexus3.onap.org:10001 +DOCKER_ENVIRONMENT=remote TAG=1.4.3-STAGING-latest TIME_OUT_DEFAULT_VALUE_SEC=1200 PROJECT_NAME=etsiintegrationtesting diff --git a/plans/so/integration-etsi-testing/config/wait-for-container.sh b/plans/so/integration-etsi-testing/config/wait-for-container.sh index 598715d9..35ee2641 100755 --- a/plans/so/integration-etsi-testing/config/wait-for-container.sh +++ b/plans/so/integration-etsi-testing/config/wait-for-container.sh @@ -118,16 +118,23 @@ process_arguments() exit 1 fi + result=$(docker inspect --format '{{.State.Running}}' $CONTAINER_NAME) + + if [ $result != "true" ] ; then + echo "$SCRIPT_NAME $(current_timestamp) ERROR: $CONTAINER_NAME container is not running" + exit 1 + fi + HOST_IP=$(docker inspect --format '{{ index .NetworkSettings.Networks "'$NETWORK_NAME'" "IPAddress"}}' $CONTAINER_NAME) - if [ $? -ne 0 ]; then + if [ $? -ne 0 ] || [ -z $HOST_IP ] ; then echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to find HOST IP using network name: $NETWORK_NAME and container name: $CONTAINER_NAME" exit 1 fi PORT=$(docker port $CONTAINER_NAME | cut -c1-$(docker port $CONTAINER_NAME | grep -aob '/' | grep -oE '[0-9]+')) - if [ $? -ne 0 ]; then + if [ $? -ne 0 ] || [ -z $PORT ] ; then echo "$SCRIPT_NAME $(current_timestamp) ERROR: Unable to find PORT using project name: $PROJECT_NAME and container name: $CONTAINER_NAME" exit 1 fi diff --git a/plans/so/integration-etsi-testing/docker-compose.local.yml b/plans/so/integration-etsi-testing/docker-compose.local.yml new file mode 100644 index 00000000..ae15e6f6 --- /dev/null +++ b/plans/so/integration-etsi-testing/docker-compose.local.yml @@ -0,0 +1,33 @@ +version: '3' +services: +################################################################################ + mariadb: + image: mariadb:10.1.11 +################################################################################ + 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} +################################################################################ + 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} +################################################################################ + vnfm-adapter: + image: onap/so/vnfm-adapter:${TAG} +################################################################################ + vnfm-simulator: + image: onap/so/vnfm-simulator:${TAG} +################################################################################ diff --git a/plans/so/integration-etsi-testing/docker-compose.yml b/plans/so/integration-etsi-testing/docker-compose.yml index 76dd7b6a..ae20b0df 100644 --- a/plans/so/integration-etsi-testing/docker-compose.yml +++ b/plans/so/integration-etsi-testing/docker-compose.yml @@ -130,7 +130,7 @@ services: volumes: - ${TEST_LAB_DIR}/volumes/so/ca-certificates/onapheat:/app/ca-certificates - ${TEST_LAB_DIR}/volumes/so/config/sdc-controller/onapheat:/app/config - - ${CONFIG_DIR_PATH}/distribution-test-zip/distributionTestZip.zip:/distribution-test-zip/distributionTestZip.zip + - ${CONFIG_DIR_PATH}/distribution-test-zip/zipped_sdc_csar.tar.gz:/distribution-test-zip/zipped_sdc_csar.tar.gz environment: - APP=sdc-controller - JVM_ARGS=-Xms64m -Xmx512m @@ -154,7 +154,7 @@ services: command: - /bin/sh - -c - - 'mkdir -p /distribution-test-zip/unzipped && unzip /distribution-test-zip/distributionTestZip.zip -d /distribution-test-zip/unzipped && /app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' + - 'mkdir -p /distribution-test-zip/unzipped && tar -xvzf /distribution-test-zip/zipped_sdc_csar.tar.gz -C /distribution-test-zip/unzipped && /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} diff --git a/plans/so/integration-etsi-testing/setup.sh b/plans/so/integration-etsi-testing/setup.sh index 5af56460..ce6637c1 100755 --- a/plans/so/integration-etsi-testing/setup.sh +++ b/plans/so/integration-etsi-testing/setup.sh @@ -31,6 +31,7 @@ ENV_FILE=$CONFIG_DIR/env TEMP_DIR_PATH=$SCRIPT_HOME/temp TEST_LAB_DIR_PATH=$TEMP_DIR_PATH/test_lab 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 MAVEN_DIR=$TEMP_DIR_PATH/maven @@ -48,7 +49,7 @@ echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..." export $(egrep -v '^#' $ENV_FILE | xargs) -MANDATORY_VARIABLES_NAMES=( "NEXUS_DOCKER_REPO_MSO" "TAG" "TIME_OUT_DEFAULT_VALUE_SEC" "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 @@ -138,7 +139,16 @@ 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=$CONFIG_DIR -docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME up -d +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 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 64284b5f..43fe47da 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 @@ -45,6 +45,7 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; 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.PathVariable; import org.springframework.web.bind.annotation.PostMapping; @@ -194,4 +195,21 @@ public class GenericVnfsController { return ResponseEntity.ok(genericVnfs); } + @DeleteMapping(value = "/generic-vnf/{vnf-id}", produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity<?> deleteGenericVnf(@PathVariable("vnf-id") final String vnfId, + @RequestParam(name = "resource-version") final String resourceVersion, final HttpServletRequest request) { + LOGGER.info("Will delete GenericVnf for 'vnf-id': {} and 'resource-version': {}", vnfId, resourceVersion); + + if (cacheServiceProvider.deleteGenericVnf(vnfId, resourceVersion)) { + LOGGER.info("Successfully delete GenericVnf from cache for 'vnf-id': {} and 'resource-version': {}", vnfId, + resourceVersion); + return ResponseEntity.noContent().build(); + } + + LOGGER.error("Unable to delete GenericVnf for 'vnf-id': {} and 'resource-version': {} ...", vnfId, + resourceVersion); + return getRequestErrorResponseEntity(request, GENERIC_VNF); + + } + } 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 8dd19cfa..901c2594 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 @@ -47,5 +47,7 @@ public interface GenericVnfCacheServiceProvider extends Clearable { List<GenericVnf> getGenericVnfs(final String selflink); + boolean deleteGenericVnf(final String vnfId, final String resourceVersion); + } 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 81a74f25..3a12dfdc 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 @@ -214,6 +214,22 @@ public class GenericVnfCacheServiceProviderImpl extends AbstractCacheServiceProv return Collections.emptyList(); } + @Override + public boolean deleteGenericVnf(final String vnfId, final String resourceVersion) { + final Optional<GenericVnf> optional = getGenericVnf(vnfId); + if (optional.isPresent()) { + final GenericVnf genericVnf = optional.get(); + if (genericVnf.getResourceVersion() != null && genericVnf.getResourceVersion().equals(resourceVersion)) { + final Cache cache = getCache(GENERIC_VNF_CACHE.getName()); + LOGGER.info("Will evict GenericVnf from cache with vnfId: {}", genericVnf.getVnfId()); + cache.evict(vnfId); + return true; + } + } + LOGGER.error("Unable to find GenericVnf for vnfId: {} and resourceVersion: {} ...", vnfId, resourceVersion); + return false; + } + private Relationship getRelationship(final String relatedLink, final GenericVnf genericVnf) { final Relationship relationShip = new Relationship(); relationShip.setRelatedTo(GENERIC_VNF); diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/GenericVnfsControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/GenericVnfsControllerTest.java index dd749db4..711dcd11 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/GenericVnfsControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/GenericVnfsControllerTest.java @@ -389,6 +389,24 @@ public class GenericVnfsControllerTest extends AbstractSpringBootTest { assertEquals(VNF_ID, actualGenericVnf.getVnfId()); } + @Test + public void test_deleteGenericVnf_usingVnfIdAndResourceVersion_removedFromCache() throws Exception { + + addCustomerServiceAndGenericVnf(); + + final Optional<GenericVnf> genericVnfOptional = genericVnfCacheServiceProvider.getGenericVnf(VNF_ID); + assertTrue(genericVnfOptional.isPresent()); + final GenericVnf genericVnf = genericVnfOptional.get(); + + final String genericVnfDeleteUrl = + getUrl(GENERIC_VNF_URL, genericVnf.getVnfId()) + "?resource-version=" + genericVnf.getResourceVersion(); + + final ResponseEntity<Void> responseEntity = + testRestTemplateService.invokeHttpDelete(genericVnfDeleteUrl, Void.class); + assertEquals(HttpStatus.NO_CONTENT, responseEntity.getStatusCode()); + + } + private void addCustomerServiceAndGenericVnf() throws Exception, IOException { final ResponseEntity<Void> customerResponse = testRestTemplateService.invokeHttpPut(getUrl(CUSTOMERS_URL), TestUtils.getCustomer(), Void.class); diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestRestTemplateService.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestRestTemplateService.java index 018c056a..e49e6d49 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestRestTemplateService.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/utils/TestRestTemplateService.java @@ -52,6 +52,11 @@ public class TestRestTemplateService { return restTemplate.exchange(url, HttpMethod.PUT, httpEntity, clazz); } + public <T> ResponseEntity<T> invokeHttpDelete(final String url, final Class<T> clazz) { + final HttpEntity<?> request = new HttpEntity<>(getHttpHeaders()); + return restTemplate.exchange(url, HttpMethod.DELETE, request, clazz); + } + public <T> ResponseEntity<T> invokeHttpPost(final String url, final Object obj, final Class<T> clazz) { final HttpEntity<?> httpEntity = getHttpEntity(obj); return restTemplate.exchange(url, HttpMethod.POST, httpEntity, clazz); 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 2d901c42..88970e74 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 @@ -19,9 +19,12 @@ */ package org.onap.so.sdncsimulator.controller; +import static org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration.DELETEVNFINSTANCE; import static org.onap.so.sdncsimulator.utils.Constants.OPERATIONS_URL; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.MediaType; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration; +import org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation; import org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation; import org.onap.so.sdncsimulator.models.InputRequest; @@ -96,7 +99,8 @@ public class OperationsController { return ResponseEntity.badRequest().build(); } - final Output output = cacheServiceProvider.putVnfOperationInformation(apiVnfOperationInformation); + final Output output = getOutput(apiVnfOperationInformation); + final OutputRequest outputRequest = new OutputRequest(output); if (output.getResponseCode().equals(HttpStatus.OK.toString())) { @@ -109,4 +113,17 @@ public class OperationsController { } + private Output getOutput(final GenericResourceApiVnfOperationInformation apiVnfOperationInformation) { + final GenericResourceApiRequestinformationRequestInformation requestInformation = + apiVnfOperationInformation.getRequestInformation(); + if (requestInformation != null) { + final GenericResourceApiRequestActionEnumeration requestAction = requestInformation.getRequestAction(); + if (DELETEVNFINSTANCE.equals(requestAction)) { + LOGGER.info("RequestAction: {} will delete vnf instance from cache ...", requestAction); + return cacheServiceProvider.deleteVnfOperationInformation(apiVnfOperationInformation); + } + } + return cacheServiceProvider.putVnfOperationInformation(apiVnfOperationInformation); + } + } 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 97dc7b11..5b32b91f 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 @@ -39,6 +39,8 @@ public interface ServiceOperationsCacheServiceProvider { Output putVnfOperationInformation(final GenericResourceApiVnfOperationInformation apiVnfOperationInformation); + Output deleteVnfOperationInformation(final GenericResourceApiVnfOperationInformation apiVnfOperationInformation); + 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 d5e991a8..616a56c4 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 @@ -78,6 +78,7 @@ import org.springframework.stereotype.Service; public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServiceProvider implements ServiceOperationsCacheServiceProvider { + private static final String EMPTY_STRING = ""; private static final Logger LOGGER = LoggerFactory.getLogger(ServiceOperationsCacheServiceProviderimpl.class); @Autowired @@ -89,7 +90,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ public Output putServiceOperationInformation(final GenericResourceApiServiceOperationInformation input) { final GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = input.getSdncRequestHeader(); - final String svcRequestId = requestHeader != null ? requestHeader.getSvcRequestId() : null; + final String svcRequestId = getSvcRequestId(requestHeader); final GenericResourceApiServiceinformationServiceInformation serviceInformation = input.getServiceInformation(); if (serviceInformation != null && isValid(serviceInformation.getServiceInstanceId())) { @@ -140,7 +141,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ final GenericResourceApiVnfinformationVnfInformation vnfInformation = input.getVnfInformation(); final GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = input.getSdncRequestHeader(); - final String svcRequestId = requestHeader != null ? requestHeader.getSvcRequestId() : null; + final String svcRequestId = getSvcRequestId(requestHeader); if (serviceInformation != null && isValid(serviceInformation.getServiceInstanceId()) && vnfInformation != null && isValid(vnfInformation.getVnfId())) { @@ -187,6 +188,55 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ } @Override + public Output deleteVnfOperationInformation(final GenericResourceApiVnfOperationInformation input) { + final GenericResourceApiServiceinformationServiceInformation serviceInformation = input.getServiceInformation(); + final GenericResourceApiVnfinformationVnfInformation vnfInformation = input.getVnfInformation(); + + final GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = input.getSdncRequestHeader(); + final String svcRequestId = getSvcRequestId(requestHeader); + + if (serviceInformation != null && isValid(serviceInformation.getServiceInstanceId()) && vnfInformation != null + && isValid(vnfInformation.getVnfId())) { + final String serviceInstanceId = serviceInformation.getServiceInstanceId(); + final String vnfId = vnfInformation.getVnfId(); + final Optional<GenericResourceApiServicemodelinfrastructureService> optional = + getGenericResourceApiServicemodelinfrastructureService(serviceInstanceId); + if (optional.isPresent()) { + final GenericResourceApiServicemodelinfrastructureService service = optional.get(); + final GenericResourceApiServicedataServiceData serviceData = service.getServiceData(); + if (serviceData != null) { + final List<GenericResourceApiServicedataServicedataVnfsVnf> vnfsList = getVnfs(serviceData); + final Optional<GenericResourceApiServicedataServicedataVnfsVnf> vnfInstanceOptional = + getExistingVnf(vnfId, vnfsList); + + if (vnfInstanceOptional.isPresent()) { + vnfsList.removeIf(vnf -> vnf.getVnfId() != null && vnf.getVnfId().equals(vnfId)); + + return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.OK.toString()) + .responseMessage(EMPTY_STRING).svcRequestId(svcRequestId) + .serviceResponseInformation( + new GenericResourceApiInstanceReference().instanceId(serviceInstanceId)) + .vnfResponseInformation(new GenericResourceApiInstanceReference().instanceId(vnfId)); + } + + } + } + LOGGER.error( + "Unable to find existing GenericResourceApiServiceModelInfrastructure in cache using service instance id: {}", + serviceInstanceId); + + } + LOGGER.error("Unable to remove vnf instance from cache due to invalid input: {}... ", input); + return new Output().ackFinalIndicator(YES).responseCode(HttpStatus.BAD_REQUEST.toString()) + .responseMessage("Unable to remove vnf").svcRequestId(svcRequestId); + + } + + private String getSvcRequestId(final GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader) { + return requestHeader != null ? requestHeader.getSvcRequestId() : null; + } + + @Override public void clearAll() { clearCache(SERVICE_TOPOLOGY_OPERATION_CACHE); } @@ -228,9 +278,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ private Optional<GenericResourceApiServicedataServicedataVnfsVnf> getExistingVnf(final String vnfId, final List<GenericResourceApiServicedataServicedataVnfsVnf> vnfsList) { - final Optional<GenericResourceApiServicedataServicedataVnfsVnf> optional = - vnfsList.stream().filter(vnf -> vnf.getVnfId() != null && vnf.getVnfId().equals(vnfId)).findFirst(); - return optional; + return vnfsList.stream().filter(vnf -> vnf.getVnfId() != null && vnf.getVnfId().equals(vnfId)).findFirst(); } private List<GenericResourceApiServicedataServicedataVnfsVnf> getVnfs( @@ -313,17 +361,13 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ apiServicedataServiceData.serviceLevelOperStatus(getServiceLevelOperStatus(input)); final GenericResourceApiServicestatusServiceStatus serviceStatus = - getServiceStatus(getSvcAction(input.getSdncRequestHeader()), getAction(input.getRequestInformation()), - HttpStatus.OK.toString()); + getServiceStatus(getSvcAction(input.getSdncRequestHeader()), + getRequestAction(input.getRequestInformation()), HttpStatus.OK.toString()); return new GenericResourceApiServicemodelinfrastructureService().serviceData(apiServicedataServiceData) .serviceStatus(serviceStatus).serviceInstanceId(serviceInstanceId); } - private String getAction(final GenericResourceApiRequestinformationRequestInformation input) { - return getString(input.getRequestAction(), ""); - } - private String getSvcAction(final GenericResourceApiSdncrequestheaderSdncRequestHeader input) { return input != null ? getStringOrNull(input.getSvcAction()) : null; } @@ -333,7 +377,7 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ return new GenericResourceApiServicestatusServiceStatus().finalIndicator(YES) .rpcAction(GenericResourceApiRpcActionEnumeration.fromValue(rpcAction)) .rpcName(SERVICE_TOPOLOGY_OPERATION).responseTimestamp(LocalDateTime.now().toString()) - .responseCode(responseCode).requestStatus(SYNCCOMPLETE).responseMessage("").action(action); + .responseCode(responseCode).requestStatus(SYNCCOMPLETE).responseMessage(EMPTY_STRING).action(action); } private GenericResourceApiOperStatusData getServiceLevelOperStatus( @@ -351,7 +395,12 @@ public class ServiceOperationsCacheServiceProviderimpl extends AbstractCacheServ } private String getRequestAction(final GenericResourceApiRequestinformationRequestInformation input) { - return input != null ? getStringOrNull(input.getRequestAction()) : null; + return getRequestAction(input, EMPTY_STRING); + } + + private String getRequestAction(final GenericResourceApiRequestinformationRequestInformation input, + final String defaultValue) { + return input != null ? getString(input.getRequestAction(), defaultValue) : defaultValue; } private GenericResourceApiServicetopologyServiceTopology getServiceTopology( diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/utils/ObjectUtils.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/utils/ObjectUtils.java index 833da414..b4d6da38 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/utils/ObjectUtils.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/main/java/org/onap/so/sdncsimulator/utils/ObjectUtils.java @@ -33,7 +33,7 @@ public class ObjectUtils { return getString(obj, null); } - public static String getString(final Object obj, String defaultValue) { + public static String getString(final Object obj, final String defaultValue) { return obj != null ? obj.toString() : defaultValue; } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java index b1ede082..a338283c 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/OperationsControllerTest.java @@ -20,11 +20,13 @@ package org.onap.so.sdncsimulator.controller; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import static org.onap.so.sdncsimulator.controller.TestUtils.getInvalidRequestInput; import static org.onap.so.sdncsimulator.controller.TestUtils.getRequestInput; import static org.onap.so.sdncsimulator.controller.TestUtils.getVnfRequestInput; +import static org.onap.so.sdncsimulator.controller.TestUtils.getVnfRequestWithRequestActionDeleteVnfInput; import static org.onap.so.sdncsimulator.controller.TestUtils.getVnfRequestWithSvcActionActivateInput; import java.util.Optional; import org.junit.After; @@ -306,6 +308,61 @@ public class OperationsControllerTest { } + @Test + public void test_postVnfOperationInformation_successfullyRemoveVnfFromExistingServiceInCache() throws Exception { + final HttpEntity<?> httpEntity = new HttpEntity<>(getRequestInput(), getHttpHeaders()); + final ResponseEntity<OutputRequest> responseEntity = + restTemplate.exchange(getUrl(), HttpMethod.POST, httpEntity, OutputRequest.class); + + assertEquals(HttpStatus.OK, responseEntity.getStatusCode()); + + final HttpEntity<?> httpAddVnfEntity = new HttpEntity<>(getVnfRequestInput(), getHttpHeaders()); + final ResponseEntity<OutputRequest> responseAddVnfEntity = + restTemplate.exchange(getVnfUrl(), HttpMethod.POST, httpAddVnfEntity, OutputRequest.class); + assertEquals(HttpStatus.OK, responseAddVnfEntity.getStatusCode()); + + Optional<GenericResourceApiServicemodelinfrastructureService> serviceOptional = + cacheServiceProvider.getGenericResourceApiServicemodelinfrastructureService(SERVICE_INSTANCE_ID); + assertTrue(serviceOptional.isPresent()); + + GenericResourceApiServicemodelinfrastructureService service = serviceOptional.get(); + assertNotNull(service.getServiceInstanceId()); + assertNotNull(service.getServiceData().getVnfs().getVnf()); + assertNotNull(service.getServiceData()); + assertNotNull(service.getServiceData().getVnfs()); + assertNotNull(service.getServiceData().getVnfs().getVnf()); + assertFalse(service.getServiceData().getVnfs().getVnf().isEmpty()); + + final HttpEntity<?> httpRemoveVnfEntity = + new HttpEntity<>(getVnfRequestWithRequestActionDeleteVnfInput(), getHttpHeaders()); + final ResponseEntity<OutputRequest> responseRemoveVnfEntity = + restTemplate.exchange(getVnfUrl(), HttpMethod.POST, httpRemoveVnfEntity, OutputRequest.class); + assertEquals(HttpStatus.OK, responseRemoveVnfEntity.getStatusCode()); + + final OutputRequest actualOutputRequest = responseRemoveVnfEntity.getBody(); + assertNotNull(actualOutputRequest); + assertNotNull(actualOutputRequest.getOutput()); + + final Output actualObject = actualOutputRequest.getOutput(); + + assertEquals(HttpStatus.OK.toString(), actualObject.getResponseCode()); + assertEquals(Constants.YES, actualObject.getAckFinalIndicator()); + assertEquals(VNF_SVC_REQUEST_ID, actualObject.getSvcRequestId()); + + serviceOptional = + cacheServiceProvider.getGenericResourceApiServicemodelinfrastructureService(SERVICE_INSTANCE_ID); + assertTrue(serviceOptional.isPresent()); + + service = serviceOptional.get(); + assertNotNull(service.getServiceInstanceId()); + assertNotNull(service.getServiceData().getVnfs().getVnf()); + assertNotNull(service.getServiceData()); + assertNotNull(service.getServiceData().getVnfs()); + assertNotNull(service.getServiceData().getVnfs().getVnf()); + assertTrue(service.getServiceData().getVnfs().getVnf().isEmpty()); + + + } private HttpHeaders getHttpHeaders() { return TestUtils.getHttpHeaders(userCredentials.getUsers().iterator().next().getUsername()); diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/TestUtils.java b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/TestUtils.java index 220ec7d3..b43ecf4c 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/TestUtils.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/java/org/onap/so/sdncsimulator/controller/TestUtils.java @@ -45,7 +45,7 @@ public class TestUtils { public static String getVnfRequestInput() throws IOException { return getFileAsString(getFile("test-data/vnfInput.json").toPath()); } - + public static String getVnfRequestWithSvcActionActivateInput() throws IOException { return getFileAsString(getFile("test-data/activateVnfInput.json").toPath()); } @@ -54,6 +54,10 @@ public class TestUtils { return getFileAsString(getFile("test-data/InvalidInput.json").toPath()); } + public static String getVnfRequestWithRequestActionDeleteVnfInput() throws IOException { + return getFileAsString(getFile("test-data/deleteVnfInput.json").toPath()); + } + public static String getFileAsString(final Path path) throws IOException { return new String(Files.readAllBytes(path)); } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/deleteVnfInput.json b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/deleteVnfInput.json new file mode 100644 index 00000000..dda16b5d --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdnc-simulator/src/test/resources/test-data/deleteVnfInput.json @@ -0,0 +1,46 @@ +{ + "input": { + "request-information": { + "request-action": "DeleteVnfInstance", + "source": "MSO", + "request-id": "1a545ea9-2a5e-4df9-9c73-529b1d0b2012" + }, + "sdnc-request-header": { + "svc-request-id": "8fd2622b-01fc-424d-bfc8-f48bcd64e546", + "svc-notification-url": "http://so-bpmn-infra.onap:8081/mso/WorkflowMessage/SDNCCallback/fd40ea09-3245-476a-b6ff-58cb042edb9d", + "svc-action": "UNASSIGN" + }, + "service-information": { + "onap-model-information": { + "model-name": "Sol004Zip4Service", + "model-version": "1.0", + "model-uuid": "99d59273-4450-4034-9141-027f0c1a807a", + "model-invariant-uuid": "51672777-9b8d-4e5e-b488-5f9092e03a82" + }, + "subscription-service-type": "vCPE", + "service-id": "ccece8fe-13da-456a-baf6-41b3a4a2bc2b", + "global-customer-id": "NordixDemoCustomer", + "service-instance-id": "ccece8fe-13da-456a-baf6-41b3a4a2bc2b" + }, + "vnf-information": { + "onap-model-information": { + "model-name": "Sol004Zip3VSP", + "model-version": "1.0", + "model-customization-uuid": "50a90cd7-a84e-4ee1-b5ba-bfa5a26f5e15", + "model-uuid": "84b9649a-4eb9-4967-9abe-e8702f55518b", + "model-invariant-uuid": "b0f14066-2b65-40d2-b5a4-c8f2116fb5fc" + }, + "vnf-id": "dfd02fb5-d7fb-4aac-b3c4-cd6b60058701", + "vnf-name": "EsyVnfInstantiationTest2", + "vnf-type": "Sol004Zip4Service/Sol004Zip3VSP 0" + }, + "vnf-request-input": { + "aic-cloud-region": "nordixcloud", + "cloud-owner": "CloudOwner", + "tenant": "693c7729b2364a26a3ca602e6f66187d", + "vnf-network-instance-group-ids": [], + "vnf-input-parameters": {}, + "vnf-name": "EsyVnfInstantiationTest2" + } + } +}
\ No newline at end of file diff --git a/plans/so/integration-etsi-testing/teardown.sh b/plans/so/integration-etsi-testing/teardown.sh index 61edc7df..e92b7314 100755 --- a/plans/so/integration-etsi-testing/teardown.sh +++ b/plans/so/integration-etsi-testing/teardown.sh @@ -28,12 +28,23 @@ ENV_FILE=$CONFIG_DIR/env TEMP_DIR_PATH=$SCRIPT_HOME/temp TEST_LAB_DIR_PATH=$TEMP_DIR_PATH/test_lab DOCKER_COMPOSE_FILE_PATH=$SCRIPT_HOME/docker-compose.yml +DOCKER_COMPOSE_LOCAL_OVERRIDE_FILE=$SCRIPT_HOME/docker-compose.local.yml echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..." export $(egrep -v '^#' $ENV_FILE | xargs) export TEST_LAB_DIR=$TEST_LAB_DIR_PATH export CONFIG_DIR_PATH=$CONFIG_DIR -docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME down +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 "Finished executing $SCRIPT_HOME/$SCRIPT_NAME" diff --git a/plans/so/vnfm_adapter/docker-compose.yml b/plans/so/vnfm_adapter/docker-compose.yml deleted file mode 100644 index 95195710..00000000 --- a/plans/so/vnfm_adapter/docker-compose.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: '3' -services: -################################################################################ - VNFM-adapter: - image: nexus3.onap.org:10001/onap/so/vnfm-adapter:1.4.4 - ports: - - "9092:9092" - environment: - - APP=VNFM-adapter - - JVM_ARGS=-Xms64m -Xmx512m - hostname: - vnfm-adapter-test - logging: - driver: "json-file" - options: - max-size: "30m" - max-file: "5" -################################################################################ diff --git a/plans/so/vnfm_adapter/setup.sh b/plans/so/vnfm_adapter/setup.sh deleted file mode 100644 index 518358b2..00000000 --- a/plans/so/vnfm_adapter/setup.sh +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/bash -# -# ============LICENSE_START======================================================= -# Copyright (C) 2019 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 -# -# 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========================================================= -# - -export NEXUS_DOCKER_REPO_MSO=nexus3.onap.org:10001 -export TAG=1.4.0-STAGING-latest - -docker-compose pull -docker-compose up -d - -sleep 2m - -REPO_IP='127.0.0.1' -ROBOT_VARIABLES="-v REPO_IP:${REPO_IP}" diff --git a/plans/so/vnfm_adapter/teardown.sh b/plans/so/vnfm_adapter/teardown.sh deleted file mode 100644 index 8b778a57..00000000 --- a/plans/so/vnfm_adapter/teardown.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# -# ============LICENSE_START======================================================= -# Copyright (C) 2019 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 -# -# 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========================================================= -# - -docker-compose down diff --git a/plans/so/vnfm_adapter/testplan.txt b/plans/so/vnfm_adapter/testplan.txt deleted file mode 100644 index 823990af..00000000 --- a/plans/so/vnfm_adapter/testplan.txt +++ /dev/null @@ -1,3 +0,0 @@ -# Test suites are relative paths under [integration/csit.git]/tests/. -# Place the suites in run order. -so/vnfm_adapter/vnfm_adapter_test.robot diff --git a/run-csit.sh b/run-csit.sh index e7457adc..5551d212 100755 --- a/run-csit.sh +++ b/run-csit.sh @@ -18,6 +18,10 @@ # $1 project/functionality # $2 robot options +# +# functions +# + function docker_stats(){ #General memory details echo "> top -bn1 | head -3" @@ -38,6 +42,59 @@ function docker_stats(){ echo } +# save current set options +function save_set() { + RUN_CSIT_SAVE_SET="$-" + RUN_CSIT_SHELLOPTS="$SHELLOPTS" +} + +# load the saved set options +function load_set() { + _setopts="$-" + + # bash shellopts + for i in $(echo "$SHELLOPTS" | tr ':' ' ') ; do + set +o ${i} + done + for i in $(echo "$RUN_CSIT_SHELLOPTS" | tr ':' ' ') ; do + set -o ${i} + done + + # other options + for i in $(echo "$_setopts" | sed 's/./& /g') ; do + set +${i} + done + set -${RUN_CSIT_SAVE_SET} +} + +# set options for quick bailout when error +function harden_set() { + set -xeo pipefail + set +u # enabled it would probably fail too many often +} + +# relax set options so the sourced file will not fail +# the responsibility is shifted to the sourced file... +function relax_set() { + set +e + set +o pipefail +} + +# wrapper for sourcing a file +function source_safely() { + [ -z "$1" ] && return 1 + relax_set + . "$1" + load_set +} + +# +# main +# + +# set and save options for quick failure +harden_set && save_set + if [ $# -eq 0 ] then echo @@ -50,13 +107,13 @@ then fi if [ -z "$WORKSPACE" ]; then - export WORKSPACE=`git rev-parse --show-toplevel` + export WORKSPACE=$(git rev-parse --show-toplevel) fi -rm -rf $WORKSPACE/archives -mkdir -p $WORKSPACE/archives +rm -rf "$WORKSPACE/archives" +mkdir -p "$WORKSPACE/archives" -if [ -f ${WORKSPACE}/${1}/testplan.txt ]; then +if [ -f "${WORKSPACE}/${1}/testplan.txt" ]; then export TESTPLAN="${1}" else echo "testplan not found: ${WORKSPACE}/${TESTPLAN}/testplan.txt" @@ -65,67 +122,64 @@ fi export TESTOPTIONS="${2}" -TESTPLANDIR=${WORKSPACE}/${TESTPLAN} +TESTPLANDIR="${WORKSPACE}/${TESTPLAN}" # Run installation of prerequired libraries -source ${WORKSPACE}/prepare-csit.sh +source_safely "${WORKSPACE}/prepare-csit.sh" # Activate the virtualenv containing all the required libraries installed by prepare-csit.sh -source "${ROBOT_VENV}/bin/activate" - -WORKDIR=`mktemp -d --suffix=-robot-workdir` -cd ${WORKDIR} +source_safely "${ROBOT_VENV}/bin/activate" -set +u -set -x +WORKDIR=$(mktemp -d --suffix=-robot-workdir) +cd "${WORKDIR}" # Add csit scripts to PATH -export PATH=${PATH}:${WORKSPACE}/docker/scripts:${WORKSPACE}/scripts:${ROBOT_VENV}/bin -export SCRIPTS=${WORKSPACE}/scripts +export PATH="${PATH}:${WORKSPACE}/docker/scripts:${WORKSPACE}/scripts:${ROBOT_VENV}/bin" +export SCRIPTS="${WORKSPACE}/scripts" export ROBOT_VARIABLES= # Sign in to nexus3 docker repo docker login -u anonymous -p anonymous nexus3.onap.org:10001 # Run setup script plan if it exists -cd ${TESTPLANDIR} -SETUP=${TESTPLANDIR}/setup.sh -if [ -f ${SETUP} ]; then +cd "${TESTPLANDIR}" +SETUP="${TESTPLANDIR}/setup.sh" +if [ -f "${SETUP}" ]; then echo "Running setup script ${SETUP}" - source ${SETUP} + source_safely "${SETUP}" fi # show memory consumption after all docker instances initialized -docker_stats | tee $WORKSPACE/archives/_sysinfo-1-after-setup.txt +docker_stats | tee "$WORKSPACE/archives/_sysinfo-1-after-setup.txt" # Run test plan -cd $WORKDIR +cd "$WORKDIR" echo "Reading the testplan:" -cat ${TESTPLANDIR}/testplan.txt | egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' | sed "s|^|${WORKSPACE}/tests/|" > testplan.txt +cat "${TESTPLANDIR}/testplan.txt" | egrep -v '(^[[:space:]]*#|^[[:space:]]*$)' | sed "s|^|${WORKSPACE}/tests/|" > testplan.txt cat testplan.txt SUITES=$( xargs -a testplan.txt ) -echo ROBOT_VARIABLES=${ROBOT_VARIABLES} +echo ROBOT_VARIABLES="${ROBOT_VARIABLES}" echo "Starting Robot test suites ${SUITES} ..." -set +e +relax_set python -m robot.run -N ${TESTPLAN} -v WORKSPACE:/tmp ${ROBOT_VARIABLES} ${TESTOPTIONS} ${SUITES} RESULT=$? -set -e -echo "RESULT: " $RESULT -rsync -av $WORKDIR/ $WORKSPACE/archives +load_set +echo "RESULT: $RESULT" +rsync -av "$WORKDIR/" "$WORKSPACE/archives" # Record list of active docker containers -docker ps --format "{{.Image}}" > $WORKSPACE/archives/_docker-images.log +docker ps --format "{{.Image}}" > "$WORKSPACE/archives/_docker-images.log" # show memory consumption after all docker instances initialized -docker_stats | tee $WORKSPACE/archives/_sysinfo-2-after-robot.txt +docker_stats | tee "$WORKSPACE/archives/_sysinfo-2-after-robot.txt" # Run teardown script plan if it exists -cd ${TESTPLANDIR} -TEARDOWN=${TESTPLANDIR}/teardown.sh -if [ -f ${TEARDOWN} ]; then +cd "${TESTPLANDIR}" +TEARDOWN="${TESTPLANDIR}/teardown.sh" +if [ -f "${TEARDOWN}" ]; then echo "Running teardown script ${TEARDOWN}" - source ${TEARDOWN} + source_safely "${TEARDOWN}" fi # TODO: do something with the output diff --git a/scripts/clamp/clone_clamp_and_change_dockercompose.sh b/scripts/clamp/clone_clamp_and_change_dockercompose.sh index 0c30b26a..afd60e78 100755 --- a/scripts/clamp/clone_clamp_and_change_dockercompose.sh +++ b/scripts/clamp/clone_clamp_and_change_dockercompose.sh @@ -39,5 +39,4 @@ sed -i '/image: onap\/clamp-backend/c\ image: nexus3.onap.org:10001\/onap\/cl sed -i '/image: onap\/clamp-frontend/c\ image: nexus3.onap.org:10001\/onap\/clamp-frontend:4.1-STAGING-latest' docker-compose.yml # Add the sql to create template so it is played by docker-compose later -cp ../../../src/test/resources/sql/loop-examples.sql ../../sql/bulkload/ -echo 'mysql -uroot -p$MYSQL_ROOT_PASSWORD -f < loop-examples.sql' >> ../../sql/load-sql-files-tests-automation.sh +echo '/docker-entrypoint-initdb.d/dump/load-fake-data.sh' >> $WORKSPACE/archives/clamp-clone/clamp/extra/sql/bootstrap-database.sh diff --git a/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-kill.sh b/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-kill.sh index 491b6405..205a6009 100755 --- a/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-kill.sh +++ b/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-kill.sh @@ -1,4 +1,4 @@ #!/bin/bash - -docker kill dfc_app0
\ No newline at end of file +docker exec -i dfc_app0 cat /var/log/ONAP/application.log +docker kill dfc_app0 diff --git a/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh b/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh index 68e0745d..808b0b17 100755 --- a/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh +++ b/scripts/dcaegen2-collectors-datafile/dfc-management/dfc-start.sh @@ -17,7 +17,6 @@ for i in {1..10}; do if [ $(docker inspect --format '{{ .State.Running }}' $DFC_APP) ] then echo "DFC app Running" - # enable TRACE logging of DFC docker exec $DFC_APP /bin/sh -c " sed -i 's/org.onap.dcaegen2.collectors.datafile: WARN/org.onap.dcaegen2.collectors.datafile: TRACE/g' /opt/app/datafile/config/application.yaml" diff --git a/scripts/dcaegen2-collectors-datafile/dfc-management/docker-compose.yml b/scripts/dcaegen2-collectors-datafile/dfc-management/docker-compose.yml index 9738bcde..9e15ccf0 100644 --- a/scripts/dcaegen2-collectors-datafile/dfc-management/docker-compose.yml +++ b/scripts/dcaegen2-collectors-datafile/dfc-management/docker-compose.yml @@ -6,8 +6,7 @@ networks: services: dfc: #image fron Nexus - #image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.datafile.datafile-app-server:latest - image: yanhuanwang/dfc:latest + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.collectors.datafile.datafile-app-server:latest #local image for test purposes #image: org.onap.dcaegen2.collectors.datafile.datafile-app-server:latest container_name: dfc_app0 diff --git a/scripts/policy/drools-pdp-script.sh b/scripts/policy/drools-pdp-script.sh index fc8556ff..6e14931f 100755 --- a/scripts/policy/drools-pdp-script.sh +++ b/scripts/policy/drools-pdp-script.sh @@ -37,8 +37,12 @@ fi # bring down maven mkdir maven cd maven -curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz -tar -xzvf apache-maven-3.3.9-bin.tar.gz +# download maven from automatically selected mirror server +curl -vLO "https://www.apache.org/dyn/mirrors/mirrors.cgi?cca2=us&preferred=http://apache.claz.org/&action=download&filename=maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" +if ! tar -xzvf apache-maven-3.3.9-bin.tar.gz ; then + echo "Installation of maven has failed!" + exit 1 +fi ls -l export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v diff --git a/scripts/policy/engine.sh b/scripts/policy/engine.sh index ef02be5a..3e9f3d42 100755 --- a/scripts/policy/engine.sh +++ b/scripts/policy/engine.sh @@ -37,8 +37,12 @@ fi # bring down maven mkdir maven cd maven -curl -O http://apache.claz.org/maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz -tar -xzvf apache-maven-3.3.9-bin.tar.gz +# download maven from automatically selected mirror server +curl -vLO "https://www.apache.org/dyn/mirrors/mirrors.cgi?cca2=us&preferred=http://apache.claz.org/&action=download&filename=maven/maven-3/3.3.9/binaries/apache-maven-3.3.9-bin.tar.gz" +if ! tar -xzvf apache-maven-3.3.9-bin.tar.gz ; then + echo "Installation of maven has failed!" + exit 1 +fi ls -l export PATH=${PATH}:${WORK_DIR}/maven/apache-maven-3.3.9/bin ${WORK_DIR}/maven/apache-maven-3.3.9/bin/mvn -v diff --git a/scripts/sdc/setup_sdc_for_sanity.sh b/scripts/sdc/setup_sdc_for_sanity.sh index 603bd457..562c26d1 100644 --- a/scripts/sdc/setup_sdc_for_sanity.sh +++ b/scripts/sdc/setup_sdc_for_sanity.sh @@ -6,7 +6,22 @@ function usage { echo "setup sdc and run ui test suite: setup_sdc_for_sanity.sh tud" } -set -x +# returns 0: if SDC_LOCAL_IMAGES is set to true value +# returns 1: otherwise +function using_local_images { + SDC_LOCAL_IMAGES=$(echo "${SDC_LOCAL_IMAGES}" | tr '[:upper:]' '[:lower:]') + + case "$SDC_LOCAL_IMAGES" in + 1|yes|true|Y) + return 0 + ;; + esac + + return 1 +} + +# fail quick if error +set -exo pipefail echo "This is ${WORKSPACE}/scripts/sdc/setup_sdc_for_sanity.sh" @@ -21,7 +36,17 @@ mkdir -p ${WORKSPACE}/data/environments/ mkdir -p ${WORKSPACE}/data/clone/ cd ${WORKSPACE}/data/clone -git clone --depth 1 http://gerrit.onap.org/r/sdc -b ${GERRIT_BRANCH} +if using_local_images && [ -n "$SDC_LOCAL_GITREPO" ] ; then + if [ -d "$SDC_LOCAL_GITREPO" ] ; then + rm -rf ./sdc + cp -a "$SDC_LOCAL_GITREPO" ./sdc + else + echo "[ERROR]: Local git repo for sdc does not exist: ${SDC_LOCAL_GITREPO}" + exit 1 + fi +else + git clone --depth 1 http://gerrit.onap.org/r/sdc -b ${GERRIT_BRANCH} +fi chmod -R 777 ${WORKSPACE}/data/clone @@ -47,39 +72,29 @@ cp ${WORKSPACE}/data/clone/sdc/sdc-os-chef/scripts/docker_run.sh ${WORKSPACE}/sc source ${WORKSPACE}/data/clone/sdc/version.properties export RELEASE=$major.$minor-STAGING-latest -${WORKSPACE}/scripts/sdc/docker_run.sh -r ${RELEASE} -e ${ENV_NAME} -p 10001 -${TEST_SUITE} - -sleep 120 - -#monitor test processes - -TIME_OUT=1200 -INTERVAL=20 -TIME=0 -CID=`docker ps | grep tests | awk '{print $1}'` - -while [ "$TIME" -lt "$TIME_OUT" ]; do - -PID=`docker exec -i $CID ps -ef | grep java | awk '{print $1}'` - -echo sanity PID is -- $PID - -if [ -z "$PID" ] - then - echo SDC sanity finished in $TIME seconds - break - fi - - echo Sleep: $INTERVAL seconds before testing if SDC sanity completed. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds - sleep $INTERVAL - TIME=$(($TIME+$INTERVAL)) -done - -if [ "$TIME" -ge "$TIME_OUT" ] - then - echo TIME OUT: SDC sanity was NOT completed in $TIME_OUT seconds... Could cause problems for tests... +if using_local_images ; then + if [ -n "$SDC_LOCAL_TAG" ] ; then + RELEASE="$SDC_LOCAL_TAG" + elif [ -z "$SDC_LOCAL_GITREPO" ] ; then + echo "[WARNING]: Local images used but no tag and no source (git repo) provided for them - we will use tag 'latest'" + RELEASE=latest + fi + + echo "[INFO]: We will use the locally built images (tag: ${RELEASE})" + ${WORKSPACE}/scripts/sdc/docker_run.sh \ + --local \ + -r ${RELEASE} \ + -e ${ENV_NAME} \ + -p 10001 -${TEST_SUITE} +else + echo "[INFO]: We will download images from the default registry (tag: ${RELEASE})" + ${WORKSPACE}/scripts/sdc/docker_run.sh \ + -r ${RELEASE} \ + -e ${ENV_NAME} \ + -p 10001 -${TEST_SUITE} fi - - +# This file is sourced in another script which is out of our control... +set +e +set +o pipefail diff --git a/tests/clamp/APIs/01__Test_CL_APIs.robot b/tests/clamp/APIs/01__Test_CL_APIs.robot index 3edccefd..9fb9d06d 100644 --- a/tests/clamp/APIs/01__Test_CL_APIs.robot +++ b/tests/clamp/APIs/01__Test_CL_APIs.robot @@ -27,21 +27,20 @@ List TCAs Should Contain Match ${resp} *Name1_tca_3* Open TCA1 - ${resp}= Get Request ${clamp_session} /restservices/clds/v2/loop/LOOP_ejh5S_v1_0_ResourceInstanceName1_tca + ${resp}= Get Request ${clamp_session} /restservices/clds/v2/loop/LOOP_yHsgu_v1_0_ResourceInstanceName1_tca Should Contain Match ${resp} *Name1_tca* Should Contain Match ${resp} *Operational Policy Item* Should Contain Match ${resp} *Operational policies* - Should Contain Match ${resp} *Micro Service policies UPDATED* Open TCA2 - ${resp}= Get Request ${clamp_session} /restservices/clds/v2/loop/LOOP_ejh5S_v1_0_ResourceInstanceName2_tca_2 + ${resp}= Get Request ${clamp_session} /restservices/clds/v2/loop/LOOP_yHsgu_v1_0_ResourceInstanceName2_tca_2 Should Contain Match ${resp} *Name2_tca_2* Should Contain Match ${resp} *Operational Policy Item* Should Contain Match ${resp} *1004* Should Contain Match ${resp} *TCA Policy Scope* Open TCA3 - ${resp}= Get Request ${clamp_session} /restservices/clds/v2/loop/LOOP_ejh5S_v1_0_ResourceInstanceName1_tca_3 + ${resp}= Get Request ${clamp_session} /restservices/clds/v2/loop/LOOP_yHsgu_v1_0_ResourceInstanceName1_tca_3 Should Contain Match ${resp} *Name1_tca_3* Should Contain Match ${resp} *Operational Policy Item* Should Contain Match ${resp} *1004* diff --git a/tests/clamp/UIs/01__Open_And_Edit_TCA.robot b/tests/clamp/UIs/01__Open_And_Edit_TCA.robot index edf54e81..114c1d46 100644 --- a/tests/clamp/UIs/01__Open_And_Edit_TCA.robot +++ b/tests/clamp/UIs/01__Open_And_Edit_TCA.robot @@ -10,7 +10,7 @@ ${login} admin ${passw} password ${SELENIUM_SPEED_FAST} 1 seconds ${SELENIUM_SPEED_SLOW} 2 seconds -${BASE_URL} https://localhost:8443 +${BASE_URL} https://localhost:443 *** Keywords *** Create the sessions ${auth}= Create List ${login} ${passw} @@ -26,7 +26,7 @@ Open Browser # Next line is to be enabled for Headless tests only (jenkins?). To see the tests disable the line. Start Virtual Display 1920 1080 Set Selenium Speed ${SELENIUM_SPEED_SLOW} - Open Browser ${BASE_URL}/designer/index.html browser=firefox + Open Browser ${BASE_URL}/index.html browser=firefox Reply to authentication popup Run Keyword And Ignore Error Insert into prompt ${login} ${passw} diff --git a/tests/clamp/UIs/02__Verify_Modification_In_UI.robot b/tests/clamp/UIs/02__Verify_Modification_In_UI.robot index 84ea22e8..d50d7976 100644 --- a/tests/clamp/UIs/02__Verify_Modification_In_UI.robot +++ b/tests/clamp/UIs/02__Verify_Modification_In_UI.robot @@ -21,8 +21,6 @@ Get Requests health check ok Should Be Equal As Strings ${resp.status_code} 200 Open TCA1 - ${resp}= Get Request ${clamp_session} /restservices/clds/v2/loop/LOOP_ejh5S_v1_0_ResourceInstanceName1_tca + ${resp}= Get Request ${clamp_session} /restservices/clds/v2/loop/LOOP_yHsgu_v1_0_ResourceInstanceName1_tca Should Contain Match ${resp} *Name1_tca* Should Contain Match ${resp} *Operational Policy* - Should Contain Match ${resp} *Micro Service policies UPDATED* - Should Contain Match ${resp} *POLICY SUBMIT request* diff --git a/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-suite/FuncSingleFile.robot b/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-suite/FuncSingleFile.robot index 823a9b27..3f8be179 100755 --- a/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-suite/FuncSingleFile.robot +++ b/tests/dcaegen2-collectors-datafile/testsuites/Functional-Single-File-suite/FuncSingleFile.robot @@ -32,12 +32,12 @@ Verify single event with single 1MB SFTP file. From event poll to published file Set Environment Variable FTP_TYPE SFTP Set Environment Variable NUM_FTP_SERVERS 1 Set Environment Variable DR_FEEDS 2:A - Set Environment Variable DRR_SIM_IP drsim_redir + Set Environment Variable DR_REDIR_SIM drsim_redir Set Environment Variable SFTP_SIMS sftp-server0:22 Set Environment Variable FTPS_SIMS ftpes-server-vsftpd0:21 ${cli_cmd_output}= Run Process ./simulators-start.sh cwd=${SIMGROUP_ROOT} - Log To Console Simulator-start: + Log To Console Simulator-start: Log To Console ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} MR Sim Emitted Files Equal 0 #Verify 0 file emitted from MR sim DR Sim Published Files Equal 0 #Verify 0 file published to DR sim @@ -66,9 +66,9 @@ Verify single event with single 1MB SFTP file. From event poll to published file DR Redir Sim Downloaded Volume Equal 1 000 000 #Verify 1 000 000 bytes published file data in DR redir sim ${cli_cmd_output}= Run Process ${SIMGROUP_ROOT}/simulators-kill.sh - Log ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} + Log To Console ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} ${cli_cmd_output}= Run Process ${DFC_ROOT}/dfc-kill.sh - Log ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} + Log To Console ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} Verify single event with single 5MB SFTP file. From event poll to published file [TAGS] DFC_FUNCTIONAL_2 @@ -88,7 +88,7 @@ Verify single event with single 5MB SFTP file. From event poll to published file Set Environment Variable FTP_TYPE SFTP Set Environment Variable NUM_FTP_SERVERS 1 Set Environment Variable DR_FEEDS 2:A - Set Environment Variable DRR_SIM_IP drsim_redir + Set Environment Variable DR_REDIR_SIM drsim_redir Set Environment Variable SFTP_SIMS sftp-server0:22 Set Environment Variable FTPS_SIMS ftpes-server-vsftpd0:21 @@ -121,15 +121,15 @@ Verify single event with single 5MB SFTP file. From event poll to published file DR Redir Sim Downloaded Volume Equal 5 000 000 #Verify 5 000 000 bytes published file data in DR redir sim ${cli_cmd_output}= Run Process ${SIMGROUP_ROOT}/simulators-kill.sh - Log ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} + Log To Console ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} ${cli_cmd_output}= Run Process ${DFC_ROOT}/dfc-kill.sh - Log ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} + Log To Console ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} ${cli_cmd_output}= Run Process docker stop $(docker ps -aq) shell=yes - Log ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} + Log To Console ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} ${cli_cmd_output}= Run Process docker rm $(docker ps -aq) shell=yes - Log ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} + Log To Console ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} Sleep 10 @@ -150,7 +150,7 @@ Verify single event with single 50MB SFTP file. From event poll to published fil Set Environment Variable FTP_TYPE SFTP Set Environment Variable NUM_FTP_SERVERS 1 Set Environment Variable DR_FEEDS 2:A - Set Environment Variable DRR_SIM_IP drsim_redir + Set Environment Variable DR_REDIR_SIM drsim_redir Set Environment Variable SFTP_SIMS sftp-server0:22 Set Environment Variable FTPS_SIMS ftpes-server-vsftpd0:21 @@ -183,9 +183,9 @@ Verify single event with single 50MB SFTP file. From event poll to published fil DR Redir Sim Downloaded Volume Equal 50 000 000 #Verify 50 000 000 bytes published file data in DR redir sim ${cli_cmd_output}= Run Process ${SIMGROUP_ROOT}/simulators-kill.sh - Log ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} + Log To Console ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} ${cli_cmd_output}= Run Process ${DFC_ROOT}/dfc-kill.sh - Log ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} + Log To Console ${cli_cmd_output.stdout} ${cli_cmd_output.stderr} ######### Single file, FTPS # Temporarily removed due to issues with the certificates for the ftsp server simulator cert. diff --git a/tests/dcaegen2/prh-testcases/resources/prh_library.robot b/tests/dcaegen2/prh-testcases/resources/prh_library.robot index 80017349..1e6d3105 100644 --- a/tests/dcaegen2/prh-testcases/resources/prh_library.robot +++ b/tests/dcaegen2/prh-testcases/resources/prh_library.robot @@ -154,7 +154,7 @@ Add service instance entry in AAI [Arguments] ${aai_service_instance} ${headers}= Create Dictionary Accept=application/json Content-Type=application/json Log AAI url ${AAI_SIMULATOR_SETUP_URL} - ${resp}= Put Request ${aai_session} /setup/add_service_instace headers=${suite_headers} data=${aai_service_instance} + ${resp}= Put Request ${aai_session} /setup/add_service_instance headers=${suite_headers} data=${aai_service_instance} Should Be Equal As Strings ${resp.status_code} 200 Add logical link entry in AAI diff --git a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py index 0886434e..eeb08265 100644 --- a/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py +++ b/tests/dcaegen2/prh-testcases/resources/simulator/AAI.py @@ -54,12 +54,12 @@ class AAISetup(BaseHTTPRequestHandler): httpServerLib.set_response_200_ok(self) logger.debug('AAISetup PUT /setup/add_pnf_entry [' + pnf_name + '] -> 200 OK') - elif re.search('/setup/add_service_instace', self.path): + elif re.search('/setup/add_service_instance', self.path): service_instance_payload = httpServerLib.get_payload(self) global service_instance service_instance = json.loads(service_instance_payload) httpServerLib.set_response_200_ok(self) - logger.debug('AAISetup PUT /setup/add_service_instace -> 200 OK') + logger.debug('AAISetup PUT /setup/add_service_instance -> 200 OK') elif re.search('/setup/add_logical_link', self.path): logical_link_payload = httpServerLib.get_payload(self) logical_link_name = json.loads(logical_link_payload).get("link-name") @@ -124,9 +124,9 @@ class AAIHandler(BaseHTTPRequestHandler): else: httpServerLib.set_response_404_not_found(self) logger.info('AAIHandler GET /aai/v12/network/logical-links/logical-link/' + logical_link_name + ' -> 404 Not found, actual link: ' + created_logical_link) - elif re.search('aai/v12/network/pnfs/pnf/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service', self.path): + elif re.search('aai/v12/network/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service', self.path): httpServerLib.set_response_200_ok(self, payload = json.dumps(service_instance).encode('utf-8')) - logger.debug('AAIHandler GET aai/v12/network/pnfs/pnf/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service -> 200 OK') + logger.debug('AAIHandler GET aai/v12/network/business/customers/customer/Demonstration/service-subscriptions/service-subscription/vFW/service-instances/service-instance/bbs_service -> 200 OK') else: httpServerLib.set_response_404_not_found(self) logger.info('AAIHandler GET ' + self.path + ' -> 404 Not found') diff --git a/tests/so/etsi/data/distributeServiceTemplate.json b/tests/so/etsi/data/distributeServiceTemplate.json index 11b98807..47a9f21b 100644 --- a/tests/so/etsi/data/distributeServiceTemplate.json +++ b/tests/so/etsi/data/distributeServiceTemplate.json @@ -20,7 +20,7 @@ { "artifactName": "manualdistributiontestvnf0_modules.json", "artifactType": "VF_MODULES_METADATA", - "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/manualdistributiontestvnf0_modules.json", + "artifactURL": "/unzipped_sdc_csar/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/manualdistributiontestvnf0_modules.json", "artifactChecksum": "NTc0NDlkNzdmYzVmMDM3ZjMxMTE2NDBmYWJiMDM1NzY\u003d", "artifactDescription": "Auto-generated VF Modules information artifact", "artifactTimeout": 120, @@ -31,7 +31,7 @@ { "artifactName": "base_ves_med1.yaml", "artifactType": "HEAT", - "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/base_ves_med1.yaml", + "artifactURL": "/unzipped_sdc_csar/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/base_ves_med1.yaml", "artifactChecksum": "YTAwNTQ3NjczY2Y5MmUwZjUzZTY1ZjNhNTA0NGQyMDY\u003d", "artifactDescription": "created from csar", "artifactTimeout": 120, @@ -40,7 +40,7 @@ "generatedArtifact": { "artifactName": "base_ves_med1.env", "artifactType": "HEAT_ENV", - "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/base_ves_med1.env", + "artifactURL": "/unzipped_sdc_csar/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/base_ves_med1.env", "artifactChecksum": "Mjg5YTVhNTlmYTdjYTFlYjYxMDlhODYzNmJhZGJiZGE\u003d", "artifactDescription": "Auto-generated HEAT Environment deployment artifact", "artifactTimeout": 120, @@ -53,7 +53,7 @@ { "artifactName": "base_ves_med1.env", "artifactType": "HEAT_ENV", - "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/base_ves_med1.env", + "artifactURL": "/unzipped_sdc_csar/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/base_ves_med1.env", "artifactChecksum": "Mjg5YTVhNTlmYTdjYTFlYjYxMDlhODYzNmJhZGJiZGE\u003d", "artifactDescription": "Auto-generated HEAT Environment deployment artifact", "artifactTimeout": 120, @@ -64,7 +64,7 @@ { "artifactName": "TOSCA.meta", "artifactType": "OTHER", - "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/TOSCA.meta", + "artifactURL": "/unzipped_sdc_csar/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/TOSCA.meta", "artifactChecksum": "NWE2ODcyOWY0NGI2MzEyOGViYjUxNTEwMjU5OWRhZmI\u003d", "artifactDescription": "created from csar", "artifactTimeout": 120, @@ -75,7 +75,7 @@ { "artifactName": "descriptor.yaml", "artifactType": "OTHER", - "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/descriptor.yaml", + "artifactURL": "/unzipped_sdc_csar/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/descriptor.yaml", "artifactChecksum": "YWZkNTg2ZGMzZjRhZjgxNzNkODJiNjgwZmRlZjlmNDE\u003d", "artifactDescription": "created from csar", "artifactTimeout": 120, @@ -90,7 +90,7 @@ { "artifactName": "service-Manualdistributiontestservice-csar.csar", "artifactType": "TOSCA_CSAR", - "artifactURL": "/sdc/v1/catalog/services/Manualdistributiontestservice/1.0/artifacts/service-Manualdistributiontestservice-csar.csar", + "artifactURL": "/unzipped_sdc_csar/v1/catalog/services/Manualdistributiontestservice/1.0/artifacts/service-Manualdistributiontestservice-csar.csar", "artifactChecksum": "YWYxNmUxNTlhMmE3MjA1NGVhNTBhYTdkMmU0OTZjNzM\u003d", "artifactDescription": "TOSCA definition package of the asset", "artifactTimeout": 0, @@ -100,4 +100,3 @@ ], "workloadContext": "Production" } - diff --git a/tests/so/etsi/etsi_tests.robot b/tests/so/etsi/etsi_tests.robot index 4459c07a..bfa23317 100644 --- a/tests/so/etsi/etsi_tests.robot +++ b/tests/so/etsi/etsi_tests.robot @@ -12,7 +12,7 @@ ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}= 48 # Represents the maximum number o Distribute Service Template Create Session sdc_controller_session http://${REPO_IP}:8085 ${data}= Get Binary File ${CURDIR}${/}data${/}distributeServiceTemplate.json - &{headers}= Create Dictionary Authorization=Basic bXNvX2FkbWluOnBhc3N3b3JkMSQ= resource-location=/distribution-test-zip/unzipped Content-Type=application/json Accept=application/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} Run Keyword If '${resp.status_code}' == '200' log to console \nexecuted with expected result Should Be Equal As Strings '${resp.status_code}' '200' diff --git a/tests/so/orchestration/assets/templates/aai/add_customer_required_fields.template b/tests/so/orchestration/assets/templates/aai/add_customer_required_fields.template new file mode 100644 index 00000000..1e008102 --- /dev/null +++ b/tests/so/orchestration/assets/templates/aai/add_customer_required_fields.template @@ -0,0 +1,5 @@ +{ + "global-customer-id": "${global_customer_id}", + "subscriber-name": "${subscriber_name}", + "subscriber-type": "${subscriber_type}" +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/aai/service_model.template b/tests/so/orchestration/assets/templates/aai/service_model.template new file mode 100644 index 00000000..bc31dece --- /dev/null +++ b/tests/so/orchestration/assets/templates/aai/service_model.template @@ -0,0 +1,14 @@ +{ + "model-invariant-id": "${modelInvariantId}", + "model-type": "${modelType}", + "model-vers": { + "model-ver": [ + { + "model-version-id": "${modelVersionId}", + "model-name": "${modelName}", + "model-version": "${modelVersion}", + "model-description": "${modelDescription}" + } + ] + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/aai/service_subscription_required_fields.template b/tests/so/orchestration/assets/templates/aai/service_subscription_required_fields.template new file mode 100644 index 00000000..29503028 --- /dev/null +++ b/tests/so/orchestration/assets/templates/aai/service_subscription_required_fields.template @@ -0,0 +1,3 @@ +{ + "service-type": "${service_type}" +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/ServiceInstance.template b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/ServiceInstance.template new file mode 100644 index 00000000..a573a77f --- /dev/null +++ b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/ServiceInstance.template @@ -0,0 +1,35 @@ +{ + "requestDetails": { + "requestInfo": { + "productFamilyId": "${productFamilyId}", + "instanceName": "${instanceName}", + "source": "VID", + "suppressRollback": false, + "requestorId": "ROBOT" + }, + "modelInfo": { + "modelType": "${serviceInstModelType}", + "modelInvariantId": "${serviceInstModelInvariantId}", + "modelVersionId": "${serviceInstModelNameVersionId}", + "modelName": "${serviceInstModelName}", + "modelVersion": "${serviceInstModelVersion}" + }, + "project": { + "projectName": "${projectName}" + }, + "owningEntity": { + "owningEntityId": "${owningEntityId}", + "owningEntityName": "${owningEntityName}" + }, + "requestParameters": { + "testApi": "${testApi}", + "userParams": [], + "subscriptionServiceType": "${serviceType}", + "aLaCarte": ${aLaCarteFlag} + }, + "subscriberInfo": { + "globalSubscriberId": "${subscriberId}", + "subscriberName": "${subscriberId}" + } + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/VfModule.template b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/VfModule.template new file mode 100644 index 00000000..6a5f6d67 --- /dev/null +++ b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/VfModule.template @@ -0,0 +1,56 @@ +{ + "requestDetails": { + "requestInfo": { + "instanceName": "${vfModuleName}", + "source": "VID", + "suppressRollback": false, + "requestorId": "az2016" + }, + "modelInfo": { + "modelType": "${vfModelType}", + "modelInvariantId": "${vfModelInvariantId}", + "modelVersionId": "${vfModelversionId}", + "modelName": "${vfModelName}", + "modelVersion": "${vfModelVersion}", + "modelCustomizationId": "${vfModelCustomizationId}" + }, + "requestParameters": { + "testApi": "${testApi}", + "aLaCarte": "${alaCarte}", + "userParams": [] + }, + "cloudConfiguration": { + "lcpCloudRegionId": "${vfLcpCloudRegionId}", + "tenantId": "${vfTenantId}", + "cloudOwner": "${cloudOwner}" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "${serviceInstanceId}", + "modelInfo": { + "modelType": "${serviceInstModelType}", + "modelInvariantId": "${serviceInstModelInvariantId}", + "modelVersionId": "${serviceInstModelNameVersionId}", + "modelName": "${serviceInstModelName}", + "modelVersion": "${serviceInstModelVersion}" + } + } + }, + { + "relatedInstance": { + "instanceId": "${vnfId}", + "modelInfo": { + "modelType": "${vnfModelType}", + "modelName": "${vnfModelName}", + "modelInvariantId": "${vnfModelInvariantId}", + "modelVersion": "${vnfModelVersion}", + "modelVersionId": "${vnfModelversionId}", + "modelCustomizationName": "${vnfModelCustomizationName}", + "modelCustomizationId": "${vnfModelcustomizationId}" + } + } + } + ] + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/VfModuleWithVolume.template b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/VfModuleWithVolume.template new file mode 100644 index 00000000..424d526a --- /dev/null +++ b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/VfModuleWithVolume.template @@ -0,0 +1,69 @@ +{ + "requestDetails": { + "requestInfo": { + "instanceName": "${vfModuleName}", + "source": "VID", + "suppressRollback": false, + "requestorId": "az2016" + }, + "modelInfo": { + "modelType": "${vfModelType}", + "modelInvariantId": "${vfModelInvariantId}", + "modelVersionId": "${vfModelversionId}", + "modelName": "${vfModelName}", + "modelVersion": "${vfModelVersion}", + "modelCustomizationId": "${vfModelCustomizationId}" + }, + "requestParameters": { + "testApi": "${testApi}", + "aLaCarte": "${alaCarte}", + "userParams": [] + }, + "cloudConfiguration": { + "lcpCloudRegionId": "${vfLcpCloudRegionId}", + "cloudOwner": "${cloudOwner}", + "tenantId": "${vfTenantId}" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "${serviceInstanceId}", + "modelInfo": { + "modelType": "${serviceInstModelType}", + "modelInvariantId": "${serviceInstModelInvariantId}", + "modelVersionId": "${serviceInstModelNameVersionId}", + "modelName": "${serviceInstModelName}", + "modelVersion": "${serviceInstModelVersion}" + } + } + }, + { + "relatedInstance": { + "instanceId": "${vnfId}", + "modelInfo": { + "modelType": "${vnfModelType}", + "modelName": "${vnfModelName}", + "modelInvariantId": "${vnfModelInvariantId}", + "modelVersion": "${vnfModelVersion}", + "modelVersionId": "${vnfModelversionId}", + "modelCustomizationName": "${vnfModelCustomizationName}", + "modelCustomizationId": "${vnfModelcustomizationId}" + } + } + }, + { + "relatedInstance": { + "instanceId": "${volumeGroupId}", + "modelInfo": { + "modelType": "${volumeGroupModelType}", + "modelName": "${volumeGroupModelName}", + "modelInvariantId": "${volumeGroupModelInvariantId}", + "modelVersion": "${volumeGroupModelVersion}", + "modelVersionId": "${volumeGroupModelversionId}", + "modelCustomizationId": "${volumeGroupModelCustomizationId}" + } + } + } + ] + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/Vnf.json b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/Vnf.json new file mode 100644 index 00000000..7e11dbe7 --- /dev/null +++ b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/Vnf.json @@ -0,0 +1,49 @@ +{ + "requestDetails": { + "requestInfo": { + "instanceName": "${vnfInstanceName}", + "source": "VID", + "suppressRollback": false, + "productFamilyId": "${productfamilyid}", + "requestorId": "ROBOT" + }, + "modelInfo": { + "modelType": "${vnfModelType}", + "modelInvariantId": "${vnfModelInvariantId}", + "modelName": "${vnfModelName}", + "modelVersionId": "${vnfModelversionId}", + "modelVersion": "${vnfModelVersion}", + "modelCustomizationName": "${vnfModelCustomizationName}", + "modelCustomizationId": "${vnfModelcustomizationId}" + }, + "requestParameters": { + "testApi": "${testApi}", + "userParams": [] + }, + "cloudConfiguration": { + "lcpCloudRegionId": "${vnfLcpCloudRegionid}", + "cloudOwner": "${cloudOwner}", + "tenantId": "${vnfTenantId}" + }, + "platform": { + "platformName": "${platformName}" + }, + "lineOfBusiness": { + "lineOfBusinessName": "${lineOfBusinessName}" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "${serviceInstanceId}", + "modelInfo": { + "modelType": "${serviceInstModelType}", + "modelInvariantId": "${serviceInstModelInvariantId}", + "modelVersionId": "${serviceInstModelNameVersionId}", + "modelName": "${serviceInstModelName}", + "modelVersion": "${serviceInstModelVersion}" + } + } + } + ] + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/VolumeGroup.template b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/VolumeGroup.template new file mode 100644 index 00000000..d117e28d --- /dev/null +++ b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Create/VolumeGroup.template @@ -0,0 +1,56 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "${volumeGroupModelType}", + "modelVersion": "${volumeGroupModelVersion}", + "modelName": "${volumeGroupModelName}", + "modelInvariantId": "${volumeGroupModelInvariantId}", + "modelVersionId": "${volumeGroupModelVersionId}", + "modelCustomizationId": "${volumeGroupModelCustomizationId}" + }, + "requestInfo": { + "instanceName": "${volumeGroupName}", + "source": "VID", + "suppressRollback": true, + "requestorId": "sk720x" + }, + "requestParameters": { + "testApi": "${testApi}", + "aLaCarte": "${alaCarte}", + "userParams": [] + }, + "cloudConfiguration": { + "lcpCloudRegionId": "${volumeGroupLcpCloudRegionId}", + "cloudOwner": "${cloudOwner}", + "tenantId": "${volumeGroupTenantId}" + }, + "relatedInstanceList": [ + { + "relatedInstance": { + "instanceId": "${serviceInstanceId}", + "modelInfo": { + "modelType": "${serviceInstModelType}", + "modelInvariantId": "${serviceInstModelInvariantId}", + "modelVersionId": "${serviceInstModelNameVersionId}", + "modelName": "${serviceInstModelName}", + "modelVersion": "${serviceInstModelVersion}" + } + } + }, + { + "relatedInstance": { + "instanceId": "${vnfId}", + "modelInfo": { + "modelType": "${vnfModelType}", + "modelName": "${vnfModelName}", + "modelInvariantId": "${vnfModelInvariantId}", + "modelVersion": "${vnfModelVersion}", + "modelVersionId": "${vnfModelversionId}", + "modelCustomizationName": "${vnfModelCustomizationName}", + "modelCustomizationId": "${vnfModelcustomizationId}" + } + } + } + ] + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/ServiceInstance.template b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/ServiceInstance.template new file mode 100644 index 00000000..531af177 --- /dev/null +++ b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/ServiceInstance.template @@ -0,0 +1,20 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "service", + "modelInvariantId": "${serviceInstModelInvariantId}", + "modelVersionId": "${serviceInstModelNameVersionId}", + "modelName": "${serviceInstModelName}", + "modelVersion":"1.0" + }, + "requestInfo": { + "source": "VID", + "requestorId": "ROBOT" + }, + "requestParameters": { + "testApi": "${testApi}", + "userParams": [], + "aLaCarte": "${aLaCarteFlag}" + } + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/VfModule.template b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/VfModule.template new file mode 100644 index 00000000..ee227e08 --- /dev/null +++ b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/VfModule.template @@ -0,0 +1,26 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "${vfModelType}", + "modelInvariantId": "${vfModelInvariantId}", + "modelVersionId": "${vfModelversionId}", + "modelName": "${vfModelName}", + "modelVersion": "${vfModelVersion}", + "modelCustomizationId": "${vfModelCustomizationId}" + }, + "requestParameters": { + "testApi": "${testApi}", + "aLaCarte": "${alaCarte}", + "userParams": [] + }, + "requestInfo": { + "source": "VID", + "requestorId": "az2016" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "${vfLcpCloudRegionId}", + "tenantId": "${vfTenantId}", + "cloudOwner": "${cloudOwner}" + } + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/Vnf.template b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/Vnf.template new file mode 100644 index 00000000..fc553952 --- /dev/null +++ b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/Vnf.template @@ -0,0 +1,25 @@ +{ + "requestDetails":{ + "modelInfo":{ + "modelType":"${vnfModelType}", + "modelInvariantId":"${vnfModelInvariantId}", + "modelNameVersionId":"${vnfModelversionId}", + "modelName":"${vnfModelName}", + "modelCustomizationName":"${vnfModelCustomizationName}", + "modelVersion":"${vnfModelVersion}" + }, + "requestInfo":{ + "source":"VID", + "requestorId":"ROBOT" + }, + "cloudConfiguration":{ + "lcpCloudRegionId":"${vnfLcpCloudRegionid}", + "tenantId":"${vnfTenantId}", + "cloudOwner": "${cloudOwner}" + }, + "requestParameters": { + "testApi": "${testApi}", + "userParams": [] + } + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/VolumeGroup.template b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/VolumeGroup.template new file mode 100644 index 00000000..b5a495f2 --- /dev/null +++ b/tests/so/orchestration/assets/templates/bpmn-infra/aLaCarte/Delete/VolumeGroup.template @@ -0,0 +1,26 @@ +{ + "requestDetails": { + "modelInfo": { + "modelType": "${volumeGroupModelType}", + "modelInvariantId": "${volumeGroupModelInvariantId}", + "modelVersionId": "${volumeGroupModelVersionId}", + "modelName": "${volumeGroupModelName}", + "modelVersion": "${volumeGroupModelVersion}", + "modelCustomizationId": "${volumeGroupModelCustomizationId}" + }, + "requestParameters": { + "testApi": "${testApi}", + "aLaCarte": "${alaCarte}", + "userParams": [] + }, + "requestInfo": { + "source": "VID", + "requestorId": "sk720x" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "${volumeGroupLcpCloudRegionId}", + "tenantId": "${volumeGroupTenantId}", + "cloudOwner": "${cloudOwner}" + } + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/gr-api/CreateAAIInventory.json b/tests/so/orchestration/assets/templates/gr-api/CreateAAIInventory.json new file mode 100644 index 00000000..5dd23235 --- /dev/null +++ b/tests/so/orchestration/assets/templates/gr-api/CreateAAIInventory.json @@ -0,0 +1,245 @@ +{ + "vserver-id": "92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "vserver-name": "tsbc0005vm002", + "vserver-name2": "tsbc0005vm002", + "vserver-selflink": "https://test.com:8774/v2/0422ffb57ba042c0800a29dc85ca70f8/servers/92272b67-d23f-42ca-87fa-7b06a9ec81f3", + "in-maint": false, + "is-closed-loop-disabled": false, + "l-interfaces": { + "l-interface": [ + { + "interface-name": "tsbc0005v_tsbc0005vm002_mgmt_port_1", + "selflink": "https://test.com:9696/v2.0/ports/07f5b14c-147a-4d14-8c94-a9e94dbc097b", + "interface-id": "07f5b14c-147a-4d14-8c94-a9e94dbc097b", + "macaddr": "02:07:f5:b1:4c:14", + "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR_OAMP_NSD_TSBC0_net_1", + "is-port-mirrored": false, + "in-maint": false, + "is-ip-unnumbered": false, + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "1.2.2.2", + "l3-interface-ipv4-prefix-length": 28, + "is-floating": false, + "neutron-network-id": "cae2ade2-9f44-40fa-b124-18b101ff9aa0", + "neutron-subnet-id": "1f954922-6e9c-4a64-9d78-62e869ba8c77" + } + ], + "vlans" : { + "vlan": [ + { + "in-maint": false, + "is-ip-unnumbered": false, + "is-private": false, + "vlan-id-inner": 0, + "vlan-id-outer": 141, + "vlan-interface": "oamfw_oam_direct1_0_port141" + } + ] + } + }, + { + "interface-name": "tsbc0005v_tsbc0005vm002_role1_port_0", + "selflink": "https://test.com:9696/v2.0/ports/0594a2f2-7ea4-42eb-abc2-48ea49677fca", + "interface-id": "0594a2f2-7ea4-42eb-abc2-48ea49677fca", + "macaddr": "02:05:94:a2:f2:7e", + "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR-UNTR-ROLE1-PARNT_net_1", + "is-port-mirrored": false, + "in-maint": false, + "is-ip-unnumbered": false, + "l-interfaces": { + "l-interface": [ + { + "interface-name": "tsbc0005v_tsbc0005vm002_subint_untrusted_role1_81", + "interface-id": "2bbfa345-33bb-495a-94b2-fb514ee1cffc", + "macaddr": "02:05:94:a2:f2:7e", + "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR_UNTR_VSE_ROLE10_net_1", + "is-port-mirrored": false, + "in-maint": false, + "is-ip-unnumbered": false + } + ] + }, + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "172.26.0.36", + "l3-interface-ipv4-prefix-length": 27, + "is-floating": false, + "neutron-network-id": "49bd2c8c-808d-4783-a1c5-5d9ae0c6a9fa", + "neutron-subnet-id": "8d073a94-b1b9-493a-8fc1-cf92abcba466" + } + ], + "vlans" : { + "vlan": [ + { + "in-maint": false, + "is-ip-unnumbered": false, + "is-private": false, + "vlan-id-inner": 0, + "vlan-id-outer": 256, + "vlan-interface": "oamfw_oam_direct1_0_port141" + } + ] + } + }, + { + "interface-name": "tsbc0005v_tsbc0005vm002_service1_port_0", + "selflink": "https://test.com:9696/v2.0/ports/27391d94-33af-474a-927d-d409249e8fd3", + "interface-id": "27391d94-33af-474a-927d-d409249e8fd3", + "macaddr": "02:27:39:1d:94:33", + "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR-UNTR-CUS-PARNT_net_1", + "is-port-mirrored": false, + "in-maint": false, + "is-ip-unnumbered": false, + "l-interfaces": { + "l-interface": [ + { + "interface-name": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_101", + "interface-id": "d54dfd09-75c6-4e04-b204-909455b8f933", + "macaddr": "02:27:39:1d:94:33", + "network-name": "GRP-27529-T-IST-05E_int_SUB-INTERFACE_net_006", + "is-port-mirrored": false, + "in-maint": false, + "is-ip-unnumbered": false + }, + { + "interface-name": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_103", + "interface-id": "f7a998c0-8939-4b07-bf4a-0862e9c325e1", + "macaddr": "02:27:39:1d:94:33", + "network-name": "GRP-27529-T-IST-05E_int_SUB-INTERFACE_net_008", + "is-port-mirrored": false, + "in-maint": false, + "is-ip-unnumbered": false + }, + { + "interface-name": "tsbc0005v_tsbc0005vm002_subint_untrusted_service1_102", + "interface-id": "621c1fea-60b8-44ee-aede-c01b8b1aaa70", + "macaddr": "02:27:39:1d:94:33", + "network-name": "GRP-27529-T-IST-05E_int_SUB-INTERFACE_net_007", + "is-port-mirrored": false, + "in-maint": false, + "is-ip-unnumbered": false + } + ] + }, + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "172.26.0.5", + "l3-interface-ipv4-prefix-length": 27, + "is-floating": false, + "neutron-network-id": "7acdc0c3-eff2-4ecb-8722-a3451711027c", + "neutron-subnet-id": "4c4cc70a-7f31-41a6-a50f-5390d80fd127" + } + ], + "vlans" : { + "vlan": [ + { + "in-maint": false, + "is-ip-unnumbered": false, + "is-private": false, + "vlan-id-inner": 0, + "vlan-id-outer": 574, + "vlan-interface": "oamfw_oam_direct1_0_port141" + } + ] + } + }, + { + "interface-name": "tsbc0005v_tsbc0005vm002_int_ha_port_0", + "selflink": "https://test.com:9696/v2.0/ports/00bb8407-650e-48b5-b919-33b88d6f8fe3", + "interface-id": "00bb8407-650e-48b5-b919-33b88d6f8fe3", + "macaddr": "02:00:bb:84:07:65", + "network-name": "tsbc0005v_int_ha_net", + "is-port-mirrored": false, + "in-maint": false, + "is-ip-unnumbered": false, + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "172.26.1.27", + "l3-interface-ipv4-prefix-length": 26, + "is-floating": false, + "neutron-network-id": "de0a1ec5-8685-4de5-999c-a791bd48c9d8", + "neutron-subnet-id": "1151932c-935d-4cdc-b134-f58bebed9bf1" + } + ], + "vlans" : { + "vlan": [ + { + "in-maint": false, + "is-ip-unnumbered": false, + "is-private": false, + + "vlan-id-inner": 0, + "vlan-id-outer": 654, + "vlan-interface": "oamfw_oam_direct1_0_port141" + } + ] + } + }, + { + "interface-name": "tsbc0005v_tsbc0005vm002_mgmt_port_0", + "selflink": "https://test.com:9696/v2.0/ports/8d93f63e-e972-48c7-ad98-b2122da47315", + "interface-id": "8d93f63e-e972-48c7-ad98-b2122da47315", + "macaddr": "02:8d:93:f6:3e:e9", + "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR_OAMP_NSD_TSBC0_net_1", + "is-port-mirrored": false, + "in-maint": false, + "is-ip-unnumbered": false, + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "1.2.2.2", + "l3-interface-ipv4-prefix-length": 28, + "is-floating": false, + "neutron-network-id": "cae2ade2-9f44-40fa-b124-18b101ff9aa0", + "neutron-subnet-id": "1f954922-6e9c-4a64-9d78-62e869ba8c77" + } + ], + "vlans" : { + "vlan": [ + { + "in-maint": false, + "is-ip-unnumbered": false, + "is-private": false, + + "vlan-id-inner": 0, + "vlan-id-outer": 123, + "vlan-interface": "oamfw_oam_direct1_0_port141" + } + ] + } + }, + { + "interface-name": "tsbc0005v_tsbc0005vm002_trusted_port", + "selflink": "https://test.com:9696/v2.0/ports/d2f51f82-0ec2-4581-bd1a-d2a82073e52b", + "interface-id": "d2f51f82-0ec2-4581-bd1a-d2a82073e52b", + "macaddr": "02:d2:f5:1f:82:0e", + "network-name": "GRP-27529-T-IST-05E-dyh3b_TIPFR_TRST_VIF_TSBC0_net_1", + "is-port-mirrored": false, + "in-maint": false, + "is-ip-unnumbered": false, + "l3-interface-ipv4-address-list": [ + { + "l3-interface-ipv4-address": "1.2.2.2", + "l3-interface-ipv4-prefix-length": 28, + "is-floating": false, + "neutron-network-id": "4f35d575-a4f2-4020-8322-3eb138e7f258", + "neutron-subnet-id": "d476da9d-bf9b-49e1-aec9-fee99b863f30" + } + ], + "vlans" : { + "vlan": [ + { + "in-maint": false, + "is-ip-unnumbered": false, + "is-private": false, + + "vlan-id-inner": 0, + "vlan-id-outer": 965, + "vlan-interface": "oamfw_oam_direct1_0_port141" + } + ] + } + } + ] + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/gr-api/PhysicalServerCreate.json b/tests/so/orchestration/assets/templates/gr-api/PhysicalServerCreate.json new file mode 100644 index 00000000..c0f0ea53 --- /dev/null +++ b/tests/so/orchestration/assets/templates/gr-api/PhysicalServerCreate.json @@ -0,0 +1,111 @@ +{ + "hostname": "rdm52r19c001", + "equip-type": "rack server", + "equip-vendor": "DELL", + "equip-model": "SVR - R740XD - AIC 25GB AC - 44 CORE - 384GB RAM - 4 X 480GB SSD - 6 X 2.4TB HDD - 2 X 1GB - 4 X 10GB X710 - 4 X 25GB (INTEL XXV710) - NBD", + "fqdn": "test.com", + "inv-status": "Configuration", + "in-maint": false, + "prov-status": "PREPROV", + "host-profile": "ns-hp1", + "role": "Application", + "function": "Node", + "p-interfaces": + { + "p-interface": + [ + { + "interface-name": "p7/1", + "speed-value": "25", + "speed-units": "GE", + "port-description": "25GE_rdm521928el1_et-0/0/1:1_[ckt-id]_[fac-id]_[CBB][NCOPS]", + "interface-role": "OAM", + "interface-type": "BUNDLE-MEMBER", + "prov-status": "PREPROV", + "in-maint": false + }, + + { + "interface-name": "p2/2", + "speed-value": "25", + "speed-units": "GE", + "port-description": "25GE_rdm521929el1_et-0/0/1:1_[ckt-id]_[fac-id]_[CBB][NCOPS]", + "interface-role": "OAM", + "interface-type": "BUNDLE-MEMBER", + "prov-status": "PREPROV", + "in-maint": false + }, + + { + "interface-name": "p7/2", + "speed-value": "25", + "speed-units": "GE", + "port-description": "25GE_rdm521929el1_et-0/0/0:1_[ckt-id]_[fac-id]_[CBB][NCOPS]", + "interface-role": "APPLICATION", + "interface-type": "PHYSICAL", + "prov-status": "PREPROV", + "in-maint": false, + "sriov-pfs": + { + "sriov-pf": + [ + { + "pf-pci-id": "0000:5e:00.0" + } + ] + } + }, + { + "interface-name": "p2/1", + "speed-value": "25", + "speed-units": "GE", + "port-description": "25GE_rdm521928el1_et-0/0/0:1_[ckt-id]_[fac-id]_[CBB][NCOPS]", + "interface-role": "APPLICATION", + "interface-type": "PHYSICAL", + "prov-status": "PREPROV", + "in-maint": false, + "sriov-pfs": + { + "sriov-pf": + [ + { + "pf-pci-id": "0000:5e:01.0" + } + ] + } + }, + { + "interface-name": "P1", + "speed-value": "1", + "speed-units": "GE", + "port-description": "1GE_rdm520019sx2_GigabitEthernet1/0/3_[ckt-id]_[fac-id]_[CBB][NCOPS]", + "interface-role": "PXE", + "interface-type": "PHYSICAL", + "prov-status": "PREPROV", + "in-maint": false + }, + + { + "interface-name": "R", + "speed-value": "1", + "speed-units": "GE", + "port-description": "1GE_rdm520019sx2_GigabitEthernet1/0/4_[ckt-id]_[fac-id]_[CBB][NCOPS]", + "interface-role": "IPMI", + "interface-type": "PHYSICAL", + "prov-status": "PREPROV", + "in-maint": false + } + ] + }, + "lag-interfaces": + { + "lag-interface": + [ + { + "interface-name": "bond1", + "prov-status": "PREPROV", + "in-maint": false + } + ] + } +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/setup_cloud_region.json b/tests/so/orchestration/assets/templates/setup_cloud_region.json new file mode 100644 index 00000000..cc5d8575 --- /dev/null +++ b/tests/so/orchestration/assets/templates/setup_cloud_region.json @@ -0,0 +1,10 @@ +{ + "cloud-owner": "${cloudOwner}", + "cloud-region-id": "${cloudRegionId}", + "cloud-type": "${cloudType}", + "owner-defined-type": "${ownerDefinedType}", + "cloud-region-version": "${cloudRegionVersion}", + "cloud-zone": "${cloudZone}", + "complex-name": "${complexName}", + "sriov-automation": "${sriovAutomation}" +}
\ No newline at end of file diff --git a/tests/so/orchestration/assets/templates/setup_tenant.json b/tests/so/orchestration/assets/templates/setup_tenant.json new file mode 100644 index 00000000..e615edef --- /dev/null +++ b/tests/so/orchestration/assets/templates/setup_tenant.json @@ -0,0 +1,4 @@ +{ + "tenant-id": "${tenantId}", + "tenant-name": "${tenantName}" +}
\ No newline at end of file diff --git a/tests/so/orchestration/data/bpmn-infra/aLaCarte/ServiceInstance.csv b/tests/so/orchestration/data/bpmn-infra/aLaCarte/ServiceInstance.csv new file mode 100644 index 00000000..a3468c83 --- /dev/null +++ b/tests/so/orchestration/data/bpmn-infra/aLaCarte/ServiceInstance.csv @@ -0,0 +1,2 @@ +uniqueKey,productFamilyId,instanceName,serviceInstModelInvariantId,serviceInstModelDescription,serviceInstModelType,serviceInstModelNameVersionId,serviceInstModelVersion,serviceInstModelName,owningEntityId,owningEntityName,projectName,serviceType,aLaCarteFlag,subscriberId,sync_response,orch_response,testApi,distributionFilePath,dlpFlag +TC_1,a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb,Robot_SI,944862ae-bb65-4429-8330-a6c9170d6672,Demo,service,d88da85c-d9e8-4f73-b837-3a72a431622b,1,Vf servername-Service,c3f57fa8-ac7d-11e8-98d0-529269fb1459,SO_Test-Network_2.0-1806 & GR_API OE SO_Test200,GR_API_OE_SO_Test200,Robot_Test_Service_Type,true,Robot_Test_Subscriber_ID,202,COMPLETE,GR_API,tests/so/orchestration/assets/templates/sdc_notif_container.json,false diff --git a/tests/so/orchestration/resources/SoKeywords.robot b/tests/so/orchestration/resources/SoKeywords.robot new file mode 100644 index 00000000..f9f68984 --- /dev/null +++ b/tests/so/orchestration/resources/SoKeywords.robot @@ -0,0 +1,103 @@ +*** Settings *** +Library StringTemplater +Library Collections +Library RequestsLibrary +Library HttpLibrary.HTTP +Library OperatingSystem +Library BuiltIn +Library String +Library XML +Resource common/Variables.robot +Resource SoVariables.robot +Resource global_properties.robot +Resource so_interface.robot + +***Variables*** +${SO_REST_URL} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_SO_SERVER_PORT} + +*** Keywords *** +Wait To Poll + [Documentation] Sleep the execution for the specified time (in seconds). + Sleep ${POLL_WAIT_TIME} + +Poll Orchestration Request + [Documentation] Poll the service orchestration request for the completion. Uses MAX_POLL_COUNT to specify the maximum number of polling attempts. + [Arguments] ${request_id} + : FOR ${INDEX} IN RANGE 1 ${MAX_POLL_COUNT} + \ Log 'Poll Count :' + \ Log ${INDEX} + \ ${orchestration_request_response}= Get Orchestration Request Status ${request_id} + + # First check request status code + \ ${orch_request_status_code}= Set Variable ${orchestration_request_response.status_code} + \ ${orchestration_failure_message}= Run Keyword If ${orch_request_status_code} != ${HTTP_OK} Catenate Error Code ${orch_request_status_code} + \ ${request_completion_status}= Run Keyword If ${orch_request_status_code} != ${HTTP_OK} Set Variable '${ORCH_REQUEST_FAILED}' + \ Exit For Loop If ${orch_request_status_code} != ${HTTP_OK} + + # Get Status of Orchestration request + \ Log ${orchestration_request_response.content} + \ ${request_completion_status} Get Json Value ${orchestration_request_response.content} /request/requestStatus/requestState + \ ${orchestration_status_message}= Run Keyword If ${request_completion_status} != '${ORCH_REQUEST_IN_PROGRESS}' Get Json Value ${orchestration_request_response.content} /request/requestStatus/statusMessage + \ Log ${request_completion_status} + + # Check for FAILED status + \ ${orchestration_failure_message}= Run Keyword If ${request_completion_status} == '${ORCH_REQUEST_FAILED}' Set Variable ${orchestration_status_message} + \ Exit For Loop If ${request_completion_status} == '${ORCH_REQUEST_FAILED}' + + # Check for COMPLETE status + \ Exit For Loop If ${request_completion_status} == '${ORCH_REQUEST_COMPLETE}' + + # Check for MAX NO OF POLL count, and exit if it has reached the maximum poll count + \ ${orchestration_failure_message}= Run Keyword If ${INDEX} == ${MaxPollCount}-1 Set Variable ${TIME_OUT_MESSAGE} + \ Exit For Loop If ${INDEX} == ${MaxPollCount}-1 + \ Wait To Poll + LOG ${orchestration_failure_message} + ${request_completion_status} Get Substring ${request_completion_status} 1 -1 + [Return] ${request_completion_status} ${orchestration_failure_message} + +Get Orchestration Request Status + [Documentation] Get the status of the orchestrated service request. + [Arguments] ${request_id} + + ${url}= Catenate SEPARATOR=/ ${SO_ORCHESTRATION_REQUESTS_URI} ${request_id} + ${orchestration_request_response} Run SO Get Request ${url} + [Return] ${orchestration_request_response} + +Get Orchestration Request Status with parameters + [Documentation] Get the status of the orchestrated service request. + [Arguments] ${request_id} ${parameter} + + ${url}= Catenate ${SO_ORCHESTRATION_REQUESTS_URI}/${request_id}?${parameter} + ${orchestration_request_response} Run SO Get Request ${url} + [Return] ${orchestration_request_response} + +Get ExtSystemErrorSource + [Documentation] Return ExtSystemErrorSource from Get Orchestration Request + [Arguments] ${request_id} + + ${orchestration_request_response} Get Orchestration Request Status with parameters ${request_id} format=statusdetail + ${orchestration_request_response_json} Parse Json ${orchestration_request_response.content} + ${extSystemErrorSource} Convert to String ${orchestration_request_response_json['request']['requestStatus']['extSystemErrorSource']} + + [Return] ${extSystemErrorSource} + +Get RollbackExtSystemErrorSource + [Documentation] Return ExtSystemErrorSource from Get Orchestration Request + [Arguments] ${request_id} + + ${orchestration_request_response} Get Orchestration Request Status with parameters ${request_id} format=statusdetail + ${orchestration_request_response_json} Parse Json ${orchestration_request_response.content} + ${rollbackExtSystemErrorSource} Convert to String ${orchestration_request_response_json['request']['requestStatus']['rollbackExtSystemErrorSource']} + + [Return] ${rollbackExtSystemErrorSource} + +Get FlowStatus + [Documentation] Return Flow Status from Get Orchestration Request + [Arguments] ${request_id} + + ${orchestration_request_response} Get Orchestration Request Status with parameters ${request_id} format=statusdetail + ${orchestration_request_response_json} Parse Json ${orchestration_request_response.content} + Log ${orchestration_request_response_json} + ${flow_status} Convert to String ${orchestration_request_response_json['request']['requestStatus']['flowStatus']} + + [Return] ${flow_status}
\ No newline at end of file diff --git a/tests/so/orchestration/resources/SoVariables.robot b/tests/so/orchestration/resources/SoVariables.robot new file mode 100644 index 00000000..b3ea9098 --- /dev/null +++ b/tests/so/orchestration/resources/SoVariables.robot @@ -0,0 +1,67 @@ +*** Variables *** +### Orchestration Polling Properties ### +${POLL_WAIT_TIME} 5 +${MEGA_POLL_WAIT_TIME} 5 +${MAX_POLL_COUNT} 72 + +### Common Properties ### +${VNFS} vnfs +${VFMODULES} vfModules +${SO_REST_URI} /onap/so/infra/serviceInstantiation/v7/serviceInstances +${SO_ORCHESTRATION_REQUESTS_URI} /onap/so/infra/orchestrationRequests/v7 +${SO_HEALTHCHECK_URI} /manage/health + +${SO_AUDIT_REST_URI} /audit/v1/services/ + +### Layer3 Properties ### +&{SO_LAYER3_HEADERS} Content-Type=application/xml Accept=application/xml Authorization=Basic YXBpaEJwbW46Y2FtdW5kYS1SMTUxMiE= +### Service Properties ### +${SO_REST_URI_CREATE_SERVICE} ${SO_REST_URI} +${SO_REST_URI_DELETE_SERVICE} ${SO_REST_URI} + +### VNF Module Properties ### +${SO_REST_URI_CREATE_VFMODULE} ${SO_REST_URI}/<SERVICEINSTANCEID>/vnfs/<VNFINSTANCEID>/vfModules +${SO_REST_URI_DELETE_VFMODULE} ${SO_REST_URI}/<SERVICEINSTANCEID>/vnfs/<VNFINSTANCEID>/vfModules/<VFMODULEINSTANCEID> +### Messages ### +${TIME_OUT_MESSAGE} No Successful response within specified time +${ORCH_FAILURE_MESSAGE} Orchestration request has failed + +##### VF SPECIFIC PROPERTIES ##### +${INVALID_SERVICE_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid serviceInstanceId is specified" +${INVALID_VNF_INST_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid vnfInstanceId is specified" +${DELETE_VNF_FAIL_MSG} "Can't Delete Generic Vnf. Generic Vnf is still in use." + +##### NETWORK SPECIFIC PROPERTIES ##### +${INVALID_NW_INST_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid networkInstanceId is specified" +${INV_MODEL_NAME_MSG} "Received error from Network Adapter: Unknown Network Type: CONTRAIL_INTERNAL" +${BLANK_MODEL_NAME_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelName is specified" +${INV_REGION_ID_MSG} "Received error from Network Adapter: Cloud Site [RegionTwo] not found" +${BLANK_REGION_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid lcpCloudRegionId is specified" +${INV_TENANT_MSG} "Received error from Network Adapter: 404 Not Found: " +${BLANK_TENANT_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid tenantId is specified" +${INV_SOURCE_MSG} "Recipe does not exist in catalog DB" +${BLANK_SOURCE_MSG} "Error parsing request.${SPACE}${SPACE}No valid source is specified" +${BLANK_INVAR_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelInvariantId is specified" +${BLANK_VER_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelVersionId is specified" +${BLANK_REQ_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid requestorId is specified" + +### Orchestration Constants ### +${ORCH_REQUEST_COMPLETE} COMPLETE +${ORCH_REQUEST_COMPLETED} COMPLETED +${ORCH_REQUEST_FAILED} FAILED +${ORCH_REQUEST_IN_PROGRESS} IN_PROGRESS + +### MODEL TYPE ### +${MODEL_TYPE_SERVICE} service +${MODEL_TYPE_VNF} vnf +${MODEL_TYPE_VFMODULE} vfModule +${MODEL_TYPE_VOLUME_GROUP} volumeGroup +${MODEL_TYPE_NETWORK} network +${INV_MODEL_TYPE_VNF} vnf1 +${INVALID_MODEL_TYPE} INVALID_MODEL_TYPE +${INVALID_SERVICE_MODEL_NAME} INVALID_SERVICE_MODEL +${INVALID_VFMODULE_MODEL_NAME} INVALID_VFMODULE_MODEL +${INVALID_CLOUD_REGION_ID} INVALID_CLR + +### CLOUD DATA ### +${TENANT_ID} 22eb191dd41a4f3c9be370fc638322f4
\ No newline at end of file diff --git a/tests/so/orchestration/resources/aai/aai_interface.robot b/tests/so/orchestration/resources/aai/aai_interface.robot new file mode 100644 index 00000000..67e828d2 --- /dev/null +++ b/tests/so/orchestration/resources/aai/aai_interface.robot @@ -0,0 +1,91 @@ +*** Settings *** +Documentation The main interface for interacting with A&AI. It handles low level stuff like managing the http request library and A&AI required fields +Library RequestsLibrary +Library UUID +Library HTTPUtils +Resource ../global_properties.robot + +*** Variables *** +${AAI_HEALTH_PATH} /aai/util/echo?action=long +${VERSIONED_INDEX_PATH} /aai/v14 +${AAI_FRONTEND_ENDPOINT} ${GLOBAL_AAI_SERVER_PROTOCOL}://${GLOBAL_INJECTED_AAI1_IP_ADDR}:${GLOBAL_AAI_SERVER_PORT} + +*** Keywords *** +Run A&AI Health Check + [Documentation] Runs an A&AI health check + :FOR ${i} IN RANGE 20 + \ ${resp}= Run A&AI Get Request ${AAI_HEALTH_PATH} + \ Log Received response from so ${resp.json()} + \ Log Received response from so status ${resp.status_code} + \ ${exit_loop}= Evaluate ${resp.status_code} == 200 + \ Exit For Loop If ${exit_loop} + \ Sleep 15s + +Run A&AI Get Request + [Documentation] Runs an A&AI get request + [Arguments] ${data_path} + Disable Warnings + Create Session aai ${AAI_FRONTEND_ENDPOINT} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Accept=application/json Content-Type=application/json X-TransactionId=Test X-FromAppId=SO + ${resp}= Get Request aai ${data_path} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp} + +Run A&AI Put Request + [Documentation] Runs an A&AI put request + [Arguments] ${data_path} ${data} + Disable Warnings + Create Session aai ${AAI_FRONTEND_ENDPOINT} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Accept=application/json Content-Type=application/json X-TransactionId=Test X-FromAppId=SO + ${resp}= Put Request aai ${data_path} data=${data} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp} + +Run A&AI Post Request + [Documentation] Runs an A&AI Post request + [Arguments] ${data_path} ${data} + Disable Warnings + Create Session aai ${AAI_FRONTEND_ENDPOINT} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Post Request aai ${data_path} data=${data} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp} + +Run A&AI Patch Request + [Documentation] Runs an A&AI Post request + [Arguments] ${data_path} ${data} + Disable Warnings + Log ${data} + Create Session aai ${AAI_FRONTEND_ENDPOINT} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Accept=application/json Content-Type=application/merge-patch+json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} X-HTTP-Method-Override=PATCH + ${resp}= Post Request aai ${data_path} data=${data} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp} + +Run A&AI Delete Request + [Documentation] Runs an A&AI delete request + [Arguments] ${data_path} ${resource_version} + Disable Warnings + Create Session aai ${AAI_FRONTEND_ENDPOINT} + ${uuid}= Generate UUID + ${headers}= Create Dictionary Accept=application/json Content-Type=application/json X-TransactionId=${GLOBAL_APPLICATION_ID}-${uuid} X-FromAppId=${GLOBAL_APPLICATION_ID} + ${resp}= Delete Request aai ${data_path}?resource-version=${resource_version} headers=${headers} + Log Received response from aai ${resp.text} + [Return] ${resp} + +Delete A&AI Entity + [Documentation] Deletes an entity in A&AI + [Arguments] ${uri} + ${get_resp}= Run A&AI Get Request ${VERSIONED_INDEX PATH}${uri} + Run Keyword If '${get_resp.status_code}' == '200' Delete A&AI Entity Exists ${uri} ${get_resp.json()['resource-version']} + +Delete A&AI Entity Exists + [Documentation] Deletes an A&AI entity + [Arguments] ${uri} ${resource_version_id} + ${put_resp}= Run A&AI Delete Request ${VERSIONED_INDEX PATH}${uri} ${resource_version_id} + Should Be Equal As Strings ${put_resp.status_code} 204 + diff --git a/tests/so/orchestration/resources/aai/service_instance.robot b/tests/so/orchestration/resources/aai/service_instance.robot new file mode 100644 index 00000000..bdf45475 --- /dev/null +++ b/tests/so/orchestration/resources/aai/service_instance.robot @@ -0,0 +1,191 @@ +*** Settings *** +Documentation Validate A&AI Serivce Instance +... +... Validate A&AI Serivce Instance + +Resource aai_interface.robot +Library Collections +Library OperatingSystem +Library RequestsLibrary +Library JSONUtils +Library HttpLibrary.HTTP +Library StringTemplater +Resource ../json_templater.robot +Resource ../aai/aai_interface.robot +Resource ../properties/cloudRegion.robot +*** Variables *** +${INDEX PATH} /aai/v15 +${GENERIC_QUERY_PATH} /search/generic-query? +${SYSTEM USER} robot-ete +${CUSTOMER SPEC PATH} /business/customers/customer/ +${SERVICE SUBSCRIPTIONS} /service-subscriptions/service-subscription/ +${SERVICE_INSTANCE_QUERY} /service-instances?service-instance-name= +${SERVCE INSTANCE TEMPLATE} robot/assets/templates/aai/service_subscription.template +${vnf_orch_update_json} robot/assets/templates/aai/vnf_orch_update.template +${GENERIC_VNF_PATH_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module/\${vf_module_id} +${GENERIC_VNF_QUERY_TEMPLATE} /network/generic-vnfs/generic-vnf/\${vnf_id}/vf-modules/vf-module?vf-module-name=\${vf_module_name} +${VLB_CLOSED_LOOP_HACK_BODY} robot/assets/templates/aai/vlb_closed_loop_hack.template +${ROOT_CLOUD_PATH} /cloud-infrastructure/cloud-regions/cloud-region +#*************** Test Case Variables ************* +${VLB_CLOSED_LOOP_DELETE} +${VLB_CLOSED_LOOP_VNF_ID} + + +*** Keywords *** +Validate Service Instance + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${service_instance_name} ${service_type} ${customer_name} ${orchestration_status} + ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers?subscriber-name=${customer_name} + ${resp}= Run A&AI Get Request ${INDEX PATH}${CUSTOMER SPEC PATH}${cust_resp.json()['customer'][0]['global-customer-id']}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE_INSTANCE_QUERY}${service_instance_name} + Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${service_instance_name} + Dictionary Should Contain Value ${resp.json()['service-instance'][0]} ${orchestration_status} + +Validate Service Instance By Id + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${service_instance_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}/nodes/service-instances/service-instance/${service_instance_id}?depth=0&nodes-only + Should Be Equal As Strings ${resp.status_code} 200 + +Delete Service Instance by Id + [Documentation] Delete passed service in A&AI + [Arguments] ${service_instance_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}/nodes/service-instances/service-instance/${service_instance_id} + Run Keyword If '${resp.status_code}' == '200' Run A&AI Delete Request ${INDEX PATH}/nodes/service-instances/service-instance/${service_instance_id} ${resp.json()['resource-version']} + +Validate Customer By Id + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${customer_id} ${status_code} + ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers/customer/${customer_id} + Should Be Equal As Strings ${cust_resp.status_code} ${status_code} + +Validate Generic VNF + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${vnf_name} ${vnf_type} ${service_instance_id} + ${generic_vnf}= Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf?vnf-name=${vnf_name} + Dictionary Should Contain Value ${generic_vnf.json()} ${vnf_name} + ${returned_vnf_type}= Get From Dictionary ${generic_vnf.json()} vnf-type + Should Contain ${returned_vnf_type} ${vnf_type} + ${vnf_id}= Get From Dictionary ${generic_vnf.json()} vnf-id + ${generic_vnf}= Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id}?depth=all + [Return] ${generic_vnf.json()} + +Delete Vnf by Id + [Documentation] Delete passed service in A&AI + [Arguments] ${vnf_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id} + + Run Keyword If '${resp.status_code}'=='200' Run A&AI Delete Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id} ${resp.json()['resource-version']} + +Delete Volume Group by Id + [Documentation] Delete passed service in A&AI + [Arguments] ${volume_group_instance_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}${ROOT_CLOUD_PATH}/${cloud_owner}/${cloud_region_id}/volume-groups/volume-group/${volume_group_instance_id} + + Run Keyword If '${resp.status_code}'=='200' Run A&AI Delete Request ${INDEX PATH}${ROOT_CLOUD_PATH}/${cloud_owner}/${cloud_region_id}/volume-groups/volume-group/${volume_group_instance_id} ${resp.json()['resource-version']} + +Validate Tenant By Name + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${tenant_name} ${cloud_owner} ${cloud_region} ${response_code} + ${tenants}= Run A&AI Get Request ${INDEX PATH}/cloud-infrastructure/cloud-regions/cloud-region/${cloud_owner}/${cloud_region}/tenants?tenant-name=${tenant_name} + Should Be Equal As Strings ${tenants.status_code} ${response_code} + Run Keyword If '${response_code}'=='200' Dictionary Should Contain Value ${tenants.json()['tenant'][0]} ${tenant_name} + +Validate Line of Business + [Arguments] ${vnf_id} @{Lobs} + :FOR ${ELEMENT} IN @{Lobs} + \ ${response} Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id}/related-to/lines-of-business?line-of-business-name=${ELEMENT} + \ Should Be Equal As Strings ${response.status_code} 200 + +Validate Platform + [Arguments] ${vnf_id} @{platforms} + :FOR ${platform} IN @{platforms} + \ ${response} Run A&AI Get Request ${INDEX PATH}/network/generic-vnfs/generic-vnf/${vnf_id}/related-to/platforms?platform-name=${platform} + \ Should Be Equal As Strings ${response.status_code} 200 + + +Validate Owning Entity By Name + [Arguments] ${owning_entity_name} + ${oe_resp}= Run A&AI Get Request ${INDEX PATH}/business/owning-entities?owning-entity-name=${owning_entity_name} + Should Be Equal As Strings ${oe_resp.json()['owning-entity'][0]['owning-entity-name']} ${owning_entity_name} + + + +VLB Closed Loop Hack + [Arguments] ${service} ${generic_vnf} ${closedloop_vf_module} + Return From Keyword If '${service}' != 'vLB' + ${vnf_id}= Get From Dictionary ${generic_vnf} vnf-id + ${vf_modules}= Get From Dictionary ${generic_vnf} vf-modules + ${list}= Get From Dictionary ${vf_modules} vf-module + ${vfmodule}= Get From List ${list} 0 + ${persona_model_id}= Get From Dictionary ${closedloop_vf_module} invariantUUID + ${persona_model_version}= Get From Dictionary ${closedloop_vf_module} version + ${dummy}= Catenate dummy_${vnf_id} + ${dict}= Create Dictionary vnf_id=${vnf_id} vf_module_id=${dummy} persona_model_id=${persona_model_id} persona_model_version=${persona_model_version} + ${datapath}= Template String ${GENERIC_VNF_PATH_TEMPLATE} ${dict} + ${data}= Fill JSON Template File ${VLB_CLOSED_LOOP_HACK_BODY} ${dict} + ${put_resp}= Run A&AI Put Request ${INDEX PATH}${datapath} ${data} + ${status_string}= Convert To String ${put_resp.status_code} + Should Match Regexp ${status_string} ^(201|412)$ + Set Test Variable ${VLB_CLOSED_LOOP_DELETE} ${datapath} + Set Test Variable ${VLB_CLOSED_LOOP_VNF_ID} ${vnf_id} + +VLB Closed Loop Hack Update + [Documentation] Update the A&AI vDNS scaling vf module to have persona-model-version 1 rather than 1.0 + [Arguments] ${stack_name} + ${dict}= Create Dictionary vnf_id=${VLB_CLOSED_LOOP_VNF_ID} vf_module_name=${stack_name} + ${query}= Template String ${GENERIC_VNF_QUERY_TEMPLATE} ${dict} + ${get_resp}= Run A&AI Get Request ${INDEX_PATH}${query} + ${json}= Set Variable ${get_resp.json()} + Set to Dictionary ${json} persona-model-version 1 + ${vf_module_id}= Get From Dictionary ${json} vf-module-id + Set to Dictionary ${dict} vf_module_id=${vf_module_id} + ${uri}= Template String ${GENERIC_VNF_PATH_TEMPLATE} ${dict} + ${resp}= Run A&AI Put Request ${INDEX_PATH}${uri} ${json} + ${get_resp}= Run A&AI Get Request ${INDEX_PATH}${query} + +Teardown VLB Closed Loop Hack + Return From Keyword If ' ${VLB_CLOSED_LOOP_DELETE}' == '' + Delete A&AI Entity ${VLB_CLOSED_LOOP_DELETE} + +Validate VF Module + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${vf_module_name} ${stack_type} + Run Keyword If '${stack_type}'=='vLB' Validate vLB Stack ${vf_module_name} + Run Keyword If '${stack_type}'=='vFW' Validate Firewall Stack ${vf_module_name} + Run Keyword If '${stack_type}'=='vVG' Validate vVG Stack ${vf_module_name} + +*** Keywords *** +Create AAI Service Instance + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${customer_id} ${service_type} ${service_instance_id} ${service_instance_name} + ${json_string}= Catenate { "service-type": "VDNS" , "service-subscriptions":[{"service-instance-id":"instanceid123","service-instance-name":"VDNS"}]} + ${put_resp}= Run A&AI Put Request ${INDEX PATH}${CUSTOMER SPEC PATH}${CUSTOMER ID}${SERVICE SUBSCRIPTIONS}/{service_type} ${json_string} + Should Be Equal As Strings ${put_resp.status_code} 201 + [Return] ${put_resp.status_code} + +Validate Service Instance Not Exist + [Arguments] ${service_instance_name} ${service_type} ${customer_name} + ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers?subscriber-name=${customer_name} + ${resp}= Run A&AI Get Request ${INDEX PATH}${CUSTOMER SPEC PATH}${cust_resp.json()['customer'][0]['global-customer-id']}${SERVICE SUBSCRIPTIONS}${service_type}${SERVICE_INSTANCE_QUERY}${service_instance_name} + Should Be Equal As Strings ${resp.status_code} 404 + +Validate Service Instance Not Exist By Id + [Arguments] ${service_instance_id} + ${resp}= Run A&AI Get Request ${INDEX PATH}/nodes/service-instances/service-instance/${service_instance_id}?depth=0&nodes-only + Should Be Equal As Strings ${resp.status_code} 404 + +Validate Customer Not Exist + [Documentation] Query and Validates A&AI Service Instance + [Arguments] ${customer_name} + ${cust_resp}= Run A&AI Get Request ${INDEX PATH}/business/customers?subscriber-name=${customer_name} + Should Be Equal As Strings ${cust_resp.status_code} 404 + +Validate Owning Entity + [Arguments] ${owning_entity_id} ${status_code} + ${oe_resp}= Run A&AI Get Request ${INDEX PATH}/business/owning-entities/owning-entity/${owning_entity_id} + Should Be Equal As Strings ${oe_resp.status_code} ${status_code} + +Validate Project + [Arguments] ${project_name} ${status_code} + ${proj_resp}= Run A&AI Get Request ${INDEX PATH}/business/projects/project/${project_name} + Should Be Equal As Strings ${proj_resp.status_code} ${status_code} diff --git a/tests/so/orchestration/resources/bpmn-infra/aLaCarte/Create/ServiceInstance.robot b/tests/so/orchestration/resources/bpmn-infra/aLaCarte/Create/ServiceInstance.robot new file mode 100644 index 00000000..bab0b327 --- /dev/null +++ b/tests/so/orchestration/resources/bpmn-infra/aLaCarte/Create/ServiceInstance.robot @@ -0,0 +1,172 @@ +*** Settings *** +Library Collections +Library RequestsLibrary +Library HttpLibrary.HTTP +Library OperatingSystem +Library BuiltIn +Library String +Library CSVLibrary +Resource ../../../json_templater.robot +Resource ../../../SoKeywords.robot +Resource ../../../common/SoVariables.robot +Resource ../../../so_interface.robot +Resource ../../../aai/service_instance.robot +Resource ../../../common/Variables.robot +Resource ../../../properties/tenant.robot +Resource ../../../properties/cloudRegion.robot + +*** Variables *** +${data_file} ../../../../data/bpmn-infra/aLaCarte/ServiceInstance.csv +${create_customer_template_file} tests/so/orchestration/assets/templates/aai/add_customer_required_fields.template +${create_service_subscription_template_file} tests/so/orchestration/assets/templates/aai/service_subscription_required_fields.template +${create_service_model_template_file} tests/so/orchestration/assets/templates/aai/service_model.template +${serviceInstanceDictionary} +${serv_inst_id} +${serv_inst_tc_code} +${SUBSCRIBER_TYPE} CUST +${EXPECTED_ORCHESTRATION_STATUS} Active +${tenant_json} tests/so/orchestration/assets/templates/setup_tenant.json +${cloud_region_json} tests/so/orchestration/assets/templates/setup_cloud_region.json +${NOT_APPLICABLE} NA + +*** Keywords *** + +Setup GR Create Service Instance + [Arguments] ${serv_inst_tc_code} + ${serviceInstanceDictionary} Read CSV Data And Create Dictionary ${CURDIR}/${data_file} + Set Suite Variable ${serviceInstanceDictionary} + Set Suite Variable ${serv_inst_tc_code} + + Setup Cloud Region + Setup Tenant in AAI + + ${create_service_instance_data} Get From Dictionary ${serviceInstanceDictionary} ${serv_inst_tc_code} + + ${SUBSCRIBER_ID} Get From Dictionary ${create_service_instance_data} subscriberId + Setup Customer ${SUBSCRIBER_ID} + ${SUBSCRIPTION_SERVICE_TYPE} Get From Dictionary ${create_service_instance_data} serviceType + Setup Service Subscription ${SUBSCRIBER_ID} ${SUBSCRIPTION_SERVICE_TYPE} + + Setup Service Model in A&AI ${serviceInstanceDictionary} ${serv_inst_tc_code} + +Teardown GR Create Service Instance + [Arguments] ${service_instance_id} + Delete Service Instance by Id ${service_instance_id} + + +Setup Cloud Region + [Documentation] Setup the cloud region in AAI + + ${cloud_region_data} Create Dictionary cloudOwner=${cloudOwner} cloudRegionId=${cloudRegionId} cloudType=${cloudType} + ... ownerDefinedType=${ownerDefinedType} cloudRegionVersion=${cloudRegionVersion} cloudZone=${cloudZone} + ... complexName=${complexName} sriovAutomation=${sriovAutomation} + ${create_cloud_region_json} Fill JSON Template File ${cloud_region_json} ${cloud_region_data} + Run A&AI Put Request ${VERSIONED_INDEX_PATH}/cloud-infrastructure/cloud-regions/cloud-region/${cloudOwner}/${cloudRegionId} ${create_cloud_region_json} + + ${json}= OperatingSystem.Get File tests/so/orchestration/assets/templates/gr-api/PhysicalServerCreate.json + ${returned_json}= To Json ${json} + Run A&AI Put Request aai/v14/cloud-infrastructure/pservers/pserver/rdm52r19c001 ${returned_json} + +Setup Tenant in AAI + [Documentation] Setup the tenant in AAI + + ${tenant_data} Create Dictionary tenantId=${aai_tenant_Id} tenantName=${aai_tenant_name} + ${create_tenant_json} Fill JSON Template File ${tenant_json} ${tenant_data} + Run A&AI Put Request ${VERSIONED_INDEX_PATH}/cloud-infrastructure/cloud-regions/cloud-region/${cloudOwner}/${cloudRegionId}/tenants/tenant/${aai_tenant_Id} ${create_tenant_json} + +Setup Customer + [Documentation] Creates customer for use in tests + [Arguments] ${SUBSCRIBER_ID} + + ${create_customer_data} Create Dictionary global_customer_id=${SUBSCRIBER_ID} subscriber_name=${SUBSCRIBER_ID} subscriber_type=${SUBSCRIBER_TYPE} + Set Suite Variable ${create_customer_data} + ${create_customer_json} Fill JSON Template File ${create_customer_template_file} ${create_customer_data} + + Run A&AI Put Request ${VERSIONED_INDEX_PATH}/business/customers/customer/${SUBSCRIBER_ID} ${create_customer_json} + +Setup Service Subscription + [Documentation] Creates service subscription for use in tests + [Arguments] ${SUBSCRIBER_ID} ${SUBSCRIPTION_SERVICE_TYPE} + ${create_service_subscription_data} Create Dictionary service_type=${SUBSCRIPTION_SERVICE_TYPE} + Set Suite Variable ${create_service_subscription_data} + ${create_service_subscription_json} Fill JSON Template File ${create_service_subscription_template_file} ${create_service_subscription_data} + + Run A&AI Put Request ${VERSIONED_INDEX_PATH}/business/customers/customer/${SUBSCRIBER_ID}/service-subscriptions/service-subscription/${SUBSCRIPTION_SERVICE_TYPE} ${create_service_subscription_json} + +Setup Service Model in A&AI + [Arguments] ${serviceeDictionary} ${serv_inst_tc_code} + + ${create_service_instance_data} Get From Dictionary ${serviceInstanceDictionary} ${serv_inst_tc_code} + ${modelInvariantId} Get From Dictionary ${create_service_instance_data} serviceInstModelInvariantId + ${modelVersionId} Get From Dictionary ${create_service_instance_data} serviceInstModelNameVersionId + ${modelName} Get From Dictionary ${create_service_instance_data} serviceInstModelName + ${modelType} Get From Dictionary ${create_service_instance_data} serviceInstModelType + ${modelVersion} Get From Dictionary ${create_service_instance_data} serviceInstModelVersion + ${modelDescription} Get From Dictionary ${create_service_instance_data} serviceInstModelDescription + Setup Model in AAI ${modelInvariantId} ${modelType} ${modelVersionId} ${modelName} ${modelVersion} ${modelDescription} + +Setup Model in AAI + [Documentation] Setup Model in AAI for use in tests + [Arguments] ${modelInvariantId} ${modelType} ${modelVersionId} ${modelName} ${modelVersion} ${modelDescription} + ${create_service_model_data} Create Dictionary modelInvariantId=${modelInvariantId} modelType=${modelType} modelVersionId=${modelVersionId} + ... modelName=${modelName} modelVersion=${modelVersion} modelDescription=${modelDescription} + ${create_service_model_json} Fill JSON Template File ${create_service_model_template_file} ${create_service_model_data} + + Run A&AI Put Request ${VERSIONED_INDEX_PATH}/service-design-and-creation/models/model/${modelInvariantId} ${create_service_model_json} + + +Create Service Instance + [Documentation] Test Template for CreateServiceInstanceInfra + [Arguments] ${serv_inst_tc_code} ${payload_template} + log in create si sub + Log ${serv_inst_tc_code} + Log ${payload_template} + ${create_service_instance_data} Get From Dictionary ${serviceInstanceDictionary} ${serv_inst_tc_code} + Log create si data + Log ${create_service_instance_data} + Log ${CURDIR}/${payload_template} + Log ${create_service_instance_data} + Log ready to fill + ${service_body}= Fill JSON Template File ${CURDIR}/${payload_template} ${create_service_instance_data} + Log got service body + Log ${service_body} + Log after service body + ${serv_inst_id} ${request_id} ${request_completion_status} ${status_code} Invoke Create Service Instance Flow ${service_body} + [Return] ${serv_inst_id} ${request_id} ${request_completion_status} ${status_code} ${service_body} + + + +Invoke Create Service Instance Flow + [Documentation] Create Service Instance + [Arguments] ${service_body} + log invoking + ${create_service_response} Run SO Post request ${SO_REST_URI_CREATE_SERVICE} ${service_body} + log retunred ${create_service_response} + Return From Keyword If ${create_service_response.status_code} != ${HTTP_ACCEPTED} ${EMPTY} ${EMPTY} ${EMPTY} ${create_service_response.status_code} + ${request_id_string} Get Json Value ${create_service_response.content} /requestReferences/requestId + ${request_id} Get Substring ${request_id_string} 1 -1 + ${instance_id_string} Get Json Value ${create_service_response.content} /requestReferences/instanceId + ${instance_id} Get Substring ${instance_id_string} 1 -1 + Log ${instance_id} + ${request_completion_status} ${orchestration_failure_message} Run Keyword If ${create_service_response.status_code} == ${HTTP_ACCEPTED} + ... Poll Orchestration Request ${request_id} + + [Return] ${instance_id} ${request_id} ${request_completion_status} ${create_service_response.status_code} + + Invoke Delete Service Instance Flow + [Documentation] Delete a service instance. + [Arguments] ${service_body} ${service_instance} + + ${delete_service_response} Run SO Delete request ${SO_REST_URI_DELETE_SERVICE}/${service_instance} data=${service_body} + + Return From Keyword If ${delete_service_response.status_code} != ${HTTP_ACCEPTED} ${EMPTY} ${EMPTY} ${EMPTY} ${delete_service_response.status_code} + + ${request_id_string} Get Json Value ${delete_service_response.content} /requestReferences/requestId + ${request_id} Get Substring ${request_id_string} 1 -1 + ${instance_id_string} Get Json Value ${delete_service_response.content} /requestReferences/instanceId + ${instance_id} Get Substring ${instance_id_string} 1 -1 + + ${request_completion_status} ${orchestration_failure_message} Run Keyword If ${delete_service_response.status_code} == ${HTTP_ACCEPTED} + ... Poll Orchestration Request ${request_id} + + [Return] ${instance_id} ${request_id} ${request_completion_status} ${delete_service_response.status_code} diff --git a/tests/so/orchestration/resources/common/SoVariables.robot b/tests/so/orchestration/resources/common/SoVariables.robot new file mode 100644 index 00000000..3bdfdc64 --- /dev/null +++ b/tests/so/orchestration/resources/common/SoVariables.robot @@ -0,0 +1,68 @@ +*** Variables *** +### Orchestration Polling Properties ### +${POLL_WAIT_TIME} 5 +${MEGA_POLL_WAIT_TIME} 5 +${MAX_POLL_COUNT} 72 + +### Common Properties ### +${VNFS} vnfs +${VFMODULES} vfModules +${SO_REST_URI} /onap/so/infra/serviceInstantiation/v7/serviceInstances +${SO_ORCHESTRATION_REQUESTS_URI} /onap/so/infra/orchestrationRequests/v7 +${SO_HEALTHCHECK_URI} /manage/health + +### Layer3 Properties ### +&{SO_LAYER3_HEADERS} Content-Type=application/xml Accept=application/xml Authorization=Basic YXBpaEJwbW46Y2FtdW5kYS1SMTUxMiE= +### Service Properties ### +${SO_REST_URI_CREATE_SERVICE} ${SO_REST_URI} +${SO_REST_URI_DELETE_SERVICE} ${SO_REST_URI} + +### VNF Module Properties ### +${SO_REST_URI_CREATE_VFMODULE} ${SO_REST_URI}/<SERVICEINSTANCEID>/vnfs/<VNFINSTANCEID>/vfModules +${SO_REST_URI_DELETE_VFMODULE} ${SO_REST_URI}/<SERVICEINSTANCEID>/vnfs/<VNFINSTANCEID>/vfModules/<VFMODULEINSTANCEID> +### Messages ### +${TIME_OUT_MESSAGE} No Successful response within specified time +${ORCH_FAILURE_MESSAGE} Orchestration request has failed + +##### VF SPECIFIC PROPERTIES ##### +${INVALID_SERVICE_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid serviceInstanceId is specified" +${INVALID_VNF_INST_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid vnfInstanceId is specified" +${DELETE_VNF_FAIL_MSG} "Can't Delete Generic Vnf. Generic Vnf is still in use." + +##### NETWORK SPECIFIC PROPERTIES ##### +${INVALID_NW_INST_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid networkInstanceId is specified" +${INV_MODEL_NAME_MSG} "Received error from Network Adapter: Unknown Network Type: CONTRAIL_INTERNAL" +${BLANK_MODEL_NAME_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelName is specified" +${INV_REGION_ID_MSG} "Received error from Network Adapter: Cloud Site [RegionTwo] not found" +${BLANK_REGION_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid lcpCloudRegionId is specified" +${INV_TENANT_MSG} "Received error from Network Adapter: 404 Not Found: " +${BLANK_TENANT_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid tenantId is specified" +${INV_SOURCE_MSG} "Recipe does not exist in catalog DB" +${BLANK_SOURCE_MSG} "Error parsing request.${SPACE}${SPACE}No valid source is specified" +${BLANK_INVAR_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelInvariantId is specified" +${BLANK_VER_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid modelVersionId is specified" +${BLANK_REQ_ID_MSG} "Error parsing request.${SPACE}${SPACE}No valid requestorId is specified" + +### Orchestration Constants ### +${ORCH_REQUEST_COMPLETE} COMPLETE +${ORCH_REQUEST_COMPLETED} COMPLETED +${ORCH_REQUEST_FAILED} FAILED +${ORCH_REQUEST_IN_PROGRESS} IN_PROGRESS + +### MODEL TYPE ### +${MODEL_TYPE_SERVICE} service +${MODEL_TYPE_VNF} vnf +${MODEL_TYPE_VFMODULE} vfModule +${MODEL_TYPE_VOLUME_GROUP} volumeGroup +${MODEL_TYPE_NETWORK} network +${INV_MODEL_TYPE_VNF} vnf1 +${INVALID_MODEL_TYPE} INVALID_MODEL_TYPE +${INVALID_SERVICE_MODEL_NAME} INVALID_SERVICE_MODEL +${INVALID_VFMODULE_MODEL_NAME} INVALID_VFMODULE_MODEL +${INVALID_CLOUD_REGION_ID} INVALID_CLR + + +### CLOUD DATA ### +${TENANT_ID} 22eb191dd41a4f3c9be370fc638322f4 + + diff --git a/tests/so/orchestration/resources/common/Variables.robot b/tests/so/orchestration/resources/common/Variables.robot new file mode 100644 index 00000000..a6ee32b2 --- /dev/null +++ b/tests/so/orchestration/resources/common/Variables.robot @@ -0,0 +1,15 @@ +*** Variables *** +### HTTP response Codes ### +${HTTP_OK} 200 +${HTTP_ACCEPTED} 202 +${HTTP_NO_CONTENT} 204 +${HTTP_BAD_REQUEST} 400 +${HTTP_BAD_GATEWAY} 502 +${HTTP_RESOURCE_NOT_FOUND} 404 +${INTERNAL_SERVER_ERROR} 500 +${METHOD_NOT_ALLOWED} 405 + +###TRUE FLASE##### +${TRUE_VALUE} true +${FALSE_VALUE} false + diff --git a/tests/so/orchestration/resources/global_properties.robot b/tests/so/orchestration/resources/global_properties.robot new file mode 100644 index 00000000..a4a0f44d --- /dev/null +++ b/tests/so/orchestration/resources/global_properties.robot @@ -0,0 +1,74 @@ +*** Settings *** +Documentation store all properties that can change or are used in multiple places here +... format is all caps with underscores between words and prepended with GLOBAL +... make sure you prepend them with GLOBAL so that other files can easily see it is from this file. + + +*** Variables *** +${GLOBAL_APPLICATION_ID} robot-ete +${GLOBAL_SELENIUM_BROWSER} chrome +${GLOBAL_SELENIUM_BROWSER_CAPABILITIES} Create Dictionary +${GLOBAL_SELENIUM_DELAY} 0 +${GLOBAL_SELENIUM_BROWSER_IMPLICIT_WAIT} 5 +${GLOBAL_SELENIUM_BROWSER_WAIT_TIMEOUT} 15 +${GLOBAL_OPENSTACK_HEAT_SERVICE_TYPE} orchestration +${GLOBAL_OPENSTACK_CINDER_SERVICE_TYPE} volume +${GLOBAL_OPENSTACK_NOVA_SERVICE_TYPE} compute +${GLOBAL_OPENSTACK_NEUTRON_SERVICE_TYPE} network +${GLOBAL_OPENSTACK_GLANCE_SERVICE_TYPE} image +${GLOBAL_OPENSTACK_KEYSTONE_SERVICE_TYPE} identity +${GLOBAL_OPENSTACK_STACK_DEPLOYMENT_TIMEOUT} 600s +${GLOBAL_AAI_CLOUD_OWNER} CloudOwner +${GLOBAL_AAI_CLOUD_OWNER_DEFINED_TYPE} OwnerType +${GLOBAL_AAI_COMPLEX_NAME} clli1 +${GLOBAL_AAI_PHYSICAL_LOCATION_ID} clli1 +${GLOBAL_BUILD_NUMBER} 0 +${GLOBAL_VID_UI_TIMEOUT_SHORT} 20s +${GLOBAL_VID_UI_TIMEOUT_MEDIUM} 60s +${GLOBAL_VID_UI_TIMEOUT_LONG} 120s +${GLOBAL_VM_PRIVATE_KEY} ${EXECDIR}/robot/assets/keys/robot_ssh_private_key.pvt +${GLOBAL_AAI_ZONE_ID} nova1 +${GLOBAL_AAI_ZONE_NAME} nova +${GLOBAL_AAI_DESIGN_TYPE} integration +${GLOBAL_AAI_ZONE_CONTEXT} labs +${GLOBAL_AAI_SERVER_PROTOCOL} http +${GLOBAL_INJECTED_AAI1_IP_ADDR} localhost +${GLOBAL_AAI_SERVER_PORT} 9900 +${GLOBAL_AAI_USERNAME} test +${GLOBAL_AAI_PASSWORD} test +${GLOBAL_INJECTED_OPENSTACK_TENANT_ID} test +${GLOBAL_INJECTED_OPENSTACK_USERNAME} test +${GLOBAL_INJECTED_OPENSTACK_PASSWORD} test +${GLOBAL_INJECTED_KEYSTONE} test +${GLOBAL_PACKET_GENERATOR_PORT} test +${GLOBAL_PACKET_GENERATOR_USERNAME} test +${GLOBAL_PACKET_GENERATOR_PASSWORD} test +${GLOBAL_SERVICE_TEMPLATE_MAPPING} test +${GLOBAL_DNS_TRAFFIC_DURATION} test +${GLOBAL_INJECTED_NETWORK} test +${GLOBAL_SO_SERVER_PROTOCOL} http +${GLOBAL_INJECTED_SO_IP_ADDR} localhost +${GLOBAL_SO_SERVER_PORT} 8080 +${GLOBAL_SO_ASDC_PORT} 8085 +${GLOBAL_SO_CATALOG_PORT} 8082 +${GLOBAL_SO_CAMUNDA_PORT} 8081 +${GLOBAL_SO_SIMULATOR_PORT} 10000 +${resourceLocation} /app/csar/ +${GLOBAL_SO_CATDB_API_URI} aaaa + +${GLOBAL_INJECTED_PROPERTIES} None +${GLOBAL_INJECTED_ARTIFACTS_VERSION} None +${GLOBAL_INJECTED_PUBLIC_NET_ID} None +${GLOBAL_INJECTED_CLOUD_ENV} None +${GLOBAL_INJECTED_SCRIPT_VERSION} None +${GLOBAL_INJECTED_VM_IMAGE_NAME} None +${GLOBAL_INJECTED_VM_FLAVOR} None +${GLOBAL_PRELOAD_PARAMETERS} None + +${GLOBAL_SDNGC_USERNAME} admin +${GLOBAL_SDNGC_PASSWORD} admin +${GLOBAL_SDNGC_SERVER_PROTOCOL} https +#${GLOBAL_INJECTED_SDNC_IP_ADDR} +${GLOBAL_INJECTED_SDNC_IP_ADDR} aaaa +${GLOBAL_SDNGC_REST_PORT} 8443 +${GLOBAL_SDNGC_ADMIN_PORT} 8443
\ No newline at end of file diff --git a/tests/so/orchestration/resources/json_templater.robot b/tests/so/orchestration/resources/json_templater.robot new file mode 100644 index 00000000..0dd88b90 --- /dev/null +++ b/tests/so/orchestration/resources/json_templater.robot @@ -0,0 +1,42 @@ +*** Settings *** +Documentation This resource is filling out json string templates and returning the json back +Library RequestsLibrary +Library StringTemplater +Library OperatingSystem +Library CSVLibrary +Library Collections +Resource global_properties.robot + +*** Keywords *** +Fill JSON Template + [Documentation] Runs substitution on template to return a filled in json + [Arguments] ${json} ${arguments} + ${returned_string}= Template String ${json} ${arguments} + Log ${returned_string} + ${returned_json}= To Json ${returned_string} + [Return] ${returned_json} + +Fill JSON Template File + [Documentation] Runs substitution on template to return a filled in json + [Arguments] ${json_file} ${arguments} + ${json}= OperatingSystem.Get File ${json_file} + ${returned_json}= Fill JSON Template ${json} ${arguments} + [Return] ${returned_json} + +Read CSV Data And Create Dictionary + [Documentation] Read CSV Data And Create Dictionary + [Arguments] ${file} + + ${status} Run Keyword And Return Status Variable Should Exist ${file} + ${csv_file} = set variable if ${status}==True ${file} + LOG ${csv_file} + ${dictionary} Create Dictionary + ${dictionary_list} read csv file to associative ${csv_file} + + ${dict_count} Get Length ${dictionary_list} + : FOR ${row_num} IN RANGE 0 ${dict_count} + \ Log ${dictionary_list[${row_num}]} + \ ${dict_key} Get From Dictionary ${dictionary_list[${row_num}]} uniqueKey + \ Set To Dictionary ${dictionary} ${dict_key} ${dictionary_list[${row_num}]} + + [Return] ${dictionary}
\ No newline at end of file diff --git a/tests/so/orchestration/resources/properties/cloudRegion.robot b/tests/so/orchestration/resources/properties/cloudRegion.robot new file mode 100644 index 00000000..b38f4285 --- /dev/null +++ b/tests/so/orchestration/resources/properties/cloudRegion.robot @@ -0,0 +1,13 @@ +*** Settings *** +Documentation Properties for CloudRegion + + +*** Variables *** +${cloudOwner} CloudOwner +${cloudRegionId} regionOne +${cloudType} openstack +${ownerDefinedType} LCP +${cloudRegionVersion} 3.0.3 +${cloudZone} TEST1 +${complexName} regionOne +${sriovAutomation} false
\ No newline at end of file diff --git a/tests/so/orchestration/resources/properties/tenant.robot b/tests/so/orchestration/resources/properties/tenant.robot new file mode 100644 index 00000000..2e1ae75d --- /dev/null +++ b/tests/so/orchestration/resources/properties/tenant.robot @@ -0,0 +1,7 @@ +*** Settings *** +Documentation Properties for Tenant + + +*** Variables *** +${aai_tenant_Id} 0422ffb57ba042c0800a29dc85ca70f8 +${aai_tenant_Name} tenantName
\ No newline at end of file diff --git a/tests/so/orchestration/resources/so_interface.robot b/tests/so/orchestration/resources/so_interface.robot new file mode 100644 index 00000000..6db22bf2 --- /dev/null +++ b/tests/so/orchestration/resources/so_interface.robot @@ -0,0 +1,76 @@ +*** Settings *** +Documentation The main interface for interacting with SO. It handles low level stuff like managing the http request library and SO required fields +Library RequestsLibrary +Library UUID +Library OperatingSystem +Library Collections +Library HTTPUtils +Resource global_properties.robot +Resource json_templater.robot +*** Variables *** +${SO_ENDPOINT} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_SO_SERVER_PORT} +${CATALOG_DB_ENDPOINT} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_SO_CATALOG_PORT} +${CAMUNDA_DB_ENDPOINT} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_SO_CAMUNDA_PORT} +${SIMULATOR_ENDPOINT} ${GLOBAL_SO_SERVER_PROTOCOL}://${GLOBAL_INJECTED_SO_IP_ADDR}:${GLOBAL_SO_SIMULATOR_PORT} + +*** Keywords *** + +Run SO Get Request + [Documentation] Runs an SO get request + [Arguments] ${full_path} ${accept}=application/json ${endPoint}=${SO_ENDPOINT} + Disable Warnings + Log Creating session ${SO_ENDPOINT} + ${session}= Create Session so ${SO_ENDPOINT} + ${uuid}= Generate UUID + ${uuidstring}= Convert To String ${uuid} + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + ${resp}= Get Request so ${full_path} headers=${headers} + Log Received response from so ${resp.text} + [Return] ${resp} + +Poll SO Get Request + [Documentation] Runs an SO get request until a certain status is received. valid values are COMPLETE + [Arguments] ${data_path} ${status} + Disable Warnings + Log Creating session ${SO_ENDPOINT} + ${session}= Create Session so ${SO_ENDPOINT} + ${uuid}= Generate UUID + ${uuidstring}= Convert To String ${uuid} + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + #do this until it is done + :FOR ${i} IN RANGE 20 + \ ${resp}= Get Request so ${data_path} headers=${headers} + \ Should Not Contain ${resp.text} FAILED + \ Log ${resp.json()['request']['requestStatus']['requestState']} + \ ${exit_loop}= Evaluate "${resp.json()['request']['requestStatus']['requestState']}" == "${status}" + \ Exit For Loop If ${exit_loop} + \ Sleep 15s + Log Received response from so ${resp.text} + [Return] ${resp} + +Run SO Post request + [Documentation] Runs an SO post request + [Arguments] ${data_path} ${data} + Disable Warnings + Log Creating session ${SO_ENDPOINT} + ${session}= Create Session so ${SO_ENDPOINT} + ${uuid}= Generate UUID + ${uuidstring}= Convert To String ${uuid} + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + ${resp}= Post Request so ${data_path} data=${data} headers=${headers} + Log Received response from so ${resp.text} + [Return] ${resp} + + +Run SO Delete request + [Documentation] Runs an SO Delete request + [Arguments] ${data_path} ${data} + Disable Warnings + Log Creating session ${SO_ENDPOINT} + ${session}= Create Session so ${SO_ENDPOINT} + ${uuid}= Generate UUID + ${uuidstring}= Convert To String ${uuid} + &{headers}= Create Dictionary Authorization=Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA== Content-Type=application/json Accept=application/json + ${resp}= Delete Request so ${data_path} ${data} headers=${headers} + Log Received response from so ${resp.text} + [Return] ${resp} diff --git a/tests/so/orchestration/testsuites/bpmn-infra/aLaCarte/Create/ServiceInstantiationTest.robot b/tests/so/orchestration/testsuites/bpmn-infra/aLaCarte/Create/ServiceInstantiationTest.robot new file mode 100644 index 00000000..c4edba1b --- /dev/null +++ b/tests/so/orchestration/testsuites/bpmn-infra/aLaCarte/Create/ServiceInstantiationTest.robot @@ -0,0 +1,34 @@ +*** Settings *** +Documentation Testing Create Generic ALaCarte Service Instance flow +Resource ../../../../resources/bpmn-infra/aLaCarte/Create/ServiceInstance.robot +Resource ../../../../resources/common/Variables.robot +Resource ../../../../resources/common/SoVariables.robot +Resource ../../../../resources/aai/service_instance.robot + +*** Variables *** +${serv_inst_id} shouldOverWrite +${create_service_instance_template_file} ../../../../assets/templates/bpmn-infra/aLaCarte/Create/ServiceInstance.template + +*** Settings *** +*** Test Cases *** +Create and Delete Service Alacarte GR_API + [Tags] Smoke Sanity + [Setup] Setup GR Create Service Instance TC_1 + log starting create SI + ${serv_inst_id} ${request_id} ${request_completion_status} ${status_code} ${service_body} Create Service Instance TC_1 ${create_service_instance_template_file} + Should Be Equal As Strings ${status_code} 202 + Should Be Equal As Strings ${request_completion_status} COMPLETE + log validating SI + Validate Service Instance Robot_SI Robot_Test_Service_Type Robot_Test_Subscriber_ID Active + Validate Owning Entity c3f57fa8-ac7d-11e8-98d0-529269fb1459 200 + Validate Project GR_API_OE_SO_Test200 200 + + log starting delete SI + ${instance_id} ${delete_si_request_id} ${request_completion_status} ${delete_service_response.status_code} Invoke Delete Service Instance Flow ${service_body} ${serv_inst_id} + Should Be Equal As Strings ${delete_service_response.status_code} 202 + Should Be Equal As Strings ${request_completion_status} COMPLETE + Validate Service Instance Not Exist By Id ${serv_inst_id} + Validate Owning Entity c3f57fa8-ac7d-11e8-98d0-529269fb1459 200 + Validate Project GR_API_OE_SO_Test200 200 + + [Teardown] Teardown GR Create Service Instance ${serv_inst_id}
\ No newline at end of file diff --git a/tests/so/vnfm_adapter/vnfm_adapter_test.robot b/tests/so/vnfm_adapter/vnfm_adapter_test.robot deleted file mode 100644 index d0c7034f..00000000 --- a/tests/so/vnfm_adapter/vnfm_adapter_test.robot +++ /dev/null @@ -1,16 +0,0 @@ -*** Settings *** -Library Collections -Library RequestsLibrary -Library OperatingSystem -Library json - -*** Variables *** - - -*** Test Cases *** - -Healthcheck - Create Session refrepo http://${REPO_IP}:9092 - &{headers}= Create Dictionary Authorization=Basic dm5mbTpwYXNzd29yZDEk== Content-Type=application/json - ${resp}= Get Request refrepo /manage/health headers=${headers} - Run Keyword If '${resp.status_code}' == 'UP' log to console \nexecuted with expected result |