Updating image version and fixing tests 49/119149/3
authorwaqas.ikram <waqas.ikram@est.tech>
Thu, 11 Mar 2021 14:41:39 +0000 (14:41 +0000)
committerwaqas.ikram <waqas.ikram@est.tech>
Fri, 19 Mar 2021 13:10:18 +0000 (13:10 +0000)
Plus adding basic test for macroflow

Change-Id: Ic21b833b5f466065bb2982783f564f515cab1444
Issue-ID: SO-3579
Signed-off-by: waqas.ikram <waqas.ikram@est.tech>
40 files changed:
plans/so/integration-etsi-testing/config/distribution-test-zip/zipped_sdc_csar.tar.gz [changed mode: 0644->0755]
plans/so/integration-etsi-testing/config/env
plans/so/integration-etsi-testing/config/override-files/api-handler-infra/onapheat/override.yaml
plans/so/integration-etsi-testing/config/override-files/sdc-controller/onapheat/override.yaml
plans/so/integration-etsi-testing/config/override-files/vnfm-simulator/onapheat/override.yaml
plans/so/integration-etsi-testing/config/wait-for-container.sh
plans/so/integration-etsi-testing/docker-compose.local.yml
plans/so/integration-etsi-testing/docker-compose.yml
plans/so/integration-etsi-testing/setup.sh
plans/so/integration-etsi-testing/so-simulators/aai-simulator/pom.xml
plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/controller/BusinessController.java
plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProvider.java
plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/main/java/org/onap/so/aaisimulator/service/providers/CustomerCacheServiceProviderImpl.java
plans/so/integration-etsi-testing/so-simulators/aai-simulator/src/test/java/org/onap/so/aaisimulator/controller/BusinessControllerTest.java
plans/so/integration-etsi-testing/so-simulators/package/docker/src/main/docker/docker-files/Dockerfile.so-simulator-base-image
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/pom.xml
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/configration/WebSecurityConfigImpl.java
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/controller/CatalogController.java
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/models/ResourceArtifact.java [new file with mode: 0644]
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProvider.java
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/providers/ResourceProviderImpl.java
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/java/org/onap/so/sdcsimulator/utils/Constants.java
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/application.yaml
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/csar/73522444-e8e9-49c1-be29-d355800aa349.csar [new file with mode: 0644]
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/main/resources/csar/ba1c0c0e-9fb8-4b83-97bb-5e9af1e73393.csar [new file with mode: 0644]
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/controller/CatalogControllerTest.java
plans/so/integration-etsi-testing/so-simulators/sdc-simulator/src/test/java/org/onap/so/sdcsimulator/providers/ResourceProviderImplTest.java
plans/so/integration-etsi-testing/teardown.sh
plans/so/macroflow/config/env [new file with mode: 0644]
plans/so/macroflow/docker-compose.yml [new file with mode: 0644]
plans/so/macroflow/setup.sh [new file with mode: 0644]
plans/so/macroflow/teardown.sh [new file with mode: 0644]
plans/so/macroflow/testplan.txt [new file with mode: 0644]
tests/so/etsi/data/distributeServiceTemplate.json
tests/so/etsi/data/notification.json [deleted file]
tests/so/etsi/data/serviceDeleteRequest.json
tests/so/etsi/data/serviceInstantiationRequest.json
tests/so/etsi/data/vnfDeleteRequest.json
tests/so/etsi/data/vnfInstantiationRequest.json
tests/so/sanity-check/macroflow.robot [new file with mode: 0644]

old mode 100644 (file)
new mode 100755 (executable)
index d0e346f..209dfca
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
index 647f53a..2e73229 100644 (file)
@@ -1,6 +1,7 @@
 NEXUS_DOCKER_REPO_MSO=nexus3.onap.org:10001
 DOCKER_ENVIRONMENT=remote
