diff options
Diffstat (limited to 'asdc-controller')
14 files changed, 163 insertions, 17 deletions
diff --git a/asdc-controller/pom.xml b/asdc-controller/pom.xml index 1059e89da9..e7e95481aa 100644 --- a/asdc-controller/pom.xml +++ b/asdc-controller/pom.xml @@ -22,6 +22,34 @@ <build> <finalName>${project.artifactId}-${project.version}</finalName> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.eclipse.m2e</groupId> + <artifactId>lifecycle-mapping</artifactId> + <version>1.0.0</version> + <configuration> + <lifecycleMappingMetadata> + <pluginExecutions> + <pluginExecution> + <pluginExecutionFilter> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> + <versionRange>[1.0.0,)</versionRange> + <goals> + <goal>unpack</goal> + </goals> + </pluginExecutionFilter> + <action> + <execute /> + </action> + </pluginExecution> + </pluginExecutions> + </lifecycleMappingMetadata> + </configuration> + </plugin> + </plugins> + </pluginManagement> <plugins> <plugin> <groupId>org.jacoco</groupId> @@ -125,7 +153,7 @@ </plugin> <plugin> <groupId>io.fabric8</groupId> - <artifactId>fabric8-maven-plugin</artifactId> + <artifactId>docker-maven-plugin</artifactId> <executions> <execution> <id>start</id> @@ -198,6 +226,11 @@ <scope>test</scope> </dependency> <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>1.9</version> + </dependency> + <dependency> <groupId>org.onap.so</groupId> <artifactId>mso-catalog-db</artifactId> <version>${project.version}</version> @@ -205,7 +238,7 @@ <dependency> <groupId>org.onap.sdc.sdc-distribution-client</groupId> <artifactId>sdc-distribution-client</artifactId> - <version>1.3.0</version> + <version>1.4.1</version> <exclusions> <exclusion> <groupId>org.slf4j</groupId> @@ -285,5 +318,10 @@ <groupId>javax.interceptor</groupId> <artifactId>javax.interceptor-api</artifactId> </dependency> + <dependency> + <groupId>org.onap.so</groupId> + <artifactId>aai-client</artifactId> + <version>${project.version}</version> + </dependency> </dependencies> </project> diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java index 3e5f82bc5e..c69800d640 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/client/ASDCConfiguration.java @@ -84,6 +84,11 @@ public class ASDCConfiguration implements IConfiguration { } @Override + public java.lang.Boolean isUseHttpsWithSDC() { + return getBooleanPropertyWithDefault("mso.asdc-connections.asdc-controller1.useHttpsWithSdc", true); + } + + @Override public boolean isConsumeProduceStatusTopic() { return true; } diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java index f2c6b2f16a..37ad7db1c9 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/installer/ResourceStructure.java @@ -23,8 +23,6 @@ import org.onap.sdc.api.notification.INotificationData; import org.onap.sdc.api.notification.IResourceInstance; import org.onap.sdc.api.results.IDistributionClientDownloadResult; import org.onap.so.asdc.client.exceptions.ArtifactInstallerException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; /** * Abstract class to represent the resource structure. diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java index 6ca97c7c67..3ae815dd71 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImpl.java @@ -22,8 +22,8 @@ package org.onap.so.asdc.tenantIsolation; import java.net.MalformedURLException; import java.net.URL; -import org.onap.so.client.aai.AAIProperties; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIProperties; +import org.onap.aaiclient.client.aai.AAIVersion; import org.onap.so.spring.SpringContextHelper; import org.springframework.context.ApplicationContext; diff --git a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java index 0128078a59..85442675c0 100644 --- a/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java +++ b/asdc-controller/src/main/java/org/onap/so/asdc/tenantIsolation/WatchdogDistribution.java @@ -25,11 +25,11 @@ package org.onap.so.asdc.tenantIsolation; import java.util.HashMap; import java.util.List; import java.util.Map; -import org.onap.so.client.aai.AAIObjectType; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; -import org.onap.so.client.aai.entities.uri.AAIUriFactory; -import org.onap.so.client.graphinventory.entities.uri.Depth; +import org.onap.aaiclient.client.aai.AAIObjectType; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory; +import org.onap.aaiclient.client.graphinventory.entities.uri.Depth; import org.onap.so.db.catalog.beans.Service; import org.onap.so.db.catalog.data.repository.ServiceRepository; import org.onap.so.db.request.beans.WatchdogComponentDistributionStatus; diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java index 40c403fd72..e4749742ee 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/ASDCConfigurationTest.java @@ -7,9 +7,9 @@ * 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. @@ -30,7 +30,7 @@ import org.springframework.beans.factory.annotation.Autowired; /** * THis class tests the ASDC Controller by using the ASDC Mock CLient - * + * * */ public class ASDCConfigurationTest extends BaseTest { @@ -52,6 +52,7 @@ public class ASDCConfigurationTest extends BaseTest { assertTrue(config.getRelevantArtifactTypes().size() == config.SUPPORTED_ARTIFACT_TYPES_LIST.size()); assertTrue(config.getWatchDogTimeout() == 1); assertTrue(config.isUseHttpsWithDmaap() == true); + assertTrue(config.isUseHttpsWithSDC() == true); } } diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java index 9294677b95..3d6fbb21ef 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/client/test/rest/ASDCRestInterfaceTest.java @@ -343,6 +343,43 @@ public class ASDCRestInterfaceTest extends BaseTest { } @Test + public void test_E2ESlicing_Distribution() throws Exception { + wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) + .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); + + wireMockServer.stubFor(post(urlPathMatching("/v1.0/activity-spec")) + .willReturn(aResponse().withHeader("Content-Type", "application/json") + .withStatus(org.springframework.http.HttpStatus.ACCEPTED.value()))); + String resourceLocation = "src/test/resources/resource-examples/e2eSlicing/"; + ObjectMapper mapper = new ObjectMapper(); + + NotificationDataImpl request; + HttpEntity<NotificationDataImpl> entity; + ResponseEntity<String> response; + headers.add("resource-location", resourceLocation); + + request = mapper.readValue(new File(resourceLocation + "nsst-notification.json"), NotificationDataImpl.class); + entity = new HttpEntity<NotificationDataImpl>(request, headers); + response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), HttpMethod.POST, entity, + String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + request = mapper.readValue(new File(resourceLocation + "nst-notification.json"), NotificationDataImpl.class); + entity = new HttpEntity<NotificationDataImpl>(request, headers); + response = restTemplate.exchange(createURLWithPort("test/treatNotification/v1"), HttpMethod.POST, entity, + String.class); + assertEquals(Response.Status.OK.getStatusCode(), response.getStatusCode().value()); + + Optional<Service> service = serviceRepo.findById("7981375e-5e0a-4bf5-93fa-f3e3c02f2b11"); + assertTrue(service.isPresent()); + assertEquals("EmbbNst", service.get().getModelName()); + + service = serviceRepo.findById("637e9b93-208b-4b06-80f2-a2021c228174"); + assertTrue(service.isPresent()); + assertEquals("EmbbCn", service.get().getModelName()); + } + + @Test public void test_PublicNS_Distribution() throws Exception { wireMockServer.stubFor(post(urlPathMatching("/aai/.*")) .willReturn(aResponse().withStatus(200).withHeader("Content-Type", "application/json"))); diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java index 9aad96cbc4..1c81553d38 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/AaiClientPropertiesImplTest.java @@ -24,7 +24,7 @@ import static org.junit.Assert.assertEquals; import org.junit.BeforeClass; import org.junit.Test; import org.onap.so.asdc.BaseTest; -import org.onap.so.client.aai.AAIVersion; +import org.onap.aaiclient.client.aai.AAIVersion; public class AaiClientPropertiesImplTest extends BaseTest { diff --git a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java index 9ef41c7cbf..67889c60da 100644 --- a/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java +++ b/asdc-controller/src/test/java/org/onap/so/asdc/tenantIsolation/WatchdogDistributionTest.java @@ -35,8 +35,8 @@ import org.junit.rules.ExpectedException; import org.mockito.Mock; import org.mockito.MockitoAnnotations; import org.onap.so.asdc.BaseTest; -import org.onap.so.client.aai.AAIResourcesClient; -import org.onap.so.client.aai.entities.uri.AAIResourceUri; +import org.onap.aaiclient.client.aai.AAIResourcesClient; +import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri; import org.onap.so.db.catalog.beans.Service; import org.springframework.beans.factory.annotation.Autowired; diff --git a/asdc-controller/src/test/resources/resource-examples/e2eSlicing/eMBB.zip b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/eMBB.zip Binary files differnew file mode 100644 index 0000000000..ce0b901fdd --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/eMBB.zip diff --git a/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nsst-notification.json b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nsst-notification.json new file mode 100644 index 0000000000..49b1c10124 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nsst-notification.json @@ -0,0 +1,32 @@ +{ + "distributionID": "28ffbae6-f44a-408c-9ec1-e329c4a48e77", + "serviceName": "EmbbCn", + "serviceVersion": "1.0", + "serviceUUID": "2763777c-27bd-4df7-93b8-c690e23f4d3f", + "serviceDescription": "EmbbCn", + "serviceInvariantUUID": "0402fb4c-4a0c-4ff2-ad2b-29218ea1d629", + "resources": [], + "serviceArtifacts": [ + { + "artifactName": "eMBB.zip", + "artifactType": "OTHER", + "artifactURL": "/eMBB.zip", + "artifactChecksum": "ZWRkMGM3NzNjMmE3NzliYTFiZGNmZjVlMDE4OWEzMTA\u003d", + "artifactDescription": "EmbbCn", + "artifactTimeout": 0, + "artifactVersion": "1", + "artifactUUID": "3f669cc1-dbe7-48ea-b606-42f497b2ac46" + }, + { + "artifactName": "service-Embbcn-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/service-Embbcn-csar.csar", + "artifactChecksum": "NTk5MDZhNzJkOWIwZDQ0YTNlNWM0Y2MyODI5Mzk0ZWU\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactVersion": "1", + "artifactUUID": "dc0f2a41-4f71-452f-91c7-0444e4d8c33b" + } + ], + "workloadContext": "Production" +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nst-notification.json b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nst-notification.json new file mode 100644 index 0000000000..8471a28b70 --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/nst-notification.json @@ -0,0 +1,35 @@ +{ + "distributionID": "ece2fb37-6e4e-4989-b54e-9b0e00afb7cc", + "serviceName": "EmbbNst", + "serviceVersion": "1.0", + "serviceUUID": "e3958a85-65e0-4a77-8981-a51755aa9d39", + "serviceDescription": "Embb Nst Template", + "serviceInvariantUUID": "1899e5c1-df4e-43a8-a889-48c157dad7bc", + "resources": [ + { + "resourceInstanceName": "embbcn_proxy 0", + "resourceCustomizationUUID": "dd6f6ce9-1a23-4303-9466-22abf2a889dc", + "resourceName": "serviceProxy", + "resourceVersion": "1.0", + "resoucreType": "Service Proxy", + "resourceUUID": "4e8212a4-2a7a-4e76-9e0f-54411bc1c17d", + "resourceInvariantUUID": "b1fc926c-8cc3-4bda-8e50-27ba3536c47f", + "category": "Generic", + "subcategory": "Abstract", + "artifacts": [] + } + ], + "serviceArtifacts": [ + { + "artifactName": "service-Embbnst-csar.csar", + "artifactType": "TOSCA_CSAR", + "artifactURL": "/service-Embbnst-csar.csar", + "artifactChecksum": "YmEzMGFlOGY1MDBhMTg4MmFlYjkwODU1YjYzOTA5NDU\u003d", + "artifactDescription": "TOSCA definition package of the asset", + "artifactTimeout": 0, + "artifactVersion": "1", + "artifactUUID": "2a690bd3-4529-4437-9e9f-805eaaa25b4a" + } + ], + "workloadContext": "Production" +}
\ No newline at end of file diff --git a/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbcn-csar.csar b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbcn-csar.csar Binary files differnew file mode 100644 index 0000000000..775f35046a --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbcn-csar.csar diff --git a/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbnst-csar.csar b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbnst-csar.csar Binary files differnew file mode 100644 index 0000000000..e6e42e489f --- /dev/null +++ b/asdc-controller/src/test/resources/resource-examples/e2eSlicing/service-Embbnst-csar.csar |