aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java21
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/reports/BasicReportGenerator.java27
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java6
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AaiService.java3
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java20
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java6
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/reports/BasicReportGeneratorTest.java16
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java24
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AAIServiceIntegrativeTest.java3
-rw-r--r--vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java22
-rw-r--r--vid-app-common/src/test/resources/responses/aai/l3-networks-by-cloud-region-and-tenantId.json300
-rw-r--r--vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java56
13 files changed, 415 insertions, 95 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java
index 19187e0fc..d7d2f85db 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/AaiController2.java
@@ -20,10 +20,14 @@
package org.onap.vid.controller;
+import java.util.stream.Collectors;
+import org.apache.commons.lang3.StringUtils;
import org.onap.vid.aai.AaiClientInterface;
import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
import org.onap.vid.aai.model.Permissions;
+import org.onap.vid.model.aaiTree.Network;
import org.onap.vid.model.aaiTree.RelatedVnf;
+import org.onap.vid.model.aaiTree.VpnBinding;
import org.onap.vid.roles.RoleProvider;
import org.onap.vid.services.AaiService;
import org.springframework.beans.factory.annotation.Autowired;
@@ -94,5 +98,22 @@ public class AaiController2 extends VidRestrictedBaseController {
return aaiService.searchGroupMembers(globalCustomerId, serviceType, invariantId, groupType, groupRole);
}
+ @RequestMapping(value = "/aai_get_vpn_list", method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public List<VpnBinding> getVpnList() {
+ return aaiService.getVpnListByVpnType("SERVICE-INFRASTRUCTURE");
+ }
+ @RequestMapping(value = "/aai_get_active_networks",
+ method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE)
+ public List<Network> getActiveNetworkList(
+ @RequestParam("cloudRegion") String cloudRegion,
+ @RequestParam("tenantId") String tenantId,
+ @RequestParam(value = "networkRole", required = false) String networkRole) {
+ return aaiService.getL3NetworksByCloudRegion(cloudRegion, tenantId, networkRole)
+ .stream()
+ .filter(Network::isBoundToVpn)
+ .filter(network -> StringUtils.isNotEmpty(network.getInstanceName()))
+ .filter(network -> StringUtils.equalsIgnoreCase(network.getOrchStatus(), "active"))
+ .collect(Collectors.toList());
+ }
}
diff --git a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
index 71c6bf345..b9908d1e3 100644
--- a/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
+++ b/vid-app-common/src/main/java/org/onap/vid/controller/WebConfig.java
@@ -98,9 +98,9 @@ public class WebConfig {
}
@Bean
- public AaiService getAaiService(AaiClientInterface aaiClient, AaiOverTLSClientInterface aaiOverTLSClient,
- AaiResponseTranslator aaiResponseTranslator, AAITreeNodeBuilder aaiTreeNode, AAIServiceTree aaiServiceTree, ExecutorService executorService) {
- return new AaiServiceImpl(aaiClient, aaiOverTLSClient, aaiResponseTranslator, aaiServiceTree, executorService);
+ public AaiService getAaiService(AaiClientInterface aaiClient, AaiResponseTranslator aaiResponseTranslator,
+ AAITreeNodeBuilder aaiTreeNode, AAIServiceTree aaiServiceTree, ExecutorService executorService) {
+ return new AaiServiceImpl(aaiClient, aaiResponseTranslator, aaiServiceTree, executorService);
}
@Bean
diff --git a/vid-app-common/src/main/java/org/onap/vid/reports/BasicReportGenerator.java b/vid-app-common/src/main/java/org/onap/vid/reports/BasicReportGenerator.java
index 00f8077d3..4c8447069 100644
--- a/vid-app-common/src/main/java/org/onap/vid/reports/BasicReportGenerator.java
+++ b/vid-app-common/src/main/java/org/onap/vid/reports/BasicReportGenerator.java
@@ -19,40 +19,39 @@
*/
package org.onap.vid.reports;
+import static org.onap.portalsdk.core.util.SystemProperties.ECOMP_REQUEST_ID;
+
import com.google.common.collect.ImmutableMap;
import io.joshworks.restclient.http.HttpResponse;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import javax.servlet.http.HttpServletRequest;
+import org.onap.vid.aai.AaiOverTLSClientInterface;
import org.onap.vid.controller.ControllersUtils;
import org.onap.vid.model.GitRepositoryState;
import org.onap.vid.model.SubscriberList;
import org.onap.vid.model.errorReport.ReportCreationParameters;
import org.onap.vid.model.probes.ExternalComponentStatus;
-import org.onap.vid.services.AaiService;
import org.onap.vid.services.ProbeService;
import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
-import javax.servlet.http.HttpServletRequest;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-
-import static org.onap.portalsdk.core.util.SystemProperties.ECOMP_REQUEST_ID;
-
@Component
public class BasicReportGenerator implements ReportGenerator {
private static final String GIT_PROPERTIES_FILENAME = "git.properties";
- private final AaiService aaiService;
+ private final AaiOverTLSClientInterface aaiOverTLSClient;
private final SystemPropertiesWrapper systemPropertiesWrapper;
private final ProbeService probeService;
@Autowired
- public BasicReportGenerator(AaiService aaiService, SystemPropertiesWrapper systemPropertiesWrapper,
+ public BasicReportGenerator(AaiOverTLSClientInterface aaiOverTLSClient, SystemPropertiesWrapper systemPropertiesWrapper,
ProbeService probeService) {
- this.aaiService = aaiService;
+ this.aaiOverTLSClient = aaiOverTLSClient;
this.systemPropertiesWrapper = systemPropertiesWrapper;
this.probeService = probeService;
}
@@ -96,7 +95,7 @@ public class BasicReportGenerator implements ReportGenerator {
ImmutableMap<String, Object> getFullSubscriberList() {
ImmutableMap<String, Object> fullSubscriberList;
try {
- HttpResponse<SubscriberList> fullSubscriberListResponse = aaiService.getFullSubscriberList();
+ HttpResponse<SubscriberList> fullSubscriberListResponse = aaiOverTLSClient.getAllSubscribers();
fullSubscriberList = ImmutableMap.<String, Object>builder()
.put("status", fullSubscriberListResponse.getStatus())
.put("body", fullSubscriberListResponse.getBody())
diff --git a/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java b/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
index 6c0fd3f52..898db332c 100644
--- a/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
+++ b/vid-app-common/src/main/java/org/onap/vid/roles/RoleProvider.java
@@ -23,7 +23,6 @@ package org.onap.vid.roles;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.joshworks.restclient.http.HttpResponse;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@@ -34,6 +33,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.web.support.UserUtils;
+import org.onap.vid.aai.AaiResponse;
import org.onap.vid.aai.exceptions.RoleParsingException;
import org.onap.vid.model.ModelConstants;
import org.onap.vid.model.Subscriber;
@@ -123,8 +123,8 @@ public class RoleProvider {
private String replaceSubscriberNameToGlobalCustomerID(String subscriberName, String logPrefix) {
// SubscriberList should be cached by cacheProvider so by calling getFullSubscriberList() method we just gat it from cache
- HttpResponse<SubscriberList> subscribersResponse = aaiService.getFullSubscriberList();
- SubscriberList subscribers = subscribersResponse.getBody();
+ AaiResponse<SubscriberList> subscribersResponse = aaiService.getFullSubscriberList();
+ SubscriberList subscribers = subscribersResponse.getT();
try {
LOG.debug(EELFLoggerDelegate.debugLogger, logPrefix + "subscribers list size is " + subscribers.customer.size() + " with the values " + om.writeValueAsString(subscribers.customer));
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiService.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiService.java
index 6c63ae07c..31fbe65d8 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AaiService.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiService.java
@@ -21,7 +21,6 @@
package org.onap.vid.services;
-import io.joshworks.restclient.http.HttpResponse;
import java.util.Collection;
import java.util.List;
import javax.ws.rs.core.Response;
@@ -53,7 +52,7 @@ public interface AaiService {
AaiResponse getServiceInstanceSearchResults(String subscriberId, String instanceIdentifier, RoleValidator roleProvider, List<String> owningEntities, List<String> projects);
- HttpResponse<SubscriberList> getFullSubscriberList();
+ AaiResponse<SubscriberList> getFullSubscriberList();
AaiResponse getServices(RoleValidator roleValidator);
diff --git a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
index fcdae441c..9b890478f 100644
--- a/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
+++ b/vid-app-common/src/main/java/org/onap/vid/services/AaiServiceImpl.java
@@ -25,7 +25,6 @@ import static org.onap.vid.aai.AaiClient.QUERY_FORMAT_RESOURCE;
import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER;
import com.fasterxml.jackson.databind.JsonNode;
-import io.joshworks.restclient.http.HttpResponse;
import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.util.ArrayList;
@@ -104,7 +103,6 @@ public class AaiServiceImpl implements AaiService {
private int indexOfSubscriberName = 6;
private AaiClientInterface aaiClient;
- private AaiOverTLSClientInterface aaiOverTLSClient;
private AaiResponseTranslator aaiResponseTranslator;
private AAIServiceTree aaiServiceTree;
private ExecutorService executorService;
@@ -115,13 +113,11 @@ public class AaiServiceImpl implements AaiService {
@Autowired
public AaiServiceImpl(
AaiClientInterface aaiClient,
- AaiOverTLSClientInterface aaiOverTLSClient,
AaiResponseTranslator aaiResponseTranslator,
AAIServiceTree aaiServiceTree,
ExecutorService executorService)
{
this.aaiClient = aaiClient;
- this.aaiOverTLSClient = aaiOverTLSClient;
this.aaiResponseTranslator = aaiResponseTranslator;
this.aaiServiceTree = aaiServiceTree;
this.executorService = executorService;
@@ -241,13 +237,11 @@ public class AaiServiceImpl implements AaiService {
@Override
public SubscriberFilteredResults getFullSubscriberList(RoleValidator roleValidator) {
- HttpResponse<SubscriberList> allSubscribers = aaiOverTLSClient.getAllSubscribers();
- return new SubscriberFilteredResults(
- roleValidator,
- allSubscribers.getBody(),
- allSubscribers.getStatusText(),
- allSubscribers.getStatus()
- );
+ AaiResponse<SubscriberList> subscriberResponse = aaiClient.getAllSubscribers();
+
+ return new SubscriberFilteredResults(roleValidator, subscriberResponse.getT(),
+ subscriberResponse.getErrorMessage(),
+ subscriberResponse.getHttpCode());
}
@Override
@@ -256,8 +250,8 @@ public class AaiServiceImpl implements AaiService {
}
@Override
- public HttpResponse<SubscriberList> getFullSubscriberList() {
- return aaiOverTLSClient.getAllSubscribers();
+ public AaiResponse<SubscriberList> getFullSubscriberList() {
+ return aaiClient.getAllSubscribers();
}
@Override
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java b/vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java
index aae1b0621..17e0c44e0 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/LocalWebConfig.java
@@ -71,9 +71,9 @@ public class LocalWebConfig {
}
@Bean
- public AaiService getAaiService(AaiClientInterface aaiClient, AaiOverTLSClientInterface aaiOverTLSClient,
- AaiResponseTranslator aaiResponseTranslator, AAITreeNodeBuilder aaiTreeNode, AAIServiceTree aaiServiceTree, ExecutorService executorService) {
- return new AaiServiceImpl(aaiClient, aaiOverTLSClient, aaiResponseTranslator, aaiServiceTree, executorService);
+ public AaiService getAaiService(AaiClientInterface aaiClient, AaiResponseTranslator aaiResponseTranslator,
+ AAITreeNodeBuilder aaiTreeNode, AAIServiceTree aaiServiceTree, ExecutorService executorService) {
+ return new AaiServiceImpl(aaiClient, aaiResponseTranslator, aaiServiceTree, executorService);
}
@Bean
diff --git a/vid-app-common/src/test/java/org/onap/vid/reports/BasicReportGeneratorTest.java b/vid-app-common/src/test/java/org/onap/vid/reports/BasicReportGeneratorTest.java
index d34646dcb..cc4578bf0 100644
--- a/vid-app-common/src/test/java/org/onap/vid/reports/BasicReportGeneratorTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/reports/BasicReportGeneratorTest.java
@@ -33,6 +33,7 @@ import org.mockito.junit.MockitoJUnitRunner;
import org.onap.portalsdk.core.domain.User;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.aai.AaiClient;
+import org.onap.vid.aai.AaiOverTLSClientInterface;
import org.onap.vid.model.SubscriberList;
import org.onap.vid.model.errorReport.ReportCreationParameters;
import org.onap.vid.model.probes.ExternalComponentStatus;
@@ -67,13 +68,8 @@ public class BasicReportGeneratorTest {
private ProbeService probeService;
@Mock
- private AaiClient aaiClient;
- @Mock
- private SchedulerService schedulerService;
- @Mock
- private AaiService aaiService;
- @Mock
- private RoleProvider roleProvider;
+ AaiOverTLSClientInterface aaiOverTLSClient;
+
@Mock
private SystemPropertiesWrapper systemPropertiesWrapper;
@@ -136,7 +132,7 @@ public class BasicReportGeneratorTest {
.put("headers", headers)
.build();
- when(aaiService.getFullSubscriberList()).thenReturn(subscriberListResponse);
+ when(aaiOverTLSClient.getAllSubscribers()).thenReturn(subscriberListResponse);
when(subscriberListResponse.getStatus()).thenReturn(status);
when(subscriberListResponse.getBody()).thenReturn(subscriberList);
when(subscriberListResponse.getHeaders()).thenReturn(headers);
@@ -154,7 +150,7 @@ public class BasicReportGeneratorTest {
RestClientException expectedException = mock(RestClientException.class);
ImmutableMap<String, Object> expectedResult = ImmutableMap.of("exception", expectedException.toString());
- when(aaiService.getFullSubscriberList()).thenThrow(expectedException);
+ when(aaiOverTLSClient.getAllSubscribers()).thenThrow(expectedException);
//when
ImmutableMap<String, Object> actualResult = basicReportGenerator.getFullSubscriberList();
@@ -162,4 +158,4 @@ public class BasicReportGeneratorTest {
//then
assertThat(actualResult).isEqualTo(expectedResult);
}
-} \ No newline at end of file
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java b/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java
index 6ba0e4039..c1033d2d0 100644
--- a/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/roles/RoleProviderTest.java
@@ -21,10 +21,17 @@
package org.onap.vid.roles;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.Mockito.when;
+import static org.mockito.MockitoAnnotations.initMocks;
+
import com.google.common.collect.ImmutableMap;
-import io.joshworks.restclient.http.HttpResponse;
+import java.util.List;
+import java.util.Map;
+import javax.servlet.http.HttpServletRequest;
import org.assertj.core.util.Lists;
import org.mockito.Mock;
+import org.onap.vid.aai.AaiResponse;
import org.onap.vid.aai.exceptions.RoleParsingException;
import org.onap.vid.model.Subscriber;
import org.onap.vid.model.SubscriberList;
@@ -32,14 +39,6 @@ import org.onap.vid.services.AaiService;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import javax.servlet.http.HttpServletRequest;
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.Mockito.when;
-import static org.mockito.MockitoAnnotations.initMocks;
-
public class RoleProviderTest {
private static final String SAMPLE_SUBSCRIBER = "sampleSubscriber";
@@ -57,8 +56,7 @@ public class RoleProviderTest {
private HttpServletRequest request;
@Mock
- private HttpResponse<SubscriberList> subscriberListHttpResponse;
-
+ private AaiResponse<SubscriberList> subscriberListResponse;
private RoleProvider roleProvider;
@@ -150,8 +148,8 @@ public class RoleProviderTest {
subscriber.subscriberName = SAMPLE_SUBSCRIBER;
subscriber.globalCustomerId = SAMPLE_CUSTOMER_ID;
SubscriberList subscriberList = new SubscriberList(Lists.list(subscriber));
- when(aaiService.getFullSubscriberList()).thenReturn(subscriberListHttpResponse);
- when(subscriberListHttpResponse.getBody()).thenReturn(subscriberList);
+ when(aaiService.getFullSubscriberList()).thenReturn(subscriberListResponse);
+ when(subscriberListResponse.getT()).thenReturn(subscriberList);
}
private Map<Long, org.onap.portalsdk.core.domain.Role> createRoles() {
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceIntegrativeTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceIntegrativeTest.java
index d42747c20..a159efd30 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceIntegrativeTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AAIServiceIntegrativeTest.java
@@ -68,7 +68,7 @@ public class AAIServiceIntegrativeTest extends TestWithAaiClient {
null,
executorService
);
- return new AaiServiceImpl(aaiClient, null, null, aaiServiceTree, executorService);
+ return new AaiServiceImpl(aaiClient, null, aaiServiceTree, executorService);
}
@BeforeMethod
@@ -160,6 +160,7 @@ public class AAIServiceIntegrativeTest extends TestWithAaiClient {
aaiServiceWithoutMocks.getVpnListByVpnType("aaa");
}
+ @Test
public void getNetworkListTest_successResponse() {
String rawResponse = TestUtils.readFileAsString("/responses/aai/l3-networks-by-cloud-region-and-tenantId.json");
final ResponseWithRequestInfo responseWithRequestInfo = mockedResponseWithRequestInfo(Response.Status.OK,
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
index 09a53684f..20409d327 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AaiServiceImplTest.java
@@ -34,7 +34,6 @@ import static org.onap.vid.model.aaiTree.NodeType.SERVICE_INSTANCE;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
-import io.joshworks.restclient.http.HttpResponse;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -54,7 +53,6 @@ import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.vid.aai.AaiClientInterface;
import org.onap.vid.aai.AaiGetVnfResponse;
-import org.onap.vid.aai.AaiOverTLSClientInterface;
import org.onap.vid.aai.AaiResponse;
import org.onap.vid.aai.AaiResponseTranslator;
import org.onap.vid.aai.ServiceInstancesSearchResults;
@@ -118,7 +116,7 @@ public class AaiServiceImplTest {
private static final String CLOUD_TYPE = "CLOUD_TYPE";
@Mock
- private HttpResponse<SubscriberList> responseAllSubscribers;
+ private AaiResponse<SubscriberList> responseAllSubscribers;
@Mock
private AaiResponse<OperationalEnvironmentList> aaiResponseOpEnvList;
@Mock
@@ -130,8 +128,7 @@ public class AaiServiceImplTest {
@Mock
private AaiClientInterface aaiClient;
- @Mock
- private AaiOverTLSClientInterface aaiOverTLSClient;
+
@Mock
private AaiResponseTranslator aaiResponseTranslator;
@Mock
@@ -144,11 +141,8 @@ public class AaiServiceImplTest {
@Test
public void shouldGetFullSubscriberListWithoutValidator() {
- when(aaiOverTLSClient.getAllSubscribers()).thenReturn(responseAllSubscribers);
-
- HttpResponse<SubscriberList> actualResponse = aaiService.getFullSubscriberList();
-
- assertThat(actualResponse).isEqualTo(responseAllSubscribers);
+ when(aaiClient.getAllSubscribers()).thenReturn(responseAllSubscribers);
+ assertThat(aaiService.getFullSubscriberList()).isEqualTo(responseAllSubscribers);
}
@Test
@@ -156,10 +150,10 @@ public class AaiServiceImplTest {
Subscriber subscriber = createSubscriber();
SubscriberList subscriberList = new SubscriberList(Collections.singletonList(subscriber));
- when(aaiOverTLSClient.getAllSubscribers()).thenReturn(responseAllSubscribers);
- when(responseAllSubscribers.getBody()).thenReturn(subscriberList);
- when(responseAllSubscribers.getStatusText()).thenReturn(STATUS_TEXT);
- when(responseAllSubscribers.getStatus()).thenReturn(HttpStatus.SC_OK);
+ when(aaiClient.getAllSubscribers()).thenReturn(responseAllSubscribers);
+ when(responseAllSubscribers.getT()).thenReturn(subscriberList);
+ when(responseAllSubscribers.getErrorMessage()).thenReturn(STATUS_TEXT);
+ when(responseAllSubscribers.getHttpCode()).thenReturn(HttpStatus.SC_OK);
SubscriberFilteredResults expectedSubscribers = new SubscriberFilteredResults(roleValidator, subscriberList,
STATUS_TEXT, HttpStatus.SC_OK);
diff --git a/vid-app-common/src/test/resources/responses/aai/l3-networks-by-cloud-region-and-tenantId.json b/vid-app-common/src/test/resources/responses/aai/l3-networks-by-cloud-region-and-tenantId.json
new file mode 100644
index 000000000..01ed853b5
--- /dev/null
+++ b/vid-app-common/src/test/resources/responses/aai/l3-networks-by-cloud-region-and-tenantId.json
@@ -0,0 +1,300 @@
+{
+ "results": [
+ {
+ "l3-network": {
+ "network-id": "CC-l3network_1",
+ "is-bound-to-vpn": false,
+ "resource-version": "1556206041065",
+ "is-provider-network": false,
+ "is-shared-network": false,
+ "is-external-network": false,
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v17/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner-CC-ANAI-528/cloud-region-id-CC-ANAI-528/tenants/tenant/tenant-id-CC-ANAI-528T1",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloud-owner-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "cloud-region-id-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenant-id-CC-ANAI-528T1"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "tenant-name-CC-ANAI-528T1"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ },
+ {
+ "l3-network": {
+ "network-id": "CC-l3network_3",
+ "network-name": "DLLSTXRNDS3",
+ "network-role": "Backup",
+ "is-bound-to-vpn": true,
+ "resource-version": "1556139217403",
+ "is-provider-network": false,
+ "is-shared-network": false,
+ "is-external-network": false,
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v17/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner-CC-ANAI-528/cloud-region-id-CC-ANAI-528/tenants/tenant/tenant-id-CC-ANAI-528T1",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloud-owner-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "cloud-region-id-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenant-id-CC-ANAI-528T1"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "tenant-name-CC-ANAI-528T1"
+ }
+ ]
+ },
+ {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v17/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner-CC-ANAI-528/cloud-region-id-CC-ANAI-528/tenants/tenant/tenant-id-CC-ANAI-528-T2",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloud-owner-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "cloud-region-id-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenant-id-CC-ANAI-528-T2"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "tenant-name-CC-ANAI-528T2"
+ }
+ ]
+ },
+ {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v17/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner-CC-ANAI-528/cloud-region-id-CC-ANAI-528/tenants/tenant/tenant-id-CC-ANAI-528T3",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloud-owner-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "cloud-region-id-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenant-id-CC-ANAI-528T3"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "tenant-name-CC-ANAI-528T3"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ },
+ {
+ "l3-network": {
+ "network-id": "l3network2-550-as988q",
+ "network-name": "CHICGIL01VDBE01_SubIntNtwk043",
+ "network-type": "K6VD",
+ "network-role": "X92XE0j",
+ "network-technology": "ZYbPEnCjX6Oqd",
+ "neutron-network-id": "fpFvDje",
+ "is-bound-to-vpn": false,
+ "service-id": "NJnzYaRlz0Test",
+ "network-role-instance": 162,
+ "resource-version": "1556823012443",
+ "orchestration-status": "active",
+ "heat-stack-id": "0GmDeg",
+ "mso-catalog-key": "la5ylhZ5g0D",
+ "contrail-network-fqdn": "EaeexDk47",
+ "model-customization-id": "wgmn6PrJ5",
+ "widget-model-id": "e0yNr",
+ "widget-model-version": "yKpry3J0VVLn",
+ "physical-network-name": "wq6OKbZMTY",
+ "is-provider-network": false,
+ "is-shared-network": false,
+ "is-external-network": false,
+ "selflink": "9xtMu4EPuTi",
+ "operational-status": "W8aj",
+ "is-trunked": true,
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v17/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner-CC-ANAI-528/cloud-region-id-CC-ANAI-528/tenants/tenant/tenant-id-CC-ANAI-528T1",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloud-owner-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "cloud-region-id-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenant-id-CC-ANAI-528T1"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "tenant-name-CC-ANAI-528T1"
+ }
+ ]
+ },
+ {
+ "related-to": "configuration",
+ "relationship-label": "org.onap.relationships.inventory.PartOf",
+ "related-link": "/aai/v17/network/configurations/configuration/configuration2-550-as988q",
+ "relationship-data": [
+ {
+ "relationship-key": "configuration.configuration-id",
+ "relationship-value": "configuration2-550-as988q"
+ }
+ ]
+ },
+ {
+ "related-to": "configuration",
+ "relationship-label": "org.onap.relationships.inventory.PartOf",
+ "related-link": "/aai/v17/network/configurations/configuration/configuration1-550-as988q",
+ "relationship-data": [
+ {
+ "relationship-key": "configuration.configuration-id",
+ "relationship-value": "configuration1-550-as988q"
+ }
+ ]
+ },
+ {
+ "related-to": "vpn-binding",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v17/network/vpn-bindings/vpn-binding/VPNbinding3-550-as988q",
+ "relationship-data": [
+ {
+ "relationship-key": "vpn-binding.vpn-id",
+ "relationship-value": "VPNbinding3-550-as988q"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "vpn-binding.vpn-name",
+ "property-value": "SZ2A5L_VPNTest"
+ },
+ {
+ "property-key": "vpn-binding.vpn-type",
+ "property-value": "1903e94v"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ },
+ {
+ "l3-network": {
+ "network-id": "CC-l3network_2",
+ "network-name": "DLLSTXRNDS2",
+ "network-role": "Primary",
+ "is-bound-to-vpn": true,
+ "resource-version": "1556136783141",
+ "is-provider-network": true,
+ "is-shared-network": true,
+ "is-external-network": true,
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v17/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner-CC-ANAI-528/cloud-region-id-CC-ANAI-528/tenants/tenant/tenant-id-CC-ANAI-528T1",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloud-owner-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "cloud-region-id-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenant-id-CC-ANAI-528T1"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "tenant-name-CC-ANAI-528T1"
+ }
+ ]
+ },
+ {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v17/cloud-infrastructure/cloud-regions/cloud-region/cloud-owner-CC-ANAI-528/cloud-region-id-CC-ANAI-528/tenants/tenant/tenant-id-CC-ANAI-528-T2",
+ "relationship-data": [
+ {
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "cloud-owner-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "cloud-region-id-CC-ANAI-528"
+ },
+ {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "tenant-id-CC-ANAI-528-T2"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "tenant.tenant-name",
+ "property-value": "tenant-name-CC-ANAI-528T2"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ }
+ ]
+} \ No newline at end of file
diff --git a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java
index e49560283..7e98f3c93 100644
--- a/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java
+++ b/vid-automation/src/test/java/org/onap/vid/api/AsyncInstantiationALaCarteApiTest3.java
@@ -1,15 +1,50 @@
package org.onap.vid.api;
+import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.not;
+import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
+import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID;
+import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE;
+import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.RELATED_VNF1_ACTION;
+import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.RELATED_VNF2_ACTION;
+import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.SERVICE_NAME;
+import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.VNF_GROUP1_ACTION;
+import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset;
+import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets;
+
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.function.Function;
import org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset;
import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
import org.onap.simulator.presetGenerator.presets.aai.PresetAAISearchNodeQueryNonEmptyResult;
import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet;
-import org.onap.simulator.presetGenerator.presets.mso.*;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAddOrRemoveOneInstanceGroupMember;
import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAddOrRemoveOneInstanceGroupMember.InstanceGroupMemberAction;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateNetworkALaCarteServiceCypress2;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteGroupingService;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNamesAlacarteService;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceMultipleVnfsServiceCypress;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfALaCarteServiceCypress;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfALaCarteServiceCypress2;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVnfGroup;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteBaseVfModuleCypress;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteNetworkAlaCarteCypress;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteService;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVfModuleCypress;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVnfAlaCarteCypress;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet;
+import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames;
import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet;
import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet;
import org.onap.vid.model.asyncInstantiation.JobAuditStatus;
@@ -26,24 +61,6 @@ import vid.automation.test.services.AsyncJobsService;
import vid.automation.test.services.SimulatorApi;
import vid.automation.test.services.SimulatorApi.RegistrationStrategy;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-import java.util.function.Function;
-
-import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.allOf;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
-import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost.DEFAULT_REQUEST_ID;
-import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE;
-import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys.*;
-import static vid.automation.test.services.SimulatorApi.registerExpectationFromPreset;
-import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets;
-
@FeatureTogglingTest({Features.FLAG_ASYNC_ALACARTE_VNF})
public class AsyncInstantiationALaCarteApiTest3 extends AsyncInstantiationBase {
@@ -466,6 +483,7 @@ public class AsyncInstantiationALaCarteApiTest3 extends AsyncInstantiationBase {
String vnfInstanceId = "VNF_INSTANCE_ID";
registerExpectationFromPresets(ImmutableList.of(
+ new PresetAAIGetSubscribersGet(),
new PresetMSODeleteVnfAlaCarteCypress(deleteVnfRequestId, serviceInstanceId, vnfInstanceId, "us16807000"),
new PresetMSOOrchestrationRequestGet(COMPLETE, deleteVnfRequestId),
new PresetMSODeleteService(deleteServiceRequestId, serviceInstanceId),