-TAG=1.6.0
+TAG=1.7.11
 TIME_OUT_DEFAULT_VALUE_SEC=1200
 PROJECT_NAME=etsiintegrationtesting
 DEFAULT_NETWORK_NAME=etsiintegrationtesting_default
+ETSI_CATALOG_IMAGE_VERSION=1.0.9
index bdf5c4d..327e798 100644 (file)
@@ -131,3 +131,5 @@ org:
       adapters:
         network:
           encryptionKey: 07a7159d3bf51a0e53be7a8f89699be7
+aai:
+  auth: 221187EFA3AD4E33600DE0488F287099934CE65C3D0697BCECC00BB58E784E07CD74A24581DC31DBC086FF63DF116378776E9BE3D1325885
index ed8bd43..e450bfd 100644 (file)
@@ -79,3 +79,10 @@ mso:
         componentNames:
   scheduling:
     enabled: false
+sdc:
+  username: mso
+  password: 76966BDD3C7414A03F7037264FF2E6C8EEC6C28F2B67F2840A1ED857C0260FEE731D73F47F828E5527125D29FD25D3E0DE39EE44C058906BF1657DE77BF897EECA93BDC07FA64F
+  key: 566B754875657232314F5548556D3665
+  endpoint: http://sdc-simulator:9991/
+etsi-catalog-manager:
+  endpoint: http://modeling-etsicatalog:8806/api/catalog/v1
index 05cb1e5..b57d0e8 100644 (file)
@@ -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
index 35ee264..11e32bc 100755 (executable)
@@ -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
index e11b800..7f59ced 100644 (file)
@@ -28,6 +28,6 @@ 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}
 ################################################################################
index 2ee5026..f1853e0 100644 (file)
@@ -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'
index ce6637c..c01c37e 100755 (executable)
@@ -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
@@ -184,6 +184,16 @@ 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}"
 
index 26815ad..c51cae1 100644 (file)
@@ -8,7 +8,7 @@
     </parent>
     <artifactId>aai-simulator</artifactId>
     <properties>
-        <version.aai.schema>1.0.0</version.aai.schema>
+        <version.aai.schema>1.8.1</version.aai.schema>
     </properties>
     <dependencies>
         <dependency>
index 4a0ed1b..1221bea 100644 (file)
@@ -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<Relationship> optional =
-                cacheServiceProvider.getRelationship(globalCustomerId, serviceType, serviceInstanceId, vnfName);
+        final List<String> relatedToVnfIds =
+                getRelatedToVnfIds(globalCustomerId, serviceType, serviceInstanceId, vnfName);
 
-        if (optional.isPresent()) {
-
-            final Relationship relationship = optional.get();
-            final Optional<RelationshipData> 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<GenericVnf> 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<String> 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);
+    }
 }
index 7000fb3..af3595a 100644 (file)
@@ -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<Relationship> getRelationship(final String globalCustomerId, final String serviceType,
-            final String serviceInstanceId, final String vnfName);
-
     Optional<Relationship> 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<String> getRelatedToVnfIds(final String globalCustomerId, final String serviceType,
+            final String serviceInstanceId, final String vnfName);
+
+    List<String> getRelatedToVnfIds(final String globalCustomerId, final String serviceType,
+            final String serviceInstanceId);
+
 }
