From: Bartek Grzybowski Date: Thu, 28 Jan 2021 08:50:56 +0000 (+0000) Subject: Merge "Update csit for nonrtric" X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=93a3060d58c058e5588d249adcf53d968c8e5593;hp=727354a35fcc6221ebfcca4ab7e251d011fc5bed;p=integration%2Fcsit.git Merge "Update csit for nonrtric" --- 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 old mode 100644 new mode 100755 index d0e346f3..209dfca4 Binary files a/plans/so/integration-etsi-testing/config/distribution-test-zip/zipped_sdc_csar.tar.gz and b/plans/so/integration-etsi-testing/config/distribution-test-zip/zipped_sdc_csar.tar.gz differ diff --git a/plans/so/integration-etsi-testing/config/env b/plans/so/integration-etsi-testing/config/env index 647f53a6..c0d8210a 100644 --- a/plans/so/integration-etsi-testing/config/env +++ b/plans/so/integration-etsi-testing/config/env @@ -1,6 +1,7 @@ NEXUS_DOCKER_REPO_MSO=nexus3.onap.org:10001 DOCKER_ENVIRONMENT=remote -TAG=1.6.0 +TAG=1.8.0-STAGING-latest TIME_OUT_DEFAULT_VALUE_SEC=1200 PROJECT_NAME=etsiintegrationtesting DEFAULT_NETWORK_NAME=etsiintegrationtesting_default +ETSI_CATALOG_IMAGE_VERSION=1.0.9 diff --git a/plans/so/integration-etsi-testing/config/override-files/api-handler-infra/onapheat/override.yaml b/plans/so/integration-etsi-testing/config/override-files/api-handler-infra/onapheat/override.yaml index bdf5c4de..327e7987 100644 --- a/plans/so/integration-etsi-testing/config/override-files/api-handler-infra/onapheat/override.yaml +++ b/plans/so/integration-etsi-testing/config/override-files/api-handler-infra/onapheat/override.yaml @@ -131,3 +131,5 @@ org: adapters: network: encryptionKey: 07a7159d3bf51a0e53be7a8f89699be7 +aai: + auth: 221187EFA3AD4E33600DE0488F287099934CE65C3D0697BCECC00BB58E784E07CD74A24581DC31DBC086FF63DF116378776E9BE3D1325885 diff --git a/plans/so/integration-etsi-testing/config/override-files/vnfm-simulator/onapheat/override.yaml b/plans/so/integration-etsi-testing/config/override-files/vnfm-simulator/onapheat/override.yaml index 05cb1e56..b57d0e85 100644 --- a/plans/so/integration-etsi-testing/config/override-files/vnfm-simulator/onapheat/override.yaml +++ b/plans/so/integration-etsi-testing/config/override-files/vnfm-simulator/onapheat/override.yaml @@ -54,3 +54,23 @@ vnfds: resourceTemplateId: vnfd2_vnfc4 vduId: vnfd2_vduForVnfc4 type: COMPUTE + - vnfdid: b1bb0ce7-2222-4fa7-95ed-4840d70a1177 + vnfclist: + - vnfcid: VNFC5 + resourceTemplateId: vnfd3_vnfc4 + vduId: vnfd3_vduForVnfc4 + type: COMPUTE + - vnfcid: VNFC6 + resourceTemplateId: vnfd3_vnfc5 + vduId: vnfd3_vduForVnfc5 + type: COMPUTE + - vnfdid: 0c960b3a-d88f-11ea-87d0-0242ac130003 + vnfclist: + - vnfcid: VNFC7 + resourceTemplateId: vnfd4_vnfc5 + vduId: vnfd4_vduForVnfc5 + type: COMPUTE + - vnfcid: VNFC8 + resourceTemplateId: vnfd4_vnfc6 + vduId: vnfd4_vduForVnfc6 + type: COMPUTE 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 35ee2641..11e32bce 100755 --- a/plans/so/integration-etsi-testing/config/wait-for-container.sh +++ b/plans/so/integration-etsi-testing/config/wait-for-container.sh @@ -121,6 +121,7 @@ process_arguments() result=$(docker inspect --format '{{.State.Running}}' $CONTAINER_NAME) if [ $result != "true" ] ; then + docker logs $CONTAINER_NAME echo "$SCRIPT_NAME $(current_timestamp) ERROR: $CONTAINER_NAME container is not running" exit 1 fi @@ -142,6 +143,7 @@ process_arguments() $WAIT_FOR_SCRIPT -t "$TIME_OUT" -h "$HOST_IP" -p "$PORT" if [ $? -ne 0 ]; then + docker logs $CONTAINER_NAME echo "$SCRIPT_NAME $(current_timestamp) ERROR: wait-for.sh failed ..." 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 index e11b8006..26b45a3d 100644 --- a/plans/so/integration-etsi-testing/docker-compose.local.yml +++ b/plans/so/integration-etsi-testing/docker-compose.local.yml @@ -28,6 +28,5 @@ services: so-vnfm-adapter: image: onap/so/vnfm-adapter:${TAG} ################################################################################ - ve-vnfm-adapter: - image: onap/so/ve-vnfm-adapter:${TAG} -################################################################################ + modeling-etsicatalog: + image: ${NEXUS_DOCKER_REPO_MSO}/onap/modeling/etsicatalog:${ETSI_CATALOG_IMAGE_VERSION} diff --git a/plans/so/integration-etsi-testing/docker-compose.yml b/plans/so/integration-etsi-testing/docker-compose.yml index 2ee5026a..f1853e0e 100644 --- a/plans/so/integration-etsi-testing/docker-compose.yml +++ b/plans/so/integration-etsi-testing/docker-compose.yml @@ -6,10 +6,14 @@ services: ports: - "3306:3306" volumes: + - /var/lib/mysql - ${TEST_LAB_DIR}/volumes/mariadb/docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d - ${TEST_LAB_DIR}/volumes/mariadb/conf.d:/etc/mysql/conf.d environment: - MYSQL_ROOT_PASSWORD=password + - MYSQL_USER=etsicatalog + - MYSQL_PASSWORD=etsicatalog + - MYSQL_DATABASE=etsicatalog hostname: mariadb.so.testlab.onap.org logging: @@ -345,27 +349,24 @@ services: command: - "/config/populate-aai-simulator.sh" ################################################################################ - ve-vnfm-adapter: - image: ${NEXUS_DOCKER_REPO_MSO}/onap/so/ve-vnfm-adapter:${TAG} + modeling-etsicatalog: + image: ${NEXUS_DOCKER_REPO_MSO}/onap/modeling/etsicatalog:${ETSI_CATALOG_IMAGE_VERSION} ports: - - "9098:9098" + - "8806:8806" volumes: - - ${CONFIG_DIR_PATH}/override-files/ve-vnfm-adapter/onapheat:/app/config - - ${CONFIG_DIR_PATH}/certificates/truststore/root-ca.crt:/app/ca-certificates/root-ca.crt + - /var/lib/mysql + - ${CONFIG_DIR_PATH}/wait-for.sh:/service/wait-for.sh environment: - - APP=ve-vnfm-adapter - - JVM_ARGS=-Xms64m -Xmx512m - - DB_HOST=mariadb + - DB_IP=mariadb + - SDC_ADDR=http://sdc-simulator:9991 hostname: - ve-vnfm-adapter + modeling-etsicatalog depends_on: - - request-db-adapter - - aai-simulator + - mariadb + - sdc-simulator logging: driver: "json-file" options: max-size: "30m" max-file: "5" - user: root - entrypoint: /bin/sh -c '/app/wait-for.sh -q -t "300" request-db-adapter:8083 -- "/app/start-app.sh"' -################################################################################ + entrypoint: /bin/sh -c '/service/wait-for.sh -t 300 -h mariadb -p 3306 && /service/modeling/etsicatalog/docker/docker-entrypoint.sh' diff --git a/plans/so/integration-etsi-testing/setup.sh b/plans/so/integration-etsi-testing/setup.sh index ce6637c1..ee2fb94f 100755 --- a/plans/so/integration-etsi-testing/setup.sh +++ b/plans/so/integration-etsi-testing/setup.sh @@ -49,7 +49,7 @@ echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..." export $(egrep -v '^#' $ENV_FILE | xargs) -MANDATORY_VARIABLES_NAMES=( "NEXUS_DOCKER_REPO_MSO" "DOCKER_ENVIRONMENT" "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", "ETSI_CATALOG_IMAGE_VERSION") for var in "${MANDATORY_VARIABLES_NAMES[@]}" do @@ -153,6 +153,8 @@ fi echo "Sleeping for 3m" sleep 3m +docker ps -a + echo "Will execute $WAIT_FOR_WORKAROUND_SCRIPT script" $WAIT_FOR_WORKAROUND_SCRIPT @@ -184,6 +186,17 @@ if [ $? -ne 0 ]; then exit 1 fi +MODELING_ETSI_CATALOG_CONTAINER_NAME="modeling-etsicatalog" +echo "Will execute $WAIT_FOR_CONTAINER_SCRIPT to wait for $MODELING_ETSI_CATALOG_CONTAINER_NAME container to start up" +$WAIT_FOR_CONTAINER_SCRIPT -c "$MODELING_ETSI_CATALOG_CONTAINER_NAME" -t "300" -n "$DEFAULT_NETWORK_NAME" + +if [ $? -ne 0 ]; then + echo "ERROR: $WAIT_FOR_CONTAINER_SCRIPT failed" + echo "Will stop running docker containers . . ." + $TEAR_DOWN_SCRIPT + exit 1 +fi + REPO_IP='127.0.0.1' ROBOT_VARIABLES="-v REPO_IP:${REPO_IP}" diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml index 26815ad0..c51cae12 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml @@ -8,7 +8,7 @@ aai-simulator - 1.0.0 + 1.8.1 diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/BusinessController.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/BusinessController.java index 4a0ed1b9..1221beae 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/BusinessController.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/BusinessController.java @@ -23,12 +23,12 @@ import static org.onap.so.aaisimulator.utils.Constants.BI_DIRECTIONAL_RELATIONSH import static org.onap.so.aaisimulator.utils.Constants.CUSTOMER_TYPE; import static org.onap.so.aaisimulator.utils.Constants.CUSTOMER_URL; import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNF; -import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNF_VNF_ID; import static org.onap.so.aaisimulator.utils.Constants.SERVICE_RESOURCE_TYPE; import static org.onap.so.aaisimulator.utils.Constants.SERVICE_SUBSCRIPTION; import static org.onap.so.aaisimulator.utils.Constants.X_HTTP_METHOD_OVERRIDE; import static org.onap.so.aaisimulator.utils.RequestErrorResponseUtils.getRequestErrorResponseEntity; import static org.onap.so.aaisimulator.utils.RequestErrorResponseUtils.getResourceVersion; +import java.util.List; import java.util.Optional; import javax.servlet.http.HttpServletRequest; import javax.ws.rs.core.MediaType; @@ -36,7 +36,6 @@ import org.onap.aai.domain.yang.Customer; import org.onap.aai.domain.yang.GenericVnf; import org.onap.aai.domain.yang.GenericVnfs; import org.onap.aai.domain.yang.Relationship; -import org.onap.aai.domain.yang.RelationshipData; import org.onap.aai.domain.yang.ServiceInstance; import org.onap.aai.domain.yang.ServiceInstances; import org.onap.aai.domain.yang.ServiceSubscription; @@ -263,33 +262,32 @@ public class BusinessController { public ResponseEntity getRelatedToGenericVnf(@PathVariable("global-customer-id") final String globalCustomerId, @PathVariable("service-type") final String serviceType, @PathVariable(name = "service-instance-id") final String serviceInstanceId, - @RequestParam(name = "vnf-name", required = true) final String vnfName, final HttpServletRequest request) { + @RequestParam(name = "vnf-name", required = false) final String vnfName, final HttpServletRequest request) { LOGGER.info( "Will retrieve generic vnf related to information for 'global customer id': {}, 'service type': {} and 'service instance id: '{} with vnfname: {}...", globalCustomerId, serviceType, serviceInstanceId, vnfName); - final Optional optional = - cacheServiceProvider.getRelationship(globalCustomerId, serviceType, serviceInstanceId, vnfName); + final List relatedToVnfIds = + getRelatedToVnfIds(globalCustomerId, serviceType, serviceInstanceId, vnfName); - if (optional.isPresent()) { - - final Relationship relationship = optional.get(); - final Optional relationshipDataOptional = relationship.getRelationshipData().stream() - .filter(existing -> GENERIC_VNF_VNF_ID.equals(existing.getRelationshipKey())).findFirst(); - if (relationshipDataOptional.isPresent()) { - final RelationshipData relationshipData = relationshipDataOptional.get(); - final String vnfId = relationshipData.getRelationshipValue(); + if (!relatedToVnfIds.isEmpty()) { + final GenericVnfs genericVnfs = new GenericVnfs(); + relatedToVnfIds.stream().forEach(vnfId -> { final Optional genericVnfOptional = genericVnfCacheServiceProvider.getGenericVnf(vnfId); if (genericVnfOptional.isPresent()) { - final GenericVnfs genericVnfs = new GenericVnfs(); - genericVnfs.getGenericVnf().add(genericVnfOptional.get()); - LOGGER.info("found service instance {} in cache", relationship); - return ResponseEntity.ok(genericVnfs); + final GenericVnf genericVnf = genericVnfOptional.get(); + LOGGER.info("found related-to generic-vnf {} in cache", genericVnf); + genericVnfs.getGenericVnf().add(genericVnf); } + }); + if (!genericVnfs.getGenericVnf().isEmpty()) { + LOGGER.info("Found {} related generic-vnfs", genericVnfs.getGenericVnf().size()); + return ResponseEntity.ok(genericVnfs); } } + LOGGER.error( "Couldn't find generic vnf related to information for 'global customer id': {}, 'service type': {} and 'service instance id: '{} with vnfname: {}...", globalCustomerId, serviceType, serviceInstanceId, vnfName); @@ -353,4 +351,12 @@ public class BusinessController { return getRequestErrorResponseEntity(request); } + + private List getRelatedToVnfIds(final String globalCustomerId, final String serviceType, + final String serviceInstanceId, final String vnfName) { + if (vnfName != null) { + return cacheServiceProvider.getRelatedToVnfIds(globalCustomerId, serviceType, serviceInstanceId, vnfName); + } + return cacheServiceProvider.getRelatedToVnfIds(globalCustomerId, serviceType, serviceInstanceId); + } } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProvider.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProvider.java index 7000fb3f..af3595a0 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProvider.java @@ -19,6 +19,7 @@ */ package org.onap.so.aaisimulator.service.providers; +import java.util.List; import java.util.Optional; import org.onap.aai.domain.yang.Customer; import org.onap.aai.domain.yang.Relationship; @@ -53,13 +54,16 @@ public interface CustomerCacheServiceProvider extends Clearable { boolean patchServiceInstance(final String globalCustomerId, final String serviceType, final String serviceInstanceId, final ServiceInstance serviceInstance); - Optional getRelationship(final String globalCustomerId, final String serviceType, - final String serviceInstanceId, final String vnfName); - Optional addRelationShip(final String globalCustomerId, final String serviceType, final String serviceInstanceId, final Relationship relationship, final String requestUri); boolean deleteSericeInstance(final String globalCustomerId, final String serviceType, final String serviceInstanceId, final String resourceVersion); + List getRelatedToVnfIds(final String globalCustomerId, final String serviceType, + final String serviceInstanceId, final String vnfName); + + List getRelatedToVnfIds(final String globalCustomerId, final String serviceType, + final String serviceInstanceId); + } diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProviderImpl.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProviderImpl.java index 7193ade1..7285faad 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProviderImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProviderImpl.java @@ -22,11 +22,14 @@ package org.onap.so.aaisimulator.service.providers; import static org.onap.so.aaisimulator.utils.CacheName.CUSTOMER_CACHE; import static org.onap.so.aaisimulator.utils.Constants.CUSTOMER_GLOBAL_CUSTOMER_ID; import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNF; +import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNF_VNF_ID; import static org.onap.so.aaisimulator.utils.Constants.GENERIC_VNF_VNF_NAME; import static org.onap.so.aaisimulator.utils.Constants.SERVICE_INSTANCE_SERVICE_INSTANCE_ID; import static org.onap.so.aaisimulator.utils.Constants.SERVICE_INSTANCE_SERVICE_INSTANCE_NAME; import static org.onap.so.aaisimulator.utils.Constants.SERVICE_SUBSCRIPTION_SERVICE_TYPE; import static org.onap.so.aaisimulator.utils.HttpServiceUtils.getBiDirectionalRelationShipListRelatedLink; +import java.util.ArrayList; +import java.util.Collections; import java.util.List; import java.util.Optional; import java.util.stream.Collectors; @@ -279,7 +282,7 @@ public class CustomerCacheServiceProviderImpl extends AbstractCacheServiceProvid } @Override - public Optional getRelationship(final String globalCustomerId, final String serviceType, + public List getRelatedToVnfIds(final String globalCustomerId, final String serviceType, final String serviceInstanceId, final String vnfName) { final Optional optional = getServiceInstance(globalCustomerId, serviceType, serviceInstanceId); @@ -289,20 +292,53 @@ public class CustomerCacheServiceProviderImpl extends AbstractCacheServiceProvid final RelationshipList relationshipList = serviceInstance.getRelationshipList(); if (relationshipList != null) { - final List relationship = relationshipList.getRelationship(); - return relationship.stream().filter( + final List relationships = relationshipList.getRelationship().stream().filter( relationShip -> relationShip.getRelatedToProperty().stream().filter(relatedToProperty -> { final String propertyKey = relatedToProperty.getPropertyKey(); final String propertyValue = relatedToProperty.getPropertyValue(); return GENERIC_VNF_VNF_NAME.equals(propertyKey) && propertyValue != null && propertyValue.equals(vnfName); - }).findFirst().isPresent()).findFirst(); + }).findFirst().isPresent()).collect(Collectors.toList()); + LOGGER.info("Found relationships {} for vnf-name: {}", relationships, vnfName); + return getGenericVnfIdsIfPresent(relationships); } LOGGER.warn("Relationship list is nulll ..."); } - LOGGER.error("Unable to RelationShip with property value: {}... ", vnfName); + LOGGER.error("Unable to find generic-vnf relationships with property value: {}... ", vnfName); + return Collections.emptyList(); + } - return Optional.empty(); + @Override + public List getRelatedToVnfIds(final String globalCustomerId, final String serviceType, + final String serviceInstanceId) { + final Optional optional = getServiceInstance(globalCustomerId, serviceType, serviceInstanceId); + + if (optional.isPresent()) { + LOGGER.info("Found service instance ..."); + final ServiceInstance serviceInstance = optional.get(); + final RelationshipList relationshipList = serviceInstance.getRelationshipList(); + + if (relationshipList != null) { + final List relationships = relationshipList.getRelationship(); + LOGGER.info("Relationships found {}", relationships); + return getGenericVnfIdsIfPresent(relationships); + } + LOGGER.warn("Relationship list is nulll ..."); + } + LOGGER.error("Unable to find generic-vnf relationships ... "); + return Collections.emptyList(); + } + + private List getGenericVnfIdsIfPresent(final List relationships) { + final List vnfIdsFound = new ArrayList<>(); + relationships.stream().forEach(relationship -> { + relationship.getRelationshipData().stream() + .filter(existing -> GENERIC_VNF_VNF_ID.equals(existing.getRelationshipKey())).findFirst() + .ifPresent(consume -> { + vnfIdsFound.add(consume.getRelationshipValue()); + }); + }); + return vnfIdsFound; } @Override diff --git a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java index c08c51ec..7da37794 100644 --- a/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java @@ -360,6 +360,41 @@ public class BusinessControllerTest extends AbstractSpringBootTest { assertEquals(GENERIC_VNF_NAME, genericVnf.getVnfName()); } + @Test + public void test_putServiceInstanceRelatedTo_ableToRetrieveAllRelatedGenericVnfsFromCache() throws Exception { + + final String url = getUrl(CUSTOMERS_URL, SERVICE_SUBSCRIPTIONS_URL, SERVICE_INSTANCE_URL); + + invokeCustomerEndPointAndAssertResponse(); + + invokeServiceInstanceEndPointAndAssertResponse(); + + final String relationShipUrl = getUrl(CUSTOMERS_URL, SERVICE_SUBSCRIPTIONS_URL, SERVICE_INSTANCE_URL, + BI_DIRECTIONAL_RELATIONSHIP_LIST_URL); + + final ResponseEntity responseEntity2 = testRestTemplateService.invokeHttpPut(relationShipUrl, + TestUtils.getRelationShipJsonObject(), Relationship.class); + + assertEquals(HttpStatus.ACCEPTED, responseEntity2.getStatusCode()); + + final String genericVnfUrl = getUrl(GENERIC_VNF_URL, VNF_ID); + final ResponseEntity genericVnfResponse = + testRestTemplateService.invokeHttpPut(genericVnfUrl, TestUtils.getGenericVnf(), Void.class); + assertEquals(HttpStatus.ACCEPTED, genericVnfResponse.getStatusCode()); + + final ResponseEntity actual = + testRestTemplateService.invokeHttpGet(url + RELATED_TO_URL, GenericVnfs.class); + + assertEquals(HttpStatus.OK, actual.getStatusCode()); + + assertTrue(actual.hasBody()); + final GenericVnfs genericVnfs = actual.getBody(); + assertFalse(genericVnfs.getGenericVnf().isEmpty()); + final GenericVnf genericVnf = genericVnfs.getGenericVnf().get(0); + assertEquals(GENERIC_VNF_NAME, genericVnf.getVnfName()); + } + + @Test public void test_DeleteSericeInstance_ServiceInstanceRemovedFromCache() throws Exception { final String url = getUrl(CUSTOMERS_URL, SERVICE_SUBSCRIPTIONS_URL, SERVICE_INSTANCE_URL); diff --git a/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image b/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image index efd7833f..f227c63f 100644 --- a/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image +++ b/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image @@ -8,7 +8,8 @@ ENV http_proxy=$HTTP_PROXY ENV https_proxy=$HTTPS_PROXY # Update the package list and upgrade installed packages -RUN apk update && apk upgrade +USER root +RUN apk update # Install commonly needed tools RUN apk --no-cache add curl netcat-openbsd sudo nss @@ -24,6 +25,8 @@ COPY scripts/start-app.sh /app RUN chown -R so:so /app && chmod 700 /app/*.sh +USER so + # Springboot configuration (required) VOLUME /app/config diff --git a/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.workaround-job-container b/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.workaround-job-container index faf8492c..795a015e 100644 --- a/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.workaround-job-container +++ b/plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.workaround-job-container @@ -22,6 +22,7 @@ FROM docker.io/alpine # Install packages -RUN apk update && apk upgrade && apk add mysql-client && apk add bash +USER root +RUN apk upgrade && apk add mysql-client -RUN apk --no-cache add curl netcat-openbsd sudo nss +RUN apk --no-cache add bash curl netcat-openbsd sudo nss diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/pom.xml b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/pom.xml index 27e7c3ea..e694fef1 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/pom.xml +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/pom.xml @@ -9,6 +9,11 @@ sdc-simulator ${project.artifactId} + + ${project.parent.groupId} + common + ${project.version} + org.springframework.boot spring-boot-starter-security diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/configration/WebSecurityConfigImpl.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/configration/WebSecurityConfigImpl.java index b2c51369..a8ede989 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/configration/WebSecurityConfigImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/configration/WebSecurityConfigImpl.java @@ -20,15 +20,12 @@ package org.onap.so.sdcsimulator.configration; import org.onap.so.sdcsimulator.utils.Constants; +import org.onap.so.simulator.configuration.SimulatorSecurityConfigurer; +import org.onap.so.simulator.model.UserCredentials; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; import org.springframework.security.config.annotation.web.builders.HttpSecurity; import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; -import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; -import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; /** * @author waqas.ikram@ericsson.com @@ -36,18 +33,12 @@ import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder; */ @Configuration @EnableWebSecurity -public class WebSecurityConfigImpl extends WebSecurityConfigurerAdapter { +public class WebSecurityConfigImpl extends SimulatorSecurityConfigurer { - private final String username; - private final String password; - private final String role; - public WebSecurityConfigImpl(@Value("${spring.security.username}") final String username, - @Value("${spring.security.password}") final String password, - @Value("${spring.security.role}") final String role) { - this.username = username; - this.password = password; - this.role = role; + @Autowired + public WebSecurityConfigImpl(final UserCredentials userCredentials) { + super(userCredentials.getUsers()); } @@ -57,15 +48,5 @@ public class WebSecurityConfigImpl extends WebSecurityConfigurerAdapter { .httpBasic(); } - @Bean - public BCryptPasswordEncoder passwordEncoder() { - return new BCryptPasswordEncoder(); - } - - @Autowired - public void configureGlobal(final AuthenticationManagerBuilder auth) throws Exception { - auth.inMemoryAuthentication().passwordEncoder(passwordEncoder()).withUser(username).password(password) - .roles(role); - } } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/controller/CatalogController.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/controller/CatalogController.java index 60c1865d..eff63b84 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/controller/CatalogController.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/controller/CatalogController.java @@ -49,6 +49,12 @@ public class CatalogController { this.resourceProvider = resourceProvider; } + @GetMapping(value = "/resources", produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML}) + public ResponseEntity getResources() { + LOGGER.info("Running getResources ..."); + return ResponseEntity.ok().body(resourceProvider.getResource()); + } + @GetMapping(value = "/resources/{csarId}/toscaModel", produces = MediaType.APPLICATION_OCTET_STREAM) public ResponseEntity getCsar(@PathVariable("csarId") final String csarId) { LOGGER.info("Running getCsar for {} ...", csarId); diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/models/ResourceArtifact.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/models/ResourceArtifact.java new file mode 100644 index 00000000..0b9e6cf1 --- /dev/null +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/models/ResourceArtifact.java @@ -0,0 +1,245 @@ +/*- + * ============LICENSE_START======================================================= + * Copyright (C) 2021 Nordix Foundation. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * 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========================================================= + */ +package org.onap.so.sdcsimulator.models; + +import java.io.Serializable; +import org.springframework.util.ObjectUtils; +import com.fasterxml.jackson.annotation.JsonProperty; + +/** + * @author Waqas Ikram (waqas.ikram@est.tech) + * + */ +public class ResourceArtifact implements Serializable { + + private static final long serialVersionUID = 3967660000071162759L; + + @JsonProperty("uuid") + private String uuid; + + @JsonProperty("invariantUUID") + private String invariantUuid; + + @JsonProperty("name") + private String name; + + @JsonProperty("version") + private String version; + + @JsonProperty("toscaModelURL") + private String toscaModelUrl; + + @JsonProperty("category") + private String category; + + @JsonProperty("subCategory") + private String subCategory; + + @JsonProperty("resourceType") + private String resourceType; + + @JsonProperty("lifecycleState") + private String lifecycleState; + + @JsonProperty("lastUpdaterUserId") + private String lastUpdaterUserId; + + public String getUuid() { + return uuid; + } + + public void setUuid(final String uuid) { + this.uuid = uuid; + } + + public ResourceArtifact uuid(final String uuid) { + this.uuid = uuid; + return this; + } + + public String getInvariantUuid() { + return invariantUuid; + } + + public void setInvariantUuid(final String invariantUuid) { + this.invariantUuid = invariantUuid; + } + + public ResourceArtifact invariantUuid(final String invariantUuid) { + this.invariantUuid = invariantUuid; + return this; + } + + public String getName() { + return name; + } + + public void setName(final String name) { + this.name = name; + } + + public ResourceArtifact name(final String name) { + this.name = name; + return this; + } + + public String getVersion() { + return version; + } + + public void setVersion(final String version) { + this.version = version; + } + + public ResourceArtifact version(final String version) { + this.version = version; + return this; + } + + public String getToscaModelUrl() { + return toscaModelUrl; + } + + public void setToscaModelUrl(final String toscaModelUrl) { + this.toscaModelUrl = toscaModelUrl; + } + + public ResourceArtifact toscaModelUrl(final String toscaModelUrl) { + this.toscaModelUrl = toscaModelUrl; + return this; + } + + public String getCategory() { + return category; + } + + public void setCategory(final String category) { + this.category = category; + } + + public ResourceArtifact category(final String category) { + this.category = category; + return this; + } + + public String getSubCategory() { + return subCategory; + } + + public void setSubCategory(final String subCategory) { + this.subCategory = subCategory; + } + + public ResourceArtifact subCategory(final String subCategory) { + this.subCategory = subCategory; + return this; + } + + public String getResourceType() { + return resourceType; + } + + public void setResourceType(final String resourceType) { + this.resourceType = resourceType; + } + + public ResourceArtifact resourceType(final String resourceType) { + this.resourceType = resourceType; + return this; + } + + public String getLifecycleState() { + return lifecycleState; + } + + public void setLifecycleState(final String lifecycleState) { + this.lifecycleState = lifecycleState; + } + + public ResourceArtifact lifecycleState(final String lifecycleState) { + this.lifecycleState = lifecycleState; + return this; + } + + public String getLastUpdaterUserId() { + return lastUpdaterUserId; + } + + public void setLastUpdaterUserId(final String lastUpdaterUserId) { + this.lastUpdaterUserId = lastUpdaterUserId; + } + + public ResourceArtifact lastUpdaterUserId(final String lastUpdaterUserId) { + this.lastUpdaterUserId = lastUpdaterUserId; + return this; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((category == null) ? 0 : category.hashCode()); + result = prime * result + ((invariantUuid == null) ? 0 : invariantUuid.hashCode()); + result = prime * result + ((lastUpdaterUserId == null) ? 0 : lastUpdaterUserId.hashCode()); + result = prime * result + ((lifecycleState == null) ? 0 : lifecycleState.hashCode()); + result = prime * result + ((name == null) ? 0 : name.hashCode()); + result = prime * result + ((resourceType == null) ? 0 : resourceType.hashCode()); + result = prime * result + ((subCategory == null) ? 0 : subCategory.hashCode()); + result = prime * result + ((toscaModelUrl == null) ? 0 : toscaModelUrl.hashCode()); + result = prime * result + ((uuid == null) ? 0 : uuid.hashCode()); + result = prime * result + ((version == null) ? 0 : version.hashCode()); + return result; + } + + @Override + public boolean equals(final Object obj) { + if (obj instanceof ResourceArtifact) { + final ResourceArtifact other = (ResourceArtifact) obj; + return ObjectUtils.nullSafeEquals(category, other.category) + && ObjectUtils.nullSafeEquals(invariantUuid, other.invariantUuid) + && ObjectUtils.nullSafeEquals(lastUpdaterUserId, other.lastUpdaterUserId) + && ObjectUtils.nullSafeEquals(lifecycleState, other.lifecycleState) + && ObjectUtils.nullSafeEquals(name, other.name) + && ObjectUtils.nullSafeEquals(resourceType, other.resourceType) + && ObjectUtils.nullSafeEquals(subCategory, other.subCategory) + && ObjectUtils.nullSafeEquals(toscaModelUrl, other.toscaModelUrl) + && ObjectUtils.nullSafeEquals(uuid, other.uuid) + && ObjectUtils.nullSafeEquals(version, other.version); + } + return false; + } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class ResourceArtifact {\n"); + sb.append(" uuid: ").append(uuid).append("\n"); + sb.append(" invariantUuid: ").append(invariantUuid).append("\n"); + sb.append(" name: ").append(name).append("\n"); + sb.append(" version: ").append(version).append("\n"); + sb.append(" toscaModelUrl: ").append(toscaModelUrl).append("\n"); + sb.append(" category: ").append(category).append("\n"); + sb.append(" subCategory: ").append(subCategory).append("\n"); + sb.append(" lastUpdaterUserId: ").append(lastUpdaterUserId).append("\n"); + sb.append("}"); + return sb.toString(); + } + +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProvider.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProvider.java index 4d5dcdd0..48353a7c 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProvider.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProvider.java @@ -20,9 +20,9 @@ package org.onap.so.sdcsimulator.providers; -import java.io.IOException; -import java.io.InputStream; import java.util.Optional; +import java.util.Set; +import org.onap.so.sdcsimulator.models.ResourceArtifact; /** * @author Eoin Hanan (eoin.hanan@est.tech) @@ -31,6 +31,6 @@ public interface ResourceProvider { Optional getResource(final String csarId); - Optional getInputStream(final String csarId) throws IOException; + Set getResource(); } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProviderImpl.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProviderImpl.java index 192ac896..eacc9d5c 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProviderImpl.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProviderImpl.java @@ -20,17 +20,29 @@ package org.onap.so.sdcsimulator.providers; +import static org.onap.so.sdcsimulator.utils.Constants.CATALOG_URL; +import static org.onap.so.sdcsimulator.utils.Constants.DOT_CSAR; +import static org.onap.so.sdcsimulator.utils.Constants.MAIN_RESOURCE_FOLDER; +import static org.onap.so.sdcsimulator.utils.Constants.WILD_CARD_REGEX; +import static org.springframework.core.io.support.ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX; import java.io.IOException; import java.io.InputStream; +import java.nio.file.DirectoryStream; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.HashSet; import java.util.Optional; +import java.util.Set; +import org.onap.so.sdcsimulator.models.ResourceArtifact; import org.onap.so.sdcsimulator.utils.Constants; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.ResourcePatternResolver; import org.springframework.stereotype.Service; import org.springframework.util.StreamUtils; @@ -44,8 +56,13 @@ public class ResourceProviderImpl implements ResourceProvider { private final String resourceLocation; - public ResourceProviderImpl(@Value("${sdc.resource.location:/app/csars/}") final String resourceLocation) { + private final ResourcePatternResolver resourcePatternResolver; + + @Autowired + public ResourceProviderImpl(@Value("${sdc.resource.location:/app/csars/}") final String resourceLocation, + final ResourcePatternResolver resourcePatternResolver) { this.resourceLocation = resourceLocation; + this.resourcePatternResolver = resourcePatternResolver; } @Override @@ -63,15 +80,80 @@ public class ResourceProviderImpl implements ResourceProvider { } @Override - public Optional getInputStream(final String csarId) throws IOException { - final Path filePath = Paths.get(resourceLocation, csarId + ".csar"); + public Set getResource() { + final Set result = new HashSet<>(); + + final Path dir = Paths.get(resourceLocation); + if (Files.exists(dir)) { + try (final DirectoryStream stream = Files.newDirectoryStream(dir, WILD_CARD_REGEX + DOT_CSAR)) { + for (final Path entry : stream) { + final String filename = getFilenameWithoutExtension(entry); + final ResourceArtifact artifact = getResourceArtifact(filename); + result.add(artifact); + LOGGER.info("Found resource on file system: {}", artifact); + + + } + } catch (final IOException ioException) { + LOGGER.error("Unable to find resources on filesystem", ioException); + } + } + + try { + final String csarFileLocationPattern = + CLASSPATH_ALL_URL_PREFIX + MAIN_RESOURCE_FOLDER + WILD_CARD_REGEX + DOT_CSAR; + final Resource[] resources = resourcePatternResolver.getResources(csarFileLocationPattern); + if (resources != null) { + + for (final Resource resource : resources) { + final ResourceArtifact artifact = + getResourceArtifact(getFilenameWithoutExtension(resource.getFilename())); + result.add(artifact); + LOGGER.info("Found resource in classpath: {}", artifact); + } + } + + } catch (final IOException ioException) { + LOGGER.error("Unable to find resources in classpath", ioException); + } + + return result; + } + + private ResourceArtifact getResourceArtifact(final String filename) { + return new ResourceArtifact().uuid(filename).invariantUuid(filename).name(filename).version("1.0") + .toscaModelUrl(CATALOG_URL + "/resources/" + filename + "/toscaModel").category("Generic") + .subCategory("Network Service").resourceType("VF").lifecycleState("CERTIFIED") + .lastUpdaterUserId("SDC_SIMULATOR"); + } + + private String getFilenameWithoutExtension(final String filename) { + return filename.substring(0, filename.lastIndexOf('.')); + } + + private String getFilenameWithoutExtension(final Path file) { + return getFilenameWithoutExtension(file.getFileName().toString()); + } + + private Optional getInputStream(final String csarId) throws IOException { + final Path filePath = Paths.get(resourceLocation, csarId + DOT_CSAR); if (Files.exists(filePath)) { + LOGGER.info("Found resource in on file system using path: {}", filePath); return Optional.of(Files.newInputStream(filePath)); } + LOGGER.warn("Couldn't find file on file system '{}', will search it in classpath", filePath); - LOGGER.info("Couldn't find file on file system '{}', will return default csar", filePath); - final ClassPathResource classPathResource = new ClassPathResource(getDefaultCsarPath(), this.getClass()); + final String path = MAIN_RESOURCE_FOLDER + csarId + DOT_CSAR; + ClassPathResource classPathResource = getClassPathResource(path); if (classPathResource.exists()) { + LOGGER.info("Found resource in classpath using path: {}", path); + return Optional.of(classPathResource.getInputStream()); + } + + LOGGER.warn("Couldn't find file on file system '{}', will return default csar", filePath); + classPathResource = getClassPathResource(getDefaultCsarPath()); + if (classPathResource.exists()) { + LOGGER.info("Found default csar in classpath"); return Optional.of(classPathResource.getInputStream()); } @@ -79,10 +161,14 @@ public class ResourceProviderImpl implements ResourceProvider { return Optional.empty(); } + private ClassPathResource getClassPathResource(final String path) { + return new ClassPathResource(path, this.getClass()); + } + /* * Used in test */ String getDefaultCsarPath() { return Constants.DEFAULT_CSAR_PATH; } -} \ No newline at end of file +} diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/utils/Constants.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/utils/Constants.java index e8412574..3ddb5bee 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/utils/Constants.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/utils/Constants.java @@ -25,6 +25,8 @@ package org.onap.so.sdcsimulator.utils; */ public class Constants { + public static final String MAIN_RESOURCE_FOLDER = "/csar/"; + public static final String BASE_URL = "/sdc/v1"; public static final String CATALOG_URL = BASE_URL + "/catalog"; @@ -35,11 +37,13 @@ public class Constants { public static final String DOT = "."; + public static final String WILD_CARD_REGEX = "*"; + public static final String DOT_CSAR = DOT + "csar"; public static final String DEFAULT_CSAR_NAME_WITH_EXT = DEFAULT_CSAR_NAME + DOT_CSAR; - public static final String DEFAULT_CSAR_PATH = "/csar/" + DEFAULT_CSAR_NAME_WITH_EXT; + public static final String DEFAULT_CSAR_PATH = MAIN_RESOURCE_FOLDER + DEFAULT_CSAR_NAME_WITH_EXT; private Constants() {} } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/application.yaml b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/application.yaml index 5bb7950a..8ae1e8ac 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/application.yaml +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/application.yaml @@ -5,7 +5,12 @@ server: ssl-enable: false spring: security: - username: mso - #password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U - password: $2a$04$Lcu/DWdyXsl/a3A0iqHTfOX1.zHQ3DlQS/nOPfafT.9pWbeEqlF7W - role: mso \ No newline at end of file + users: + - username: mso + #password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + password: $2a$04$Lcu/DWdyXsl/a3A0iqHTfOX1.zHQ3DlQS/nOPfafT.9pWbeEqlF7W + role: mso + - username: modeling + #password: Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U + password: $2a$04$Lcu/DWdyXsl/a3A0iqHTfOX1.zHQ3DlQS/nOPfafT.9pWbeEqlF7W + role: mso \ No newline at end of file diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/csar/73522444-e8e9-49c1-be29-d355800aa349.csar b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/csar/73522444-e8e9-49c1-be29-d355800aa349.csar new file mode 100644 index 00000000..db8f12d8 Binary files /dev/null and b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/csar/73522444-e8e9-49c1-be29-d355800aa349.csar differ diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/csar/ba1c0c0e-9fb8-4b83-97bb-5e9af1e73393.csar b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/csar/ba1c0c0e-9fb8-4b83-97bb-5e9af1e73393.csar new file mode 100644 index 00000000..4e0400fa Binary files /dev/null and b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/csar/ba1c0c0e-9fb8-4b83-97bb-5e9af1e73393.csar differ diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/controller/CatalogControllerTest.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/controller/CatalogControllerTest.java index ca55f495..e63a7f90 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/controller/CatalogControllerTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/controller/CatalogControllerTest.java @@ -24,19 +24,21 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.Base64; import java.util.Optional; +import java.util.Set; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.Mockito; -import org.onap.so.sdcsimulator.controller.CatalogController; +import org.onap.so.sdcsimulator.models.ResourceArtifact; import org.onap.so.sdcsimulator.providers.ResourceProvider; import org.onap.so.sdcsimulator.utils.Constants; +import org.onap.so.simulator.model.UserCredentials; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; import org.springframework.boot.test.web.client.TestRestTemplate; import org.springframework.boot.web.server.LocalServerPort; import org.springframework.context.annotation.Configuration; +import org.springframework.core.ParameterizedTypeReference; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; @@ -64,8 +66,8 @@ public class CatalogControllerTest { @Autowired private TestRestTemplate restTemplate; - @Value("${spring.security.username}") - private String username; + @Autowired + private UserCredentials userCredentials; @Test public void test_getCsar_validCsarId_matchContent() { @@ -81,6 +83,19 @@ public class CatalogControllerTest { } + @Test + public void test_getResources_validResourcesFromClassPath() { + + final ResponseEntity> response = + restTemplate.exchange(getBaseUrl() + "/resources", HttpMethod.GET, new HttpEntity<>(getHttpHeaders()), + new ParameterizedTypeReference>() {}); + + assertEquals(HttpStatus.OK, response.getStatusCode()); + assertTrue(response.hasBody()); + assertEquals(3, response.getBody().size()); + + } + @Test public void test_getCsar_invalidCsar_internalServerError() { final ResourceProvider mockedResourceProvider = Mockito.mock(ResourceProvider.class); @@ -99,7 +114,7 @@ public class CatalogControllerTest { private HttpHeaders getHttpHeaders() { final HttpHeaders requestHeaders = new HttpHeaders(); - requestHeaders.add("Authorization", getBasicAuth(username)); + requestHeaders.add("Authorization", getBasicAuth(userCredentials.getUsers().get(0).getUsername())); requestHeaders.setContentType(MediaType.APPLICATION_JSON); return requestHeaders; } diff --git a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/providers/ResourceProviderImplTest.java b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/providers/ResourceProviderImplTest.java index a7cb5dd7..c132184c 100644 --- a/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/providers/ResourceProviderImplTest.java +++ b/plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/providers/ResourceProviderImplTest.java @@ -26,11 +26,13 @@ import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.UUID; import org.junit.Rule; import org.junit.Test; import org.junit.rules.TemporaryFolder; import org.onap.so.sdcsimulator.utils.Constants; import org.springframework.core.io.ClassPathResource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; import org.springframework.util.StreamUtils; /** @@ -42,18 +44,22 @@ public class ResourceProviderImplTest { @Rule public TemporaryFolder temporaryFolder = new TemporaryFolder(); - private static final String DUMMY_CONTENT = "Hell world"; + private static final String DUMMY_CONTENT = "Hello world"; + + private final PathMatchingResourcePatternResolver resourcePatternResolver = + new PathMatchingResourcePatternResolver(); @Test public void test_getResource_withValidPath_matchContent() throws IOException { final File folder = temporaryFolder.newFolder(); - final Path file = Files.createFile(folder.toPath().resolve("empty.csar")); + final String uuid = UUID.randomUUID().toString(); + final Path file = Files.createFile(folder.toPath().resolve(uuid + Constants.DOT_CSAR)); Files.write(file, DUMMY_CONTENT.getBytes()); - final ResourceProviderImpl objUnderTest = new ResourceProviderImpl(folder.getPath()); + final ResourceProviderImpl objUnderTest = new ResourceProviderImpl(folder.getPath(), resourcePatternResolver); - assertArrayEquals(DUMMY_CONTENT.getBytes(), objUnderTest.getResource("empty").get()); + assertArrayEquals(DUMMY_CONTENT.getBytes(), objUnderTest.getResource(uuid).get()); } @Test @@ -62,21 +68,21 @@ public class ResourceProviderImplTest { final byte[] expectedResult = StreamUtils.copyToByteArray(classPathResource.getInputStream()); - final ResourceProviderImpl objUnderTest = new ResourceProviderImpl(""); + final ResourceProviderImpl objUnderTest = new ResourceProviderImpl("", resourcePatternResolver); assertArrayEquals(expectedResult, objUnderTest.getResource(Constants.DEFAULT_CSAR_NAME).get()); } @Test - public void test_getResource_unbleToreadFileFromClasspath_emptyOptional() throws IOException { + public void test_getResource_unbleToReadFileFromClasspath_emptyOptional() throws IOException { - final ResourceProviderImpl objUnderTest = new ResourceProviderImpl("") { + final ResourceProviderImpl objUnderTest = new ResourceProviderImpl("", resourcePatternResolver) { @Override String getDefaultCsarPath() { return "/some/dummy/path"; } }; - assertFalse(objUnderTest.getResource(Constants.DEFAULT_CSAR_NAME).isPresent()); + assertFalse(objUnderTest.getResource(UUID.randomUUID().toString()).isPresent()); } } diff --git a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/model/Vnfds.java b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/model/Vnfds.java index cf550067..6fe696ee 100644 --- a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/model/Vnfds.java +++ b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/model/Vnfds.java @@ -31,6 +31,17 @@ public class Vnfds { public void setVnfcList(final List vnfclist) { this.vnfclist = vnfclist; } + + @Override + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Vnfd {\n"); + sb.append(" vnfdId: ").append(vnfdId).append("\n"); + sb.append(" vnfclist: ").append(vnfclist).append("\n"); + sb.append("}"); + return sb.toString(); + } + } @@ -82,8 +93,20 @@ public class Vnfds { this.grantResourceId = grantResourceId; } - } + @Override + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Vnfc {\n"); + sb.append(" vnfcId: ").append(vnfcId).append("\n"); + sb.append(" type: ").append(type).append("\n"); + sb.append(" vduId: ").append(vduId).append("\n"); + sb.append(" resourceTemplateId: ").append(resourceTemplateId).append("\n"); + sb.append(" grantResourceId: ").append(grantResourceId).append("\n"); + sb.append("}"); + return sb.toString(); + } + } public List getVnfdList() { return vnfdList; @@ -94,4 +117,15 @@ public class Vnfds { this.vnfdList = vnfdList; } + @Override + public String toString() { + final StringBuilder sb = new StringBuilder(); + sb.append("class Vnfds {\n"); + sb.append(" vnfdList: ").append(vnfdList).append("\n"); + sb.append("}"); + return sb.toString(); + } + + + } diff --git a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/InstantiateOperationProgressor.java b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/InstantiateOperationProgressor.java index 0a5444b9..6b483548 100644 --- a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/InstantiateOperationProgressor.java +++ b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/InstantiateOperationProgressor.java @@ -40,9 +40,10 @@ public class InstantiateOperationProgressor extends OperationProgressor { @Override protected List getAddResources(final String vnfdId) { final List resources = new ArrayList<>(); - + LOGGER.info("Will find GrantsAddResources for vnfdId: {}", vnfdId); for (final Vnfd vnfd : vnfds.getVnfdList()) { if (vnfd.getVnfdId().equals(vnfdId)) { + LOGGER.info("Found vnfd: {}", vnfd); for (final Vnfc vnfc : vnfd.getVnfcList()) { final GrantsAddResources addResource = new GrantsAddResources(); vnfc.setGrantResourceId(UUID.randomUUID().toString()); @@ -80,9 +81,12 @@ public class InstantiateOperationProgressor extends OperationProgressor { addResource.getVimConnectionId()); } LOGGER.info("VIM connections in grant response: {}", mapOfGrantResourceIdToVimConnectionId); + final String vnfInstanceId = operation.getVnfInstanceId(); + + LOGGER.info("vnfds: {}", vnfds); for (final Vnfd vnfd : vnfds.getVnfdList()) { - if (vnfd.getVnfdId().equals(svnfmService.getVnf(operation.getVnfInstanceId()).getVnfdId())) { + if (vnfd.getVnfdId().equals(svnfmService.getVnf(vnfInstanceId).getVnfdId())) { for (final Vnfc vnfc : vnfd.getVnfcList()) { final InlineResponse201InstantiatedVnfInfoVnfcResourceInfo vnfcResourceInfoItem = new InlineResponse201InstantiatedVnfInfoVnfcResourceInfo(); diff --git a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/TerminateOperationProgressor.java b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/TerminateOperationProgressor.java index bd729f3a..9257e49f 100644 --- a/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/TerminateOperationProgressor.java +++ b/plans/so/integration-etsi-testing/so-simulators/vnfm-simulator/vnfm-service/src/main/java/org/onap/so/svnfm/simulator/services/TerminateOperationProgressor.java @@ -12,12 +12,15 @@ import org.onap.so.adapters.vnfmadapter.extclients.vnfm.lcn.model.LcnVnfLcmOpera import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201.InstantiationStateEnum; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoResourceHandle; import org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201InstantiatedVnfInfoVnfcResourceInfo; -import org.onap.so.svnfm.simulator.model.Vnfds; -import org.onap.so.svnfm.simulator.repository.VnfOperationRepository; import org.onap.so.svnfm.simulator.config.ApplicationConfig; import org.onap.so.svnfm.simulator.model.VnfOperation; +import org.onap.so.svnfm.simulator.model.Vnfds; +import org.onap.so.svnfm.simulator.repository.VnfOperationRepository; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class TerminateOperationProgressor extends OperationProgressor { + private static final Logger LOGGER = LoggerFactory.getLogger(TerminateOperationProgressor.class); public TerminateOperationProgressor(final VnfOperation operation, final SvnfmService svnfmService, final VnfOperationRepository vnfOperationRepository, final ApplicationConfig applicationConfig, @@ -33,9 +36,12 @@ public class TerminateOperationProgressor extends OperationProgressor { @Override protected List getRemoveResources(final String vnfdId) { final List resources = new ArrayList<>(); + LOGGER.info("Will find RemoveResources for vnfdId: {}", vnfdId); + final String vnfInstanceId = operation.getVnfInstanceId(); final org.onap.so.adapters.vnfmadapter.extclients.vnfm.model.InlineResponse201 vnf = - svnfmService.getVnf(operation.getVnfInstanceId()); + svnfmService.getVnf(vnfInstanceId); + LOGGER.info("Found InlineResponse201: {} for vnfInstanceId: {}", vnf, vnfInstanceId); for (final InlineResponse201InstantiatedVnfInfoVnfcResourceInfo vnfc : vnf.getInstantiatedVnfInfo() .getVnfcResourceInfo()) { final GrantsAddResources addResource = new GrantsAddResources(); diff --git a/plans/usecases-config-over-netconf/config-over-netconf/cds/cds_setup.sh b/plans/usecases-config-over-netconf/config-over-netconf/cds/cds_setup.sh deleted file mode 100755 index b595e6b1..00000000 --- a/plans/usecases-config-over-netconf/config-over-netconf/cds/cds_setup.sh +++ /dev/null @@ -1,55 +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========================================================= - -# @author Rahul Tyagi (rahul.tyagi@est.tech) - -CDS_DATA_PATH=$WORKSPACE/plans/$PARENT/$SUB_PARENT/cds - -cd $CDS_DATA_PATH -export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') -unset http_proxy https_proxy - -#cd $WORKSPACE/archives/cds/ms/blueprintsprocessor/distribution/src/main/dc/ - -############# update ip of sdnc in docker-compose########### -SDNC_CONTAINER=$(docker ps -a -q --filter="name=sdnc_controller_container") -SDNC_CONTAINER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $SDNC_CONTAINER) -echo " " >> docker-compose.yaml -echo " extra_hosts:" >> docker-compose.yaml -echo " - 'sdnc:$LOCAL_IP'" >> docker-compose.yaml -############################################################# - -docker-compose up -d -sleep 10 -################# Check state of BP #################### -BP_CONTAINER=$(docker ps -a -q --filter="name=bp-rest") -CCSDK_MARIADB=$(docker ps -a -q --filter="name=ccsdk-mariadb") -for i in {1..10}; do -if [ $(docker inspect --format='{{ .State.Running }}' $BP_CONTAINER) ] && \ -[ $(docker inspect --format='{{ .State.Running }}' $CCSDK_MARIADB) ] -then - echo "Blueprint proc Service Running" - break -else - echo sleep $i - sleep $i -fi -done - diff --git a/plans/usecases-config-over-netconf/config-over-netconf/cds/docker-compose.yaml b/plans/usecases-config-over-netconf/config-over-netconf/cds/docker-compose.yaml index 4834f912..f914e48c 100755 --- a/plans/usecases-config-over-netconf/config-over-netconf/cds/docker-compose.yaml +++ b/plans/usecases-config-over-netconf/config-over-netconf/cds/docker-compose.yaml @@ -23,9 +23,17 @@ services: - "8000:8080" restart: always environment: - APPLICATIONNAME: BlueprintsProcessor - BUNDLEVERSION: 1.0.0 - APP_CONFIG_HOME: /opt/app/onap/config - STICKYSELECTORKEY: - ENVCONTEXT: dev + - APPLICATIONNAME=BlueprintsProcessor + - BUNDLEVERSION=1.0.0 + - APP_CONFIG_HOME=/opt/app/onap/config + - ENVCONTEXT=dev + volumes: + - /etc/localtime:/etc/localtime:ro + - ${WORKSPACE}/plans/usecases-config-over-netconf/config-over-netconf/cds/resources:/opt/app/onap/res + entrypoint: + - /bin/sh + - -c + - "/opt/app/onap/res/importCerAndStartService.sh" + extra_hosts: + - sdnc:${LOCAL_IP} diff --git a/plans/usecases-config-over-netconf/config-over-netconf/cds/resources/application.properties b/plans/usecases-config-over-netconf/config-over-netconf/cds/resources/application.properties new file mode 100755 index 00000000..34d572e5 --- /dev/null +++ b/plans/usecases-config-over-netconf/config-over-netconf/cds/resources/application.properties @@ -0,0 +1,97 @@ +# Web Server Configurations +# START -Controller Blueprints Properties & Load Resource Source Mappings +resourceSourceMappings=processor-db=source-db,input=source-input,default=source-default,sdnc=source-rest,aai-data=source-rest,capability=source-capability,rest=source-rest,vault-data=source-rest,script=source-capability + +# Controller Blueprints Core Configuration +blueprintsprocessor.blueprintDeployPath=/opt/app/onap/blueprints/deploy +blueprintsprocessor.blueprintArchivePath=/opt/app/onap/blueprints/archive +blueprintsprocessor.blueprintWorkingPath=/opt/app/onap/blueprints/working + +# Controller Blueprint Load Configurations +blueprintsprocessor.loadBluePrintPaths=/opt/app/onap/model-catalog/blueprint-model +blueprintsprocessor.loadModeTypePaths=/opt/app/onap/model-catalog/definition-type +blueprintsprocessor.loadResourceDictionaryPaths=/opt/app/onap/model-catalog/resource-dictionary + +# CBA file extension +controllerblueprints.loadCbaExtension=zip + +### END -Controller Blueprints Properties + +blueprintsprocessor.grpcEnable=true +blueprintsprocessor.httpPort=8080 +blueprintsprocessor.grpcPort=9111 + +# DB +blueprintsprocessor.db.url=jdbc:mysql://db:3306/sdnctl +blueprintsprocessor.db.username=sdnctl +blueprintsprocessor.db.password=sdnctl +blueprintsprocessor.db.driverClassName=org.mariadb.jdbc.Driver +blueprintsprocessor.db.hibernateHbm2ddlAuto=update +blueprintsprocessor.db.hibernateDDLAuto=update +blueprintsprocessor.db.hibernateNamingStrategy=org.hibernate.cfg.ImprovedNamingStrategy +blueprintsprocessor.db.hibernateDialect=org.hibernate.dialect.MySQL5InnoDBDialect + +# Processor-DB Endpoint +blueprintsprocessor.db.processor-db.type=maria-db +blueprintsprocessor.db.processor-db.url=jdbc:mysql://mariadb-galera:3306/sdnctl +blueprintsprocessor.db.processor-db.username=root +blueprintsprocessor.db.processor-db.password=secretpassword + +# Python Executor +blueprints.processor.functions.python.executor.executionPath=/opt/app/onap/scripts/jython/ccsdk_blueprints +blueprints.processor.functions.python.executor.modulePaths=/opt/app/onap/scripts/jython/ccsdk_blueprints,/opt/app/onap/scripts/jython/ccsdk_netconf,/opt/app/onap/scripts/jython/ccsdk_restconf + +security.user.password: {bcrypt}$2a$10$duaUzVUVW0YPQCSIbGEkQOXwafZGwQ/b32/Ys4R1iwSSawFgz7QNu +security.user.name: ccsdkapps + +# Used in Health Check +#endpoints.user.name=ccsdkapps +#endpoints.user.password=ccsdkapps + +# Executor Options +blueprintsprocessor.resourceResolution.enabled=true +blueprintsprocessor.netconfExecutor.enabled=true +blueprintsprocessor.restConfExecutor.enabled=true +blueprintsprocessor.cliExecutor.enabled=true +blueprintsprocessor.remoteScriptCommand.enabled=true + +# Command Executor +blueprintsprocessor.grpcclient.remote-python.type=token-auth +blueprintsprocessor.grpcclient.remote-python.host=localhost +blueprintsprocessor.grpcclient.remote-python.port=50051 +blueprintsprocessor.grpcclient.remote-python.token=Basic Y2NzZGthcHBzOmNjc2RrYXBwcw== + +# Python Executor +blueprintsprocessor.grpcclient.py-executor.type=tls-auth +blueprintsprocessor.grpcclient.py-executor.host=py-executor-default:50052 +blueprintsprocessor.grpcclient.py-executor.trustCertCollection=/opt/app/onap/config/certs/py-executor/py-executor-chain.pem + +# Config Data REST client settings +blueprintsprocessor.restconfEnabled=true +blueprintsprocessor.restclient.sdnc.type=basic-auth +blueprintsprocessor.restclient.sdnc.url=http://sdnc:8282 +blueprintsprocessor.restclient.sdnc.username=admin +blueprintsprocessor.restclient.sdnc.password=Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U +blueprintprocessor.remoteScriptCommand.enabled=true + +# Encrypted username and password for health check service +endpoints.user.name=eHbVUbJAj4AG2522cSbrOQ== +endpoints.user.password=eHbVUbJAj4AG2522cSbrOQ== + +# BaseUrls for health check blueprint processor services +blueprintprocessor.healthcheck.baseUrl=http://localhost:8080/ +blueprintprocessor.healthcheck.mapping-service-name-with-service-link=[Execution service,/api/v1/execution-service/health-check],[Resources service,/api/v1/resources/health-check],[Template service,/api/v1/template/health-check] + +# BaseUrls for health check Cds Listener services +cdslistener.healthcheck.baseUrl=http://cds-sdc-listener:8080/ +cdslistener.healthcheck.mapping-service-name-with-service-link=[SDC Listener service,/api/v1/sdclistener/healthcheck] + +# Actuator Properties +management.endpoints.web.exposure.include=* +management.endpoint.health.show-details=always +management.info.git.mode=full + +# Error Managements +error.catalog.applicationId=cds +error.catalog.type=properties +error.catalog.errorDefinitionDir=/opt/app/onap/config/ \ No newline at end of file diff --git a/plans/usecases-config-over-netconf/config-over-netconf/cds/resources/error-messages_en.properties b/plans/usecases-config-over-netconf/config-over-netconf/cds/resources/error-messages_en.properties new file mode 100755 index 00000000..3b731c70 --- /dev/null +++ b/plans/usecases-config-over-netconf/config-over-netconf/cds/resources/error-messages_en.properties @@ -0,0 +1,77 @@ +# Error Messages Configurations + +org.onap.ccsdk.cds.blueprintsprocessor.generic_failure=cause=Internal error in Blueprint Processor run time.,action=Contact CDS administrator team. +org.onap.ccsdk.cds.blueprintsprocessor.resource_path_missing=cause=Resource path missing or wrong.,action=Please reload your artifact in run time. +org.onap.ccsdk.cds.blueprintsprocessor.resource_writing_fail=cause=Fail to write resources files.,action=Please reload your files and make sure it is in the right format. +org.onap.ccsdk.cds.blueprintsprocessor.io_file_interrupt=cause=IO file system interruption.,action=Please reload your file and make sure it is in the right format. +org.onap.ccsdk.cds.blueprintsprocessor.invalid_request_format=cause=bad request provided.,action=Verify the request payload. +org.onap.ccsdk.cds.blueprintsprocessor.unauthorized_request=cause=The request requires user authentication.,action=Please provide the right credentials. +org.onap.ccsdk.cds.blueprintsprocessor.request_not_found=cause=Request mapping doesn't exist.,action=Please verify your request. +org.onap.ccsdk.cds.blueprintsprocessor.conflict_adding_resource=cause=Duplicated entry while saving resource.,action=Please make the saving model doesn't exist. +org.onap.ccsdk.cds.blueprintsprocessor.duplicate_data=cause=Duplicated data - was expecting one result, got more than one.,action=Please provide single resource at a time. +org.onap.ccsdk.cds.blueprintsprocessor.resource_not_found=cause=No response was found for this request in the server.,action=Provide the ID to find the resource. +org.onap.ccsdk.cds.blueprintsprocessor.unsupported_media_type=cause=An invalid media was provided.,action=Please make sure your media or artifact is in the proper structure or format. + +# Self Service API +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.generic_failure=cause=Internal error in Self Service API.,action=Verify the request and try again. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.generic_process_failure=cause=Internal error while processing REST call to the Self Service API.,action=Verify the request and try again. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.invalid_file_extension=cause=Failed trying to upload a non ZIP file format.,action=Please reload your file and make sure it is in ZIP format. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.resource_path_missing=cause=Resource path missing or wrong.,action=Please reload your artifact in run time. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.resource_writing_fail=cause=Fail to write resources files.,action=Please reload your files and make sure it is in the right format. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.io_file_interrupt=cause=IO file system interruption.,action=Please reload your file and make sure it is in the right format. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.invalid_request_format=cause=bad request provided.,action=Verify the request payload. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.unauthorized_request=cause=The request requires user authentication.,action=Please provide the right credentials. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.request_not_found=cause=Request mapping doesn't exist.,action=Please verify your request. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.conflict_adding_resource=cause=Duplicated entry while saving resource.,action=Please make the saving model doesn't exist. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.duplicate_data=cause=Duplicated data - was expecting one result, got more than one.,action=Please provide single resource at a time. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.resource_not_found=cause=No response was found for this request in the server.,action=Provide the ID to find the resource. +org.onap.ccsdk.cds.blueprintsprocessor.selfservice.api.unsupported_media_type=cause=An invalid media was provided.,action=Please make sure your media or artifact is in the proper structure or format. + +# Designer API +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.generic_failure=cause=Internal error while processing REST call to the Designer API.,action=Verify the request and try again. +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.invalid_file_extension=cause=Failed trying to upload a non ZIP file format.,action=Please reload your file and make sure it is in ZIP format. +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.resource_path_missing=cause=Resource path missing or wrong.,action=Please reload your artifact in run time. +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.resource_writing_fail=cause=Fail to write resources files.,action=Please reload your files and make sure it is in the right format. +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.io_file_interrupt=cause=IO file system interruption.,action=Please reload your file and make sure it is in the right format. +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.invalid_request_format=cause=bad request provided.,action=Verify the request payload. +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.unauthorized_request=cause=The request requires user authentication.,action=Please provide the right credentials. +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.request_not_found=cause=Request mapping doesn't exist.,action=Please verify your request. +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.conflict_adding_resource=cause=Duplicated entry while saving resource.,action=Please make the saving model doesn't exist. +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.duplicate_data=cause=Duplicated data - was expecting one result, got more than one.,action=Please provide single resource at a time. +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.resource_not_found=cause=No response was found for this request in the server.,action=Provide the ID to find the resource. +org.onap.ccsdk.cds.blueprintsprocessor.designer.api.unsupported_media_type=cause=An invalid media was provided.,action=Please make sure your media or artifact is in the proper structure or format. + +# Resource API +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.generic_failure=cause=Internal error while processing REST call to the Resource API.,action=Verify the request and try again. +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.invalid_file_extension=cause=Failed trying to upload a non ZIP file format.,action=Please reload your file and make sure it is in ZIP format. +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.resource_path_missing=cause=Resource path missing or wrong.,action=Please reload your artifact in run time. +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.resource_writing_fail=cause=Fail to write resources files.,action=Please reload your files and make sure it is in the right format. +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.io_file_interrupt=cause=IO file system interruption.,action=Please reload your file and make sure it is in the right format. +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.invalid_request_format=cause=bad request provided.,action=Verify the request payload. +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.unauthorized_request=cause=The request requires user authentication.,action=Please provide the right credentials. +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.request_not_found=cause=Request mapping doesn't exist.,action=Please verify your request. +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.conflict_adding_resource=cause=Duplicated entry while saving resource.,action=Please make the saving model doesn't exist. +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.duplicate_data=cause=Duplicated data - was expecting one result, got more than one.,action=Please provide single resource at a time. +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.resource_not_found=cause=No response was found for this request in the server.,action=Provide the ID to find the resource. +org.onap.ccsdk.cds.blueprintsprocessor.resource.api.unsupported_media_type=cause=An invalid media was provided.,action=Please make sure your media or artifact is in the proper structure or format. + +# Configs API +org.onap.ccsdk.cds.blueprintsprocessor.configs.api.generic_failure=cause=Internal error while processing REST call to the Configs API.,action=Verify the request and try again. +org.onap.ccsdk.cds.blueprintsprocessor.configs.api.resource_path_missing=cause=Resource path missing or wrong.,action=Please reload your artifact in run time. +org.onap.ccsdk.cds.blueprintsprocessor.configs.api.io_file_interrupt=cause=IO file system interruption.,action=Please reload your file and make sure it is in the right format. +org.onap.ccsdk.cds.blueprintsprocessor.configs.api.invalid_request_format=cause=bad request provided.,action=Verify the request payload. +org.onap.ccsdk.cds.blueprintsprocessor.configs.api.unauthorized_request=cause=The request requires user authentication.,action=Please provide the right credentials. +org.onap.ccsdk.cds.blueprintsprocessor.configs.api.request_not_found=cause=Request mapping doesn't exist.,action=Please verify your request. +org.onap.ccsdk.cds.blueprintsprocessor.configs.api.conflict_adding_resource=cause=Duplicated entry while saving resource.,action=Please make the saving model doesn't exist. +org.onap.ccsdk.cds.blueprintsprocessor.configs.api.duplicate_data=cause=Duplicated data - was expecting one result, got more than one.,action=Please provide single resource at a time. +org.onap.ccsdk.cds.blueprintsprocessor.configs.api.resource_not_found=cause=No response was found for this request in the server.,action=Provide the ID to find the resource. + +# Python Executor +org.onap.ccsdk.cds.blueprintsprocessor.functions.python.executor.generic_failure=cause=Internal error in Blueprint Processor run time.,action=Contact CDS administrator team. + +# Resource resolution +org.onap.ccsdk.cds.blueprintsprocessor.resource.resolution.invalid_request_format=cause=bad request provided.,action=Verify the request payload. +org.onap.ccsdk.cds.blueprintsprocessor.resource.resolution.resource_not_found=cause=No response was found for this resolution in CDS.,action=Verify definition of the resource in CBA. +org.onap.ccsdk.cds.blueprintsprocessor.resource.resolution.internal_error=cause=Internal error while processing Resource Resolution.,action=Verify the payload. + +org.onap.ccsdk.cds.sdclistener.generic_failure=cause=Internal error in SDC Listener.,action=Contact CDS administrator team. \ No newline at end of file diff --git a/plans/usecases-config-over-netconf/config-over-netconf/cds/resources/importCerAndStartService.sh b/plans/usecases-config-over-netconf/config-over-netconf/cds/resources/importCerAndStartService.sh new file mode 100755 index 00000000..b5816068 --- /dev/null +++ b/plans/usecases-config-over-netconf/config-over-netconf/cds/resources/importCerAndStartService.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +chmod -R 775 /opt/app/onap/res +cp -f /opt/app/onap/res/application.properties /opt/app/onap/config +cp -f /opt/app/onap/res/error-messages_en.properties /opt/app/onap/config + +echo "Starting Service..." +source /startService.sh \ No newline at end of file diff --git a/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/docker-compose.yml b/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/docker-compose.yml new file mode 100755 index 00000000..d8e723ba --- /dev/null +++ b/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3' + +services: + netconf-pnp-simulator: + image: nexus3.onap.org:10001/onap/integration/simulators/netconf-pnp-simulator:2.8.6 + container_name: netconf-simulator + restart: always + ports: + - "830:830" + - "6513:6513" + volumes: + - ${NETCONF_CONFIG_PATH}:/config/modules/mynetconf diff --git a/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/netconf-config/data.json b/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/netconf-config/data.json new file mode 100644 index 00000000..63872eef --- /dev/null +++ b/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/netconf-config/data.json @@ -0,0 +1,10 @@ +{ + "mynetconf:netconflist": { + "netconf": [ + { + "netconf-id": 3, + "netconf-param": 3 + } + ] + } +} diff --git a/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/netconf-config/model.yang b/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/netconf-config/model.yang new file mode 100644 index 00000000..6c8c36ab --- /dev/null +++ b/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/netconf-config/model.yang @@ -0,0 +1,29 @@ +module mynetconf { + yang-version 1.1; + namespace "urn:mynetconf:test"; + + prefix nft; + + organization + "mynetconf"; + contact + "my netconf address"; + description + "yang model for mynetconf"; + revision "2019-03-01" { + description + "initial version"; + } + + container netconflist { + list netconf { + key netconf-id; + leaf netconf-id { + type uint16; + } + leaf netconf-param { + type uint32; + } + } + } +} diff --git a/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/netconf-config/subscriber.py b/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/netconf-config/subscriber.py new file mode 100755 index 00000000..61272967 --- /dev/null +++ b/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/netconf-config/subscriber.py @@ -0,0 +1,136 @@ +#!/usr/bin/env python3 + +__author__ = "Mislav Novakovic " +__copyright__ = "Copyright 2018, Deutsche Telekom AG" +__license__ = "Apache 2.0" + +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# This sample application demonstrates use of Python programming language bindings for sysrepo library. +# Original c application was rewritten in Python to show similarities and differences +# between the two. +# +# Most notable difference is in the very different nature of languages, c is weakly statically typed language +# while Python is strongly dynamically typed. Python code is much easier to read and logic easier to comprehend +# for smaller scripts. Memory safety is not an issue but lower performance can be expected. +# +# The original c implementation is also available in the source, so one can refer to it to evaluate trade-offs. + +import sysrepo as sr +import sys + + +# Helper function for printing changes given operation, old and new value. +def print_change(op, old_val, new_val): + if op == sr.SR_OP_CREATED: + print(f"CREATED: {new_val.to_string()}") + elif op == sr.SR_OP_DELETED: + print(f"DELETED: {old_val.to_string()}") + elif op == sr.SR_OP_MODIFIED: + print(f"MODIFIED: {old_val.to_string()} to {new_val.to_string()}") + elif op == sr.SR_OP_MOVED: + print(f"MOVED: {new_val.xpath()} after {old_val.xpath()}") + + +# Helper function for printing events. +def ev_to_str(ev): + if ev == sr.SR_EV_VERIFY: + return "verify" + elif ev == sr.SR_EV_APPLY: + return "apply" + elif ev == sr.SR_EV_ABORT: + return "abort" + else: + return "unknown" + + +# Function to print current configuration state. +# It does so by loading all the items of a session and printing them out. +def print_current_config(session, module_name): + select_xpath = f"/{module_name}:*//*" + + values = session.get_items(select_xpath) + + if values is not None: + print("========== BEGIN CONFIG ==========") + for i in range(values.val_cnt()): + print(values.val(i).to_string(), end='') + print("=========== END CONFIG ===========") + + +# Function to be called for subscribed client of given session whenever configuration changes. +def module_change_cb(sess, module_name, event, private_ctx): + try: + print("========== Notification " + ev_to_str(event) + " =============================================") + if event == sr.SR_EV_APPLY: + print_current_config(sess, module_name) + + print("========== CHANGES: =============================================") + + change_path = f"/{module_name}:*" + + it = sess.get_changes_iter(change_path) + + while True: + change = sess.get_change_next(it) + if change is None: + break + print_change(change.oper(), change.old_val(), change.new_val()) + + print("========== END OF CHANGES =======================================") + except Exception as e: + print(e) + + return sr.SR_ERR_OK + + +def main(): + # Notable difference between c implementation is using exception mechanism for open handling unexpected events. + # Here it is useful because `Connection`, `Session` and `Subscribe` could throw an exception. + try: + module_name = "ietf-interfaces" + if len(sys.argv) > 1: + module_name = sys.argv[1] + else: + print("\nYou can pass the module name to be subscribed as the first argument") + + print(f"Application will watch for changes in {module_name}") + + # connect to sysrepo + conn = sr.Connection(module_name) + + # start session + sess = sr.Session(conn) + + # subscribe for changes in running config */ + subscribe = sr.Subscribe(sess) + + subscribe.module_change_subscribe(module_name, module_change_cb) + + try: + print_current_config(sess, module_name) + except Exception as e: + print(e) + + print("========== STARTUP CONFIG APPLIED AS RUNNING ==========") + + sr.global_loop() + + print("Application exit requested, exiting.") + + except Exception as e: + print(e) + + +if __name__ == '__main__': + main() diff --git a/plans/usecases-config-over-netconf/config-over-netconf/setup.sh b/plans/usecases-config-over-netconf/config-over-netconf/setup.sh index fcedbecf..2e61da0a 100644 --- a/plans/usecases-config-over-netconf/config-over-netconf/setup.sh +++ b/plans/usecases-config-over-netconf/config-over-netconf/setup.sh @@ -20,101 +20,102 @@ # @author Rahul Tyagi (rahul.tyagi@est.tech) - -SCRIPTS="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -export PARENT=usecases-config-over-netconf -export SUB_PARENT=config-over-netconf -source ${WORKSPACE}/plans/$PARENT/$SUB_PARENT/test.properties +SCRIPTS="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +source "${WORKSPACE}"/plans/usecases-config-over-netconf/config-over-netconf/test.properties export MTU=$(/sbin/ifconfig | grep MTU | sed 's/.*MTU://' | sed 's/ .*//' | sort -n | head -1) if [ "$MTU" == "" ]; then - export MTU="1450" + export MTU="1450" fi -# clone integration branch for pnf-simulator -mkdir -m 755 -p $WORKSPACE/temp/integration -cd $WORKSPACE/temp -git clone -b dublin --single-branch --depth=1 http://gerrit.onap.org/r/integration.git integration - -HOST_IP_ADDR=localhost +export CONFIG_OVER_NETCONF=${CONFIG_OVER_NETCONF} -# setup sdnc +# Prepare enviroment +echo "Uninstall docker-py and reinstall docker." +pip uninstall -y docker-py +pip uninstall -y docker +pip install -U docker==2.7.0 -cd $SDNC_DOCKER_PATH +# Disable Proxy - for local run unset http_proxy https_proxy -docker pull $NETOPEER_DOCKER_REPO:$NETOPEER_IMAGE_TAG -docker tag $NETOPEER_DOCKER_REPO:$NETOPEER_IMAGE_TAG $NETOPEER_DOCKER_REPO:latest -#sed -i "s/DMAAP_TOPIC_ENV=.*/DMAAP_TOPIC_ENV="AUTO"/g" diocker-compose.yml -docker login -u $NEXUS_USERNAME -p $NEXUS_PASSWD $NEXUS_DOCKER_REPO +# Export default Networking bridge created on the host machine +export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') -docker pull $NEXUS_DOCKER_REPO/onap/sdnc-image:$SDNC_IMAGE_TAG -docker tag $NEXUS_DOCKER_REPO/onap/sdnc-image:$SDNC_IMAGE_TAG onap/sdnc-image:latest +###################### Netconf-PNP-Simulator Setup ###################### -docker pull $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$ANSIBLE_IMAGE_TAG -docker tag $NEXUS_DOCKER_REPO/onap/sdnc-ansible-server-image:$ANSIBLE_IMAGE_TAG onap/sdnc-ansible-server-image:latest +# Export Netconf-Pnp Simulator conf path +export NETCONF_CONFIG_PATH -docker pull $NEXUS_DOCKER_REPO/onap/ccsdk-blueprintsprocessor:$BP_IMAGE_TAG -docker tag $NEXUS_DOCKER_REPO/onap/ccsdk-blueprintsprocessor:$BP_IMAGE_TAG onap/ccsdk-blueprintsprocessor:latest +# Start N etconf-Pnp-Simulator Container with docker-compose and configuration from docker-compose.yml +docker-compose -f "${CONFIG_OVER_NETCONF}"/netconf-pnp-simulator/docker-compose.yml up -d -export SDNC_CERT_PATH=${CERT_SUBPATH} -#sed -i 's/sdnc_controller_container/sdnc_controller_container\n volumes: \n - $SDNC_CERT_PATH:\/opt\/opendaylight\/current\/certs/' docker-compose.yaml -# start SDNC containers with docker compose and configuration from docker-compose.yml -docker-compose up -d +# Update default Networking bridge IP in mount.json file +sed -i "s/pnfaddr/${LOCAL_IP}/g" "${REQUEST_DATA_PATH}"/mount.xml -# start pnf simulator +############################## SDNC Setup ############################## -cd $INT_DOCKER_PATH +export SDNC_CERT_PATH="${CERT_SUBPATH}" -./simulator.sh start& +docker pull "${NEXUS_DOCKER_REPO}"/onap/sdnc-image:"${SDNC_IMAGE_TAG}" +docker tag "${NEXUS_DOCKER_REPO}"/onap/sdnc-image:"${SDNC_IMAGE_TAG}" onap/sdnc-image:latest -# WAIT 10 minutes maximum and test every 5 seconds if SDNC is up using HealthCheck API -TIME_OUT=1000 -INTERVAL=30 -TIME=0 -while [ "$TIME" -lt "$TIME_OUT" ]; do - response=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-sdnc" -H "X-TransactionId: csit-sdnc" -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8282/restconf/operations/SLI-API:healthcheck ); - echo $response +docker pull "${NEXUS_DOCKER_REPO}"/onap/sdnc-ansible-server-image:"${ANSIBLE_IMAGE_TAG}" +docker tag "${NEXUS_DOCKER_REPO}"/onap/sdnc-ansible-server-image:"${ANSIBLE_IMAGE_TAG}" onap/sdnc-ansible-server-image:latest - if [ "$response" == "200" ]; then - echo SDNC started in $TIME seconds - break; - fi +docker-compose -f "${CONFIG_OVER_NETCONF}"/sdn/docker-compose.yaml up -d - echo Sleep: $INTERVAL seconds before testing if SDNC is up. Total wait time up now is: $TIME seconds. Timeout is: $TIME_OUT seconds - sleep $INTERVAL - TIME=$(($TIME+$INTERVAL)) +# Check if SDNC Service is healthy and ready +for i in {1..10}; do + SDNC_IP=$(get-instance-ip.sh sdnc_controller_container) + RESP_CODE=$(curl --write-out '%{http_code}' --silent --output /dev/null -H "Authorization: Basic YWRtaW46S3A4Yko0U1hzek0wV1hsaGFrM2VIbGNzZTJnQXc4NHZhb0dHbUp2VXkyVQ==" -X POST -H "X-FromAppId: csit-sdnc" -H "X-TransactionId: csit-sdnc" -H "Accept: application/json" -H "Content-Type: application/json" http://localhost:8282/restconf/operations/SLI-API:healthcheck) + if [[ "${RESP_CODE}" == '200' ]]; then + echo "SDNC Service is Ready." + break + fi + echo "Waiting for SDNC Service to Start Up..." + sleep 2m done -export LOCAL_IP=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+') -sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/mount.xml +if [[ "${SDNC_IP}" == 'none' || "${SDNC_IP}" == '' || "${RESP_CODE}" != '200' ]]; then + echo "SDNC Service not started Could cause problems for testing activities...!" +fi +############################## CDS Setup ############################## -if [ "$TIME" -ge "$TIME_OUT" ]; then - echo TIME OUT: karaf session not started in $TIME_OUT seconds... Could cause problems for testing activities... -fi +docker pull "${NEXUS_DOCKER_REPO}"/onap/ccsdk-blueprintsprocessor:"${BP_IMAGE_TAG}" +docker tag "${NEXUS_DOCKER_REPO}"/onap/ccsdk-blueprintsprocessor:"${BP_IMAGE_TAG}" onap/ccsdk-blueprintsprocessor:latest -########################################## blueprintsprocessor setup ########################################################## -source $CDS_DOCKER_PATH/cds_setup.sh +docker-compose -f "${CONFIG_OVER_NETCONF}"/cds/docker-compose.yaml up -d -########## update pnf simulator ip in config deploy request ######## +echo "Sleeping 1 minute" +sleep 1m -NETOPEER_CONTAINER=$(docker ps -a -q --filter="name=netopeer") -NETOPEER_CONTAINER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $SDNC_CONTAINER) -RES_KEY=$(uuidgen -r) -sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/config-deploy.json -sed -i "s/pnfaddr/$LOCAL_IP/g" $REQUEST_DATA_PATH/config-assign.json +BP_CONTAINER=$(docker ps -a -q --filter="name=bp-rest") +CCSDK_MARIADB=$(docker ps -a -q --filter="name=ccsdk-mariadb") -sed -i "s/reskey/$RES_KEY/g" $REQUEST_DATA_PATH/config-deploy.json -sed -i "s/reskey/$RES_KEY/g" $REQUEST_DATA_PATH/config-assign.json +for i in {1..10}; do + if [ $(docker inspect --format='{{ .State.Running }}' "${BP_CONTAINER}") ] && + [ $(docker inspect --format='{{ .State.Running }}' "${CCSDK_MARIADB}") ]; then + echo "Blueprint Proc Service Running" + break + else + echo sleep "${i}" + sleep "${i}" + fi +done -#########################check if server is up gracefully ###################################### +############################ Update Setup ############################ -# Sleep additional 3 minutes (180 secs) to give application time to finish +RES_KEY=$(uuidgen -r) +sed -i "s/pnfaddr/$LOCAL_IP/g" "${REQUEST_DATA_PATH}"/config-deploy.json +sed -i "s/pnfaddr/$LOCAL_IP/g" "${REQUEST_DATA_PATH}"/config-assign.json -sleep 150 +sed -i "s/reskey/$RES_KEY/g" "${REQUEST_DATA_PATH}"/config-deploy.json +sed -i "s/reskey/$RES_KEY/g" "${REQUEST_DATA_PATH}"/config-assign.json # Pass any variables required by Robot test suites in ROBOT_VARIABLES - -ROBOT_VARIABLES="-v SCRIPTS:${SCRIPTS}" +REPO_IP='127.0.0.1' +ROBOT_VARIABLES+=" -v REPO_IP:${REPO_IP} " +ROBOT_VARIABLES+=" -v SCRIPTS:${SCRIPTS} " \ No newline at end of file diff --git a/plans/usecases-config-over-netconf/config-over-netconf/teardown.sh b/plans/usecases-config-over-netconf/config-over-netconf/teardown.sh index 9613e3ee..7257b366 100755 --- a/plans/usecases-config-over-netconf/config-over-netconf/teardown.sh +++ b/plans/usecases-config-over-netconf/config-over-netconf/teardown.sh @@ -1,18 +1,10 @@ #!/bin/bash -SDNC_DOCKER_COMPOSE_PATH=$SDNC_DOCKER_PATH/docker-compose.yaml -PNFSIM_DOCKER_COMPOSE_PATH=$INT_DOCKER_PATH/docker-compose.yml -CDS_DOCKER_COMPOSE_PATH=$CDS_DOCKER_PATH/docker-compose.yaml +echo 'Stop, Removing all running containers...' +docker stop $(docker ps -aq) && docker rm $(docker ps -aq) -echo "==========================blueprint-processor logs ==================================" -docker logs bp-rest +echo 'Removing Volumes...' +echo y | docker volume prune -echo "==========================sdnc-controller logs ======================================" -docker logs sdnc_controller_container - - -docker-compose -f $SDNC_DOCKER_COMPOSE_PATH down -docker-compose -f $PNFSIM_DOCKER_COMPOSE_PATH down -docker-compose -f $CDS_DOCKER_COMPOSE_PATH down - -rm -rf $WORKSPACE/temp +echo 'Removing Networks...' +echo y | docker network prune \ No newline at end of file diff --git a/plans/usecases-config-over-netconf/config-over-netconf/test.properties b/plans/usecases-config-over-netconf/config-over-netconf/test.properties index ee002461..4e4c99b4 100644 --- a/plans/usecases-config-over-netconf/config-over-netconf/test.properties +++ b/plans/usecases-config-over-netconf/config-over-netconf/test.properties @@ -1,14 +1,10 @@ NEXUS_DOCKER_REPO=nexus3.onap.org:10001 NEXUS_USERNAME=docker NEXUS_PASSWD=docker +BP_IMAGE_TAG=0.7.1 SDNC_IMAGE_TAG=1.7.6 ANSIBLE_IMAGE_TAG=1.7.6 -BP_IMAGE_TAG=0.6.4 -REQUEST_DATA_PATH=$WORKSPACE/tests/$PARENT/$SUB_PARENT/data -TC_PLANS_PATH=$WORKSPACE/plans/$PARENT/$SUB_PARENT -CDS_DOCKER_PATH=$TC_PLANS_PATH/cds -SDNC_DOCKER_PATH=$TC_PLANS_PATH/sdn -INT_DOCKER_PATH=$WORKSPACE/temp/integration/test/mocks/pnfsimulator -CERT_SUBPATH=$TC_PLANS_PATH/certs -NETOPEER_DOCKER_REPO=sysrepo/sysrepo-netopeer2 -NETOPEER_IMAGE_TAG=v0.7.7 +CERT_SUBPATH=${WORKSPACE}/plans/usecases-config-over-netconf/config-over-netconf/certs +CONFIG_OVER_NETCONF=${WORKSPACE}/plans/usecases-config-over-netconf/config-over-netconf +REQUEST_DATA_PATH=${WORKSPACE}/tests/usecases-config-over-netconf/config-over-netconf/data +NETCONF_CONFIG_PATH=${WORKSPACE}/plans/usecases-config-over-netconf/config-over-netconf/netconf-pnp-simulator/netconf-config \ No newline at end of file diff --git a/tests/so/etsi/data/distributeServiceTemplate.json b/tests/so/etsi/data/distributeServiceTemplate.json index 47a9f21b..6c64d5c2 100644 --- a/tests/so/etsi/data/distributeServiceTemplate.json +++ b/tests/so/etsi/data/distributeServiceTemplate.json @@ -1,102 +1,52 @@ { - "distributionID": "cfe30d6c-eb67-4ffb-ba98-4b654162223a", - "serviceName": "manualDistributionTestService", - "serviceVersion": "1.0", - "serviceUUID": "28d4acf3-4791-4998-8d06-1cdf6d1767a9", - "serviceDescription": "Test", - "serviceInvariantUUID": "0ddc448d-5513-44bc-8b02-5759d84600d5", - "resources": [ - { - "resourceInstanceName": "manualDistributionTestVNF 0", - "resourceCustomizationUUID": "82ad3aa0-edc6-410c-a217-655fb064323f", - "resourceName": "manualDistributionTestVNF", - "resourceVersion": "1.0", - "resoucreType": "VF", - "resourceUUID": "e8e39dc4-4761-4da7-aedf-7d1fd3637772", - "resourceInvariantUUID": "0a0b9979-863d-4b7e-b7f4-d27725a182b3", - "category": "Application L4+", - "subcategory": "Media Servers", - "artifacts": [ + "distributionID": "f0d0e9e2-10aa-4f66-a0cc-cf5ecb386b42", + "serviceName": "EtsiServiceCSIT3", + "serviceVersion": "1.0", + "serviceUUID": "fdea6501-dabd-4428-b52c-623336a3b403", + "serviceDescription": "test", + "serviceInvariantUUID": "10b3d278-e262-44ca-a0c0-4e663c2d7562", + "resources": [ { - "artifactName": "manualdistributiontestvnf0_modules.json", - "artifactType": "VF_MODULES_METADATA", - "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, - "artifactVersion": "1", - "artifactUUID": "a10f397a-6546-4a27-843f-25821955ef3e", - "relatedArtifactsInfo": [] - }, - { - "artifactName": "base_ves_med1.yaml", - "artifactType": "HEAT", - "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, - "artifactVersion": "2", - "artifactUUID": "e216d9da-18c4-460f-8b2b-d7f8dd9e9295", - "generatedArtifact": { - "artifactName": "base_ves_med1.env", - "artifactType": "HEAT_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, - "artifactVersion": "2", - "artifactUUID": "6243747f-e794-4519-82b2-6399846f1951", - "generatedFromUUID": "e216d9da-18c4-460f-8b2b-d7f8dd9e9295" - }, - "relatedArtifactsInfo": [] - }, - { - "artifactName": "base_ves_med1.env", - "artifactType": "HEAT_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, - "artifactVersion": "2", - "artifactUUID": "6243747f-e794-4519-82b2-6399846f1951", - "relatedArtifactsInfo": [] - }, + "resourceInstanceName": "EtsiVnfCSIT3 0", + "resourceCustomizationUUID": "3341825c-837c-4e84-8a82-cc69033ca92f", + "resourceName": "EtsiVnfCSIT3", + "resourceVersion": "1.0", + "resourceUUID": "bb7ff27f-d609-4d02-9926-2f4c5eb89316", + "resourceInvariantUUID": "037f7b1b-5c62-44c1-b806-f92fe8970171", + "category": "Generic", + "subcategory": "Network Service", + "artifacts": [], + "artifactsImpl": [], + "resourceType": "VF" + } + ], + "serviceArtifacts": [ { - "artifactName": "TOSCA.meta", - "artifactType": "OTHER", - "artifactURL": "/unzipped_sdc_csar/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/TOSCA.meta", - "artifactChecksum": "NWE2ODcyOWY0NGI2MzEyOGViYjUxNTEwMjU5OWRhZmI\u003d", - "artifactDescription": "created from csar", - "artifactTimeout": 120, - "artifactVersion": "1", - "artifactUUID": "6c64d38b-186f-4339-9a76-a266c40f40ec", - "relatedArtifactsInfo": [] - }, + "artifactName": "service-Etsiservicecsit3-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/unzipped_sdc_csar/v1/catalog/services/Etsiservicecsit3/1.0/artifacts/service-Etsiservicecsit3-csar.csar", + "artifactChecksum": "NDcwMjRmZjg3MWYwY2FmMTAxN2RlZWEzMWE2OTU2ZjA=", + "artifactDescription": "TOSCA definition package ofthe asset", + "artifactTimeout": 0, + "artifactVersion": "1", + "artifactUUID": "587a89d9-ca2d-41b7-929e-de191fd4bf29", + "relatedArtifacts": [] + } + ], + "workloadContext": "Production", + "resourcesImpl": [ { - "artifactName": "descriptor.yaml", - "artifactType": "OTHER", - "artifactURL": "/unzipped_sdc_csar/v1/catalog/services/Manualdistributiontestservice/1.0/resourceInstances/manualdistributiontestvnf0/artifacts/descriptor.yaml", - "artifactChecksum": "YWZkNTg2ZGMzZjRhZjgxNzNkODJiNjgwZmRlZjlmNDE\u003d", - "artifactDescription": "created from csar", - "artifactTimeout": 120, - "artifactVersion": "1", - "artifactUUID": "4bd0cdf6-0b12-4d19-b3d8-6dbc34fe397e", - "relatedArtifactsInfo": [] + "resourceInstanceName": "EtsiVnfCSIT3 0", + "resourceCustomizationUUID": "3341825c-837c-4e84-8a82-cc69033ca92f", + "resourceName": "EtsiVnfCSIT3", + "resourceVersion": "1.0", + "resourceUUID": "bb7ff27f-d609-4d02-9926-2f4c5eb89316", + "resourceInvariantUUID": "037f7b1b-5c62-44c1-b806-f92fe8970171", + "category": "Generic", + "subcategory": "Network Service", + "artifacts": [], + "artifactsImpl": [], + "resourceType": "VF" } - ] - } - ], - "serviceArtifacts": [ - { - "artifactName": "service-Manualdistributiontestservice-csar.csar", - "artifactType": "TOSCA_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, - "artifactVersion": "1", - "artifactUUID": "e6e8c36a-b939-4845-995a-41c50be890a0" - } - ], - "workloadContext": "Production" + ] } diff --git a/tests/so/etsi/data/serviceDeleteRequest.json b/tests/so/etsi/data/serviceDeleteRequest.json index 257b0673..4fd43e44 100644 --- a/tests/so/etsi/data/serviceDeleteRequest.json +++ b/tests/so/etsi/data/serviceDeleteRequest.json @@ -2,9 +2,9 @@ "requestDetails": { "modelInfo": { "modelType": "service", - "modelInvariantId": "0ddc448d-5513-44bc-8b02-5759d84600d5", - "modelVersionId": "28d4acf3-4791-4998-8d06-1cdf6d1767a9", - "modelName": "manualDistributionTestService", + "modelInvariantId": "10b3d278-e262-44ca-a0c0-4e663c2d7562", + "modelVersionId": "fdea6501-dabd-4428-b52c-623336a3b403", + "modelName": "EtsiServiceCSIT3", "modelVersion": "1.0" }, "requestInfo": { @@ -16,4 +16,4 @@ "aLaCarte": true } } -} \ No newline at end of file +} diff --git a/tests/so/etsi/data/serviceInstantiationRequest.json b/tests/so/etsi/data/serviceInstantiationRequest.json index 054a2ffe..8520c0d8 100644 --- a/tests/so/etsi/data/serviceInstantiationRequest.json +++ b/tests/so/etsi/data/serviceInstantiationRequest.json @@ -1,33 +1,33 @@ { - "requestDetails": { - "requestInfo": { - "instanceName": "CsitEtsiInstance", - "source": "VID", - "suppressRollback": false, - "requestorId": "demo" - }, - "modelInfo": { - "modelType": "service", - "modelInvariantId": "0ddc448d-5513-44bc-8b02-5759d84600d5", - "modelVersionId": "28d4acf3-4791-4998-8d06-1cdf6d1767a9", - "modelName": "manualDistributionTestService", - "modelVersion": "1.0" - }, - "requestParameters": { - "userParams": [], - "testApi": "GR_API", - "subscriptionServiceType": "vCPE", - "aLaCarte": true - }, - "subscriberInfo": { - "globalSubscriberId": "DemoCustomer" - }, - "project": { - "projectName": "etsiCsitProject" - }, - "owningEntity": { - "owningEntityId": "f2e1071e-3d47-4a65-94d4-e473ec03326a", - "owningEntityName": "OE-Demonstration" - } + "requestDetails": { + "requestInfo": { + "instanceName": "CsitEtsiInstance", + "source": "VID", + "suppressRollback": false, + "requestorId": "demo" + }, + "modelInfo": { + "modelType": "service", + "modelInvariantId": "10b3d278-e262-44ca-a0c0-4e663c2d7562", + "modelVersionId": "fdea6501-dabd-4428-b52c-623336a3b403", + "modelName": "EtsiServiceCSIT3", + "modelVersion": "1.0" + }, + "requestParameters": { + "userParams": [], + "testApi": "GR_API", + "subscriptionServiceType": "vCPE", + "aLaCarte": true + }, + "subscriberInfo": { + "globalSubscriberId": "DemoCustomer" + }, + "project": { + "projectName": "etsiCsitProject" + }, + "owningEntity": { + "owningEntityId": "f2e1071e-3d47-4a65-94d4-e473ec03326a", + "owningEntityName": "OE-Demonstration" } + } } diff --git a/tests/so/etsi/data/vnfDeleteRequest.json b/tests/so/etsi/data/vnfDeleteRequest.json index 08862ea8..32728669 100644 --- a/tests/so/etsi/data/vnfDeleteRequest.json +++ b/tests/so/etsi/data/vnfDeleteRequest.json @@ -2,11 +2,11 @@ "requestDetails": { "modelInfo": { "modelType": "vnf", - "modelInvariantId": "b0f14066-2b65-40d2-b5a4-c8f2116fb5fc", - "modelVersionId": "84b9649a-4eb9-4967-9abe-e8702f55518b", - "modelName": "Sol004Zip3VSP", - "modelCustomizationName": "Sol004Zip3VSP 0", - "modelCustomizationId": "ff0860ac-fa9a-4fff-956b-80eeb7a330bc", + "modelInvariantId": "037f7b1b-5c62-44c1-b806-f92fe8970171", + "modelVersionId": "73522444-e8e9-49c1-be29-d355800aa349", + "modelName": "EtsiVnfCSIT3", + "modelCustomizationName": "EtsiVnfCSIT3 0", + "modelCustomizationId": "3341825c-837c-4e84-8a82-cc69033ca92f", "modelVersion": "1.0" }, "requestInfo": { @@ -22,4 +22,4 @@ "tenantId": "693c7729b2364a26a3ca602e6f66187d" } } -} \ No newline at end of file +} diff --git a/tests/so/etsi/data/vnfInstantiationRequest.json b/tests/so/etsi/data/vnfInstantiationRequest.json index a4cc5c90..03a143b0 100644 --- a/tests/so/etsi/data/vnfInstantiationRequest.json +++ b/tests/so/etsi/data/vnfInstantiationRequest.json @@ -1,49 +1,47 @@ { - "requestDetails": { - "requestInfo": { - "instanceName": "CsitEtsiVnfInstance", - "source": "VID", - "suppressRollback": false, - "requestorId": "demo", - "productFamilyId": "f13844f4-dbf8-4d0e-a979-45204f3ddb4e" - }, - "modelInfo": { - "modelType": "vnf", - "modelInvariantId": "0a0b9979-863d-4b7e-b7f4-d27725a182b3", - "modelVersionId": "8f43a8c9-c677-462a-ae36-8ddb5990a60d", - "modelName": "manualDistributionTestVNF", - "modelVersion": "1.0", - "modelCustomizationId": "82ad3aa0-edc6-410c-a217-655fb064323f", - "modelCustomizationName": "manualDistributionTestVNF 0" - }, - "requestParameters": { - "userParams": [], - "testApi": "GR_API" - }, - "cloudConfiguration": { - "lcpCloudRegionId": "EtsiCloudRegion", - "cloudOwner": "CloudOwner", - "tenantId": "693c7729b2364a26a3ca602e6f66187d" - }, - "lineOfBusiness": { - "lineOfBusinessName": "EtsiCsitLineOfBusiness" - }, - "platform": { - "platformName": "EtsiCsitPlatform" - }, - "relatedInstanceList": [ - { - "relatedInstance": { - "instanceId": "", - "modelInfo": { - "modelType": "service", - "modelName": "Sol004Zip4Service", - "modelInvariantId": "0ddc448d-5513-44bc-8b02-5759d84600d5", - "modelVersion": "1.0", - "modelVersionId": "99d59273-4450-4034-9141-027f0c1a807a" - } - } - } - ] - } -} \ No newline at end of file + "requestDetails": { + "requestInfo": { + "instanceName": "CsitEtsiVnfInstance", + "source": "VID", + "suppressRollback": false, + "requestorId": "demo", + "productFamilyId": "f13844f4-dbf8-4d0e-a979-45204f3ddb4e" + }, + "modelInfo": { + "modelType": "vnf", + "modelInvariantId": "037f7b1b-5c62-44c1-b806-f92fe8970171", + "modelVersionId": "73522444-e8e9-49c1-be29-d355800aa349", + "modelName": "EtsiVnfCSIT3", + "modelVersion": "1.0", + "modelCustomizationId": "3341825c-837c-4e84-8a82-cc69033ca92f", + "modelCustomizationName": "EtsiVnfCSIT3 0" + }, + "requestParameters": { + "userParams": [], + "testApi": "GR_API" + }, + "cloudConfiguration": { + "lcpCloudRegionId": "EtsiCloudRegion", + "cloudOwner": "CloudOwner", + "tenantId": "693c7729b2364a26a3ca602e6f66187d" + }, + "lineOfBusiness": { + "lineOfBusinessName": "EtsiCsitLineOfBusiness" + }, + "platform": { + "platformName": "EtsiCsitPlatform" + }, + "relatedInstanceList": [{ + "relatedInstance": { + "instanceId": "", + "modelInfo": { + "modelType": "service", + "modelName": "EtsiServiceCSIT3", + "modelInvariantId": "10b3d278-e262-44ca-a0c0-4e663c2d7562", + "modelVersion": "1.0", + "modelVersionId": "fdea6501-dabd-4428-b52c-623336a3b403" + } + } + }] + } +} diff --git a/tests/so/etsi/data/vnfPackageOnboardRequest.json b/tests/so/etsi/data/vnfPackageOnboardRequest.json new file mode 100644 index 00000000..08b7e05c --- /dev/null +++ b/tests/so/etsi/data/vnfPackageOnboardRequest.json @@ -0,0 +1 @@ +{"csarId": "73522444-e8e9-49c1-be29-d355800aa349"} diff --git a/tests/so/etsi/etsi_tests.robot b/tests/so/etsi/etsi_tests.robot index 6aebd137..57238cb0 100644 --- a/tests/so/etsi/etsi_tests.robot +++ b/tests/so/etsi/etsi_tests.robot @@ -9,6 +9,43 @@ ${SLEEP_INTERVAL_SEC}= 5 ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT}= 48 # Represents the maximum number of attempts that will be made before a timeout. It sleeps for SLEEP_INTERVAL_SEC seconds before retry. *** Test Cases *** +OnBoard VNF Package In Etsi Catalog + Create Session etsi_catalog_session http://${REPO_IP}:8806 + ${data}= Get Binary File ${CURDIR}${/}data${/}vnfPackageOnboardRequest.json + &{headers}= Create Dictionary Content-Type=application/json Accept=application/json + ${resp}= Post Request etsi_catalog_session /api/catalog/v1/vnfpackages data=${data} headers=${headers} + Run Keyword If '${resp.status_code}' == '202' log to console \nexecuted with expected result + Should Be Equal As Strings '${resp.status_code}' '202' + log to console ${resp.content} + ${onboarding_job_json_response}= Evaluate json.loads(r"""${resp.content}""", strict=False) json + ${job_ID}= Set Variable ${onboarding_job_json_response}[jobId] + Should Not Be Empty ${job_ID} + ${actual_job_status}= Set Variable "" + + FOR ${INDEX} IN RANGE ${MAXIMUM_ATTEMPTS_BEFORE_TIMEOUT} + ${onboarding_job_status_request}= Get Request etsi_catalog_session /api/catalog/v1/jobs/${job_ID} + Run Keyword If '${onboarding_job_status_request.status_code}' == '200' log to console \nexecuted with expected result + log to console ${onboarding_job_status_request.content} + + ${onboarding_job_status_json_response}= Evaluate json.loads(r"""${onboarding_job_status_request.content}""", strict=False) json + + ${actual_job_status}= Set Variable "" + + ${response_descriptor_exists}= Run Keyword And Return Status Get From Dictionary ${onboarding_job_status_json_response} responseDescriptor + ${status_exists}= Run Keyword And Return Status Get From Dictionary ${onboarding_job_status_json_response}[responseDescriptor] status + + ${actual_job_status}= Set Variable If ${response_descriptor_exists} == True and ${status_exists} == True + ... ${onboarding_job_status_json_response}[responseDescriptor][status] + + Log To Console Received actual repsonse status:${actual_job_status} + Run Keyword If '${actual_job_status}' == 'finished' or '${actual_job_status}' == 'error' or '${actual_job_status}' == 'timeout' Exit For Loop + log to console Will try again after ${SLEEP_INTERVAL_SEC} seconds + SLEEP ${SLEEP_INTERVAL_SEC} + END + Log To Console final repsonse status received: ${actual_job_status} + Run Keyword If '${actual_job_status}' == 'finished' log to console \nexecuted with expected result + Should Be Equal As Strings '${actual_job_status}' 'finished' + Distribute Service Template Create Session sdc_controller_session http://${REPO_IP}:8085 ${data}= Get Binary File ${CURDIR}${/}data${/}distributeServiceTemplate.json diff --git a/tests/usecases-config-over-netconf/config-over-netconf/config_over_netconf.robot b/tests/usecases-config-over-netconf/config-over-netconf/config_over_netconf.robot index 21c03c6f..e7d923f8 100644 --- a/tests/usecases-config-over-netconf/config-over-netconf/config_over_netconf.robot +++ b/tests/usecases-config-over-netconf/config-over-netconf/config_over_netconf.robot @@ -9,7 +9,7 @@ Library String ${SDNC_KEYSTORE_CONFIG_PATH} /config/netconf-keystore:keystore ${SDNC_MOUNT_PATH} /config/network-topology:network-topology/topology/topology-netconf/node/pnf-simulator ${PNFSIM_MOUNT_PATH} /config/network-topology:network-topology/topology/topology-netconf/node/pnf-simulator/yang-ext:mount/mynetconf:netconflist -${BP_UPLOAD_URL} /api/v1/execution-service/upload +${BP_UPLOAD_URL} /api/v1/blueprint-model/publish ${BP_PROCESS_URL} /api/v1/execution-service/process ${BP_ARCHIVE_PATH} ${CURDIR}/data/blueprint_archive.zip diff --git a/tests/usecases-config-over-netconf/config-over-netconf/data/blueprint_archive.zip b/tests/usecases-config-over-netconf/config-over-netconf/data/blueprint_archive.zip index ac346554..642c85f5 100644 Binary files a/tests/usecases-config-over-netconf/config-over-netconf/data/blueprint_archive.zip and b/tests/usecases-config-over-netconf/config-over-netconf/data/blueprint_archive.zip differ diff --git a/tests/vnfsdk-refrepo/resources/vnfsdk_properties.robot b/tests/vnfsdk-refrepo/resources/vnfsdk_properties.robot index bc9684d6..f240a5fa 100644 --- a/tests/vnfsdk-refrepo/resources/vnfsdk_properties.robot +++ b/tests/vnfsdk-refrepo/resources/vnfsdk_properties.robot @@ -11,14 +11,14 @@ ${OPERATION_STATUS_FAILED}= FAILED ${OPERATION_STATUS_PASS}= PASS ${csar_valid_no_security}= valid_no_security.csar -${execute_no_security_csar_validation}= [{"scenario": "onap-dublin","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_valid_no_security}","pnf":"true"}}] +${execute_no_security_csar_validation}= [{"scenario": "onap-vtp","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_valid_no_security}","pnf":"true"}}] ${expected_valid_no_security_warnings}= [{u'lineNumber': -1, u'message': u'Warning. Consider adding package integrity and authenticity assurance according to ETSI NFV-SOL 004 Security Option 1', u'code': u'0x1006', u'file': u'', u'vnfreqNo': u'R130206'}] ${csar_invalid_with_security}= invalid_with_security.csar -${execute_security_csar_validation}= [{"scenario": "onap-dublin","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_invalid_with_security}","pnf":"true"}}] -${execute_security_csar_validation_selected_rules}= [{"scenario": "onap-dublin","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_invalid_with_security}","pnf":"true","rules":"${CERTIFICATION_RULE},${PM_DICTIONARY_YAML_RULE}"}}] +${execute_security_csar_validation}= [{"scenario": "onap-vtp","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_invalid_with_security}","pnf":"true"}}] +${execute_security_csar_validation_selected_rules}= [{"scenario": "onap-vtp","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_invalid_with_security}","pnf":"true","rules":"${CERTIFICATION_RULE},${PM_DICTIONARY_YAML_RULE}"}}] ${csar_invalid_pm_dictionary}= invalid_pm_dictionary.csar -${execute_invalid_pm_dictionary_r130206_validation}= [{"scenario": "onap-dublin","testSuiteName": "validation","testCaseName": "csar-validate-r130206","parameters": {"csar": "file://${csar_invalid_pm_dictionary}","pnf":"true"}}] -${execute_invalid_pm_dictionary_validation}= [{"scenario": "onap-dublin","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_invalid_pm_dictionary}","pnf":"true"}}] +${execute_invalid_pm_dictionary_r130206_validation}= [{"scenario": "onap-vtp","testSuiteName": "validation","testCaseName": "csar-validate-r130206","parameters": {"csar": "file://${csar_invalid_pm_dictionary}","pnf":"true"}}] +${execute_invalid_pm_dictionary_validation}= [{"scenario": "onap-vtp","testSuiteName": "validation","testCaseName": "csar-validate","parameters": {"csar": "file://${csar_invalid_pm_dictionary}","pnf":"true"}}]