From 50b9e8ab49218a94d935bbabb6511cd75b2e3dcb Mon Sep 17 00:00:00 2001 From: Fiete Ostkamp Date: Mon, 21 Jul 2025 21:56:37 +0200 Subject: [PATCH] Create tests for AAIRepository - create integration test that asserts http requests towards AAI - bump snapshot version to 1.13.1-SNAPSHOT Issue-ID: AAI-4191 Change-Id: I104c2ea0ecef64dcebdea5e02c14a37df82c1a21 Signed-off-by: Fiete Ostkamp --- .gitignore | 1 + packages/docker/pom.xml | 4 +- packages/pom.xml | 4 +- pom.xml | 2 +- so-cnf-adapter-application/pom.xml | 17 ++- .../onap/so/adapters/cnf/rest/CnfAdapterRest.java | 46 +++--- .../so/adapters/cnf/util/AaiRepositoryTest.java | 156 +++++++++++++++++++++ .../resources/__files/bulkDeleteRequestBody.json | 11 ++ .../resources/__files/bulkProcessRequestBody.json | 16 +++ .../__files/bulkProcessVnfVfModuleRequest.json | 20 +++ .../src/test/resources/__files/genericVnf.json | 67 +++++++++ .../src/test/resources/__files/k8sResource.json | 18 +++ .../__files/k8sResourceExistsResponse.json | 7 + .../__files/k8sResourceNotFoundResponse.json | 14 ++ .../src/test/resources/__files/vfModule.json | 18 +++ .../__files/vfModuleWithRelationshipsResponse.json | 66 +++++++++ so-cnfm/pom.xml | 2 +- so-cnfm/so-cnfm-lcm/pom.xml | 2 +- so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/pom.xml | 2 +- .../so-cnfm-lcm/so-cnfm-lcm-application/pom.xml | 2 +- so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/pom.xml | 2 +- .../so-cnfm-lcm-database-service/pom.xml | 2 +- so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/pom.xml | 2 +- 23 files changed, 444 insertions(+), 37 deletions(-) create mode 100644 so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/util/AaiRepositoryTest.java create mode 100644 so-cnf-adapter-application/src/test/resources/__files/bulkDeleteRequestBody.json create mode 100644 so-cnf-adapter-application/src/test/resources/__files/bulkProcessRequestBody.json create mode 100644 so-cnf-adapter-application/src/test/resources/__files/bulkProcessVnfVfModuleRequest.json create mode 100644 so-cnf-adapter-application/src/test/resources/__files/genericVnf.json create mode 100644 so-cnf-adapter-application/src/test/resources/__files/k8sResource.json create mode 100644 so-cnf-adapter-application/src/test/resources/__files/k8sResourceExistsResponse.json create mode 100644 so-cnf-adapter-application/src/test/resources/__files/k8sResourceNotFoundResponse.json create mode 100644 so-cnf-adapter-application/src/test/resources/__files/vfModule.json create mode 100644 so-cnf-adapter-application/src/test/resources/__files/vfModuleWithRelationshipsResponse.json diff --git a/.gitignore b/.gitignore index e361410..b2e3a1c 100644 --- a/.gitignore +++ b/.gitignore @@ -24,3 +24,4 @@ target **/.sts4-cache **/.java-version .vscode +*.http diff --git a/packages/docker/pom.xml b/packages/docker/pom.xml index b638d93..6c52063 100755 --- a/packages/docker/pom.xml +++ b/packages/docker/pom.xml @@ -4,10 +4,10 @@ org.onap.so.adapters.so-cnf-adapter packages - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT org.onap.so.adapters.so-cnf-adapter.packages - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT pom docker Docker Packaging diff --git a/packages/pom.xml b/packages/pom.xml index 7969a86..02398e4 100644 --- a/packages/pom.xml +++ b/packages/pom.xml @@ -4,11 +4,11 @@ org.onap.so.adapters.so-cnf-adapter so-cnf-adapter - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT packages pom - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT Packages diff --git a/pom.xml b/pom.xml index 519ca1b..15817f2 100644 --- a/pom.xml +++ b/pom.xml @@ -8,7 +8,7 @@ org.onap.so.adapters.so-cnf-adapter so-cnf-adapter - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT SO CNF Adapter pom diff --git a/so-cnf-adapter-application/pom.xml b/so-cnf-adapter-application/pom.xml index 5783ecb..d0daeb0 100755 --- a/so-cnf-adapter-application/pom.xml +++ b/so-cnf-adapter-application/pom.xml @@ -26,13 +26,26 @@ org.onap.so.adapters.so-cnf-adapter so-cnf-adapter - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT so-cnf-adapter-application - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT SO CNF Application Jar ${project.artifactId}-${project.version} + + + + org.jacoco + jacoco-maven-plugin + + + org/onap/so/adapters/cnf/model/** + + + + + org.springframework.boot diff --git a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java index afce775..baa62c1 100644 --- a/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java +++ b/so-cnf-adapter-application/src/main/java/org/onap/so/adapters/cnf/rest/CnfAdapterRest.java @@ -161,7 +161,7 @@ public class CnfAdapterRest { synchronizationService.createSubscriptionIfNotExists(aaiRequest); callbackResponse.setCompletionStatus(AaiCallbackResponse.CompletionStatus.COMPLETED); } catch (Exception e) { - logger.warn("Failed to create resource in AAI", e); + logger.warn("Failed to create resource in AAI {}", e); callbackResponse.setCompletionStatus(AaiCallbackResponse.CompletionStatus.FAILED); callbackResponse.setMessage(e.getMessage()); } @@ -187,7 +187,7 @@ public class CnfAdapterRest { aaiService.aaiDelete(aaiRequest); callbackResponse.setCompletionStatus(AaiCallbackResponse.CompletionStatus.COMPLETED); } catch (Exception e) { - logger.warn("Failed to delete resource from AAI", e); + logger.warn("Failed to delete resource from AAI {}", e); callbackResponse.setCompletionStatus(AaiCallbackResponse.CompletionStatus.FAILED); callbackResponse.setMessage(e.getMessage()); } @@ -211,7 +211,7 @@ public class CnfAdapterRest { try { statusCheckResponse = simpleStatusCheckService.statusCheck(statusCheckRequest); } catch (Exception e) { - logger.error("END - Status check process failed", e); + logger.error("END - Status check process failed {}", e); statusCheckResponse = simpleStatusCheckService.statusCheckError(statusCheckRequest, e); } callbackClient.sendPostCallback(statusCheckRequest.getCallbackUrl(), statusCheckResponse); @@ -329,7 +329,7 @@ public class CnfAdapterRest { try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -364,7 +364,7 @@ public class CnfAdapterRest { HttpDelete req = new HttpDelete(uri + "/v1/rb/definition/" + rbName + "/" + rbVersion); try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } @@ -382,7 +382,7 @@ public class CnfAdapterRest { HttpGet req = new HttpGet(uri + "/v1/rb/definition/" + rbName); try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } @@ -475,7 +475,7 @@ public class CnfAdapterRest { uri + "/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName); try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -494,7 +494,7 @@ public class CnfAdapterRest { new HttpGet(uri + "/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile"); try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -513,7 +513,7 @@ public class CnfAdapterRest { uri + "/v1/rb/definition/" + rbName + "/" + rbVersion + "/profile/" + prName); try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } @@ -547,7 +547,7 @@ public class CnfAdapterRest { try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -572,7 +572,7 @@ public class CnfAdapterRest { try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -592,7 +592,7 @@ public class CnfAdapterRest { + prName + "/config/" + cfgName); try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -613,7 +613,7 @@ public class CnfAdapterRest { + "/profile/" + prName + "/config/" + cfgName); try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } @@ -640,7 +640,7 @@ public class CnfAdapterRest { try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -664,7 +664,7 @@ public class CnfAdapterRest { try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -686,7 +686,7 @@ public class CnfAdapterRest { try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -703,7 +703,7 @@ public class CnfAdapterRest { HttpGet req = new HttpGet(uri + "/v1/connectivity-info/" + connName); try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -720,7 +720,7 @@ public class CnfAdapterRest { HttpDelete req = new HttpDelete(uri + "/v1/connectivity-info/" + connName); try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } @@ -745,7 +745,7 @@ public class CnfAdapterRest { try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -764,7 +764,7 @@ public class CnfAdapterRest { + "/config-template/" + tName); try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -783,7 +783,7 @@ public class CnfAdapterRest { + "/config-template/" + tName); try (CloseableHttpResponse response = httpClient.execute(req)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } @@ -818,7 +818,7 @@ public class CnfAdapterRest { try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } @@ -843,7 +843,7 @@ public class CnfAdapterRest { try (CloseableHttpClient httpClient = HttpClients.createDefault(); CloseableHttpResponse response = httpClient.execute(post)) { - logger.info("response:" + response.getEntity()); + logger.info("response: " + response.getEntity()); return EntityUtils.toString(response.getEntity()); } } diff --git a/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/util/AaiRepositoryTest.java b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/util/AaiRepositoryTest.java new file mode 100644 index 0000000..e5a8a9d --- /dev/null +++ b/so-cnf-adapter-application/src/test/java/org/onap/so/adapters/cnf/util/AaiRepositoryTest.java @@ -0,0 +1,156 @@ +/* + * Copyright © 2025 Deutsche Telekom + * + * 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. + */ + +package org.onap.so.adapters.cnf.util; + +import org.apache.http.entity.ContentType; +import org.junit.Before; +import org.junit.Rule; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.onap.so.adapters.cnf.model.aai.AaiRequest; +import org.onap.so.adapters.cnf.service.aai.KubernetesResource; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.boot.test.context.SpringBootTest.WebEnvironment; +import org.springframework.boot.web.server.LocalServerPort; +import org.springframework.http.HttpStatus; +import org.springframework.test.context.DynamicPropertyRegistry; +import org.springframework.test.context.DynamicPropertySource; +import org.springframework.test.context.junit4.SpringRunner; +import org.springframework.util.SocketUtils; +import org.springframework.web.client.RestTemplate; +import org.springframework.web.util.DefaultUriBuilderFactory; + +import com.github.tomakehurst.wiremock.client.WireMock; +import com.github.tomakehurst.wiremock.junit.WireMockRule; + +import static com.github.tomakehurst.wiremock.client.WireMock.exactly; +import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + +import lombok.SneakyThrows; + +@SpringBootTest +@RunWith(SpringRunner.class) +public class AaiRepositoryTest { + + private static int wireMockPort = SocketUtils.findAvailableTcpPort(); + + @Rule + public WireMockRule wireMockRule = new WireMockRule(wireMockConfig().port(wireMockPort)); + + @DynamicPropertySource + static void configureProperties(DynamicPropertyRegistry registry) { + registry.add("aai.enabled", () -> "true"); + registry.add("aai.endpoint", () -> "http://localhost:" + wireMockPort); + } + + @Test + @SneakyThrows + public void thatAAIResourcesCanBeUpdated() { + final String K8S_URL = "/aai/v24/cloud-infrastructure/cloud-regions/cloud-region/someOwner/someRegion/tenants/tenant/someTenant/k8s-resources/k8s-resource/someId"; + WireMock.stubFor(WireMock.get(WireMock.urlEqualTo(K8S_URL)) + .willReturn(WireMock.aResponse().withStatus(HttpStatus.OK.value()).withBodyFile("k8sResource.json"))); + final String VFMODULE_URL = "/aai/v24/network/generic-vnfs/generic-vnf/someGenericVnfId/vf-modules/vf-module/someVfModuleId"; + WireMock.stubFor(WireMock.get(WireMock.urlEqualTo(VFMODULE_URL)) + .willReturn(WireMock.aResponse().withStatus(HttpStatus.OK.value()).withBodyFile("vfModule.json"))); + final String GENERIC_VNF_URL = "/aai/v24/network/generic-vnfs/generic-vnf/someGenericVnfId"; + WireMock.stubFor(WireMock.get(WireMock.urlEqualTo(GENERIC_VNF_URL)) + .willReturn(WireMock.aResponse().withStatus(HttpStatus.OK.value()).withBodyFile("genericVnf.json"))); + final String BULK_URL = "/aai/v24/bulkprocess"; + final String expectedBulkBody = new String( + Files.readAllBytes(Paths.get("src/test/resources/__files/bulkProcessRequestBody.json"))); + WireMock.stubFor(WireMock.put(WireMock.urlEqualTo(BULK_URL)).withRequestBody(WireMock.equalToJson(expectedBulkBody)) + .willReturn(WireMock.aResponse().withStatus(HttpStatus.CREATED.value()).withBody("{}"))); + final String expectedVnfVfModuleBulkBody = new String( + Files.readAllBytes(Paths.get("src/test/resources/__files/bulkProcessVnfVfModuleRequest.json"))); + WireMock.stubFor( + WireMock.put(WireMock.urlEqualTo(BULK_URL)).withRequestBody(WireMock.equalToJson(expectedVnfVfModuleBulkBody)) + .willReturn(WireMock.aResponse().withStatus(HttpStatus.CREATED.value()).withBody("{}"))); + + KubernetesResource resource = new KubernetesResource(); + resource.setId("someId"); + resource.setName("someName"); + AaiRequest request = new AaiRequest(); + request.setCloudOwner("someOwner"); + request.setCloudRegion("someRegion"); + request.setTenantId("someTenant"); + request.setGenericVnfId("someGenericVnfId"); + request.setVfModuleId("someVfModuleId"); + IAaiRepository aaiRepository = IAaiRepository.instance(true); + aaiRepository.update(resource, request); + WireMock.verify(exactly(0), WireMock.putRequestedFor(WireMock.urlEqualTo(BULK_URL))); + aaiRepository.commit(false); + WireMock.verify(WireMock.getRequestedFor(WireMock.urlEqualTo(K8S_URL))); + WireMock.verify(WireMock.putRequestedFor(WireMock.urlEqualTo(BULK_URL)) + .withRequestBody(WireMock.equalToJson(expectedBulkBody))); + WireMock.verify(WireMock.putRequestedFor(WireMock.urlEqualTo(BULK_URL)) + .withRequestBody(WireMock.equalToJson(expectedVnfVfModuleBulkBody))); + } + + @Test + @SneakyThrows + public void thatAAIResourcesCanBeDeleted() { + final String K8S_NOT_FOUND_URL = "/aai/v24/cloud-infrastructure/cloud-regions/cloud-region/someCloudOwner/someCloudRegionId/tenants/tenant/someTenantId/k8s-resources/k8s-resource/doesNotExist"; + WireMock.stubFor(WireMock.get(WireMock.urlEqualTo(K8S_NOT_FOUND_URL)) + .willReturn(WireMock.aResponse().withStatus(HttpStatus.NOT_FOUND.value()) + .withBodyFile("k8sResourceNotFoundResponse.json"))); + final String K8S_URL = "/aai/v24/cloud-infrastructure/cloud-regions/cloud-region/someCloudOwner/someCloudRegionId/tenants/tenant/someTenantId/k8s-resources/k8s-resource/someK8sResource"; + WireMock.stubFor(WireMock.get(WireMock.urlEqualTo(K8S_URL)) + .willReturn(WireMock.aResponse().withStatus(HttpStatus.OK.value()).withBodyFile("k8sResource.json"))); + final String K8S_EXISTS_URL = "/aai/v24/cloud-infrastructure/cloud-regions/cloud-region/someOwner/someRegion/tenants/tenant/someTenant/k8s-resources/k8s-resource/12345"; + final String K8S_EXISTS_URL_MINIMAL = "/aai/v24/cloud-infrastructure/cloud-regions/cloud-region/someOwner/someRegion/tenants/tenant/someTenant/k8s-resources/k8s-resource/12345?format=count&resultIndex=0&resultSize=1"; + WireMock.stubFor(WireMock.get(WireMock.urlEqualTo(K8S_EXISTS_URL_MINIMAL)) + .willReturn( + WireMock.aResponse().withStatus(HttpStatus.OK.value()).withBodyFile("k8sResourceExistsResponse.json"))); + WireMock.stubFor(WireMock.get(WireMock.urlEqualTo(K8S_EXISTS_URL)) + .willReturn(WireMock.aResponse().withStatus(HttpStatus.OK.value()).withBodyFile("k8sResource.json").withHeader("Content-Type", ContentType.APPLICATION_JSON.toString()))); + WireMock.stubFor(WireMock.delete(WireMock.urlEqualTo(K8S_EXISTS_URL)) + .willReturn(WireMock.aResponse().withStatus(HttpStatus.OK.value()))); + final String VFMODULE_URL = "/aai/v24/network/generic-vnfs/generic-vnf/someGenericVnfId/vf-modules/vf-module/someVfModuleId"; + WireMock.stubFor(WireMock.get(WireMock.urlEqualTo(VFMODULE_URL)) + .willReturn(WireMock.aResponse().withStatus(HttpStatus.OK.value()) + .withBodyFile("vfModuleWithRelationshipsResponse.json"))); + + final String BULK_URL = "/aai/v24/bulkprocess"; + final String expectedBulkBody = new String( + Files.readAllBytes(Paths.get("src/test/resources/__files/bulkDeleteRequestBody.json"))); + WireMock.stubFor(WireMock.put(WireMock.urlEqualTo(BULK_URL)).withRequestBody(WireMock.equalToJson(expectedBulkBody)) + .willReturn(WireMock.aResponse().withStatus(HttpStatus.CREATED.value()).withBody("{}"))); + + KubernetesResource resource = new KubernetesResource(); + resource.setId("someId"); + resource.setName("someName"); + AaiRequest request = new AaiRequest(); + request.setCloudOwner("someOwner"); + request.setCloudRegion("someRegion"); + request.setTenantId("someTenant"); + request.setGenericVnfId("someGenericVnfId"); + request.setVfModuleId("someVfModuleId"); + IAaiRepository aaiRepository = IAaiRepository.instance(true); + List resourceList = new ArrayList<>(); + resourceList.add(resource); + aaiRepository.delete(request, resourceList); + WireMock.verify(exactly(0),WireMock.deleteRequestedFor(WireMock.urlEqualTo(BULK_URL))); + aaiRepository.commit(false); + WireMock.verify(WireMock.putRequestedFor(WireMock.urlEqualTo(BULK_URL)) + .withRequestBody(WireMock.equalToJson(expectedBulkBody))); + } +} diff --git a/so-cnf-adapter-application/src/test/resources/__files/bulkDeleteRequestBody.json b/so-cnf-adapter-application/src/test/resources/__files/bulkDeleteRequestBody.json new file mode 100644 index 0000000..46b419b --- /dev/null +++ b/so-cnf-adapter-application/src/test/resources/__files/bulkDeleteRequestBody.json @@ -0,0 +1,11 @@ +{ + "transactions": [ + { + "delete": [ + { + "uri": "/cloud-infrastructure/cloud-regions/cloud-region/someOwner/someRegion/tenants/tenant/someTenant/k8s-resources/k8s-resource/12345?resource-version=3.0" + } + ] + } + ] +} diff --git a/so-cnf-adapter-application/src/test/resources/__files/bulkProcessRequestBody.json b/so-cnf-adapter-application/src/test/resources/__files/bulkProcessRequestBody.json new file mode 100644 index 0000000..8a1c3d1 --- /dev/null +++ b/so-cnf-adapter-application/src/test/resources/__files/bulkProcessRequestBody.json @@ -0,0 +1,16 @@ +{ + "transactions": [ + { + "put": [ + { + "uri": "/cloud-infrastructure/cloud-regions/cloud-region/someOwner/someRegion/tenants/tenant/someTenant/k8s-resources/k8s-resource/someId", + "body": { + "id": "someId", + "name": "someName", + "resource-version": "3.0" + } + } + ] + } + ] +} diff --git a/so-cnf-adapter-application/src/test/resources/__files/bulkProcessVnfVfModuleRequest.json b/so-cnf-adapter-application/src/test/resources/__files/bulkProcessVnfVfModuleRequest.json new file mode 100644 index 0000000..cb6ed81 --- /dev/null +++ b/so-cnf-adapter-application/src/test/resources/__files/bulkProcessVnfVfModuleRequest.json @@ -0,0 +1,20 @@ +{ + "transactions": [ + { + "put": [ + { + "uri": "/cloud-infrastructure/cloud-regions/cloud-region/someOwner/someRegion/tenants/tenant/someTenant/k8s-resources/k8s-resource/someId/relationship-list/relationship", + "body": { + "related-link": "/network/generic-vnfs/generic-vnf/someGenericVnfId/vf-modules/vf-module/someVfModuleId" + } + }, + { + "uri": "/cloud-infrastructure/cloud-regions/cloud-region/someOwner/someRegion/tenants/tenant/someTenant/k8s-resources/k8s-resource/someId/relationship-list/relationship", + "body": { + "related-link": "/network/generic-vnfs/generic-vnf/someGenericVnfId" + } + } + ] + } + ] +} diff --git a/so-cnf-adapter-application/src/test/resources/__files/genericVnf.json b/so-cnf-adapter-application/src/test/resources/__files/genericVnf.json new file mode 100644 index 0000000..2400a36 --- /dev/null +++ b/so-cnf-adapter-application/src/test/resources/__files/genericVnf.json @@ -0,0 +1,67 @@ +{ + "vnf-id": "someGenericVnfId", + "vnf-instance-id": "instance-id-001", + "vnf-name": "exampleVnfName", + "vnf-name2": "exampleVnfAlternateName", + "vnf-type": "exampleVnfType", + "service-id": "service-id-001", + "regional-resource-zone": "zone-001", + "prov-status": "active", + "operational-status": "in-service-path", + "license-key": "obsolete-license-key", + "equipment-role": "exampleRole", + "orchestration-status": "orchestrated", + "vnf-package-name": "package-name-001", + "vnf-discriptor-name": "descriptor-name-001", + "job-id": "job-id-001", + "heat-stack-id": "heat-stack-id-001", + "mso-catalog-key": "catalog-key-001", + "management-option": "managed-customer-id-001", + "ipv4-oam-address": "192.168.1.1", + "ipv4-loopback0-address": "192.168.1.2", + "nm-lan-v6-address": "2001:db8::1", + "management-v6-address": "2001:db8::2", + "vcpu": 4, + "vcpu-units": "cores", + "vmemory": 16, + "vmemory-units": "GB", + "vdisk": 100, + "vdisk-units": "GB", + "nshd": 1, + "nvm": 2, + "nnet": 3, + "in-maint": false, + "is-closed-loop-disabled": false, + "summary-status": "operation-summary", + "encrypted-access-flag": true, + "entitlement-assignment-group-uuid": "obsolete-assignment-group-uuid", + "entitlement-resource-uuid": "obsolete-resource-uuid", + "license-assignment-group-uuid": "obsolete-license-assignment-group-uuid", + "license-key-uuid": "obsolete-license-key-uuid", + "model-invariant-id": "model-invariant-id-001", + "model-version-id": "model-version-id-001", + "persona-model-version": "persona-model-version-001", + "model-customization-id": "model-customization-id-001", + "widget-model-id": "widget-model-id-001", + "widget-model-version": "widget-model-version-001", + "as-number": "as-number-001", + "regional-resource-subzone": "subzone-001", + "nf-type": "network-function-type", + "nf-function": "network-function-description", + "nf-role": "network-role", + "nf-naming-code": "naming-code-001", + "selflink": "http://example.com/selflink/genericVnf", + "ipv4-oam-gateway-address": "192.168.1.254", + "ipv4-oam-gateway-address-prefix-length": 24, + "vlan-id-outer": 100, + "nm-profile-name": "nm-profile-001", + "software-version": "1.0.0", + "application-id": "application-id-001", + "l-interfaces": {}, + "lag-interfaces": {}, + "vf-modules": {}, + "licenses": {}, + "bgp-groups": {}, + "bgp-neighbors": {}, + "entitlements": {} +} diff --git a/so-cnf-adapter-application/src/test/resources/__files/k8sResource.json b/so-cnf-adapter-application/src/test/resources/__files/k8sResource.json new file mode 100644 index 0000000..ec3702d --- /dev/null +++ b/so-cnf-adapter-application/src/test/resources/__files/k8sResource.json @@ -0,0 +1,18 @@ +{ + "id": "12345", + "name": "someName", + "group": "someGroup", + "version": "1.0", + "kind": "someKind", + "namespace": "someNamespace", + "labels": [ + "label1", + "label2", + "label3" + ], + "selflink": "http://example.com/selflink", + "data-owner": "someOwner", + "data-source": "someSource", + "data-source-version": "2.0", + "resource-version": "3.0" +} diff --git a/so-cnf-adapter-application/src/test/resources/__files/k8sResourceExistsResponse.json b/so-cnf-adapter-application/src/test/resources/__files/k8sResourceExistsResponse.json new file mode 100644 index 0000000..134a2d1 --- /dev/null +++ b/so-cnf-adapter-application/src/test/resources/__files/k8sResourceExistsResponse.json @@ -0,0 +1,7 @@ +{ + "results": [ + { + "k8s-resource": 1 + } + ] +} diff --git a/so-cnf-adapter-application/src/test/resources/__files/k8sResourceNotFoundResponse.json b/so-cnf-adapter-application/src/test/resources/__files/k8sResourceNotFoundResponse.json new file mode 100644 index 0000000..f58994a --- /dev/null +++ b/so-cnf-adapter-application/src/test/resources/__files/k8sResourceNotFoundResponse.json @@ -0,0 +1,14 @@ +{ + "requestError": { + "serviceException": { + "messageId": "SVC3001", + "text": "Resource not found for %1 using id %2 (msg=%3) (ec=%4)", + "variables": [ + "GET", + "cloud-infrastructure/cloud-regions/cloud-region/someCloudOwner/someCloudRegionId/tenants/tenant/someTenantId/k8s-resources/k8s-resource/doesNotExist", + "Node Not Found:No Node of type k8s-resource found at: cloud-infrastructure/cloud-regions/cloud-region/someCloudOwner/someCloudRegionId/tenants/tenant/someTenantId/k8s-resources/k8s-resource/doesNotExist", + "ERR.5.4.6114" + ] + } + } +} diff --git a/so-cnf-adapter-application/src/test/resources/__files/vfModule.json b/so-cnf-adapter-application/src/test/resources/__files/vfModule.json new file mode 100644 index 0000000..7ed0569 --- /dev/null +++ b/so-cnf-adapter-application/src/test/resources/__files/vfModule.json @@ -0,0 +1,18 @@ +{ + "vf-module-id": "someVfModuleId", + "vf-module-name": "exampleVfModuleName", + "heat-stack-id": "heat-stack-id-456", + "orchestration-status": "active", + "is-base-vf-module": false, + "automated-assignment": true, + "model-invariant-id": "model-invariant-id-789", + "model-version-id": "model-version-id-101", + "persona-model-version": "persona-model-version-202", + "model-customization-id": "model-customization-id-303", + "widget-model-id": "widget-model-id-404", + "widget-model-version": "widget-model-version-505", + "contrail-service-instance-fqdn": "service-instance-contrail-id-606", + "module-index": 0, + "selflink": "http://example.com/selflink/vfModule", + "operational-status": "in-service-path" +} diff --git a/so-cnf-adapter-application/src/test/resources/__files/vfModuleWithRelationshipsResponse.json b/so-cnf-adapter-application/src/test/resources/__files/vfModuleWithRelationshipsResponse.json new file mode 100644 index 0000000..6ca1fa0 --- /dev/null +++ b/so-cnf-adapter-application/src/test/resources/__files/vfModuleWithRelationshipsResponse.json @@ -0,0 +1,66 @@ +{ + "vf-module-id": "someVfModuleId", + "vf-module-name": "exampleVfModuleName", + "heat-stack-id": "heat-stack-id-456", + "orchestration-status": "active", + "is-base-vf-module": false, + "automated-assignment": true, + "model-invariant-id": "model-invariant-id-789", + "model-version-id": "model-version-id-101", + "persona-model-version": "persona-model-version-202", + "model-customization-id": "model-customization-id-303", + "widget-model-id": "widget-model-id-404", + "widget-model-version": "widget-model-version-505", + "contrail-service-instance-fqdn": "service-instance-contrail-id-606", + "module-index": 0, + "selflink": "http://example.com/selflink/vfModule", + "operational-status": "in-service-path", + "relationship-list": { + "relationship": [ + { + "related-to": "pnf", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v24/network/pnfs/pnf/731534264", + "relationship-data": [ + { + "relationship-key": "pnf.pnf-name", + "relationship-value": "731534264" + } + ] + }, + { + "related-to": "pserver", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v24/cloud-infrastructure/pservers/pserver/45673245", + "relationship-data": [ + { + "relationship-key": "pserver.hostname", + "relationship-value": "45673245" + } + ] + }, + { + "related-to": "k8s-resource", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v24/cloud-infrastructure/cloud-regions/cloud-region/someCloudOwner/someCloudRegionId/tenants/tenant/someTenantId/k8s-resources/k8s-resource/doesNotExist", + "relationship-data": [ + { + "relationship-key": "k8s-resource.id", + "relationship-value": "doesNotExist" + } + ] + }, + { + "related-to": "k8s-resource", + "relationship-label": "org.onap.relationships.inventory.ComposedOf", + "related-link": "/aai/v24/cloud-infrastructure/cloud-regions/cloud-region/someCloudOwner/someCloudRegionId/tenants/tenant/someTenantId/k8s-resources/k8s-resource/someK8sResource", + "relationship-data": [ + { + "relationship-key": "k8s-resource.id", + "relationship-value": "someK8sResource" + } + ] + } + ] + } +} diff --git a/so-cnfm/pom.xml b/so-cnfm/pom.xml index 7abfb00..71afd6b 100644 --- a/so-cnfm/pom.xml +++ b/so-cnfm/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter so-cnf-adapter - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT so-cnfm pom diff --git a/so-cnfm/so-cnfm-lcm/pom.xml b/so-cnfm/so-cnfm-lcm/pom.xml index 316b8e3..34a6a95 100644 --- a/so-cnfm/so-cnfm-lcm/pom.xml +++ b/so-cnfm/so-cnfm-lcm/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter so-cnfm - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/pom.xml b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/pom.xml index 38147c2..cec5782 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/pom.xml +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-api/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm so-cnfm-lcm - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT so-cnfm-lcm-api diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-application/pom.xml b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-application/pom.xml index 14fed45..953cb10 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-application/pom.xml +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-application/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm so-cnfm-lcm - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT so-cnfm-lcm-application diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/pom.xml b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/pom.xml index 8e58cfe..117a323 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/pom.xml +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-bpmn-flows/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm so-cnfm-lcm - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT so-cnfm-lcm-bpmn-flows diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml index f5ee660..32f1c1a 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-database-service/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm so-cnfm-lcm - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT so-cnfm-lcm-database-service diff --git a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/pom.xml b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/pom.xml index 7b6cbef..6752876 100644 --- a/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/pom.xml +++ b/so-cnfm/so-cnfm-lcm/so-cnfm-lcm-service/pom.xml @@ -4,7 +4,7 @@ org.onap.so.adapters.so-cnf-adapter.so-cnfm.lcm so-cnfm-lcm - 1.13.0-SNAPSHOT + 1.13.1-SNAPSHOT so-cnfm-lcm-service -- 2.16.6