index 7193ade..7285faa 100644 (file)
@@ -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<Relationship> getRelationship(final String globalCustomerId, final String serviceType,
+    public List<String> getRelatedToVnfIds(final String globalCustomerId, final String serviceType,
             final String serviceInstanceId, final String vnfName) {
         final Optional<ServiceInstance> 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> relationship = relationshipList.getRelationship();
-                return relationship.stream().filter(
+                final List<Relationship> 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<String> getRelatedToVnfIds(final String globalCustomerId, final String serviceType,
+            final String serviceInstanceId) {
+        final Optional<ServiceInstance> 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<Relationship> 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<String> getGenericVnfIdsIfPresent(final List<Relationship> relationships) {
+        final List<String> 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
index c08c51e..9d950a9 100644 (file)
@@ -360,6 +360,36 @@ 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<Relationship> responseEntity2 = testRestTemplateService.invokeHttpPut(relationShipUrl,
+                TestUtils.getRelationShipJsonObject(), Relationship.class);
+        assertEquals(HttpStatus.ACCEPTED, responseEntity2.getStatusCode());
+        
+        final String genericVnfUrl = getUrl(GENERIC_VNF_URL, VNF_ID);
+        final ResponseEntity<Void> genericVnfResponse =
+                testRestTemplateService.invokeHttpPut(genericVnfUrl, TestUtils.getGenericVnf(), Void.class);
+        assertEquals(HttpStatus.ACCEPTED, genericVnfResponse.getStatusCode());
+        
+        final ResponseEntity<GenericVnfs> 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);
index 27e7c3e..78d2cdf 100644 (file)
@@ -1,45 +1,51 @@
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-    <parent>
-        <artifactId>so-simulators</artifactId>
-        <groupId>org.onap.so.simulators</groupId>
-        <version>1.0-SNAPSHOT</version>
-    </parent>
-    <modelVersion>4.0.0</modelVersion>
-    <artifactId>sdc-simulator</artifactId>
-    <name>${project.artifactId}</name>
-    <dependencies>
-        <dependency>
-            <groupId>org.springframework.boot</groupId>
-            <artifactId>spring-boot-starter-security</artifactId>
-            <exclusions>
-                <exclusion>
-                    <groupId>org.springframework.boot</groupId>
-                    <artifactId>spring-boot-starter-tomcat</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-    </dependencies>
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-                <configuration>
-                    <mainClass>org.onap.so.sdcsimulator.SdcSimulatorApplication</mainClass>
-                </configuration>
-                <executions>
-                    <execution>
-                        <goals>
-                            <goal>repackage</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-            <plugin>
-                <groupId>org.springframework.boot</groupId>
-                <artifactId>spring-boot-maven-plugin</artifactId>
-            </plugin>
-        </plugins>
-    </build>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+       <parent>
+               <artifactId>so-simulators</artifactId>
+               <groupId>org.onap.so.simulators</groupId>
+               <version>1.0-SNAPSHOT</version>
+       </parent>
+       <modelVersion>4.0.0</modelVersion>
+       <artifactId>sdc-simulator</artifactId>
+       <name>${project.artifactId}</name>
+       <dependencies>
+               <dependency>
+                       <groupId>${project.parent.groupId}</groupId>
+                       <artifactId>common</artifactId>
+                       <version>${project.version}</version>
+               </dependency>
+               <dependency>
+                       <groupId>org.springframework.boot</groupId>
+                       <artifactId>spring-boot-starter-security</artifactId>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>org.springframework.boot</groupId>
+                                       <artifactId>spring-boot-starter-tomcat</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+       </dependencies>
+       <build>
+               <plugins>
+                       <plugin>
+                               <groupId>org.springframework.boot</groupId>
+                               <artifactId>spring-boot-maven-plugin</artifactId>
+                               <configuration>
+                                       <mainClass>org.onap.so.sdcsimulator.SdcSimulatorApplication</mainClass>
+                               </configuration>
+                               <executions>
+                                       <execution>
+                                               <goals>
+                                                       <goal>repackage</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.springframework.boot</groupId>
+                               <artifactId>spring-boot-maven-plugin</artifactId>
+                       </plugin>
+               </plugins>
+       </build>
 </project>
\ No newline at end of file
index b2c5136..f3a7239 100644 (file)
 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,36 +33,16 @@ 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());
     }
 
-
     @Override
     protected void configure(final HttpSecurity http) throws Exception {
         http.csrf().disable().authorizeRequests().antMatchers(Constants.CATALOG_URL + "/**/**").authenticated().and()
                 .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);
-    }
-
 }
index 60c1865..eff63b8 100644 (file)
@@ -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<byte[]> 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 (file)
index 0000000..347702e
--- /dev/null
@@ -0,0 +1,243 @@
+/*-
+ * ============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();
+    }
+}
index 4d5dcdd..75ac782 100644 (file)
@@ -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,5 @@ public interface ResourceProvider {
 
     Optional<byte[]> getResource(final String csarId);
 
-    Optional<InputStream> getInputStream(final String csarId) throws IOException;
-
+    Set<ResourceArtifact> getResource();
 }
index 192ac89..b014d8f 100644 (file)
 
 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,73 @@ public class ResourceProviderImpl implements ResourceProvider {
     }
 
     @Override
-    public Optional<InputStream> getInputStream(final String csarId) throws IOException {
-        final Path filePath = Paths.get(resourceLocation, csarId + ".csar");
+    public Set<ResourceArtifact> getResource() {
+        final Set<ResourceArtifact> result = new HashSet<>();
+        final Path dir = Paths.get(resourceLocation);
+        if (Files.exists(dir)) {
+            try (final DirectoryStream<Path> 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<InputStream> 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.info("Couldn't find file on file system '{}', will return default csar", filePath);
-        final ClassPathResource classPathResource = new ClassPathResource(getDefaultCsarPath(), this.getClass());
+        LOGGER.warn("Couldn't find file on file system '{}', will search it in classpath", filePath);
+        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 +154,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
+}
index e841257..3ddb5be 100644 (file)
@@ -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() {}
 }
index 5bb7950..8ae1e8a 100644 (file)
@@ -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 (file)
index 0000000..db8f12d
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 (file)
index 0000000..4e0400f
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
index ca55f49..9c05f3e 100644 (file)
@@ -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,17 @@ public class CatalogControllerTest {
 
     }
 
+    @Test
+    public void test_getResources_validResourcesFromClassPath() {
+        final ResponseEntity<Set<ResourceArtifact>> response =
+                restTemplate.exchange(getBaseUrl() + "/resources", HttpMethod.GET, new HttpEntity<>(getHttpHeaders()),
+                        new ParameterizedTypeReference<Set<ResourceArtifact>>() {});
+        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 +112,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;
     }
index a7cb5dd..9a9f30c 100644 (file)
@@ -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;
 
 /**
@@ -38,45 +40,38 @@ import org.springframework.util.StreamUtils;
  * @author Eoin Hanan (eoin.hanan@est.tech)
  */
 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());
-
-        assertArrayEquals(DUMMY_CONTENT.getBytes(), objUnderTest.getResource("empty").get());
+        final ResourceProviderImpl objUnderTest = new ResourceProviderImpl(folder.getPath(), resourcePatternResolver);
+        assertArrayEquals(DUMMY_CONTENT.getBytes(), objUnderTest.getResource(uuid).get());
     }
 
     @Test
     public void test_getResource_withoutValidPath_matchContent() throws IOException {
         final ClassPathResource classPathResource = new ClassPathResource(Constants.DEFAULT_CSAR_PATH, this.getClass());
-
         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 {
-
-        final ResourceProviderImpl objUnderTest = new ResourceProviderImpl("") {
+    public void test_getResource_unbleToReadFileFromClasspath_emptyOptional() throws IOException {
+        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());
     }
 }
index e92b731..51e5701 100755 (executable)
@@ -6,15 +6,15 @@
 # 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=========================================================
 #
diff --git a/plans/so/macroflow/config/env b/plans/so/macroflow/config/env
new file mode 100644 (file)
index 0000000..f0ed0d0
--- /dev/null
@@ -0,0 +1,2 @@
+PROJECT_NAME=macroflowintegrationtesting
+DEFAULT_NETWORK_NAME=macroflowintegrationtesting_default
diff --git a/plans/so/macroflow/docker-compose.yml b/plans/so/macroflow/docker-compose.yml
new file mode 100644 (file)
index 0000000..9df89d0
--- /dev/null
@@ -0,0 +1,18 @@
+version: '3'
+services:
+################################################################################
+  aai-simulator:
+    image: simulators/aai-simulator:latest
+    ports:
+      - "9993:9993"
+    environment:
+    - APP=AAI-SIMULATOR
+    - JVM_ARGS=-Xms64m -Xmx512m
+    hostname:
+      aai-simulator
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "30m"
+        max-file: "5"
+################################################################################
diff --git a/plans/so/macroflow/setup.sh b/plans/so/macroflow/setup.sh
new file mode 100644 (file)
index 0000000..1f8c8b8
--- /dev/null
@@ -0,0 +1,146 @@
+#!/bin/bash
+#
+# ============LICENSE_START=======================================================
+#   Copyright (C) 2021 Nordix Foundation.
+# ================================================================================
+#  Licensed under the Apache License, Version 2.0 (the "License");
+#  you may not use this file except in compliance with the License.
+#  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing, software
+#  distributed under the License is distributed on an "AS IS" BASIS,
+#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#  See the License for the specific language governing permissions and
+#  limitations under the License.
+#
+#  SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+
+# @author Waqas Ikram (waqas.ikram@est.tech)
+
+MAVEN_VERSION_DIR="apache-maven-3.3.9"
+MAVEN_TAR_FILE="$MAVEN_VERSION_DIR-bin.tar.gz"
+MAVEN_TAR_LOCATION="https://archive.apache.org/dist/maven/maven-3/3.3.9/binaries/$MAVEN_TAR_FILE"
+
+SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+SCRIPT_NAME=$(basename $0)
+CONFIG_DIR=$SCRIPT_HOME/config
+ENV_FILE=$CONFIG_DIR/env
+TEMP_DIR_PATH=$SCRIPT_HOME/temp
+
+DOCKER_COMPOSE_FILE_PATH=$SCRIPT_HOME/docker-compose.yml
+TEAR_DOWN_SCRIPT=$SCRIPT_HOME/teardown.sh
+
+INTEGRATION_ETSI_TESTING_DIR=$WORKSPACE/plans/so/integration-etsi-testing
+INTEGRATION_ETSI_TESTING_CONFIG_DIR=$INTEGRATION_ETSI_TESTING_DIR/config
+
+MAVEN_DIR=$TEMP_DIR_PATH/maven
+INSTALLED_MAVEN_DIR=$MAVEN_DIR/$MAVEN_VERSION_DIR
+MVN=$INSTALLED_MAVEN_DIR/bin/mvn
+MVN_VERSION="$MVN -v"
+MVN_SETTINGS_XML="$INTEGRATION_ETSI_TESTING_DIR/settings.xml"
+MVN_CLEAN_INSTALL="$MVN clean install"
+SIMULATOR_MAVEN_PROJECT_POM="$INTEGRATION_ETSI_TESTING_DIR/so-simulators/pom.xml"
+WAIT_FOR_CONTAINER_SCRIPT=$INTEGRATION_ETSI_TESTING_CONFIG_DIR/"wait-for-container.sh"
+
+echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..."
+
+export $(egrep -v '^#' $ENV_FILE | xargs)
+
+MANDATORY_VARIABLES_NAMES=( "PROJECT_NAME" "DEFAULT_NETWORK_NAME" )
+
+for var in "${MANDATORY_VARIABLES_NAMES[@]}"
+ do
+   if [ -z "${!var}" ]; then
+     echo "Missing mandatory attribute $var in $ENV_FILE"
+     exit 1
+  fi
+done
+
+if [[ ! "$TEMP_DIR_PATH" || ! -d "$TEMP_DIR_PATH" ]]; then
+        echo "Creating temporary directory $TEMP_DIR_PATH"
+        mkdir $TEMP_DIR_PATH
+
+        if [ $? -ne 0 ]; then
+                echo "Could not create $TEMP_DIR_PATH"
+                exit 1
+        fi
+
+fi
+echo "Will use ${TEMP_DIR_PATH} directory"
+
+if [[ ! "$MAVEN_DIR" || ! -d "$MAVEN_DIR" ]]; then
+        echo "Creating temporary maven directory $MAVEN_DIR"
+        mkdir $MAVEN_DIR
+
+        if [ $? -ne 0 ]; then
+                echo "Could not create $MAVEN_DIR"
+                exit 1
+        fi
+fi
+echo "Will use ${MAVEN_DIR} directory for maven install"
+
+if [[ ! "$INSTALLED_MAVEN_DIR" || ! -d "$INSTALLED_MAVEN_DIR" ]]; then
+        echo "Installing maven ..."
+        cd $MAVEN_DIR
+
+        CURL=`which curl`
+        if [[ ! "$CURL" ]]; then
+                echo "curl command is not installed"
+                echo "Unable to execute test plan"
+                exit 1
+        fi
+        curl -O $MAVEN_TAR_LOCATION
+
+        TAR=`which tar`
+        if [[ ! "$TAR" ]]; then
+                echo "tar command is not installed"
+                echo "Unable to execute test plan"
+                exit 1
+        fi
+
+        tar -xzvf $MAVEN_TAR_FILE
+
+        echo "Finished installing maven ..."
+fi
+
+echo "Maven installed under directory $INSTALLED_MAVEN_DIR"
+
+$MVN_VERSION
+
+if [ $? -ne 0 ]; then
+        echo "Unable to run mvn -v command"
+        exit 1
+fi
+
+cd $SCRIPT_HOME
+
+echo "Will build simulator project using $MVN_CLEAN_INSTALL -f $SIMULATOR_MAVEN_PROJECT_POM --settings $MVN_SETTINGS_XML"
+$MVN_CLEAN_INSTALL -f $SIMULATOR_MAVEN_PROJECT_POM --settings $MVN_SETTINGS_XML
+
+if [ $? -ne 0 ]; then
+        echo "Maven build failed"
+        exit 1
+fi
+
+docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME up -d
+
+echo "Sleeping for 1m"
+sleep 1m
+
+AAI_SIMULATOR_CONTAINER_NAME="aai-simulator"
+echo "Will execute $WAIT_FOR_CONTAINER_SCRIPT to wait for $AAI_SIMULATOR_CONTAINER_NAME container to start up"
+$WAIT_FOR_CONTAINER_SCRIPT -c "$AAI_SIMULATOR_CONTAINER_NAME" -t "300" -n "$DEFAULT_NETWORK_NAME"
+if [ $? -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}"
+
+echo "Finished executing $SCRIPT_HOME/$SCRIPT_NAME"
diff --git a/plans/so/macroflow/teardown.sh b/plans/so/macroflow/teardown.sh
new file mode 100644 (file)
index 0000000..34d7254
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/bash
+#
+# ============LICENSE_START=======================================================
+#  Copyright (C) 2021 Nordix Foundation.
+# ================================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# SPDX-License-Identifier: Apache-2.0
+# ============LICENSE_END=========================================================
+#
+
+# @author Waqas Ikram (waqas.ikram@est.tech)
+
+SCRIPT_HOME="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
+SCRIPT_NAME=$(basename $0)
+CONFIG_DIR=$SCRIPT_HOME/config
+ENV_FILE=$CONFIG_DIR/env
+DOCKER_COMPOSE_FILE_PATH=$SCRIPT_HOME/docker-compose.yml
+
+echo "Running $SCRIPT_HOME/$SCRIPT_NAME ..."
+export $(egrep -v '^#' $ENV_FILE | xargs)
+
+echo "Tearing down docker containers ..."
+docker-compose -f $DOCKER_COMPOSE_FILE_PATH -p $PROJECT_NAME down
+echo "Finished executing $SCRIPT_HOME/$SCRIPT_NAME"
diff --git a/plans/so/macroflow/testplan.txt b/plans/so/macroflow/testplan.txt
new file mode 100644 (file)
index 0000000..00a8d8b
--- /dev/null
@@ -0,0 +1,3 @@
+# Test suites are relative paths under [integration/csit.git]/tests/.
+# Place the suites in run order.
+so/sanity-check/macroflow.robot
index 47a9f21..6c64d5c 100644 (file)
 {
-  "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/notification.json b/tests/so/etsi/data/notification.json
deleted file mode 100644 (file)
index 54bbc09..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-{
-    "id": "3aa49739-aabd-4d40-8c32-b5b97940201b",
-    "notificationType": "VnfLcmOperationOccurrenceNotification",
-    "subscriptionId": null,
-    "timeStamp": null,
-    "notificationStatus": "START",
-    "operationState": "PROCESSING",
-    "vnfInstanceId": "a23c5388-e035-4ca6-a126-662ad8dd8687",
-    "operation": "INSTANTIATE",
-    "isAutomaticInvocation": null,
-    "vnfLcmOpOccId": null,
-    "affectedVnfcs": null,
-    "affectedVirtualLinks": null,
-    "affectedVirtualStorages": null,
-    "changedInfo": null,
-    "changedExtConnectivity": null,
-    "error": null,
-    "_links": {
-        "vnfInstance": {
-            "href": "https://so-vnfm-simulator:9093/vnflcm/v1/vnf_instances/a23c5388-e035-4ca6-a126-662ad8dd8687"
-        },
-        "subscription": null,
-        "vnfLcmOpOcc": null
-    }
-}
-
index 257b067..4fd43e4 100644 (file)
@@ -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
+}
index 054a2ff..8520c0d 100644 (file)
@@ -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"
     }
+  }
 }
index 08862ea..432ec34 100644 (file)
@@ -1,25 +1,25 @@
 {
-       "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",
-                       "modelVersion": "1.0"
-               },
-               "requestInfo": {
-                       "source": "VID",
-                       "requestorId": "demo"
-               },
-               "requestParameters": {
-                       "testApi": "GR_API"
-               },
-               "cloudConfiguration": {
-                       "lcpCloudRegionId": "nordixcloud",
-                       "cloudOwner": "CloudOwner",
-                       "tenantId": "693c7729b2364a26a3ca602e6f66187d"
-               }
-       }
-}
\ No newline at end of file
+    "requestDetails": {
+        "modelInfo": {
+            "modelType": "vnf",
+            "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": {
+            "source": "VID",
+            "requestorId": "demo"
+        },
+        "requestParameters": {
+            "testApi": "GR_API"
+        },
+        "cloudConfiguration": {
+            "lcpCloudRegionId": "nordixcloud",
+            "cloudOwner": "CloudOwner",
+            "tenantId": "693c7729b2364a26a3ca602e6f66187d"
+        }
+    }
+}
index a4cc5c9..8aff734 100644 (file)
@@ -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",
+    "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",
-            "modelVersionId": "99d59273-4450-4034-9141-027f0c1a807a"
-          }
-        }
-      }
-    ]
-  }
-}
\ No newline at end of file
+            "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/sanity-check/macroflow.robot b/tests/so/sanity-check/macroflow.robot
new file mode 100644 (file)
index 0000000..149797a
--- /dev/null
@@ -0,0 +1,15 @@
+*** Settings ***
+Library     Collections
+Library     RequestsLibrary
+Library     OperatingSystem
+Library     json
+
+*** Test Cases ***
+Healthcheck
+    [Documentation]    Runs AAI SIMULATOR Health check
+    Create Session   aai_simulator_session  https://${REPO_IP}:9993
+    &{headers}=  Create Dictionary    Accept=text/plain
+    ${resp}=    Get Request    aai_simulator_session    /aai/v19/healthcheck    headers=${headers}
+    log to console    Received response from AAI SIMULATOR ${resp.text}
+    Should Be Equal As Strings    '${resp.status_code}'    '200'
+    Should Be Equal As Strings    '${resp.text}'    'healthy'