Implant vid-app-common org.onap.vid.job (main and test)
Issue-ID: VID-378
Change-Id: I41b0bdc2c4e3635f3f3319b1cd63cefc61912dfc
Signed-off-by: Einat Vinouze <einat.vinouze@intl.att.com>
Signed-off-by: Ittay Stern <ittay.stern@att.com>
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AAITreeConverterTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AAITreeConverterTest.java
index 5bdfd12..560e6cb 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/AAITreeConverterTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/AAITreeConverterTest.java
@@ -25,17 +25,16 @@
import org.mockito.MockitoAnnotations;
import org.onap.vid.aai.util.AAITreeConverter;
import org.onap.vid.model.Action;
-import org.onap.vid.model.aaiTree.AAITreeNode;
-import org.onap.vid.model.aaiTree.Network;
+import org.onap.vid.model.aaiTree.*;
import org.onap.vid.model.aaiTree.ServiceInstance;
-import org.onap.vid.model.aaiTree.VfModule;
-import org.onap.vid.model.aaiTree.Vnf;
+import org.onap.vid.mso.model.CloudConfiguration;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.util.List;
+import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.emptyOrNullString;
import static org.hamcrest.Matchers.hasKey;
@@ -43,6 +42,7 @@
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.not;
import static org.onap.vid.asdc.parser.ToscaParserImpl2.Constants.A_LA_CARTE;
+import static org.testng.Assert.assertNull;
public class AAITreeConverterTest {
@@ -59,28 +59,41 @@
AAITreeNode aaiTree = generateAaiTreeToConvert(0, 0);
- ServiceInstance result = aaiTreeConverter.convertTreeToUIModel(aaiTree, "global-customer-id", "service-type", A_LA_CARTE);
+ ServiceInstance result = aaiTreeConverter.convertTreeToUIModel(aaiTree, "global-customer-id", "service-type", A_LA_CARTE, "", "");
assertService(result, 0, 0, true);
}
@Test
- public void testConvertTreeToUIModel_MultipleChildren() throws Exception {
+ public void testConvertTreeToUIModel_MultipleChildren() {
AAITreeNode aaiTree = generateAaiTreeToConvert(2, 2);
- ServiceInstance serviceInstance = aaiTreeConverter.convertTreeToUIModel(aaiTree, "global-customer-id", "service-type", null);
+ ServiceInstance serviceInstance = aaiTreeConverter.convertTreeToUIModel(aaiTree, "global-customer-id", "service-type", null, "", "");
assertService(serviceInstance, 2, 2, false);
int nodesCounter = 0;
assertThat(serviceInstance.getVnfs().entrySet(), hasSize(2));
- assertVnf(serviceInstance.getVnfs().get("vnf-model-version-id:00"+(nodesCounter++)), 0, 0, false);
- assertVnf(serviceInstance.getVnfs().get("vnf-model-version-id:00"+(nodesCounter++)), 0, 0, false);
+ assertVnf(serviceInstance.getVnfs().get("vnf-instance-id" + (nodesCounter++)), 0, 0);
+ assertVnf(serviceInstance.getVnfs().get("vnf-instance-id" + (nodesCounter++)), 0, 0);
assertThat(serviceInstance.getNetworks().entrySet(), hasSize(2));
- assertNetwork(serviceInstance.getNetworks().get("network-model-version-id:00"+(nodesCounter++)), false);
- assertNetwork(serviceInstance.getNetworks().get("network-model-version-id:00"+(nodesCounter)), false);
+ assertNetwork(serviceInstance.getNetworks().get("network-instance-id" + (nodesCounter++)), false);
+ assertNetwork(serviceInstance.getNetworks().get("network-instance-id" + (nodesCounter++)), false);
+
+ assertThat(serviceInstance.getVnfGroups().size(), equalTo(1));
+ assertThat(serviceInstance.getVnfGroups().get("vnf-group-id" + (nodesCounter++)).getInstanceId(), startsWith("vnf-group-id"));
+
+ assertThat(serviceInstance.getCollectionResources().size(), equalTo(1));
+ CollectionResource cr = serviceInstance.getCollectionResources().get("cr-id" + (nodesCounter++));
+ assertThat(cr.getInstanceId(), startsWith("cr-id"));
+
+ assertThat(cr.getNcfs().size(), equalTo(1));
+ assertThat(cr.getNcfs().get("ncf-id").getInstanceId(), startsWith("ncf-id"));
+
+ assertThat(serviceInstance.getExistingVNFCounterMap().get("vnf-model-customization-id"), equalTo(2L));
+ assertThat(serviceInstance.getExistingNetworksCounterMap().get("network-model-customization-id"), equalTo(2L));
}
@DataProvider
@@ -99,7 +112,7 @@
int nodesCounter = 0;
for (Boolean customizationName: vfModules) {
- vnfTreeNode.getChildren().add(createVfModule(nodesCounter++, customizationName));
+ vnfTreeNode.getChildren().add(createVfModule(customizationName));
}
for (Boolean customizationName: networks) {
@@ -108,24 +121,21 @@
Vnf actualVnf = Vnf.from(vnfTreeNode);
- assertVnf(actualVnf, vfModules.size(), networks.size(), false);
+ assertVnf(actualVnf, vfModules.size(), networks.size());
nodesCounter = 0;
for (Boolean customizationName: vfModules) {
String key = customizationName ? "vfModule key in model" : "vfModule-model-version-id";
assertThat(actualVnf.getVfModules(), hasKey(key));
- assertThat(actualVnf.getVfModules().get(key), hasKey(key + ":00" + nodesCounter));
- VfModule actualVfModule = actualVnf.getVfModules().get(key).get(key + ":00" + nodesCounter);
+ assertThat(actualVnf.getVfModules().get(key), hasKey("vfModule-instance-id"));
+ VfModule actualVfModule = actualVnf.getVfModules().get(key).get("vfModule-instance-id");
assertVfModule(actualVfModule, customizationName);
- nodesCounter++;
}
for (Boolean customizationName: networks) {
- String key = customizationName ? "network key in model" : "network-model-version-id";
-
- assertThat(actualVnf.getNetworks(), hasKey(key + ":00" + nodesCounter));
- Network actualNetwork = actualVnf.getNetworks().get(key + ":00" + nodesCounter);
+ assertThat(actualVnf.getNetworks(), hasKey("network-instance-id" + nodesCounter));
+ Network actualNetwork = actualVnf.getNetworks().get("network-instance-id" + nodesCounter);
assertNetwork(actualNetwork, customizationName);
nodesCounter++;
}
@@ -142,45 +152,79 @@
private AAITreeNode createVnf(int uniqueNumber, boolean hasCustomizationName) {
AAITreeNode vnfTreeNode = new AAITreeNode();
- vnfTreeNode.setId("vnf-instance-id");
+ vnfTreeNode.setId("vnf-instance-id" + uniqueNumber);
vnfTreeNode.setName("vnf-instance-name");
- vnfTreeNode.setType("generic-vnf");
+ vnfTreeNode.setType(NodeType.GENERIC_VNF);
vnfTreeNode.setModelVersionId("vnf-model-version-id");
+ vnfTreeNode.setModelCustomizationId("vnf-model-customization-id");
if (hasCustomizationName) {
vnfTreeNode.setModelCustomizationName("vnf model customization name");
vnfTreeNode.setKeyInModel("vnf key in model");
}
- vnfTreeNode.setUniqueNumber(uniqueNumber);
return vnfTreeNode;
}
- private AAITreeNode createVfModule(int uniqueNumber, boolean hasCustomizationName) {
+ private AAITreeNode createVnfGroup(int uniqueNumber) {
+ AAITreeNode treeNode = new AAITreeNode();
+ treeNode.setId("vnf-group-id" + uniqueNumber);
+ treeNode.setType(NodeType.INSTANCE_GROUP);
+ treeNode.getAdditionalProperties().put("instance-group-type", "vnfGroup-type");
+ return treeNode;
+ }
+
+ private AAITreeNode createCollectionResource(int uniqueNumber) {
+ AAITreeNode treeNode = new AAITreeNode();
+ treeNode.setId("cr-id" + uniqueNumber);
+ treeNode.setType(NodeType.COLLECTION_RESOURCE);
+ treeNode.getChildren().add(createNCF());
+ return treeNode;
+ }
+
+ private AAITreeNode createNCF() {
+ AAITreeNode treeNode = new AAITreeNode();
+ treeNode.setId("ncf-id");
+ treeNode.setType(NodeType.INSTANCE_GROUP);
+ treeNode.getAdditionalProperties().put("instance-group-type", "L3-NETWORK");
+ return treeNode;
+ }
+
+ @Test
+ public void givenPlacementIsNull_whenConvertToNetwork_relevantFieldsAreAlsoNull() {
+ AAITreeNode aaiTreeNode = new AAITreeNode();
+ aaiTreeNode.setType(NodeType.NETWORK);
+ Network actualNetwork = Network.from(aaiTreeNode);
+ assertNull(actualNetwork.getCloudOwner());
+ assertNull(actualNetwork.getLcpCloudRegionId());
+ assertNull(actualNetwork.getTenantId());
+ }
+
+ private AAITreeNode createVfModule(boolean hasCustomizationName) {
AAITreeNode vfModuleTreeNode = new AAITreeNode();
vfModuleTreeNode.setId("vfModule-instance-id");
vfModuleTreeNode.setName("vfModule-instance-name");
- vfModuleTreeNode.setType("vf-module");
+ vfModuleTreeNode.setType(NodeType.VF_MODULE);
vfModuleTreeNode.setModelVersionId("vfModule-model-version-id");
+ vfModuleTreeNode.setModelCustomizationId("vfModule-model-customization-id");
if (hasCustomizationName) {
vfModuleTreeNode.setModelCustomizationName("vfModule model customization name");
vfModuleTreeNode.setKeyInModel("vfModule key in model");
}
- vfModuleTreeNode.setUniqueNumber(uniqueNumber);
-
+ vfModuleTreeNode.setCloudConfiguration(new CloudConfiguration("lcpRegion2", "tenant3", "cloudOwner1"));
return vfModuleTreeNode;
}
private AAITreeNode createNetwork(int uniqueNumber, boolean hasCustomizationName) {
AAITreeNode networkTreeNode = new AAITreeNode();
- networkTreeNode.setId("network-instance-id");
+ networkTreeNode.setId("network-instance-id" + uniqueNumber);
networkTreeNode.setName("network-instance-name");
- networkTreeNode.setType("l3-network");
+ networkTreeNode.setType(NodeType.NETWORK);
networkTreeNode.setModelVersionId("network-model-version-id");
+ networkTreeNode.setModelCustomizationId("network-model-customization-id");
if (hasCustomizationName) {
networkTreeNode.setModelCustomizationName("network model customization name");
networkTreeNode.setKeyInModel("network key in model");
}
- networkTreeNode.setUniqueNumber(uniqueNumber);
-
+ networkTreeNode.setCloudConfiguration(new CloudConfiguration("auk51a", "b530fc990b6d4334bd45518bebca6a51", "att-nc"));
return networkTreeNode;
}
@@ -196,17 +240,16 @@
assertThat(serviceInstance.getIsALaCarte(), is(isALaCarte));
}
- private void assertVnf(Vnf actualVnf, int expectedVfModules, int expectedNetworks, boolean hasCustomizationName) {
- assertThat(actualVnf.getInstanceId(), is("vnf-instance-id"));
+ private void assertVnf(Vnf actualVnf, int expectedVfModules, int expectedNetworks) {
+ assertThat(actualVnf.getInstanceId(), containsString("vnf-instance-id"));
assertThat(actualVnf.getInstanceName(), is("vnf-instance-name"));
assertThat(actualVnf.getAction(), is(Action.None));
assertThat(actualVnf.getModelInfo().getModelType(), is("vnf"));
assertThat(actualVnf.getModelInfo().getModelVersionId(), is("vnf-model-version-id"));
assertThat(actualVnf.getVfModules().entrySet(), hasSize(expectedVfModules));
assertThat(actualVnf.getNetworks().entrySet(), hasSize(expectedNetworks));
- assertThat(actualVnf.getTrackById(), is(not(emptyOrNullString())));
- String expectedCustomizationName = hasCustomizationName ? "vnf model customization name" : null;
- assertThat(actualVnf.getModelInfo().getModelCustomizationName(), is(expectedCustomizationName));
+ assertThat(actualVnf.getTrackById(), containsString("vnf-instance-id"));
+ assertNull(actualVnf.getModelInfo().getModelCustomizationName());
}
private void assertVfModule(VfModule actualVfModule, boolean hasCustomizationName) {
@@ -215,20 +258,27 @@
assertThat(actualVfModule.getAction(), is(Action.None));
assertThat(actualVfModule.getModelInfo().getModelType(), is("vfModule"));
assertThat(actualVfModule.getModelInfo().getModelVersionId(), is("vfModule-model-version-id"));
- assertThat(actualVfModule.getTrackById(), is(not(emptyOrNullString())));
+ assertThat(actualVfModule.getTrackById(), is("vfModule-instance-id"));
String expectedCustomizationName = hasCustomizationName ? "vfModule model customization name" : null;
assertThat(actualVfModule.getModelInfo().getModelCustomizationName(), is(expectedCustomizationName));
+ assertThat(actualVfModule.getCloudOwner(), is("cloudOwner1"));
+ assertThat(actualVfModule.getLcpCloudRegionId(), is("lcpRegion2"));
+ assertThat(actualVfModule.getTenantId(), is("tenant3"));
}
private void assertNetwork(Network actualNetwork, boolean hasCustomizationName) {
- assertThat(actualNetwork.getInstanceId(), is("network-instance-id"));
+ assertThat(actualNetwork.getInstanceId(), containsString("network-instance-id"));
assertThat(actualNetwork.getInstanceName(), is("network-instance-name"));
assertThat(actualNetwork.getAction(), is(Action.None));
assertThat(actualNetwork.getModelInfo().getModelType(), is("network"));
assertThat(actualNetwork.getModelInfo().getModelVersionId(), is("network-model-version-id"));
- assertThat(actualNetwork.getTrackById(), is(not(emptyOrNullString())));
+ assertThat(actualNetwork.getTrackById(), containsString("network-instance-id"));
String expectedCustomizationName = hasCustomizationName ? "network model customization name" : null;
assertThat(actualNetwork.getModelInfo().getModelCustomizationName(), is(expectedCustomizationName));
+ assertThat(actualNetwork.getCloudOwner(), is("att-nc"));
+ assertThat(actualNetwork.getLcpCloudRegionId(), is("auk51a"));
+ assertThat(actualNetwork.getTenantId(), is("b530fc990b6d4334bd45518bebca6a51"));
+
}
private AAITreeNode generateAaiTreeToConvert(int numberOfVnfs, int numberOfNetworks) {
@@ -236,6 +286,7 @@
AAITreeNode aaiTree = new AAITreeNode();
aaiTree.setId("service-instance-id");
aaiTree.setName("service-instance-name");
+ aaiTree.setType(NodeType.SERVICE_INSTANCE);
for (int i = 0; i < numberOfVnfs; i++) {
aaiTree.getChildren().add(createVnf(counter++, false));
@@ -245,6 +296,9 @@
aaiTree.getChildren().add(createNetwork(counter++, false));
}
+ aaiTree.getChildren().add(createVnfGroup(counter++));
+ aaiTree.getChildren().add(createCollectionResource(counter++));
+
return aaiTree;
}
-}
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java
index fdeeb00..b2d8e85 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiClientTest.java
@@ -20,9 +20,51 @@
package org.onap.vid.aai;
+import static java.util.stream.Collectors.toList;
+import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.hamcrest.Matchers.containsString;
+import static org.hamcrest.Matchers.either;
+import static org.hamcrest.Matchers.hasProperty;
+import static org.hamcrest.Matchers.instanceOf;
+import static org.hamcrest.Matchers.is;
+import static org.hamcrest.Matchers.sameInstance;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.ArgumentMatchers.nullable;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER;
+import static org.onap.vid.utils.Unchecked.toURI;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.fail;
+
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableList;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.net.URI;
+import java.security.cert.CertificateException;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.function.BiConsumer;
+import java.util.function.Function;
+import java.util.stream.Stream;
+import javax.crypto.BadPaddingException;
+import javax.net.ssl.SSLHandshakeException;
+import javax.servlet.ServletContext;
+import javax.ws.rs.ProcessingException;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.core.Response;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.apache.commons.lang3.exception.ExceptionUtils;
@@ -32,10 +74,20 @@
import org.mockito.Mockito;
import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate;
import org.onap.portalsdk.core.util.SystemProperties;
-import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.RelatedToProperty;
import org.onap.vid.aai.model.AaiGetTenatns.GetTenantsResponse;
-import org.onap.vid.aai.model.*;
-import org.onap.vid.aai.util.*;
+import org.onap.vid.aai.model.CustomQuerySimpleResult;
+import org.onap.vid.aai.model.ModelVer;
+import org.onap.vid.aai.model.ModelVersions;
+import org.onap.vid.aai.model.PortDetailsTranslator;
+import org.onap.vid.aai.model.Properties;
+import org.onap.vid.aai.model.RelatedToProperty;
+import org.onap.vid.aai.model.ResourceType;
+import org.onap.vid.aai.model.SimpleResult;
+import org.onap.vid.aai.util.AAIRestInterface;
+import org.onap.vid.aai.util.CacheProvider;
+import org.onap.vid.aai.util.HttpsAuthClient;
+import org.onap.vid.aai.util.ServletRequestHelper;
+import org.onap.vid.aai.util.SystemPropertyHelper;
import org.onap.vid.controller.LocalWebConfig;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.model.Subscriber;
@@ -55,37 +107,6 @@
import sun.security.provider.certpath.SunCertPathBuilderException;
import sun.security.validator.ValidatorException;
-import javax.crypto.BadPaddingException;
-import javax.net.ssl.SSLHandshakeException;
-import javax.servlet.ServletContext;
-import javax.ws.rs.ProcessingException;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.core.Response;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URI;
-import java.security.cert.CertificateException;
-import java.util.ArrayList;
-import java.util.Map;
-import java.util.function.BiConsumer;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static org.apache.commons.lang3.StringUtils.equalsIgnoreCase;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.*;
-import static org.mockito.ArgumentMatchers.nullable;
-import static org.mockito.Matchers.any;
-import static org.mockito.Matchers.anyBoolean;
-import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.argThat;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Matchers.isNull;
-import static org.mockito.Mockito.*;
-import static org.onap.vid.utils.Unchecked.toURI;
-import static org.testng.Assert.*;
-
@ContextConfiguration(classes = {LocalWebConfig.class, SystemProperties.class})
@WebAppConfiguration
public class AaiClientTest {
@@ -345,7 +366,7 @@
Assert.assertTrue(response.t.length> 0);
- Assert.assertEquals(tenants[0].cloudOwner,"att-aic-cloud-owner");
+ Assert.assertEquals(tenants[0].cloudOwner,"irma-aic-cloud-owner");
}
final String tenantResponseRaw ="" +
@@ -355,10 +376,10 @@
"\"relationship-list\": {" +
"\"relationship\": [{" +
"\"related-to\": \"tenant\"," +
- "\"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/att-aic/AAIAIC25/tenants/tenant/092eb9e8e4b7412e8787dd091bc58e86\"," +
+ "\"related-link\": \"/aai/v11/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/AAIAIC25/tenants/tenant/092eb9e8e4b7412e8787dd091bc58e86\"," +
"\"relationship-data\": [{" +
"\"relationship-key\": \"cloud-region.cloud-owner\"," +
- "\"relationship-value\": \"att-aic-cloud-owner\"" +
+ "\"relationship-value\": \"irma-aic-cloud-owner\"" +
"}," +
"{" +
"\"relationship-key\": \"cloud-region.cloud-region-id\"," +
@@ -427,11 +448,11 @@
" {" +
" \"related-to\": \"volume-group\"," +
" \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
- " \"related-link\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/volume-groups/volume-group/66013ebe-0c81-44b9-a24f-7c6acba73a39\"," +
+ " \"related-link\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/rdm5b/volume-groups/volume-group/66013ebe-0c81-44b9-a24f-7c6acba73a39\"," +
" \"relationship-data\": [" +
" {" +
" \"relationship-key\": \"cloud-region.cloud-owner\"," +
- " \"relationship-value\": \"att-aic\"" +
+ " \"relationship-value\": \"irma-aic\"" +
" }," +
" {" +
" \"relationship-key\": \"cloud-region.cloud-region-id\"," +
@@ -446,11 +467,11 @@
" {" +
" \"related-to\": \"vserver\"," +
" \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
- " \"related-link\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/tenants/tenant/db1818f7f2e34862b378bfb2cc520f91/vservers/vserver/5eef9f6d-9933-4bc6-9a1a-862d61309437\"," +
+ " \"related-link\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/rdm5b/tenants/tenant/db1818f7f2e34862b378bfb2cc520f91/vservers/vserver/5eef9f6d-9933-4bc6-9a1a-862d61309437\"," +
" \"relationship-data\": [" +
" {" +
" \"relationship-key\": \"cloud-region.cloud-owner\"," +
- " \"relationship-value\": \"att-aic\"" +
+ " \"relationship-value\": \"irma-aic\"" +
" }," +
" {" +
" \"relationship-key\": \"cloud-region.cloud-region-id\"," +
@@ -490,7 +511,7 @@
GetTenantsResponse tenant = aaiClientMock.getHomingDataByVfModule("vnfInstanceId", "vfModuleId");
- Assert.assertEquals(tenant.cloudOwner,"att-aic");
+ Assert.assertEquals(tenant.cloudOwner,"irma-aic" );
Assert.assertEquals(tenant.cloudRegionID,"rdm5b");
Assert.assertEquals(tenant.tenantID,"db1818f7f2e34862b378bfb2cc520f91");
@@ -601,7 +622,7 @@
// double each case to propagateExceptions = true/false, to verify that "don't propagate" really still work
ImmutableList.of(l.getLeft(), l.getRight(), true).toArray(),
ImmutableList.of(l.getLeft(), l.getRight(), false).toArray()
- )).collect(Collectors.toList()).toArray(new Object[][]{});
+ )).collect(toList()).toArray(new Object[][]{});
}
private static UncheckedBiConsumer<HttpsAuthClient, Client> mockExceptionOnClientProvider(Exception e) {
@@ -734,6 +755,83 @@
};
}
+ @Test
+ public void testGetLatestVersionByInvariantId() throws IOException {
+
+ ModelVersions modelVersions = JACKSON_OBJECT_MAPPER.readValue("" +
+ "{\n" +
+ " \"results\": [\n" +
+ " {\n" +
+ " \"model\": {\n" +
+ " \"model-invariant-id\": \"f6342be5-d66b-4d03-a1aa-c82c3094c4ea\",\n" +
+ " \"model-type\": \"service\",\n" +
+ " \"resource-version\": \"1534274421300\"\n" +
+ " }\n" +
+ " },\n" +
+ " {\n" +
+ " \"model-ver\": {\n" +
+ " \"model-version-id\": \"a92f899d-a3ec-465b-baed-1663b0a5aee1\",\n" +
+ " \"model-name\": \"NCM_VLAN_SVC_ym161f\",\n" +
+ " \"model-version\": \"bbb\",\n" +
+ " \"distribution-status\": \"DISTRIBUTION_COMPLETE_OK\",\n" +
+ " \"model-description\": \"Network Collection service for vLAN tagging\",\n" +
+ " \"resource-version\": \"1534788756086\"\n" +
+ " }\n" +
+ " },\n" +
+ " {\n" +
+ " \"model-ver\": {\n" +
+ " \"model-version-id\": \"d2fda667-e92e-4cfa-9620-5da5de01a319\",\n" +
+ " \"model-name\": \"NCM_VLAN_SVC_ym161f\",\n" +
+ " \"model-version\": \"aaa\",\n" +
+ " \"distribution-status\": \"DISTRIBUTION_COMPLETE_OK\",\n" +
+ " \"model-description\": \"Network Collection service for vLAN tagging\",\n" +
+ " \"resource-version\": \"1534444087221\"\n" +
+ " }\n" +
+ " }]}", ModelVersions.class);
+
+
+ final AaiClient aaiClient = new AaiClient(null, null, null);
+
+ assertThat(aaiClient.toModelVerStream(modelVersions).collect(toList()),
+ containsInAnyOrder(
+ hasProperty("modelVersionId", is("a92f899d-a3ec-465b-baed-1663b0a5aee1")),
+ hasProperty("modelVersionId", is("d2fda667-e92e-4cfa-9620-5da5de01a319"))
+ ));
+
+ }
+
+ @DataProvider
+ public static Object[][] versionsDataProvider() {
+ return new Object[][] {
+ { Stream.of("10","20","30"), "30" },
+ { Stream.of("10","20","20"), "20" },
+ { Stream.of("c","b","a"), "c" },
+ { Stream.of("1.0","2.0","1.8"), "2.0" },
+ { Stream.of("1.0.7","2.0.2","2.0.9"), "2.0.9" },
+ { Stream.of("0","0","0"), "0" },
+ { Stream.of("","10"), "10" },
+
+ };
+ }
+
+ @Test(dataProvider = "versionsDataProvider")
+ public void maxModelVer(Stream<String> input, String expected) {
+ Stream<ModelVer> modelVerStream = input.map(version -> {
+ ModelVer mv = new ModelVer();
+ mv.setModelVersion(version);
+ return mv;
+ });
+
+ final AaiClient aaiClient = new AaiClient(null, null, null);
+
+ assertThat(aaiClient.maxModelVer(modelVerStream), hasProperty("modelVersion", is(expected)));
+ }
+
+ @Test(expectedExceptions = GenericUncheckedException.class)
+ public void maxModelVerException() {
+ final AaiClient aaiClient = new AaiClient(null, null, null);
+ aaiClient.maxModelVer(Stream.of(new ModelVer()));
+ }
@Test(dataProvider = "cloudRegionAndTenantDataProvider")
public void getCloudRegionAndTenantByVnfId(String tenantName, String cloudRegionId) throws JsonProcessingException {
SimpleResult tenant = new SimpleResult();
diff --git a/vid-app-common/src/test/java/org/onap/vid/aai/AaiResponseTranslatorTest.java b/vid-app-common/src/test/java/org/onap/vid/aai/AaiResponseTranslatorTest.java
index 12f7429..0454886 100644
--- a/vid-app-common/src/test/java/org/onap/vid/aai/AaiResponseTranslatorTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/aai/AaiResponseTranslatorTest.java
@@ -45,9 +45,9 @@
" \"results\": [{" +
" \"id\": \"2979590232\"," +
" \"node-type\": \"cloud-region\"," +
- " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/SDNO-S-BcloudReg-E1802\"," +
+ " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/SDNO-S-BcloudReg-E1802\"," +
" \"properties\": {" +
- " \"cloud-owner\": \"att-aic\"," +
+ " \"cloud-owner\": \"irma-aic\"," +
" \"cloud-region-id\": \"THE-EXPECTED-REGION-ID\"," +
" \"sriov-automation\": false," +
" \"resource-version\": \"1513631040564\"" +
@@ -122,7 +122,7 @@
"{" +
" \"results\": [{" +
" \"node-type\": \"cloud-region\"," +
- " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/SDNO-S-BcloudReg-E1802\"," +
+ " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/SDNO-S-BcloudReg-E1802\"," +
" \"properties\": {" +
" \"resource-version\": \"1513631040564\"" +
" }" +
diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserImpl2Test.java b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserImpl2Test.java
index 91c4805..92d78d4 100644
--- a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserImpl2Test.java
+++ b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserImpl2Test.java
@@ -20,11 +20,33 @@
package org.onap.vid.asdc.parser;
+import static com.google.common.collect.Lists.newArrayList;
+import static org.hamcrest.Matchers.aMapWithSize;
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.hasKey;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.vid.asdc.parser.ToscaParserImpl2.Constants.ECOMP_GENERATED_NAMING_PROPERTY;
+import static org.onap.vid.testUtils.TestUtils.assertJsonStringEqualsIgnoreNulls;
+
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Path;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
import net.javacrumbs.jsonunit.JsonAssert;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.LogManager;
@@ -43,7 +65,19 @@
import org.onap.vid.asdc.AsdcClient;
import org.onap.vid.asdc.local.LocalAsdcClient;
import org.onap.vid.controller.ToscaParserMockHelper;
-import org.onap.vid.model.*;
+import org.onap.vid.model.CR;
+import org.onap.vid.model.Network;
+import org.onap.vid.model.NetworkCollection;
+import org.onap.vid.model.Node;
+import org.onap.vid.model.PortMirroringConfig;
+import org.onap.vid.model.ResourceGroup;
+import org.onap.vid.model.Service;
+import org.onap.vid.model.ServiceModel;
+import org.onap.vid.model.ServiceProxy;
+import org.onap.vid.model.VNF;
+import org.onap.vid.model.VfModule;
+import org.onap.vid.model.VidNotions;
+import org.onap.vid.model.VolumeGroup;
import org.onap.vid.properties.Features;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
@@ -52,22 +86,6 @@
import org.testng.annotations.Test;
import org.togglz.core.manager.FeatureManager;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Path;
-import java.util.*;
-import java.util.stream.Collectors;
-import java.util.stream.Stream;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static org.hamcrest.Matchers.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-import static org.onap.vid.asdc.parser.ToscaParserImpl2.Constants.ECOMP_GENERATED_NAMING_PROPERTY;
-import static org.onap.vid.testUtils.TestUtils.assertJsonStringEqualsIgnoreNulls;
-
public class ToscaParserImpl2Test {
private final String myUUID = "myUUID";
@@ -101,7 +119,7 @@
@Test(dataProvider = "expectedServiceModel")
public void assertEqualsBetweenServices(String uuid, ToscaParserMockHelper mockHelper) throws Exception {
- Service expectedService = mockHelper.getNewServiceModel().getService();
+ Service expectedService = mockHelper.getServiceModel().getService();
Service actualService = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getService();
assertJsonStringEqualsIgnoreNulls(om.writeValueAsString(expectedService), om.writeValueAsString(actualService));
}
@@ -111,12 +129,12 @@
final Path csarPath = getCsarPath(mockHelper.getUuid());
log.info("Comparing for csar " + csarPath);
ServiceModel actualServiceModel = toscaParserImpl2.makeServiceModel(csarPath, getServiceByUuid(mockHelper.getUuid()));
- assertJsonStringEqualsIgnoreNulls(om.writeValueAsString(mockHelper.getNewServiceModel()), om.writeValueAsString(actualServiceModel));
+ assertJsonStringEqualsIgnoreNulls(om.writeValueAsString(mockHelper.getServiceModel()), om.writeValueAsString(actualServiceModel));
}
@Test(dataProvider = "expectedServiceModel")
public void assertEqualsBetweenNetworkNodes(String uuid, ToscaParserMockHelper mockHelper) throws Exception {
- Map<String, Network> expectedNetworksMap = mockHelper.getNewServiceModel().getNetworks();
+ Map<String, Network> expectedNetworksMap = mockHelper.getServiceModel().getNetworks();
Map<String, Network> actualNetworksMap = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getNetworks();
for (Map.Entry<String, Network> entry : expectedNetworksMap.entrySet()) {
Network expectedNetwork = entry.getValue();
@@ -130,7 +148,7 @@
//Because we are not supporting the old flow, the JSON are different by definition.
@Test(dataProvider = "expectedServiceModel")
public void assertEqualsBetweenVnfsOfTosca(String uuid, ToscaParserMockHelper mockHelper) throws Exception {
- Map<String, VNF> expectedVnfsMap = mockHelper.getNewServiceModel().getVnfs();
+ Map<String, VNF> expectedVnfsMap = mockHelper.getServiceModel().getVnfs();
Map<String, VNF> actualVnfsMap = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getVnfs();
for (Map.Entry<String, VNF> entry : expectedVnfsMap.entrySet()) {
VNF expectedVnf = entry.getValue();
@@ -142,10 +160,12 @@
}
}
+
+
@Test(dataProvider = "expectedServiceModel")
public void assertEqualsBetweenCollectionResourcesOfTosca(String uuid, ToscaParserMockHelper mockHelper) throws Exception {
- Map<String, CR> expectedVnfsMap = mockHelper.getNewServiceModel().getCollectionResource();
- Map<String, CR> actualCRsMap = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getCollectionResource();
+ Map<String, CR> expectedVnfsMap = mockHelper.getServiceModel().getCollectionResources();
+ Map<String, CR> actualCRsMap = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getCollectionResources();
if(!actualCRsMap.isEmpty()) {
for (Map.Entry<String, CR> entry : expectedVnfsMap.entrySet()) {
CR expectedCR = entry.getValue();
@@ -201,28 +221,28 @@
@Test(dataProvider = "expectedServiceModel")
public void assertEqualsBetweenVolumeGroups(String uuid, ToscaParserMockHelper mockHelper) throws Exception {
Map<String, VolumeGroup> actualVolumeGroups = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getVolumeGroups();
- Map<String, VolumeGroup> expectedVolumeGroups = mockHelper.getNewServiceModel().getVolumeGroups();
+ Map<String, VolumeGroup> expectedVolumeGroups = mockHelper.getServiceModel().getVolumeGroups();
assertJsonStringEqualsIgnoreNulls(om.writeValueAsString(expectedVolumeGroups), om.writeValueAsString(actualVolumeGroups));
}
@Test(dataProvider = "expectedServiceModel")
public void assertEqualsBetweenVfModules(String uuid, ToscaParserMockHelper mockHelper) throws Exception {
Map<String, VfModule> actualVfModules = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getVfModules();
- Map<String, VfModule> expectedVfModules = mockHelper.getNewServiceModel().getVfModules();
+ Map<String, VfModule> expectedVfModules = mockHelper.getServiceModel().getVfModules();
assertJsonStringEqualsIgnoreNulls(om.writeValueAsString(expectedVfModules), om.writeValueAsString(actualVfModules));
}
@Test(dataProvider = "expectedServiceModel")
public void assertEqualsBetweenPolicyConfigurationNodes(String uuid, ToscaParserMockHelper mockHelper) throws Exception {
Map<String, PortMirroringConfig> actualConfigurations = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getConfigurations();
- Map<String, PortMirroringConfig> expectedConfigurations = mockHelper.getNewServiceModel().getConfigurations();
+ Map<String, PortMirroringConfig> expectedConfigurations = mockHelper.getServiceModel().getConfigurations();
JsonAssert.assertJsonEquals(actualConfigurations, expectedConfigurations);
}
@Test
public void assertEqualsBetweenPolicyConfigurationByPolicyFalse() throws Exception {
ToscaParserMockHelper mockHelper = new ToscaParserMockHelper(Constants.configurationByPolicyFalseUuid, Constants.configurationByPolicyFalseFilePath);
- Map<String, PortMirroringConfig> expectedConfigurations = mockHelper.getNewServiceModel().getConfigurations();
+ Map<String, PortMirroringConfig> expectedConfigurations = mockHelper.getServiceModel().getConfigurations();
Map<String, PortMirroringConfig> actualConfigurations = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getConfigurations();
setPprobeServiceProxy(expectedConfigurations);
@@ -250,7 +270,7 @@
final ToscaParserMockHelper mockHelper = new ToscaParserMockHelper("90fe6842-aa76-4b68-8329-5c86ff564407", "empty.json");
final ServiceModel serviceModel = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid()));
- assertJsonStringEqualsIgnoreNulls("{ vfModules: { 201712488_adiodvpe10..201712488AdiodVpe1..ADIOD_vRE_BV..module-1: { inputs: { availability_zone_0: { } } } } }", om.writeValueAsString(serviceModel));
+ assertJsonStringEqualsIgnoreNulls("{ vfModules: { 201712488_pasqualevpe10..201712488PasqualeVpe1..PASQUALE_vRE_BV..module-1: { inputs: { availability_zone_0: { } } } } }", om.writeValueAsString(serviceModel));
}
@Test
@@ -260,7 +280,7 @@
assertJsonStringEqualsIgnoreNulls("" +
"{ vnfs: " +
- " { \"201712-488_ADIOD-vPE-1 0\": " +
+ " { \"201712-488_PASQUALE-vPE-1 0\": " +
" { properties: { " +
" ecomp_generated_naming: \"true\", " +
" nf_naming: \"{naming_policy=SDNC_Policy.Config_MS_1806SRIOV_VPE_ADIoDJson, ecomp_generated_naming=true}\" " +
@@ -278,14 +298,14 @@
@Test(dataProvider = "expectedServiceModel")
public void assertEqualsBetweenServiceProxyNodes(String uuid, ToscaParserMockHelper mockHelper) throws Exception {
Map<String, ServiceProxy> actualServiceProxies = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getServiceProxies();
- Map<String, ServiceProxy> expectedServiceProxies = mockHelper.getNewServiceModel().getServiceProxies();
+ Map<String, ServiceProxy> expectedServiceProxies = mockHelper.getServiceModel().getServiceProxies();
JsonAssert.assertJsonEquals(actualServiceProxies, expectedServiceProxies);
}
@Test(dataProvider = "expectedServiceModel")
public void assertEqualsBetweenVnfGroups(String uuid, ToscaParserMockHelper mockHelper) throws Exception {
Map<String, ResourceGroup> actualVnfGroups = toscaParserImpl2.makeServiceModel(getCsarPath(mockHelper.getUuid()), getServiceByUuid(mockHelper.getUuid())).getVnfGroups();
- Map<String, ResourceGroup> expectedVnfGroups = mockHelper.getNewServiceModel().getVnfGroups();
+ Map<String, ResourceGroup> expectedVnfGroups = mockHelper.getServiceModel().getVnfGroups();
JsonAssert.assertJsonEquals(actualVnfGroups, expectedVnfGroups);
}
@@ -342,7 +362,7 @@
static final String vfWithAnnotationUuid = "f4d84bb4-a416-4b4e-997e-0059973630b9";
static final String vlUuid = "cb49608f-5a24-4789-b0f7-2595473cb997";
static final String crUuid = "76f27dfe-33e5-472f-8e0b-acf524adc4f0";
- static final String vfWithVfcGroup = "6bce7302-70bd-4057-b48e-8d5b99e686ca"; //service-VdbeSrv-csar.zip
+ static final String vfWithVfcGroup = "6bce7302-70bd-4057-b48e-8d5b99e686ca"; //service-VdorotheaSrv-csar.zip
// public static final String PNFUuid = "68101369-6f08-4e99-9a28-fa6327d344f3";
static final String vfFilePath = "vf-csar.JSON";
static final String vlFilePath = "vl-csar.JSON";
@@ -358,6 +378,8 @@
//public static final String vnfGroupingUuid = "4117a0b6-e234-467d-b5b9-fe2f68c8b0fc";
//public static final String vnfGroupingFilePath = "vnf-grouping-csar.json";
+ public static final String QUANTITY = "quantity";
+
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserInflatorTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserInflatorTest.java
index 4c5cc97..d6c080d 100644
--- a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserInflatorTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/ToscaParserInflatorTest.java
@@ -20,7 +20,16 @@
package org.onap.vid.asdc.parser;
+import static java.util.Collections.emptyMap;
+import static org.hamcrest.Matchers.is;
+import static org.junit.Assert.assertThat;
+
import com.google.common.collect.ImmutableMap;
+import java.io.IOException;
+import java.io.InputStream;
+import java.nio.file.Path;
+import java.util.Map;
+import java.util.UUID;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
@@ -41,16 +50,6 @@
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Path;
-import java.util.Map;
-import java.util.UUID;
-
-import static java.util.Collections.emptyMap;
-import static org.hamcrest.Matchers.is;
-import static org.junit.Assert.assertThat;
-
public class ToscaParserInflatorTest {
private static final Logger log = LogManager.getLogger(ToscaParserInflatorTest.class);
@@ -83,15 +82,15 @@
@Test
public void inflateFabricConfigurationModel_allIdsAreGiven() throws Exception {
- final String fabricConfigurationUuid = "90fe6842-aa76-4b68-8329-5c86ff564407";
+ final String fabricConfigurationUuid = "12344bb4-a416-4b4e-997e-0059973630b9";
final Map<String, Names> inflated = inflateModelByUuid(fabricConfigurationUuid);
// see vf-with-annotation-csar.json
assertThat(inflated, is(ImmutableMap.of(
- "8df1892c-377d-460b-8a8d-fc8a116e9d92", doubleName("201712-488_ADIOD-vPE-1 0"),
- "8d521692-7661-4296-b77e-a2058bb62e87", new Names("201712488AdiodVpe1..ADIOD_vRE_BV..module-1", "201712488_adiodvpe10..201712488AdiodVpe1..ADIOD_vRE_BV..module-1"),
- "79fbee20-7fba-4166-ae4b-b94c869e7d8b", new Names("201712488AdiodVpe1..ADIOD_vPFE_BV..module-2","201712488_adiodvpe10..201712488AdiodVpe1..ADIOD_vPFE_BV..module-2"),
- "806505b8-7a7c-47a2-acef-b4d26fe95a92", new Names("201712488AdiodVpe1..ADIOD_base_vPE_BV..module-0","201712488_adiodvpe10..201712488AdiodVpe1..ADIOD_base_vPE_BV..module-0")
+ "ea81d6f7-0861-44a7-b7d5-d173b562c350", doubleName("2017-488_PASQUALE-vPE 0"),
+ "a5d8df05-11cb-4351-96e0-b6d4168ea4df", new Names("2017488PasqualeVpe..PASQUALE_vRE_BV..module-1", "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1"),
+ "b3e8b26e-cff0-49fc-a4e6-f3e16c8440fe", new Names("2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2","2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2"),
+ "040e591e-5d30-4e0d-850f-7266e5a8e013", new Names("2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0","2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0")
)));
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java
index 788f780..edaf712 100644
--- a/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/asdc/parser/VidNotionsBuilderTest.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,28 +30,35 @@
import org.mockito.MockitoAnnotations;
import org.onap.sdc.tosca.parser.api.ISdcCsarHelper;
import org.onap.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.onap.sdc.tosca.parser.impl.SdcToscaParserFactory;
import org.onap.sdc.toscaparser.api.NodeTemplate;
import org.onap.sdc.toscaparser.api.Property;
import org.onap.sdc.toscaparser.api.elements.Metadata;
import org.onap.vid.model.*;
import org.onap.vid.properties.Features;
+import org.onap.vid.testUtils.TestUtils;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import org.togglz.core.manager.FeatureManager;
-import java.util.LinkedHashMap;
-import java.util.UUID;
+import java.io.File;
+import java.io.IOException;
+import java.nio.file.Path;
+import java.nio.file.Paths;
+import java.util.*;
import java.util.function.BiConsumer;
+import static java.util.Collections.emptyList;
+import static java.util.Collections.emptyMap;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasProperty;
import static org.hamcrest.Matchers.is;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-import static org.testng.Assert.assertEquals;
+import static org.onap.vid.model.VidNotions.*;
+import static org.testng.AssertJUnit.assertEquals;
public class VidNotionsBuilderTest {
@@ -61,6 +68,10 @@
@Mock
private FeatureManager featureManagerMock;
+ private ServiceModel serviceModel;
+
+ private ISdcCsarHelper csarHelper;
+
@BeforeClass
public void initMocks() {
MockitoAnnotations.initMocks(this);
@@ -75,12 +86,12 @@
public void VLNetworkWithPropertyNetworkTechnologyOVS_UIHintIsPositive() {
ISdcCsarHelper csarHelper = mockForNonLegacyInstantiationUI();
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper), is(VidNotions.InstantiationUI.NETWORK_WITH_PROPERTY_NETWORK_TECHNOLOGY_EQUALS_STANDARD_SRIOV_OR_OVS));
- assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper) , is(VidNotions.ModelCategory.IS_5G_PROVIDER_NETWORK_MODEL));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel), is(InstantiationUI.NETWORK_WITH_PROPERTY_NETWORK_TECHNOLOGY_EQUALS_STANDARD_SRIOV_OR_OVS));
+ assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper, serviceModel) , is(ModelCategory.IS_5G_PROVIDER_NETWORK_MODEL));
}
@NotNull
- protected ISdcCsarHelper mockForNonLegacyInstantiationUI() {
+ private ISdcCsarHelper mockForNonLegacyInstantiationUI() {
ISdcCsarHelper csarHelper = ToscaParserImpl2Test.getMockedSdcCsarHelper(UUID.randomUUID().toString());
NodeTemplate nodeTemplate = mock(NodeTemplate.class);
@@ -98,15 +109,16 @@
@DataProvider
public static Object[][] anyAlacarteDataProvider() {
return new Object[][] {
- {"A-La-Carte", VidNotions.InstantiationUI.ANY_ALACARTE_NEW_UI},
- {"Macro", VidNotions.InstantiationUI.LEGACY},
+ {"A-La-Carte", InstantiationUI.ANY_ALACARTE_NEW_UI},
+ {"Macro", InstantiationUI.LEGACY},
};
}
@Test(dataProvider = "anyAlacarteDataProvider")
- public void FLAG_EXP_ANY_ALACARTE_NEW_INSTANTIATION_UI_is_active_UIHintIsPositive(String instantiationType, VidNotions.InstantiationUI expectedInstantiationUI) {
+ public void FLAG_EXP_ANY_ALACARTE_NEW_INSTANTIATION_UI_is_active_UIHintIsPositive(String instantiationType, InstantiationUI expectedInstantiationUI) {
+ initServiceModelAndscarHelperWithMocks();
+
when(featureManagerMock.isActive(Features.FLAG_EXP_ANY_ALACARTE_NEW_INSTANTIATION_UI)).thenReturn(true);
- ISdcCsarHelper csarHelper = ToscaParserImpl2Test.getMockedSdcCsarHelper(UUID.randomUUID().toString());
when(csarHelper.getServiceMetadata()).thenReturn(new Metadata(ImmutableMap.of(
"instantiationType", instantiationType
)));
@@ -119,12 +131,12 @@
when(csarHelper.getServiceVlList()).thenReturn(ImmutableList.of(nodeTemplate));
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper), is(expectedInstantiationUI));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel), is(expectedInstantiationUI));
}
@Test
public void VLNetworkWithPropertyNetworkTechnologyNot5G_UIHintIsNegative() {
- ISdcCsarHelper csarHelper = ToscaParserImpl2Test.getMockedSdcCsarHelper(UUID.randomUUID().toString());
+ initServiceModelAndscarHelperWithMocks();
NodeTemplate nodeTemplate = mock(NodeTemplate.class);
@@ -135,85 +147,91 @@
when(csarHelper.getServiceVlList()).thenReturn(ImmutableList.of(nodeTemplate));
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper), is(VidNotions.InstantiationUI.LEGACY));
- assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper) , is(VidNotions.ModelCategory.OTHER));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel), is(InstantiationUI.LEGACY));
+ assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper, serviceModel) , is(ModelCategory.OTHER));
}
@Test
- public void withoutMocks_givenZippedToscaFile_hasAnyNetworkWithPropertyEqualsToAnyOfYieldsTrue() throws SdcToscaParserException {
- SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
- ISdcCsarHelper csarHelper = factory.getSdcCsarHelper(getClass().getClassLoader().getResource("service-vl-csar.zip").getPath(),false);
-
+ public void withoutMocks_givenZippedToscaFile_hasAnyNetworkWithPropertyEqualsToAnyOfYieldsTrue() throws SdcToscaParserException, IOException {
+ initServiceModelAndscarHelperWithRealCsar("/csars/service-vl-csar.zip");
assertThat(vidNotionsBuilder.isALaCarte(csarHelper), is(false));
assertThat(vidNotionsBuilder.hasAnyNetworkWithPropertyEqualsToAnyOf(csarHelper, "unexpected_property_name"), is(false));
assertThat(vidNotionsBuilder.hasAnyNetworkWithPropertyEqualsToAnyOf(csarHelper, "network_technology","Standard-SR-IOV"), is(true));
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper), is(VidNotions.InstantiationUI.LEGACY));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel), is(InstantiationUI.LEGACY));
}
- //@Test
- //public void withoutMocks_givenZippedToscaFile_hasFabricConfigurationYieldsTrue() throws SdcToscaParserException {
- // SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
- // ISdcCsarHelper csarHelper = factory.getSdcCsarHelper(getClass().getClassLoader().getResource("service-fabric-configuration.zip").getPath(),false);
- //
- // assertThat(vidNotionsBuilder.isALaCarte(csarHelper), is(false));
- // assertThat(vidNotionsBuilder.hasFabricConfiguration(csarHelper), is(true));
- // assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper), is(VidNotions.InstantiationUI.LEGACY));
- //}
+ @Test
+ public void withoutMocks_givenZippedToscaFile_hasFabricConfigurationYieldsTrue() throws SdcToscaParserException, IOException {
+ initServiceModelAndscarHelperWithRealCsar("/csars/service-fabric-configuration.zip");
+ assertThat(vidNotionsBuilder.isALaCarte(csarHelper), is(false));
+ assertThat(vidNotionsBuilder.hasFabricConfiguration(csarHelper), is(true));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel), is(InstantiationUI.LEGACY));
+ }
+ @Test(dataProvider = "trueAndFalse", dataProviderClass = TestUtils.class)
+ public void withoutMocks_givenZippedToscaFileOfTransportService_InstantiationUIAndCategoryAreRight(boolean flagValue) throws SdcToscaParserException, IOException {
+ initServiceModelAndscarHelperWithRealCsar("/csars/csarTransportWithPnfs.zip");
+
+ when(featureManagerMock.isActive(Features.FLAG_1908_TRANSPORT_SERVICE_NEW_INSTANTIATION_UI)).thenReturn(flagValue);
+
+ assertThat(vidNotionsBuilder.isALaCarte(csarHelper), is(false));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel), is(flagValue ? InstantiationUI.TRANSPORT_SERVICE : InstantiationUI.LEGACY));
+ assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper, serviceModel), is(ModelCategory.Transport));
+ }
+
+ @Test(dataProvider = "trueAndFalse", dataProviderClass = TestUtils.class)
+ public void withoutMocks_givenZippedToscaFileOfInfraStructureVpn_InstantiationUIIsRight(boolean flagValue) throws SdcToscaParserException, IOException {
+ initServiceModelAndscarHelperWithRealCsar("/csars/service-Infravpn-csar.zip");
+ when(featureManagerMock.isActive(Features.FLAG_1908_INFRASTRUCTURE_VPN)).thenReturn(flagValue);
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel), is(flagValue ? InstantiationUI.INFRASTRUCTURE_VPN : InstantiationUI.LEGACY));
+ assertThat(vidNotionsBuilder.suggestModelCategory(csarHelper, serviceModel), is(ModelCategory.INFRASTRUCTURE_VPN));
+ }
@Test
public void uuidIsExactly1ffce89fEtc_UIHintIsPositive() {
- ISdcCsarHelper csarHelper = ToscaParserImpl2Test.getMockedSdcCsarHelper(UUID.randomUUID().toString());
+ initServiceModelAndscarHelperWithMocks();
when(csarHelper.getServiceMetadata()).thenReturn(new Metadata(ImmutableMap.of(
"UUID", "95eb2c44-bff2-4e8b-ad5d-8266870b7717"
)));
when(featureManagerMock.isActive(Features.FLAG_5G_IN_NEW_INSTANTIATION_UI)).thenReturn(true);
- assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper), is(VidNotions.InstantiationUI.SERVICE_UUID_IS_1ffce89f_ef3f_4cbb_8b37_82134590c5de));
+ assertThat(vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel), is(InstantiationUI.SERVICE_UUID_IS_1ffce89f_ef3f_4cbb_8b37_82134590c5de));
}
-
- @DataProvider
- public static Object[][] trueAndFalse() {
- return new Object[][] {{true}, {false}};
- }
-
- @Test(dataProvider = "trueAndFalse")
+ @Test(dataProvider = "trueAndFalse", dataProviderClass = TestUtils.class)
public void buildVidNotions_nullByFlag(boolean flagValue) {
- ISdcCsarHelper csarHelper = ToscaParserImpl2Test.getMockedSdcCsarHelper(UUID.randomUUID().toString());
+ initServiceModelAndscarHelperWithMocks();
when(featureManagerMock.isActive(Features.FLAG_5G_IN_NEW_INSTANTIATION_UI)).thenReturn(flagValue);
- assertThat(vidNotionsBuilder.buildVidNotions(csarHelper, null), hasProperty("instantiationUI", is(VidNotions.InstantiationUI.LEGACY)));
+ assertThat(vidNotionsBuilder.buildVidNotions(csarHelper, serviceModel), hasProperty("instantiationUI", is(InstantiationUI.LEGACY)));
}
@DataProvider
public static Object[][] ServiceRoleTypesDataProvider() {
return new Object[][] {
- {"gROUPING", VidNotions.InstantiationUI.SERVICE_WITH_VNF_GROUPING},
- {"", VidNotions.InstantiationUI.LEGACY},
+ {"gROUPING", InstantiationUI.SERVICE_WITH_VNF_GROUPING},
+ {"", InstantiationUI.LEGACY},
};
}
@Test(dataProvider = "ServiceRoleTypesDataProvider")
- public void testGetViewEditUITypeForResourceGroup(String serviceRole, VidNotions.InstantiationUI expectedViewEditUI) {
- when(featureManagerMock.isActive(Features.FLAG_ASYNC_INSTANTIATION)).thenReturn(true);
+ public void testGetViewEditUITypeForResourceGroup(String serviceRole, InstantiationUI expectedViewEditUI) {
+ initServiceModelAndscarHelperWithMocks();
when(featureManagerMock.isActive(Features.FLAG_1902_VNF_GROUPING)).thenReturn(true);
- ISdcCsarHelper csarHelper = ToscaParserImpl2Test.getMockedSdcCsarHelper(UUID.randomUUID().toString());
when(csarHelper.getServiceMetadata()).thenReturn(new Metadata(ImmutableMap.of(
"serviceRole", serviceRole
)));
- assertThat(vidNotionsBuilder.suggestViewEditUI(csarHelper, null), is(expectedViewEditUI));
+ assertThat(vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel), is(expectedViewEditUI));
}
@DataProvider
public static Object[][] macroToViewEditDataProvider() {
return new Object[][] {
- {"macro service + not excluded + needed flags are open", true, false, true, true, VidNotions.InstantiationUI.MACRO_SERVICE},
- {"not macro service", false, false, true, true, VidNotions.InstantiationUI.LEGACY},
- {"macro that shall be excluded because it has pnf", true, true, true, true, VidNotions.InstantiationUI.LEGACY},
- {"macro service + FLAG_ASYNC_INSTANTIATION off", true, false, false, true, VidNotions.InstantiationUI.LEGACY},
- {"macro service + FLAG_1902_NEW_VIEW_EDIT off", true, false, true, false, VidNotions.InstantiationUI.LEGACY},
+ {"macro service + not excluded + needed flags are open", true, false, true, InstantiationUI.MACRO_SERVICE},
+ {"not macro service", false, true, true, InstantiationUI.LEGACY},
+ {"macro that shall be excluded because it has pnf", true, true, true, InstantiationUI.LEGACY},
+ {"macro service + FLAG_1902_NEW_VIEW_EDIT off", true, false, false, InstantiationUI.LEGACY},
};
}
@@ -222,19 +240,16 @@
String testDescription,
boolean isMacro,
boolean isExcluded,
- boolean isFlagAsyncInstantiationActive,
boolean isFlag1902NewViewEdit,
- VidNotions.InstantiationUI expectedViewEditUi) {
+ InstantiationUI expectedViewEditUi) {
- ISdcCsarHelper csarHelper = mock(ISdcCsarHelper.class);
- ServiceModel serviceModel = mock(ServiceModel.class);
+ initServiceModelAndscarHelperWithMocks();
//mock for is Macro
String instantiationType = isMacro ? ToscaParserImpl2.Constants.MACRO : ToscaParserImpl2.Constants.A_LA_CARTE;
Service service = mock(Service.class);
when(serviceModel.getService()).thenReturn(service);
when(service.getInstantiationType()).thenReturn(instantiationType);
- when(featureManagerMock.isActive(Features.FLAG_ASYNC_INSTANTIATION)).thenReturn(isFlagAsyncInstantiationActive);
when(featureManagerMock.isActive(Features.FLAG_1902_NEW_VIEW_EDIT)).thenReturn(isFlag1902NewViewEdit);
//mock for isExcluded
@@ -242,17 +257,16 @@
when(serviceModel.getPnfs()).thenReturn(ImmutableMap.of("a", mock(Node.class)));
}
- VidNotions.InstantiationUI result = vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel);
+ InstantiationUI result = vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel);
assertEquals(expectedViewEditUi, result);
}
@DataProvider
public static Object[][] instantiationUIToViewEditDataProvider() {
return new Object[][] {
- {"network cloud(5G) service + needed flags are open", true, true, true, VidNotions.InstantiationUI.NETWORK_WITH_PROPERTY_NETWORK_TECHNOLOGY_EQUALS_STANDARD_SRIOV_OR_OVS},
- {"mocked service + needed flags are open", false, true, true, VidNotions.InstantiationUI.LEGACY},
- {"network cloud(5G) service + FLAG_ASYNC_INSTANTIATION is off", true, false, true, VidNotions.InstantiationUI.LEGACY},
- {"network cloud(5G) service + FLAG_1902_NEW_VIEW_EDIT is off", true, true, false, VidNotions.InstantiationUI.LEGACY},
+ {"network cloud(5G) service + needed flags are open", true, true, InstantiationUI.NETWORK_WITH_PROPERTY_NETWORK_TECHNOLOGY_EQUALS_STANDARD_SRIOV_OR_OVS},
+ {"mocked service + needed flags are open", false, true, InstantiationUI.LEGACY},
+ {"network cloud(5G) service + FLAG_1902_NEW_VIEW_EDIT is off", true, false, InstantiationUI.LEGACY},
};
}
@@ -261,12 +275,10 @@
public void whenInstantiationUIIsNotLegacy_viewEditIsRight(
String testDescription,
boolean isInstantiationUINotLegacy,
- boolean isFlagAsyncInstantiationActive,
boolean isFlag1902NewViewEdit,
- VidNotions.InstantiationUI expectedViewEditUi) {
+ InstantiationUI expectedViewEditUi) {
ISdcCsarHelper csarHelper = isInstantiationUINotLegacy ? mockForNonLegacyInstantiationUI() : mock(ISdcCsarHelper.class);
- when(featureManagerMock.isActive(Features.FLAG_ASYNC_INSTANTIATION)).thenReturn(isFlagAsyncInstantiationActive);
when(featureManagerMock.isActive(Features.FLAG_1902_NEW_VIEW_EDIT)).thenReturn(isFlag1902NewViewEdit);
ServiceModel serviceModel = mock(ServiceModel.class);
@@ -274,7 +286,7 @@
when(serviceModel.getService()).thenReturn(service);
when(service.getInstantiationType()).thenReturn(ToscaParserImpl2.Constants.A_LA_CARTE);
- VidNotions.InstantiationUI result = vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel);
+ InstantiationUI result = vidNotionsBuilder.suggestViewEditUI(csarHelper, serviceModel);
assertEquals(expectedViewEditUi, result);
}
@@ -282,7 +294,7 @@
public static Object[][] mockerForMacroExcluded() {
return new Object[][] {
{"service with pnfs", (BiConsumer<ServiceModel, FeatureManager>) (serviceModel, fm)->when(serviceModel.getPnfs()).thenReturn(ImmutableMap.of("a", mock(Node.class))), true},
- {"service with collection resource", (BiConsumer<ServiceModel, FeatureManager>) (serviceModel, fm)->when(serviceModel.getCollectionResource()).thenReturn(ImmutableMap.of("a", mock(CR.class))), true},
+ {"service with collection resource", (BiConsumer<ServiceModel, FeatureManager>) (serviceModel, fm) -> when(serviceModel.getCollectionResources()).thenReturn(ImmutableMap.of("a", mock(CR.class))), true},
{"service with network + FLAG_NETWORK_TO_ASYNC_INSTANTIATION false ", (BiConsumer<ServiceModel, FeatureManager>) (serviceModel, fm)->{
when(serviceModel.getNetworks()).thenReturn(ImmutableMap.of("a", mock(Network.class)));
when(fm.isActive(Features.FLAG_NETWORK_TO_ASYNC_INSTANTIATION)).thenReturn(false);}
@@ -290,7 +302,7 @@
{"service with network + FLAG_NETWORK_TO_ASYNC_INSTANTIATION true", (BiConsumer<ServiceModel, FeatureManager>) (serviceModel, fm)->{
when(serviceModel.getNetworks()).thenReturn(ImmutableMap.of("a", mock(Network.class)));
when(fm.isActive(Features.FLAG_NETWORK_TO_ASYNC_INSTANTIATION)).thenReturn(true);}
- , false},
+ , false},
{"empty service + FLAG_NETWORK_TO_ASYNC_INSTANTIATION false", (BiConsumer<ServiceModel, FeatureManager>) (serviceModel, fm)->when(fm.isActive(Features.FLAG_NETWORK_TO_ASYNC_INSTANTIATION)).thenReturn(false), false},
};
}
@@ -302,9 +314,197 @@
assertEquals(shallBeExcluded, vidNotionsBuilder.isMacroExcludedFromAsyncFlow(serviceModel));
}
+ @DataProvider
+ public static Object[][] toscaParserInstantiationTypeToVidNotion() {
+ return new Object[][] {
+ {ToscaParserImpl2.Constants.MACRO, InstantiationType.Macro},
+ {ToscaParserImpl2.Constants.A_LA_CARTE, InstantiationType.ALaCarte},
+ {ToscaParserImpl2.Constants.CLIENT_CONFIG, InstantiationType.ClientConfig},
+ {"I dont know", InstantiationType.ClientConfig},
+ {"", InstantiationType.ClientConfig}
+ };
+ }
+ @Test(dataProvider="toscaParserInstantiationTypeToVidNotion")
+ public void testSuggestInstantiationTypeWhenInstantiationUiLegacy(String toscaParserInstantiationType, InstantiationType expectedInstantiationType) {
+ ServiceModel serviceModel = mock(ServiceModel.class);
+ Service service = mock(Service.class);
+ when(serviceModel.getService()).thenReturn(service);
+ when(service.getInstantiationType()).thenReturn(toscaParserInstantiationType);
+ assertEquals(expectedInstantiationType, vidNotionsBuilder.suggestInstantiationType(serviceModel, ModelCategory.OTHER));
+ }
+ @DataProvider
+ public static Object[][] instantiationUIAndFeatureFlagsForInstantiationType() {
+ return new Object[][] {
+ {ModelCategory.Transport, Features.FLAG_1908_TRANSPORT_SERVICE_NEW_INSTANTIATION_UI, true, InstantiationType.Macro},
+ {ModelCategory.Transport, Features.FLAG_1908_TRANSPORT_SERVICE_NEW_INSTANTIATION_UI, false, InstantiationType.ALaCarte},
+ {ModelCategory.INFRASTRUCTURE_VPN, Features.FLAG_1908_INFRASTRUCTURE_VPN, true, InstantiationType.Macro},
+ {ModelCategory.INFRASTRUCTURE_VPN, Features.FLAG_1908_INFRASTRUCTURE_VPN, false, InstantiationType.ALaCarte},
+ {ModelCategory.OTHER, Features.FLAG_1908_INFRASTRUCTURE_VPN, true, InstantiationType.ALaCarte}, //not mapped InstantiationUI
+ };
+ }
+ @Test(dataProvider="instantiationUIAndFeatureFlagsForInstantiationType")
+ public void testSuggestInstantiationTypeByModelCategoryAndFeatureFlags(
+ ModelCategory instantiationUI,
+ Features featureFlag,
+ boolean isFeatureOn,
+ InstantiationType expectedInstantiationType) {
+ ServiceModel serviceModel = mock(ServiceModel.class);
+ Service service = mock(Service.class);
+ when(serviceModel.getService()).thenReturn(service);
+ when(service.getInstantiationType()).thenReturn(ToscaParserImpl2.Constants.A_LA_CARTE);
+ when(featureManagerMock.isActive(featureFlag)).thenReturn(isFeatureOn);
+ assertEquals(expectedInstantiationType, vidNotionsBuilder.suggestInstantiationType(serviceModel, instantiationUI));
+ }
+ @DataProvider
+ public static Object[][] FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UIValueAndCollectionResourceForVidNotions() {
+ return new Object[][] {
+ {true, ImmutableMap.of("Some string", mock(CR.class)), InstantiationUI.SERVICE_WITH_COLLECTION_RESOURCE, ModelCategory.SERVICE_WITH_COLLECTION_RESOURCE},
+ {true, Collections.EMPTY_MAP, InstantiationUI.LEGACY, ModelCategory.OTHER},
+ {true, null, InstantiationUI.LEGACY, ModelCategory.OTHER},
+ {false, ImmutableMap.of("Some string", mock(CR.class)), InstantiationUI.LEGACY, ModelCategory.SERVICE_WITH_COLLECTION_RESOURCE},
+ {false, Collections.EMPTY_MAP, InstantiationUI.LEGACY, ModelCategory.OTHER},
+ {false, null, InstantiationUI.LEGACY, ModelCategory.OTHER}
+ };
+ }
-}
+ @Test(dataProvider="FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UIValueAndCollectionResourceForVidNotions")
+ public void testSuggestInstantiationUiAndModelCategoryByCollectionResourceAndFeatureFlag_FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI(
+ boolean featureFlagValue,
+ Map<String, CR> collectionResource,
+ VidNotions.InstantiationUI expectedInstantiationUi,
+ VidNotions.ModelCategory expectedModelCategory) {
+ initServiceModelAndscarHelperWithMocks();
+
+ Service service = mock(Service.class);
+ when(service.getInstantiationType()).thenReturn(ToscaParserImpl2.Constants.MACRO);
+ when(serviceModel.getService()).thenReturn(service);
+ when(serviceModel.getCollectionResources()).thenReturn(collectionResource);
+ when(featureManagerMock.isActive(Features.FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI)).thenReturn(featureFlagValue);
+ VidNotions vidNotions = vidNotionsBuilder.buildVidNotions(csarHelper, serviceModel);
+ assertEquals(expectedInstantiationUi, vidNotions.getInstantiationUI());
+ assertEquals(expectedModelCategory, vidNotions.getModelCategory());
+ assertEquals(InstantiationUI.LEGACY, vidNotions.getViewEditUI());
+ assertEquals(InstantiationType.Macro, vidNotions.getInstantiationType());
+ }
+
+ @DataProvider
+ public static Object[][] givenCollectionResourceServiceDataProvider() {
+ return new Object[][]{
+ {false, true, InstantiationUI.LEGACY},
+ {true, false, InstantiationUI.LEGACY},
+ {true, true, InstantiationUI.SERVICE_WITH_COLLECTION_RESOURCE}
+ };
+ }
+
+ @Test(dataProvider = "givenCollectionResourceServiceDataProvider")
+ public void givenCollectionResourceService_whenSuggestViewEdit_thenResultAccordingFeatureFlag(
+ boolean crFlag, boolean resumeFlag, VidNotions.InstantiationUI expectedViewEditUi) {
+
+ //mock service with CR
+ ServiceModel mockServiceModel = mock(ServiceModel.class);
+ when(mockServiceModel.getCollectionResources()).thenReturn(ImmutableMap.of("a", mock(CR.class)));
+
+ //mock feature flags
+ when(featureManagerMock.isActive(Features.FLAG_1908_COLLECTION_RESOURCE_NEW_INSTANTIATION_UI)).thenReturn(crFlag);
+ when(featureManagerMock.isActive(Features.FLAG_1908_RESUME_MACRO_SERVICE)).thenReturn(resumeFlag);
+
+ assertEquals(expectedViewEditUi, vidNotionsBuilder.suggestViewEditUI(mock(ISdcCsarHelper.class), mockServiceModel));
+ }
+
+ @Test
+ public void whenServiceModelIsNull_thenInstantiationTypeIsClientConfig() {
+ assertEquals( InstantiationType.ClientConfig, vidNotionsBuilder.suggestInstantiationType(null, ModelCategory.OTHER));
+ }
+
+ @Test
+ public void whenServiceInServiceModelIsNull_thenInstantiationTypeIsClientConfig() {
+ assertEquals( InstantiationType.ClientConfig, vidNotionsBuilder.suggestInstantiationType(mock(ServiceModel.class), ModelCategory.OTHER));
+ }
+
+ @Test
+ public void whenInstantiationTypeInServiceModelIsNull_thenInstantiationTypeIsClientConfig() {
+ initServiceModelAndscarHelperWithMocks();
+ Service service = mock(Service.class);
+ when(serviceModel.getService()).thenReturn(service);
+ when(service.getInstantiationType()).thenReturn(null);
+ assertEquals( InstantiationType.ClientConfig, vidNotionsBuilder.suggestInstantiationType(serviceModel, ModelCategory.OTHER));
+ }
+
+ private void initServiceModelAndscarHelperWithRealCsar(String path) throws SdcToscaParserException, IOException {
+ Path csarPath = Paths.get(new File(getClass().getResource(path).getPath()).getCanonicalPath());
+ ToscaParserImpl2 toscaParser = new ToscaParserImpl2(vidNotionsBuilder);
+ org.onap.vid.asdc.beans.Service asdcServiceMetadata = mock(org.onap.vid.asdc.beans.Service.class);
+ when(asdcServiceMetadata.getVersion()).thenReturn("versions");
+ serviceModel = toscaParser.makeServiceModel(csarPath, asdcServiceMetadata);
+ csarHelper = toscaParser.getSdcCsarHelper(csarPath);
+ }
+
+ private void initServiceModelAndscarHelperWithMocks() {
+ csarHelper = ToscaParserImpl2Test.getMockedSdcCsarHelper(UUID.randomUUID().toString());
+ serviceModel = mock(ServiceModel.class);
+ }
+
+ @DataProvider
+ public static Object[][] VnfNcIndicationDataProvider() {
+ return new Object[][] {
+ {true, "VNF", InstantiationUI.A_LA_CARTE_VNF_SERVICE_ROLE},
+ {false, "VNF", InstantiationUI.LEGACY},
+ {false, "notVNF", InstantiationUI.LEGACY},
+ {true, null, InstantiationUI.LEGACY},
+ {true, "notVNF", InstantiationUI.LEGACY},
+ {true, "vnf", InstantiationUI.A_LA_CARTE_VNF_SERVICE_ROLE},
+ };
+ }
+
+ @Test (dataProvider = "VnfNcIndicationDataProvider")
+ public void whenServiceRoleVnf_thenInstantiationTypeNewUI(boolean flagOn, String serviceRole, InstantiationUI expectedViewEditUi){
+ initServiceModelAndscarHelperWithMocks();
+
+ when(featureManagerMock.isActive(Features.FLAG_1908_A_LA_CARTE_VNF_NEW_INSTANTIATION_UI)).thenReturn(flagOn);
+
+ when(csarHelper.getServiceMetadata()).thenReturn(new Metadata(serviceRole == null ?
+ emptyMap() : ImmutableMap.of(ToscaParserImpl2.Constants.SERVICE_ROLE, serviceRole)
+ ));
+
+ assertEquals(expectedViewEditUi, vidNotionsBuilder.suggestInstantiationUI(csarHelper, serviceModel));
+ }
+
+ private static NodeTemplate mockNodeTemplateChild(boolean withFabricConfiguration) {
+ NodeTemplate child = mock(NodeTemplate.class);
+ when(child.getType()).thenReturn(withFabricConfiguration ? ToscaParserImpl2.Constants.FABRIC_CONFIGURATION_TYPE : "nothing");
+ return child;
+ }
+
+ private static ISdcCsarHelper mockServiceNodeTemplates(ISdcCsarHelper csarHelper, ImmutableList<NodeTemplate> children) {
+ when(csarHelper.getNodeTemplateChildren(any())).thenReturn(children);
+
+ NodeTemplate parent = mock(NodeTemplate.class);
+ List<NodeTemplate> nodeTemplates = ImmutableList.of(parent);
+
+ when(csarHelper.getServiceNodeTemplates()).thenReturn(nodeTemplates);
+ return csarHelper;
+ }
+
+ @DataProvider
+ public static Object[][] csarHelpersForFabricConfiguration() {
+ ISdcCsarHelper csarHelperWithNoNodes = mock(ISdcCsarHelper.class);
+ when(csarHelperWithNoNodes.getServiceNodeTemplates()).thenReturn(emptyList());
+
+ return new Object[][] {
+ { "zero nodes", false, csarHelperWithNoNodes },
+ { "single node with no child", false, mockServiceNodeTemplates(mock(ISdcCsarHelper.class), ImmutableList.of()) },
+ { "single node with single fabric child", true, mockServiceNodeTemplates(mock(ISdcCsarHelper.class), ImmutableList.of(mockNodeTemplateChild(true))) },
+ { "single node with single fabric child and single non-fabric", true, mockServiceNodeTemplates(mock(ISdcCsarHelper.class), ImmutableList.of(
+ mockNodeTemplateChild(true), mockNodeTemplateChild(true))) },
+ };
+ }
+
+ @Test (dataProvider = "csarHelpersForFabricConfiguration")
+ public void hasFabricConfiguration(String desc, boolean shouldHaveFabricConfiguration, ISdcCsarHelper csarHelper) {
+ assertThat(desc, vidNotionsBuilder.hasFabricConfiguration(csarHelper), is(shouldHaveFabricConfiguration));
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/changeManagement/WorkflowRequestDetailTest.java b/vid-app-common/src/test/java/org/onap/vid/changeManagement/WorkflowRequestDetailTest.java
index 38f15d7..fbaa763 100644
--- a/vid-app-common/src/test/java/org/onap/vid/changeManagement/WorkflowRequestDetailTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/changeManagement/WorkflowRequestDetailTest.java
@@ -19,15 +19,17 @@
*/
package org.onap.vid.changeManagement;
-import org.testng.annotations.Test;
-
import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSetters;
import static org.hamcrest.MatcherAssert.assertThat;
+import org.onap.vid.testUtils.TestUtils;
+import org.testng.annotations.Test;
+
public class WorkflowRequestDetailTest {
@Test
public void shouldHaveProperSettersAndGetters() {
+ TestUtils.registerCloudConfigurationValueGenerator();
assertThat(WorkflowRequestDetail.class, hasValidGettersAndSetters());
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/config/DataSourceConfig.java b/vid-app-common/src/test/java/org/onap/vid/config/DataSourceConfig.java
index 43adc8c..15f849a 100644
--- a/vid-app-common/src/test/java/org/onap/vid/config/DataSourceConfig.java
+++ b/vid-app-common/src/test/java/org/onap/vid/config/DataSourceConfig.java
@@ -63,7 +63,7 @@
Resource[] mappingLocations = {
new ClassPathResource("WEB-INF/fusion/orm/Fusion.hbm.xml"),
new ClassPathResource("WEB-INF/fusion/orm/Workflow.hbm.xml"),
- new ClassPathResource("WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml")
+// new ClassPathResource("WEB-INF/fusion/orm/RNoteBookIntegration.hbm.xml")
};
sessionFactory.setHibernateProperties(properties);
diff --git a/vid-app-common/src/test/java/org/onap/vid/config/JobAdapterConfig.java b/vid-app-common/src/test/java/org/onap/vid/config/JobAdapterConfig.java
index 7462a32..149fad3 100644
--- a/vid-app-common/src/test/java/org/onap/vid/config/JobAdapterConfig.java
+++ b/vid-app-common/src/test/java/org/onap/vid/config/JobAdapterConfig.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.
@@ -21,33 +21,26 @@
package org.onap.vid.config;
-import org.hibernate.SessionFactory;
+import org.mockito.Mockito;
import org.onap.vid.job.JobAdapter;
-import org.onap.vid.job.JobsBrokerService;
import org.onap.vid.job.impl.JobAdapterImpl;
-import org.onap.vid.job.impl.JobsBrokerServiceInDatabaseImpl;
-import org.onap.vid.properties.VidProperties;
-import org.onap.portalsdk.core.service.DataAccessService;
-import org.onap.portalsdk.core.util.SystemProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.togglz.core.manager.FeatureManager;
@Configuration
@EnableTransactionManagement
public class JobAdapterConfig {
@Bean
- public JobAdapter jobAdapter() {
- return new JobAdapterImpl();
+ public FeatureManager featureManager() {
+ return Mockito.mock(FeatureManager.class);
}
@Bean
- public JobsBrokerService jobsBrokerService(DataAccessService dataAccessService, SessionFactory sessionFactory) {
- int maxOpenedInstantiationRequestsToMso = Integer.parseInt(SystemProperties.getProperty(VidProperties.MSO_MAX_OPENED_INSTANTIATION_REQUESTS));
- int pollingIntervalSeconds = Integer.parseInt(SystemProperties.getProperty(VidProperties.MSO_ASYNC_POLLING_INTERVAL_SECONDS));
-
- return new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, maxOpenedInstantiationRequestsToMso, pollingIntervalSeconds);
+ public JobAdapter jobAdapter(FeatureManager featureManager) {
+ return new JobAdapterImpl(featureManager);
}
-}
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java
index 1fc46ee..c4f7886 100644
--- a/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java
+++ b/vid-app-common/src/test/java/org/onap/vid/config/JobCommandsConfigWithMockedMso.java
@@ -28,6 +28,7 @@
import org.onap.vid.aai.util.SSLContextProvider;
import org.onap.vid.aai.util.ServletRequestHelper;
import org.onap.vid.aai.util.SystemPropertyHelper;
+import org.onap.vid.dal.AsyncInstantiationRepository;
import org.onap.vid.job.JobAdapter;
import org.onap.vid.job.JobsBrokerService;
import org.onap.vid.job.command.*;
@@ -52,8 +53,13 @@
}
@Bean
- public JobsBrokerService jobsBrokerService(DataAccessService dataAccessService, SessionFactory sessionFactory) {
- return new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, 200, 0);
+ public VersionService versionService() {
+ return Mockito.mock(VersionService.class);
+ }
+
+ @Bean
+ public JobsBrokerService jobsBrokerService(DataAccessService dataAccessService, SessionFactory sessionFactory, VersionService versionService) {
+ return new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, 200, 0,versionService);
}
@Bean
@@ -76,9 +82,10 @@
return new HttpsAuthClient("some random path", systemPropertyHelper, sslContextProvider, featureManager);
}
+
@Bean
- public JobAdapter jobAdapter() {
- return new JobAdapterImpl();
+ public JobAdapter jobAdapter(FeatureManager featureManager) {
+ return new JobAdapterImpl(featureManager);
}
@Bean
@@ -100,119 +107,159 @@
}
@Bean
- public AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic(DataAccessService dataAccessService,
- JobAdapter jobAdapter,
+ public MsoRequestBuilder msoRequestHandlerService(AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ CloudOwnerService cloudOwnerService,
+ AaiClientInterface aaiClient,
+ FeatureManager featureManager) {
+ return new MsoRequestBuilder(asyncInstantiationBusinessLogic, cloudOwnerService, aaiClient, featureManager);
+ }
+ @Bean
+ public AsyncInstantiationRepository asyncInstantiationRepository(DataAccessService dataAccessService) {
+ return new AsyncInstantiationRepository(dataAccessService);
+ }
+
+ @Bean
+ public AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic(JobAdapter jobAdapter,
JobsBrokerService jobsBrokerService,
SessionFactory sessionFactory,
AaiClientInterface aaiClient,
FeatureManager featureManager,
- CloudOwnerService cloudOwnerService) {
- return new AsyncInstantiationBusinessLogicImpl(dataAccessService, jobAdapter, jobsBrokerService, sessionFactory, aaiClient, featureManager, cloudOwnerService);
+ CloudOwnerService cloudOwnerService,
+ AsyncInstantiationRepository asyncInstantiationRepository,
+ AuditService auditService) {
+ return new AsyncInstantiationBusinessLogicImpl(jobAdapter, jobsBrokerService, sessionFactory, aaiClient, featureManager, cloudOwnerService, asyncInstantiationRepository, auditService);
}
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public MacroServiceInstantiationCommand serviceInstantiationCommand() {
- return new MacroServiceInstantiationCommand();
- }
-
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public ServiceInProgressStatusCommand inProgressStatusCommand() {
- return new ServiceInProgressStatusCommand();
- }
-
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public ALaCarteServiceInstantiationCommand aLaCarteServiceInstantiationCommand() {
- return new ALaCarteServiceInstantiationCommand();
- }
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public ALaCarteServiceCommand aLaCarteServiceCommand(
AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
JobsBrokerService jobsBrokerService,
+ MsoRequestBuilder msoRequestBuilder,
MsoResultHandlerService msoResultHandlerService,
JobAdapter jobAdapter,
InProgressStatusService inProgressStatusService,
WatchChildrenJobsBL watchChildrenJobsBL,
- RestMsoImplementation restMso) {
- return new ALaCarteServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoResultHandlerService, jobAdapter, restMso);
+ RestMsoImplementation restMso,
+ AuditService auditService) {
+ return new ALaCarteServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService);
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+ public MacroServiceCommand macroServiceCommand(
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ JobsBrokerService jobsBrokerService,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ JobAdapter jobAdapter,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ RestMsoImplementation restMso,
+ AuditService auditService) {
+ return new MacroServiceCommand(inProgressStatusService, watchChildrenJobsBL, asyncInstantiationBusinessLogic, jobsBrokerService, msoRequestBuilder, msoResultHandlerService, jobAdapter, restMso, auditService);
+ }
+
+
+ @Bean
+ @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+ public NetworkCommand networkCommand(
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ RestMsoImplementation restMso,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter) {
+ return new NetworkCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService,
+ inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter);
+ }
+ @Bean
+ @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
public InstanceGroupCommand instanceGroupCommand(
AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
- MsoResultHandlerService msoResultHandlerService, InProgressStatusService inProgressStatusService,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
WatchChildrenJobsBL watchChildrenJobsBL,
- RestMsoImplementation restMso) {
- return new InstanceGroupCommand(asyncInstantiationBusinessLogic, restMso, msoResultHandlerService, inProgressStatusService, watchChildrenJobsBL);
+ RestMsoImplementation restMso,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter) {
+ return new InstanceGroupCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter);
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public VnfInstantiationCommand vnfInstantiationCommand() {
- return new VnfInstantiationCommand();
+ public InstanceGroupMemberCommand instanceGroupMemberCommand (
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ RestMsoImplementation restMso,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter) {
+ return new InstanceGroupMemberCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService, inProgressStatusService,
+ watchChildrenJobsBL, jobsBrokerService, jobAdapter);
+ }
+
+
+ @Bean
+ @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
+ public VnfCommand VnfCommand(
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ RestMsoImplementation restMso,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter,
+ FeatureManager featureManager) {
+ return new VnfCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService,
+ inProgressStatusService, watchChildrenJobsBL, jobsBrokerService ,jobAdapter,
+ featureManager);
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public VolumeGroupInstantiationCommand volumeGroupInstantiationCommand() {
- return new VolumeGroupInstantiationCommand();
+ public VolumeGroupCommand volumeGroupCommand(
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ RestMsoImplementation restMso,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter) {
+ return new VolumeGroupCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService,
+ inProgressStatusService, watchChildrenJobsBL, jobsBrokerService ,jobAdapter);
}
@Bean
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public WatchingCommandBaseModule watchingCommandBaseModule() {
- return new WatchingCommandBaseModule();
+ public VfmoduleCommand VfmoduleCommand(
+ AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic,
+ RestMsoImplementation restMso,
+ MsoRequestBuilder msoRequestBuilder,
+ MsoResultHandlerService msoResultHandlerService,
+ InProgressStatusService inProgressStatusService,
+ WatchChildrenJobsBL watchChildrenJobsBL,
+ JobsBrokerService jobsBrokerService,
+ JobAdapter jobAdapter) {
+ return new VfmoduleCommand(asyncInstantiationBusinessLogic, restMso, msoRequestBuilder, msoResultHandlerService,
+ inProgressStatusService, watchChildrenJobsBL, jobsBrokerService, jobAdapter);
+ }
+ @Bean
+ public AuditService auditService(RestMsoImplementation msoClient, AsyncInstantiationRepository asyncInstantiationRepository) {
+ return new AuditServiceImpl(msoClient, asyncInstantiationRepository);
}
@Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public VolumeGroupInProgressStatusCommand volumeGroupInProgressStatusCommand() {
- return new VolumeGroupInProgressStatusCommand();
- }
-
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public VfmoduleInstantiationCommand vfmoduleInstantiationCommand() {
- return new VfmoduleInstantiationCommand();
- }
-
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public WatchingCommand watchingCommandCommand() {
- return new WatchingCommand();
- }
-
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public ResourceInProgressStatusCommand resourceInProgressStatusCommand() {
- return new ResourceInProgressStatusCommand();
- }
-
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public VnfInProgressStatusCommand vnfInProgressStatusCommand() {
- return new VnfInProgressStatusCommand();
- }
-
- @Bean
- @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
- public InstanceGroupInstantiationCommand instanceGroupInstantiationCommand() {
- return new InstanceGroupInstantiationCommand();
- }
-
- @Bean
- public AuditService auditService(AsyncInstantiationBusinessLogic asyncInstantiationBL, RestMsoImplementation msoClient) {
- return new AuditServiceImpl(asyncInstantiationBL, msoClient);
- }
-
- @Bean
- public InProgressStatusService inProgressStatusService(AsyncInstantiationBusinessLogic asyncInstantiationBL, RestMsoImplementation restMso, AuditService auditService) {
- return new InProgressStatusService(asyncInstantiationBL, restMso, auditService);
+ public InProgressStatusService inProgressStatusService(AsyncInstantiationBusinessLogic asyncInstantiationBL, RestMsoImplementation restMso, AuditService auditService, FeatureManager featureManager) {
+ return new InProgressStatusService(asyncInstantiationBL, restMso, auditService, featureManager);
}
@Bean
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
index a60aa7e..2377c80 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/AaiControllerTest.java
@@ -21,8 +21,14 @@
package org.onap.vid.controller;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.ArgumentMatchers.booleanThat;
import static org.mockito.BDDMockito.given;
import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.post;
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
@@ -34,13 +40,16 @@
import com.google.common.collect.ImmutableMultimap;
import com.google.common.collect.Lists;
import com.google.common.collect.Multimap;
+import java.io.IOException;
import java.util.Map;
import java.util.UUID;
+import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.core.Response;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.vid.aai.AaiResponse;
import org.onap.vid.aai.AaiResponseTranslator.PortMirroringConfigData;
@@ -53,14 +62,18 @@
import org.onap.vid.aai.model.PortDetailsTranslator.PortDetailsError;
import org.onap.vid.aai.model.PortDetailsTranslator.PortDetailsOk;
import org.onap.vid.aai.util.AAIRestInterface;
+import org.onap.vid.properties.Features;
+import org.onap.vid.roles.Role;
import org.onap.vid.model.VersionByInvariantIdsRequest;
import org.onap.vid.roles.RoleProvider;
+import org.onap.vid.roles.RoleValidator;
import org.onap.vid.services.AaiService;
import org.onap.vid.utils.SystemPropertiesWrapper;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
+import org.togglz.core.manager.FeatureManager;
@RunWith(MockitoJUnitRunner.class)
public class AaiControllerTest {
@@ -76,12 +89,16 @@
private RoleProvider roleProvider;
@Mock
private SystemPropertiesWrapper systemPropertiesWrapper;
+
+ @Mock
+ private FeatureManager featureManager;
+
private MockMvc mockMvc;
private AaiController aaiController;
@Before
public void setUp() {
- aaiController = new AaiController(aaiService, aaiRestInterface, roleProvider, systemPropertiesWrapper);
+ aaiController = new AaiController(aaiService, aaiRestInterface, roleProvider, systemPropertiesWrapper, featureManager);
mockMvc = MockMvcBuilders.standaloneSetup(aaiController).build();
}
@@ -248,5 +265,42 @@
.andExpect(status().isOk())
.andExpect(content().string(expectedResponse));
}
+
+ @Test
+ public void getSubscriberDetailsOmitServiceInstances_reduceDepthEnabledAndOmitQueryParam() throws IOException {
+ getSubscriberDetailsOmitServiceInstances("some subscriber id",
+ true, true, true);
+ }
+
+ @Test
+ public void getSubscriberDetailsOmitServiceInstances_reduceDepthDisabledAndOmitQueryParam() throws IOException {
+ getSubscriberDetailsOmitServiceInstances("another-subscriber-id-123",
+ false, true, false);
+ }
+
+ @Test
+ public void getSubscriberDetailsOmitServiceInstances_reduceDepthDisabled() throws IOException {
+ getSubscriberDetailsOmitServiceInstances("123-456-789-123-345-567-6",
+ false, false, false);
+ }
+
+ @Test
+ public void getSubscriberDetailsOmitServiceInstances_reduceDepthEnabled() throws IOException {
+ getSubscriberDetailsOmitServiceInstances("0000000000000000000000000",
+ true, false, false);
+ }
+
+ private void getSubscriberDetailsOmitServiceInstances(String subscriberId, boolean isFlag1906AaiSubDetailsReduceDepthEnabled,
+ boolean omitServiceInstancesQueryParam, boolean omitServiceInstancesExpectedGetSubscriberDataParam) throws IOException {
+ when(featureManager.isActive(Features.FLAG_1906_AAI_SUB_DETAILS_REDUCE_DEPTH)).thenReturn(isFlag1906AaiSubDetailsReduceDepthEnabled);
+ HttpServletRequest request = mock(HttpServletRequest.class);
+ when(roleProvider.getUserRoles(request)).thenReturn(ImmutableList.of(mock(Role.class), mock(Role.class)));
+ AaiResponse subscriberData = mock(AaiResponse.class);
+ when(subscriberData.getT()).thenReturn(null);
+ when(subscriberData.getHttpCode()).thenReturn(200);
+ when(aaiService.getSubscriberData(any(), any(), anyBoolean())).thenReturn(subscriberData);
+ aaiController.getSubscriberDetails(request, subscriberId, omitServiceInstancesQueryParam);
+ verify(aaiService).getSubscriberData(argThat(subscriberId::equals), any(RoleValidator.class), booleanThat(b -> omitServiceInstancesExpectedGetSubscriberDataParam == b));
+ }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/AaiServiceInstanceStandardQueryControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/AaiServiceInstanceStandardQueryControllerTest.java
index 2a8db96..b036b47 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/AaiServiceInstanceStandardQueryControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/AaiServiceInstanceStandardQueryControllerTest.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.
@@ -20,18 +20,20 @@
package org.onap.vid.controller;
-import org.mockito.Answers;
+import com.google.common.collect.ImmutableList;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.onap.vid.aai.util.ServiceInstanceStandardQuery;
import org.onap.vid.asdc.AsdcCatalogException;
import org.onap.vid.model.Service;
import org.onap.vid.model.ServiceModel;
import org.onap.vid.model.VidNotions;
import org.onap.vid.model.VidNotions.ModelCategory;
+import org.onap.vid.model.aaiTree.AAITreeNode;
import org.onap.vid.properties.Features;
+import org.onap.vid.services.AAIServiceTree;
import org.onap.vid.services.VidService;
+import org.springframework.http.HttpMethod;
import org.springframework.mock.web.MockHttpServletRequest;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeClass;
@@ -56,8 +58,9 @@
@Mock
private VidService sdcService;
- @Mock(answer = Answers.RETURNS_MOCKS)
- private ServiceInstanceStandardQuery serviceInstanceStandardQuery;
+ @Mock
+ private AAIServiceTree aaiServiceTree;
+
//Don't use initMocks with @BeforeMethod
//because AaiServiceInstanceStandardQueryController contains final members that can not be injected twice
@@ -69,7 +72,7 @@
@AfterMethod
public void resetMocks() {
- reset(sdcService, featureManager, serviceInstanceStandardQuery);
+ reset(sdcService, featureManager);
}
@Test
@@ -80,13 +83,14 @@
// - assert that AAI was accessed
when(featureManager.isActive(Features.FLAG_PRESENT_PROVIDER_NETWORKS_ASSOCIATIONS)).thenReturn(true);
+ when(aaiServiceTree.buildAAITree(any(), any(), any(HttpMethod.class), any(), anyBoolean())).thenReturn(ImmutableList.of(mock(AAITreeNode.class)));
final UUID randomModelUuid = UUID.randomUUID();
mockServiceModel(ModelCategory.IS_5G_PROVIDER_NETWORK_MODEL, randomModelUuid);
doGetNetworksToVlansByServiceInstance(randomModelUuid);
- verify(serviceInstanceStandardQuery).fetchServiceInstance(any(), any(), any());
+ verify(aaiServiceTree).buildAAITree(any(), any(), any(HttpMethod.class), any(), anyBoolean());
}
@Test
@@ -103,7 +107,7 @@
mockServiceModel(ModelCategory.OTHER, randomModelUuid);
assertThat(doGetNetworksToVlansByServiceInstance(randomModelUuid).serviceNetworks, hasSize(0));
- verifyZeroInteractions(serviceInstanceStandardQuery);
+ verifyZeroInteractions(aaiServiceTree);
}
@Test
@@ -123,7 +127,7 @@
Service mockedService = mock(Service.class);
when(mockedModel.getService()).thenReturn(mockedService);
when(mockedService.getVidNotions()).thenReturn(
- new VidNotions(instantiationUI, modelCategory, VidNotions.InstantiationUI.LEGACY)
+ new VidNotions(instantiationUI, modelCategory, VidNotions.InstantiationUI.LEGACY, VidNotions.InstantiationType.ALaCarte)
);
when(sdcService.getService(randomModelUuid.toString())).thenReturn(mockedModel);
@@ -137,4 +141,4 @@
"my service type",
"my instance id");
}
-}
+}
\ No newline at end of file
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 7e50c89..701f1c6 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
@@ -44,6 +44,7 @@
import javax.servlet.ServletContext;
import java.io.File;
+import java.util.concurrent.ExecutorService;
@Configuration
public class LocalWebConfig {
@@ -66,8 +67,8 @@
@Bean
public AaiService getAaiService(AaiClientInterface aaiClient, AaiOverTLSClientInterface aaiOverTLSClient,
- AaiResponseTranslator aaiResponseTranslator, AAITreeNodeBuilder aaiTreeNode, AAIServiceTree aaiServiceTree) {
- return new AaiServiceImpl(aaiClient, aaiOverTLSClient, aaiResponseTranslator, aaiTreeNode, aaiServiceTree);
+ AaiResponseTranslator aaiResponseTranslator, AAITreeNodeBuilder aaiTreeNode, AAIServiceTree aaiServiceTree, ExecutorService executorService) {
+ return new AaiServiceImpl(aaiClient, aaiOverTLSClient, aaiResponseTranslator, aaiTreeNode, aaiServiceTree, executorService);
}
@Bean
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerNewTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerNewTest.java
index a5222dd..43edeeb 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerNewTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerNewTest.java
@@ -20,24 +20,24 @@
package org.onap.vid.controller;
+import static org.mockito.Mockito.mock;
+
+import javax.servlet.http.HttpServletRequest;
import org.junit.Test;
import org.onap.vid.mso.MsoBusinessLogicImpl;
import org.onap.vid.mso.MsoInterface;
+import org.onap.vid.mso.rest.MsoRestClientNew;
import org.onap.vid.mso.rest.RequestDetails;
import org.onap.vid.mso.rest.RequestDetailsWrapper;
import org.onap.vid.services.CloudOwnerServiceImpl;
import org.springframework.http.ResponseEntity;
-import org.togglz.core.manager.FeatureManager;
-
-import javax.servlet.http.HttpServletRequest;
-
-import static org.mockito.Mockito.mock;
public class MsoControllerNewTest {
private MsoController createTestSubject() {
try {
- return new MsoController(new MsoBusinessLogicImpl(mock(MsoInterface.class),mock(FeatureManager.class)), new CloudOwnerServiceImpl(null, null));
+ return new MsoController(new MsoBusinessLogicImpl(mock(MsoInterface.class)), mock(MsoRestClientNew.class),
+ new CloudOwnerServiceImpl(null, null));
} catch (Exception e) {
return null;
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java
index 02ab287..a1b4559 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/MsoControllerTest.java
@@ -46,6 +46,7 @@
import org.junit.Test;
import org.onap.vid.mso.MsoBusinessLogic;
import org.onap.vid.mso.MsoResponseWrapper;
+import org.onap.vid.mso.rest.MsoRestClientNew;
import org.onap.vid.mso.rest.Request;
import org.onap.vid.mso.rest.RequestDetails;
import org.onap.vid.mso.rest.Task;
@@ -66,12 +67,14 @@
private MockMvc mockMvc;
private MsoBusinessLogic msoBusinessLogic;
private CloudOwnerService cloudService;
+ private MsoRestClientNew msoRestClient;
@Before
public void setUp() {
msoBusinessLogic = mock(MsoBusinessLogic.class);
cloudService = mock(CloudOwnerService.class);
- MsoController msoController = new MsoController(msoBusinessLogic, cloudService);
+ msoRestClient = mock(MsoRestClientNew.class);
+ MsoController msoController = new MsoController(msoBusinessLogic, msoRestClient, cloudService);
mockMvc = MockMvcBuilders.standaloneSetup(msoController).build();
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/ToscaParserMockHelper.java b/vid-app-common/src/test/java/org/onap/vid/controller/ToscaParserMockHelper.java
index 2eedee9..9e77e99 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/ToscaParserMockHelper.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/ToscaParserMockHelper.java
@@ -22,25 +22,21 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.module.kotlin.KotlinModule;
-import org.apache.commons.io.IOUtils;
-import org.apache.log4j.LogManager;
-import org.apache.log4j.Logger;
-import org.onap.vid.model.NewServiceModel;
-
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
+import org.apache.commons.io.IOUtils;
+import org.apache.log4j.LogManager;
+import org.apache.log4j.Logger;
+import org.onap.vid.model.ServiceModel;
-/**
- * Created by moriya1 on 04/07/2017.
- */
public class ToscaParserMockHelper {
private static final Logger logger = LogManager.getLogger(ToscaParserMockHelper.class);
private static final ObjectMapper om = new ObjectMapper();
private final String uuid;
private final String filePath;
- private final NewServiceModel newServiceModel;
+ private final ServiceModel serviceModel;
public ToscaParserMockHelper(String uuid, String filePath) throws IOException {
this.uuid = uuid;
@@ -50,7 +46,7 @@
logger.info(jsonFile);
String expectedJsonAsString = IOUtils.toString(jsonFile, StandardCharsets.UTF_8.name());
om.registerModule(new KotlinModule());
- this.newServiceModel = om.readValue(expectedJsonAsString, NewServiceModel.class);
+ this.serviceModel = om.readValue(expectedJsonAsString, ServiceModel.class);
}
public String getUuid() {
@@ -61,7 +57,7 @@
return filePath;
}
- public NewServiceModel getNewServiceModel() {
- return newServiceModel;
+ public ServiceModel getServiceModel() {
+ return serviceModel;
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java b/vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java
index 39d3cdd..484f4a0 100644
--- a/vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/controller/VidControllerTest.java
@@ -178,7 +178,7 @@
private ServiceModel createServiceModel(int i) {
ServiceModel model = new ServiceModel();
- model.setCollectionResource(ImmutableMap.of("resKey" + i, new CR()));
+ model.setCollectionResources(ImmutableMap.of("resKey" + i, new CR()));
model.setNetworks(ImmutableMap.of("network" + i, new Network()));
model.setPnfs(ImmutableMap.of("pnf" + i, new Node()));
model.setServiceProxies(ImmutableMap.of("servProxy" + i, new ServiceProxy()));
diff --git a/vid-app-common/src/test/java/org/onap/vid/dal/AsyncInstantiationRepositoryTest.java b/vid-app-common/src/test/java/org/onap/vid/dal/AsyncInstantiationRepositoryTest.java
new file mode 100644
index 0000000..be5a44e
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/dal/AsyncInstantiationRepositoryTest.java
@@ -0,0 +1,103 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.dal;
+
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
+import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
+import static org.hamcrest.core.IsEqual.equalTo;
+
+import com.google.common.collect.ImmutableList;
+import java.time.ZonedDateTime;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+import java.util.stream.Collectors;
+import javax.inject.Inject;
+import org.onap.portalsdk.core.service.DataAccessService;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.vid.config.DataSourceConfig;
+import org.onap.vid.config.MockedAaiClientAndFeatureManagerConfig;
+import org.onap.vid.job.Job;
+import org.onap.vid.model.ResourceInfo;
+import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
+import org.onap.vid.mso.rest.AsyncRequestStatus;
+import org.onap.vid.mso.rest.RequestStatus;
+import org.onap.vid.services.AsyncInstantiationBaseTest;
+import org.onap.vid.utils.TimeUtils;
+import org.springframework.test.context.ContextConfiguration;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+@ContextConfiguration(classes = {DataSourceConfig.class, SystemProperties.class, MockedAaiClientAndFeatureManagerConfig.class})
+public class AsyncInstantiationRepositoryTest extends AsyncInstantiationBaseTest {
+
+ @Inject
+ private DataAccessService dataAccessService;
+
+ @BeforeClass
+ void initServicesInfoService() {
+ createInstanceParamsMaps();
+ }
+
+ @Test
+ public void whenSaveNewRequest_thenRequestIsRetrieved() {
+ AsyncInstantiationRepository underTest = new AsyncInstantiationRepository(dataAccessService);
+ ServiceInstantiation serviceInstantiation = generateALaCarteWithVnfsServiceInstantiationPayload();
+ UUID jobUuid = UUID.randomUUID();
+ underTest.addJobRequest(jobUuid, serviceInstantiation);
+ ServiceInstantiation stored = underTest.getJobRequest(jobUuid);
+ assertThat(stored, jsonEquals(serviceInstantiation).when(IGNORING_ARRAY_ORDER));
+ }
+
+ private AsyncRequestStatus createAsyncRequestStatus(String message, String requestState){
+ RequestStatus requestStatus = new RequestStatus(requestState, message, TimeUtils.zonedDateTimeToString(ZonedDateTime.now()));
+ AsyncRequestStatus.Request request = new AsyncRequestStatus.Request(requestStatus);
+ return new AsyncRequestStatus(request);
+ }
+
+ @Test
+ public void getResourceInfoByRootJobId_returnsMapOfjobIdResources(){
+ AsyncInstantiationRepository underTest = new AsyncInstantiationRepository(dataAccessService);
+ UUID jobId1= UUID.randomUUID();
+ UUID jobId2= UUID.randomUUID();
+ AsyncRequestStatus errorMessage= createAsyncRequestStatus("MSO failed resource", "FAILED");
+ List<ResourceInfo> requestInfoList= ImmutableList.of(
+ new ResourceInfo("aaaaaa",jobId1, "64f3123a-f9a8-4591-b481-d662134bcb52", Job.JobStatus.COMPLETED, null),
+ new ResourceInfo("bbbbbb",jobId1, "65f3123a-f9a8-4591-b481-kodj9ig87gdu", Job.JobStatus.COMPLETED_WITH_ERRORS, null),
+ new ResourceInfo("dddddd",jobId1, null, Job.JobStatus.FAILED, null),
+ new ResourceInfo("cccccc",jobId1, null, Job.JobStatus.FAILED, errorMessage),
+ new ResourceInfo("eeeeee",jobId2, null, Job.JobStatus.FAILED, null),
+ new ResourceInfo("ffffff",jobId2, "66f3123a-f9a8-4591-b481-ghfgh6767567", Job.JobStatus.COMPLETED, null)
+ );
+ for(ResourceInfo info: requestInfoList){
+ underTest.saveResourceInfo(info);
+ }
+ Map<String, ResourceInfo> storedByTrackId = underTest.getResourceInfoByRootJobId(jobId1);
+ assertThat(storedByTrackId.values(), hasSize(4));
+ assertThat(storedByTrackId.get("aaaaaa").getInstanceId(), equalTo("64f3123a-f9a8-4591-b481-d662134bcb52"));
+ assertThat(storedByTrackId.get("cccccc").getErrorMessage().request.requestStatus.getStatusMessage(), equalTo("MSO failed resource"));
+ assertThat(storedByTrackId.get("cccccc").getErrorMessage().request.requestStatus.getRequestState(), equalTo("FAILED"));
+ assertThat(storedByTrackId.get("dddddd").getErrorMessage(), equalTo(null));
+ assertThat(storedByTrackId.values(), jsonEquals(requestInfoList.stream().filter(i-> i.getRootJobId().equals(jobId1)).collect(Collectors.toList())).when(IGNORING_ARRAY_ORDER));
+ }
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/CommandUtilsTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/CommandUtilsTest.java
index da300bf..ee43d1f 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/CommandUtilsTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/CommandUtilsTest.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.
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/InProgressStatusServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/InProgressStatusServiceTest.java
index c8772ee..125d2ed 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/InProgressStatusServiceTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/InProgressStatusServiceTest.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.
@@ -20,8 +20,10 @@
package org.onap.vid.job.command;
+import org.jetbrains.annotations.NotNull;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.onap.vid.job.Job;
import org.onap.vid.job.impl.JobSharedData;
@@ -29,11 +31,16 @@
import org.onap.vid.mso.RestMsoImplementation;
import org.onap.vid.mso.RestObject;
import org.onap.vid.mso.rest.AsyncRequestStatus;
-import org.onap.vid.services.AsyncInstantiationBaseTest;
+import org.onap.vid.properties.Features;
import org.onap.vid.services.AsyncInstantiationBusinessLogic;
+import org.onap.vid.services.AuditService;
+import org.onap.vid.services.AsyncInstantiationBaseTest;
+import org.onap.vid.testUtils.TestUtils;
import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import org.togglz.core.manager.FeatureManager;
import java.util.UUID;
import java.util.stream.Stream;
@@ -51,6 +58,12 @@
@Mock
private AsyncInstantiationBusinessLogic asyncInstantiationBL;
+ @Mock
+ private AuditService auditService;
+
+ @Mock
+ private FeatureManager featureManager;
+
@InjectMocks
private InProgressStatusService inProgressStatusService;
@@ -59,10 +72,16 @@
MockitoAnnotations.initMocks(this);
}
+ @BeforeMethod
+ public void resetMocks() {
+ Mockito.reset(restMso);
+ Mockito.reset(asyncInstantiationBL);
+ }
+
@DataProvider
public static Object[][] jobStatuses() {
return Stream.of(Job.JobStatus.values())
- .map(student -> new Object[] { student })
+ .map(status -> new Object[] { status })
.toArray(Object[][]::new);
}
@@ -71,16 +90,14 @@
UUID jobUuid = UUID.randomUUID();
String userId = "mockedUserID";
+ String testApi = "mockedTestApi";
String requestId = UUID.randomUUID().toString();
ServiceInstantiation serviceInstantiation = mock(ServiceInstantiation.class);
when(asyncInstantiationBL.getOrchestrationRequestsPath()).thenReturn("");
- RestObject<AsyncRequestStatus> msoResponse = mock(RestObject.class);
AsyncRequestStatus requestStatus = AsyncInstantiationBaseTest.asyncRequestStatusResponse("");
-
- when(msoResponse.getStatusCode()).thenReturn(200);
- when(msoResponse.get()).thenReturn(requestStatus);
+ RestObject<AsyncRequestStatus> msoResponse = createMockedAsyncRequestStatus(requestStatus, 200);
when(restMso.GetForObject(contains(requestId), eq(AsyncRequestStatus.class))).thenReturn(msoResponse);
when(asyncInstantiationBL.calcStatus(any())).thenReturn(expectedJobStatus);
@@ -88,16 +105,60 @@
ExpiryChecker expiryChecker = mock(ExpiryChecker.class);
when(expiryChecker.isExpired(any())).thenReturn(false);
- JobSharedData sharedData = new JobSharedData(jobUuid, userId, serviceInstantiation);
+ JobSharedData sharedData = new JobSharedData(jobUuid, userId, serviceInstantiation, testApi);
Job.JobStatus actualJobStatus = inProgressStatusService.call(expiryChecker, sharedData, requestId);
assertEquals(expectedJobStatus, actualJobStatus);
- verify(asyncInstantiationBL).auditMsoStatus(eq(jobUuid), same(requestStatus.request));
-
+ verify(auditService).auditMsoStatus(eq(jobUuid), same(requestStatus.request));
+ verify(asyncInstantiationBL).updateResourceInfo(eq(sharedData), eq(expectedJobStatus), eq(requestStatus));
//verify we don't update service info during this case, which shall stay in_progress
verify(asyncInstantiationBL, never()).updateServiceInfo(any(), any());
+ }
+ @NotNull
+ protected RestObject<AsyncRequestStatus> createMockedAsyncRequestStatus(AsyncRequestStatus requestStatus, int statusCode) {
+ RestObject<AsyncRequestStatus> msoResponse = mock(RestObject.class);
+ when(msoResponse.getStatusCode()).thenReturn(statusCode);
+ when(msoResponse.get()).thenReturn(requestStatus);
+ return msoResponse;
+ }
+ @Test(dataProvider = "trueAndFalse", dataProviderClass = TestUtils.class)
+ public void whenGetAsyncRequestStatus_thenRightResponseReturned(boolean isResumeFlagActive) {
+ String requestId = "abcRequest";
+ String baseMso = "/fakeBase/v15";
+
+ when(asyncInstantiationBL.getOrchestrationRequestsPath()).thenReturn(baseMso);
+ when(featureManager.isActive(Features.FLAG_1908_RESUME_MACRO_SERVICE)).thenReturn(isResumeFlagActive);
+
+ AsyncRequestStatus requestStatus = AsyncInstantiationBaseTest.asyncRequestStatusResponse("");
+ RestObject<AsyncRequestStatus> mockedResponse = createMockedAsyncRequestStatus(requestStatus, 399);
+ String path = baseMso + "/" + requestId + (isResumeFlagActive ? "?format=detail" : "");
+ when(restMso.GetForObject(eq(path), eq(AsyncRequestStatus.class))).thenReturn(mockedResponse);
+
+ assertEquals(mockedResponse, inProgressStatusService.getAsyncRequestStatus(requestId));
+ }
+
+ @DataProvider
+ public static Object[][] getAsyncReturnErrorDataProvider() {
+ return new Object[][]{
+ {AsyncInstantiationBaseTest.asyncRequestStatusResponse("xyz"), 400},
+ {AsyncInstantiationBaseTest.asyncRequestStatusResponse("xyz"), 401},
+ {AsyncInstantiationBaseTest.asyncRequestStatusResponse("xyz"), 500},
+ {null, 200},
+ };
+ }
+
+ @Test(dataProvider = "getAsyncReturnErrorDataProvider", expectedExceptions = InProgressStatusService.BadResponseFromMso.class)
+ public void whenGetAsyncReturnError_thenExceptionIsThrown(AsyncRequestStatus requestStatus, int statusCode) {
+ String requestId = "abcRequest";
+ String baseMso = "/fakeBase/v15";
+ when(asyncInstantiationBL.getOrchestrationRequestsPath()).thenReturn(baseMso);
+
+ RestObject<AsyncRequestStatus> mockedResponse = createMockedAsyncRequestStatus(requestStatus, statusCode);
+ when(restMso.GetForObject(eq(baseMso + "/" + requestId), eq(AsyncRequestStatus.class))).thenReturn(mockedResponse);
+
+ inProgressStatusService.getAsyncRequestStatus(requestId);
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java
index b4a5c64..c68c5f7 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/InstanceGroupCommandTest.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.
@@ -20,29 +20,35 @@
package org.onap.vid.job.command;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.only;
-import static org.mockito.Mockito.same;
-import static org.mockito.Mockito.verify;
-
import com.google.common.collect.ImmutableMap;
-import java.util.Optional;
+import org.apache.commons.beanutils.BeanUtils;
import org.mockito.Answers;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobsBrokerService;
import org.onap.vid.job.impl.JobSharedData;
+import org.onap.vid.model.Action;
import org.onap.vid.model.RequestReferencesContainer;
import org.onap.vid.model.serviceInstantiation.InstanceGroup;
import org.onap.vid.mso.RestMsoImplementation;
import org.onap.vid.mso.model.ModelInfo;
import org.onap.vid.services.AsyncInstantiationBusinessLogic;
-import org.onap.vid.testUtils.TestUtils;
import org.springframework.http.HttpMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import java.util.Optional;
+import java.util.Set;
+
+import static java.util.function.Function.identity;
+import static java.util.stream.Collectors.toMap;
+import static org.apache.commons.lang.RandomStringUtils.randomAlphanumeric;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.*;
+
public class InstanceGroupCommandTest {
@Mock(answer = Answers.RETURNS_MOCKS)
@@ -53,11 +59,20 @@
@Mock(answer = Answers.RETURNS_MOCKS)
MsoResultHandlerService msoResultHandlerService;
+ @Mock(answer = Answers.RETURNS_MOCKS)
+ MsoRequestBuilder msoRequestBuilder;
+
@Mock WatchChildrenJobsBL watchChildrenJobsBL;
@Mock(answer = Answers.RETURNS_MOCKS)
AsyncInstantiationBusinessLogic asyncInstantiationBL;
+ @Mock(answer = Answers.RETURNS_MOCKS)
+ JobsBrokerService jobsBrokerService;
+
+ @Mock(answer = Answers.RETURNS_MOCKS)
+ JobAdapter jobAdapter;
+
@Mock InProgressStatusService inProgressStatusService;
@InjectMocks
@@ -68,29 +83,41 @@
command = null;
MockitoAnnotations.initMocks(this);
}
-
- @Test
- public void createMyself_callsMso() {
- final ModelInfo serviceModelInfo = setStrings(new ModelInfo());
+ @DataProvider
+ public static Object[][] testApis() {
+ return new Object[][]{
+ {"VNF_API"}, {null}};
+ }
+ @Test(dataProvider = "testApis")
+ public void createMyself_callsMso(String testApi) {
+ final ModelInfo serviceModelInfo = setRandomStrings(new ModelInfo());
final String serviceInstanceId = "service-instance-id";
final String userId = "ff3223";
- command.init(new JobSharedData(
- null, userId, instanceGroupRequest
- ), ImmutableMap.of(
+ when(instanceGroupRequest.getAction()).thenReturn(Action.Delete);
+
+ JobSharedData sharedData = new JobSharedData(
+ null, userId, instanceGroupRequest, testApi);
+ command.init(sharedData, ImmutableMap.of(
"resourceModelInfos", ImmutableMap.of("SERVICE_MODEL_INFO", serviceModelInfo),
"resourceInstancesIds", ImmutableMap.of("SERVICE_INSTANCE_ID", serviceInstanceId)
));
command.createMyself();
- verify(asyncInstantiationBL).generateInstanceGroupInstantiationRequest(
- same(instanceGroupRequest), eq(serviceModelInfo), eq(serviceInstanceId), eq(userId));
+ verify(msoRequestBuilder).generateInstanceGroupInstantiationRequest(
+ same(instanceGroupRequest), eq(serviceModelInfo), eq(serviceInstanceId), eq(userId), eq(testApi));
verify(restMso, only()).restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), any(), eq(Optional.empty()));
-
}
- private ModelInfo setStrings(ModelInfo object) {
- return TestUtils.setStringsInStringProperties(object);
+ private ModelInfo setRandomStrings(ModelInfo object) {
+ try {
+ Set<String> fields = BeanUtils.describe(object).keySet();
+ BeanUtils.populate(object,
+ fields.stream().collect(toMap(identity(), s -> randomAlphanumeric(4))));
+ return object;
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/JobCommandFactoryTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/JobCommandFactoryTest.java
index d7389ad..72336e5 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/JobCommandFactoryTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/JobCommandFactoryTest.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.
@@ -105,7 +105,7 @@
final UUID uuid = UUID.randomUUID();
final Map<String, Object> data = ImmutableMap.of("foo", "bar");
- final JobSharedData sharedData = new JobSharedData(uuid, "userid", new MockedRequest(1,"a"));
+ final JobSharedData sharedData = new JobSharedData(uuid, "userid", new MockedRequest(1,"a"), "testApi");
when(job.getType()).thenReturn(jobType);
when(job.getUuid()).thenReturn(uuid);
@@ -119,4 +119,4 @@
assertThat(command, equalTo(mockCommand));
}
-}
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java
new file mode 100644
index 0000000..e477161
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/MacroServiceCommandTest.java
@@ -0,0 +1,136 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.job.command;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.vid.model.VidNotions.ModelCategory.INFRASTRUCTURE_VPN;
+import static org.onap.vid.model.VidNotions.ModelCategory.IS_5G_FABRIC_CONFIGURATION_MODEL;
+import static org.onap.vid.model.VidNotions.ModelCategory.IS_5G_PROVIDER_NETWORK_MODEL;
+import static org.onap.vid.model.VidNotions.ModelCategory.OTHER;
+import static org.onap.vid.model.VidNotions.ModelCategory.SERVICE_WITH_COLLECTION_RESOURCE;
+import static org.onap.vid.model.VidNotions.ModelCategory.Transport;
+import static org.testng.AssertJUnit.assertEquals;
+
+import com.google.common.collect.ImmutableList;
+import java.util.Collections;
+import java.util.List;
+import java.util.UUID;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.onap.vid.job.Job;
+import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobsBrokerService;
+import org.onap.vid.job.impl.JobSharedData;
+import org.onap.vid.model.Action;
+import org.onap.vid.model.VidNotions;
+import org.onap.vid.model.serviceInstantiation.BaseResource;
+import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
+import org.onap.vid.mso.RestMsoImplementation;
+import org.onap.vid.mso.rest.AsyncRequestStatus;
+import org.onap.vid.services.AsyncInstantiationBusinessLogic;
+import org.onap.vid.services.AuditService;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+public class MacroServiceCommandTest {
+
+ @Mock
+ private InProgressStatusService inProgressStatusService;
+
+ @Mock
+ private WatchChildrenJobsBL watchChildrenJobsB;
+
+ @Mock
+ private AsyncInstantiationBusinessLogic asyncInstantiationBL;
+
+ @Mock
+ private JobsBrokerService jobsBrokerService;
+
+ @Mock
+ private MsoRequestBuilder msoRequestBuilder;
+
+ @Mock
+ private MsoResultHandlerService msoResultHandlerService;
+
+ @Mock
+ private JobAdapter jobAdapter;
+
+ @Mock
+ private RestMsoImplementation restMso;
+
+ @Mock
+ private AuditService auditService;
+
+ @InjectMocks
+ private MacroServiceCommand macroServiceCommand;
+
+ @DataProvider
+ public static Object[][] modelCategoryPre1806DataProvider() {
+ return new Object[][]{
+ {IS_5G_PROVIDER_NETWORK_MODEL, false},
+ {IS_5G_FABRIC_CONFIGURATION_MODEL, false},
+ {Transport, true},
+ {SERVICE_WITH_COLLECTION_RESOURCE, true},
+ {INFRASTRUCTURE_VPN, true},
+ {OTHER, false},
+ };
+ }
+
+ @BeforeClass
+ public void initMocks() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @Test(dataProvider = "modelCategoryPre1806DataProvider")
+ public void testShouldUsePre1806Request(VidNotions.ModelCategory modelCategory, boolean expectedResult) {
+ ServiceInstantiation serviceInstantiation = mock(ServiceInstantiation.class);
+ VidNotions vidNotions = mock(VidNotions.class);
+ when(serviceInstantiation.getVidNotions()).thenReturn(vidNotions);
+ when(vidNotions.getModelCategory()).thenReturn(modelCategory);
+ assertEquals(macroServiceCommand.shouldUsePre1806Request(serviceInstantiation), expectedResult);
+ }
+
+ @DataProvider
+ public static Object[][] MsoFilteredRequestsDataProvider() {
+ return new Object[][]{
+ {Collections.EMPTY_LIST},
+ {ImmutableList.of(new AsyncRequestStatus.Request())}
+ };
+ }
+
+ @Test(dataProvider = "MsoFilteredRequestsDataProvider")
+ public void givenResumeAction_whenCantRetrieveRequestIdFromMSO_thenJobIsFailed(List<AsyncRequestStatus.Request> requests) {
+ String instanceId = UUID.randomUUID().toString();
+ BaseResource baseResource = mock(BaseResource.class);
+ when(baseResource.getInstanceId()).thenReturn(instanceId);
+ when(baseResource.getAction()).thenReturn(Action.Resume);
+ macroServiceCommand.init(new JobSharedData(null, null, baseResource, null));
+ when(auditService.retrieveRequestsFromMsoByServiceIdAndRequestTypeAndScope(eq(instanceId), any(), any()))
+ .thenReturn(requests);
+ assertEquals(macroServiceCommand.resumeMyself(), Job.JobStatus.FAILED);
+ }
+
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/MsoResultHandlerServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/MsoResultHandlerServiceTest.java
new file mode 100644
index 0000000..5f95801
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/MsoResultHandlerServiceTest.java
@@ -0,0 +1,95 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.job.command;
+
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+import static org.onap.vid.job.impl.AsyncInstantiationIntegrationTest.createResponse;
+import static org.testng.AssertJUnit.assertEquals;
+
+import java.util.UUID;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.vid.job.Job;
+import org.onap.vid.job.impl.JobSharedData;
+import org.onap.vid.model.RequestReferencesContainer;
+import org.onap.vid.mso.RestObject;
+import org.onap.vid.services.AsyncInstantiationBusinessLogic;
+import org.onap.vid.services.AuditService;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+public class MsoResultHandlerServiceTest {
+
+ @Mock
+ private AsyncInstantiationBusinessLogic asyncInstantiationBusinessLogic;
+
+ @Mock
+ private AuditService auditService;
+
+ @InjectMocks
+ private MsoResultHandlerService underTest;
+
+ @BeforeClass
+ public void initMocks() {
+ MockitoAnnotations.initMocks(this);
+ }
+
+ @DataProvider
+ public static Object[][] okStatusCodes() {
+ return new Object[][]{
+ {200}, {202} , {300}, {399}
+ };
+ }
+
+ @Test(dataProvider = "okStatusCodes")
+ public void whenOkResponseFromMso_getResultsWithIdsAndCompleteWithNoAction(int statusCode) {
+ String instanceId = UUID.randomUUID().toString();
+ String requestId = UUID.randomUUID().toString();
+ JobSharedData sharedData = new JobSharedData();
+ RestObject<RequestReferencesContainer> msoResponse = createResponse(statusCode, instanceId, requestId);
+ MsoResult expectedResult = new MsoResult(Job.JobStatus.COMPLETED_WITH_NO_ACTION, new MsoResourceIds(requestId, instanceId));
+ MsoResult actualMsoResult = underTest.handleResponse(sharedData, msoResponse, "test desc");
+ assertEquals(expectedResult, actualMsoResult);
+ verify(asyncInstantiationBusinessLogic).addResourceInfo(eq(sharedData), eq(Job.JobStatus.IN_PROGRESS), eq(instanceId));
+ }
+
+ @DataProvider
+ public static Object[][] notOkStatusCodes() {
+ return new Object[][]{
+ {199}, {400} , {404}, {500}
+ };
+ }
+
+ @Test(dataProvider = "notOkStatusCodes")
+ public void whenNotOkFromMso_getResultsWithFailedStatus(int statusCode) {
+ Mockito.reset(asyncInstantiationBusinessLogic);
+ JobSharedData sharedData = new JobSharedData();
+ RestObject<RequestReferencesContainer> msoResponse = createResponse(statusCode);
+ MsoResult expectedResult = new MsoResult(Job.JobStatus.FAILED);
+ MsoResult actualMsoResult = underTest.handleResponse(new JobSharedData(), msoResponse, "test desc");
+ assertEquals(expectedResult, actualMsoResult);
+ verify(asyncInstantiationBusinessLogic).addFailedResourceInfo(eq(sharedData), eq(msoResponse));
+ }
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java
index 9f252c5..2780e15 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceCommandTest.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.
@@ -20,29 +20,38 @@
package org.onap.vid.job.command;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.jetbrains.annotations.NotNull;
+import org.onap.vid.exceptions.AbortingException;
import org.onap.vid.exceptions.GenericUncheckedException;
+import org.onap.vid.exceptions.TryAgainException;
import org.onap.vid.job.Job;
import org.onap.vid.job.JobAdapter;
+import org.onap.vid.job.JobsBrokerService;
import org.onap.vid.job.NextCommand;
import org.onap.vid.job.impl.JobSharedData;
import org.onap.vid.model.Action;
-import org.onap.vid.model.serviceInstantiation.BaseResource;
+import org.onap.vid.model.serviceInstantiation.*;
import org.onap.vid.mso.RestMsoImplementation;
+import org.onap.vid.mso.model.ModelInfo;
import org.springframework.http.HttpMethod;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import javax.ws.rs.ProcessingException;
-import java.util.Collections;
-import java.util.Optional;
+import java.util.*;
+import java.util.stream.Collectors;
import java.util.stream.Stream;
+import static java.util.Collections.emptyList;
+import static org.mockito.AdditionalAnswers.returnsFirstArg;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.*;
import static org.onap.vid.job.command.ResourceCommandKt.ACTION_PHASE;
import static org.onap.vid.job.command.ResourceCommandKt.INTERNAL_STATE;
+import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.*;
+import static org.onap.vid.model.Action.*;
import static org.onap.vid.utils.Logging.getMethodCallerName;
import static org.testng.Assert.assertNull;
import static org.testng.Assert.assertTrue;
@@ -54,20 +63,34 @@
public static class MockCommand extends ResourceCommand {
public MockCommand(InternalState mockState, Action mockPhase, Job.JobStatus mockedJobStatus) {
- super(mock(RestMsoImplementation.class, RETURNS_MOCKS), mock(InProgressStatusService.class), mock(MsoResultHandlerService.class, RETURNS_MOCKS), mock(WatchChildrenJobsBL.class));
+ this(mockState, mockPhase, mockedJobStatus, false);
+ }
+ public MockCommand(InternalState mockState, Action mockPhase, Job.JobStatus mockedJobStatus, boolean lateInit) {
+ super(
+ mock(RestMsoImplementation.class, RETURNS_MOCKS),
+ mock(InProgressStatusService.class),
+ mock(MsoResultHandlerService.class, RETURNS_MOCKS),
+ mock(WatchChildrenJobsBL.class),
+ mock(JobsBrokerService.class, RETURNS_MOCKS),
+ mock(JobAdapter.class, RETURNS_MOCKS));
this.mockedJobStatus = mockedJobStatus;
this.mockState = mockState;
this.mockPhase = mockPhase;
- if (mockState==InternalState.INITIAL) {
- init(mock(JobSharedData.class), Collections.emptyMap());
- }
- else {
- init(mock(JobSharedData.class), ImmutableMap.of(INTERNAL_STATE, mockState.name(), ACTION_PHASE, mockPhase.name()));
+ if (!lateInit) {
+ init();
}
when(this.getWatchChildrenJobsBL().cumulateJobStatus(any(), any())).thenReturn(mockedJobStatus);
}
+ protected void init() {
+ if (mockState == InternalState.INITIAL) {
+ init(mock(JobSharedData.class), Collections.emptyMap());
+ } else {
+ init(mock(JobSharedData.class), ImmutableMap.of(INTERNAL_STATE, mockState.name(), ACTION_PHASE, mockPhase.name()));
+ }
+ }
+
private final Job.JobStatus mockedJobStatus;
private final InternalState mockState;
private final Action mockPhase;
@@ -76,7 +99,7 @@
@NotNull
@Override
public Job.JobStatus createChildren() {
- if (mockState == InternalState.CREATING_CHILDREN || (mockState == InternalState.INITIAL && mockPhase== Action.Delete))
+ if (mockState == InternalState.CREATING_CHILDREN || (mockState == InternalState.INITIAL && mockPhase== Delete))
return mockedJobStatus;
throw (new RuntimeException("Not expected to call "+getMethodCallerName()));
}
@@ -95,7 +118,7 @@
@NotNull
@Override
- public MsoRestCallPlan planCreateMyselfRestCall(@NotNull CommandParentData commandParentData, @NotNull JobAdapter.AsyncJobRequest request, @NotNull String userId) {
+ public MsoRestCallPlan planCreateMyselfRestCall(@NotNull CommandParentData commandParentData, @NotNull JobAdapter.AsyncJobRequest request, @NotNull String userId, String testApi) {
return mockedPlanOrThrow(InternalState.CREATE_MYSELF);
}
@@ -109,16 +132,19 @@
public static class MockCommandTestingStateMachine extends MockCommand {
private final JobSharedData sharedData;
+ private final boolean isDescendantHasAction;
public MockCommandTestingStateMachine(InternalState mockState, Action mockPhase, Job.JobStatus mockedJobStatus, boolean mockedNeedToDeleteMySelf) {
- this(mockState, mockPhase, mockedJobStatus, mockedNeedToDeleteMySelf, false);
+ this(mockState, mockPhase, mockedJobStatus, mockedNeedToDeleteMySelf, false, true);
}
- public MockCommandTestingStateMachine(InternalState mockState, Action mockPhase, Job.JobStatus mockedJobStatus, boolean mockedNeedToDeleteMySelf, boolean isService) {
- super(mockState, mockPhase, mockedJobStatus);
+ public MockCommandTestingStateMachine(InternalState mockState, Action mockPhase, Job.JobStatus mockedJobStatus, boolean mockedNeedToDeleteMySelf, boolean isService, boolean isDescendantHasAction) {
+ super(mockState, mockPhase, mockedJobStatus, true);
this.mockedNeedToDeleteMySelf = mockedNeedToDeleteMySelf;
this.isService = isService;
this.sharedData = mock(JobSharedData.class, RETURNS_MOCKS);
+ this.isDescendantHasAction = isDescendantHasAction;
+ init();
}
protected final boolean mockedNeedToDeleteMySelf;
@@ -150,6 +176,11 @@
public JobSharedData getSharedData() {
return sharedData;
}
+
+ @Override
+ protected boolean isDescendantHasAction(@NotNull Action phase) {
+ return isDescendantHasAction;
+ }
}
@DataProvider
@@ -171,28 +202,28 @@
InternalState internalState, Job.JobStatus jobStatus, InternalState expectedState) {
//there is no meaning to the constructor inputs here
- MockCommandTestingStateMachine underTest = new MockCommandTestingStateMachine(InternalState.TERMINAL, Action.Delete, Job.JobStatus.FAILED, true);
+ MockCommandTestingStateMachine underTest = new MockCommandTestingStateMachine(InternalState.TERMINAL, Delete, Job.JobStatus.FAILED, true);
assertEquals(expectedState, underTest.calcNextStateDeletePhase(jobStatus, internalState));
}
@Test
public void whenNoNeedToDeleteMyself_internalStateMovesFromWatchingToTerminal() {
- MockCommandTestingStateMachine underTest = new MockCommandTestingStateMachine(InternalState.WATCHING, Action.Delete, Job.JobStatus.COMPLETED, false);
+ MockCommandTestingStateMachine underTest = new MockCommandTestingStateMachine(InternalState.WATCHING, Delete, Job.JobStatus.COMPLETED, false);
assertEquals(InternalState.TERMINAL, underTest.calcNextStateDeletePhase(Job.JobStatus.COMPLETED, InternalState.WATCHING));
}
@DataProvider
public static Object[][] testShallStopJobDataProvider() {
return new Object[][]{
- {Job.JobStatus.IN_PROGRESS, Action.None, false, false},
- {Job.JobStatus.COMPLETED_WITH_NO_ACTION, Action.None, false, false},
- {Job.JobStatus.COMPLETED, Action.None, false, false},
- {Job.JobStatus.FAILED, Action.None, false, true},
- {Job.JobStatus.COMPLETED_WITH_ERRORS, Action.None, false, true},
- {Job.JobStatus.COMPLETED_WITH_ERRORS, Action.None, true, false},
- {Job.JobStatus.FAILED, Action.None, true, false},
- {Job.JobStatus.FAILED, Action.Delete, true, true},
- {Job.JobStatus.FAILED, Action.Create, true, true},
+ {Job.JobStatus.IN_PROGRESS, None, false, false},
+ {Job.JobStatus.COMPLETED_WITH_NO_ACTION, None, false, false},
+ {Job.JobStatus.COMPLETED, None, false, false},
+ {Job.JobStatus.FAILED, None, false, true},
+ {Job.JobStatus.COMPLETED_WITH_ERRORS, None, false, true},
+ {Job.JobStatus.COMPLETED_WITH_ERRORS, None, true, false},
+ {Job.JobStatus.FAILED, None, true, false},
+ {Job.JobStatus.FAILED, Delete, true, true},
+ {Job.JobStatus.FAILED, Create, true, true},
};
}
@@ -200,7 +231,7 @@
@Test(dataProvider = "testShallStopJobDataProvider")
public void testShallStopJob(Job.JobStatus jobStatus, Action action, boolean isService, boolean expectedResult) {
//in this test, there is no meaning to constructor parameters besides isService
- MockCommandTestingStateMachine underTest = new MockCommandTestingStateMachine(InternalState.WATCHING, Action.Delete, Job.JobStatus.COMPLETED, false, isService);
+ MockCommandTestingStateMachine underTest = new MockCommandTestingStateMachine(InternalState.WATCHING, Delete, Job.JobStatus.COMPLETED, false, isService, true);
BaseResource mockedRequest = mock(BaseResource.class);
when(underTest.getSharedData().getRequest()).thenReturn(mockedRequest);
@@ -209,6 +240,94 @@
assertEquals(expectedResult, underTest.shallStopJob(jobStatus));
}
+ public static class FakeResourceCreator {
+
+ public static<T> Map<String, T> convertToMap(List<T> list) {
+ if (list==null) {
+ return null;
+ }
+ return list.stream().collect(Collectors.toMap(x-> UUID.randomUUID().toString(), x->x));
+ }
+
+ static ServiceInstantiation createService(List<Vnf> vnfs, List<Network> networks, List<InstanceGroup> vnfGroups) {
+ return new ServiceInstantiation(mock(ModelInfo.class), null, null, null, null, null, null, null, null, null, null, null, null, null, null,
+ convertToMap(vnfs),
+ convertToMap(networks),
+ convertToMap(vnfGroups),
+ null,
+ null, false, 1, false,false,null, null, null, null, null, null, null);
+ }
+
+ public static ServiceInstantiation createServiceWith2InstancesInEachLevel(Action action) {
+ return createService(
+ ImmutableList.of(
+ createVnf(ImmutableList.of(createVfModule(action), createVfModule(action)), action),
+ createVnf(ImmutableList.of(createVfModule(action), createVfModule(action)), action)),
+ ImmutableList.of(
+ createNetwork(action),
+ createNetwork(action)),
+ ImmutableList.of(
+ createGroup(ImmutableList.of(createMember(action), createMember(action)), action),
+ createGroup(ImmutableList.of(createMember(action), createMember(action)), action))
+ );
+ }
+
+ static InstanceGroup createGroup(List<InstanceGroupMember> groupMembers, Action action) {
+ return new InstanceGroup(mock(ModelInfo.class), null, action.name(), false, null, convertToMap(groupMembers), null, null, null);
+ }
+
+ static InstanceGroupMember createMember(Action action) {
+ return new InstanceGroupMember(null, action.toString(), null, null, null);
+ }
+
+ static Vnf createVnf(List<VfModule> vfModules, Action action) {
+ Map<String, Map<String, VfModule>> vfModulesMap = new HashMap<>();
+ vfModulesMap.put("abc",convertToMap(vfModules));
+
+ return new Vnf(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, null, false, null, vfModulesMap, null, null, null);
+ }
+
+ static Vnf createVnf(Action action) {
+ return new Vnf(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, null, false, null,null, null, null, null);
+ }
+
+ static VfModule createVfModule(Action action) {
+ return new VfModule(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, false, false, null, null, null, null);
+ }
+
+ static Network createNetwork(Action action) {
+ return new Network(mock(ModelInfo.class), null, null, action.toString(), null, null, null, null, null, null, false, null, null, null, null);
+ }
+ }
+
+ @DataProvider
+ public static Object[][] testIsDescendantHasActionDataProvider() {
+ return new Object[][]{
+ {"empty service", Create, false, createService(emptyList(), emptyList(), emptyList())},
+ {"instance group with None", Create, false, createService(emptyList(), emptyList(), ImmutableList.of(createGroup(emptyList(), None)))},
+ {"instance group with Create", Create, true, createService(emptyList(), emptyList(), ImmutableList.of(createGroup(emptyList(), Create)))},
+ {"instance group None + member Delete", Delete, true, createService(emptyList(), emptyList(), ImmutableList.of(createGroup(ImmutableList.of(createMember(Delete)), None)))},
+ {"instance group None + member Create", Delete, false, createService(emptyList(), emptyList(), ImmutableList.of(createGroup(ImmutableList.of(createMember(Create)), None)))},
+ {"instance group None + member Create + member Delete", Delete, true,
+ createService(emptyList(), emptyList(), ImmutableList.of(createGroup(ImmutableList.of(createMember(Create), createMember(Delete)), None)))},
+ {"vnf Create", Delete, false, createService(ImmutableList.of(createVnf(emptyList(), Create)), emptyList(),emptyList())},
+ {"vnf Create", Create, true, createService(ImmutableList.of(createVnf(emptyList(), Create)), emptyList(),emptyList())},
+ {"vnf Create null VfModules internal map", Create, false, createService(ImmutableList.of(createVnf(null, Delete)), emptyList(),emptyList())},
+ {"vnf Delete with null VfModules", Create, false, createService(ImmutableList.of(createVnf(Delete)), emptyList(),emptyList())},
+ {"vnf None + VfModule Create", Create, true, createService(ImmutableList.of(createVnf(ImmutableList.of(createVfModule(Create)), None)), emptyList(),emptyList())},
+ {"vnf None + VfModule None", Create, false, createService(ImmutableList.of(createVnf(ImmutableList.of(createVfModule(None)), None)), emptyList(),emptyList())},
+ {"network Create", Create, true, createService(emptyList(), ImmutableList.of(createNetwork(Create)), emptyList())},
+ {"network Delete", Create, false, createService(emptyList(), ImmutableList.of(createNetwork(Delete)), emptyList())},
+ };
+ }
+
+ @Test(dataProvider = "testIsDescendantHasActionDataProvider")
+ public void testIsDescendantHasAction(String desc, Action action, boolean expectedResult, BaseResource request) {
+ //in this test, there is no meaning to constructor parameters
+ MockCommand underTest = new MockCommand(InternalState.WATCHING, Delete, Job.JobStatus.COMPLETED);
+ assertEquals(expectedResult, underTest.isDescendantHasAction(request, action));
+ }
+
@DataProvider
public static Object[][] testCallDataProvider() {
return new Object[][]{
@@ -235,7 +354,7 @@
String description, InternalState internalState, Job.JobStatus currentStateResult,
InternalState expectedNextState, Job.JobStatus expectedNextStatus) {
- MockCommandTestingStateMachine underTest = new MockCommandTestingStateMachine(internalState, Action.Delete, currentStateResult, true);
+ MockCommandTestingStateMachine underTest = new MockCommandTestingStateMachine(internalState, Delete, currentStateResult, true);
NextCommand nextCommand = underTest.call();
assertEquals(expectedNextStatus, nextCommand.getStatus());
@@ -250,12 +369,6 @@
}
}
- @Test(expectedExceptions = IllegalStateException.class)
- public void whenCommandInUnMappedState_exceptionIsThrown() {
- MockCommandTestingStateMachine underTest = new MockCommandTestingStateMachine(InternalState.TERMINAL, Action.Delete, Job.JobStatus.COMPLETED, true);
- underTest.call();
- }
-
@DataProvider
public static Object[][] InProgressDataProvider() {
return Stream.of(Job.JobStatus.values())
@@ -266,7 +379,7 @@
@Test(dataProvider = "InProgressDataProvider")
public void whenGetResultFromMso_InProgressReturnThem(Job.JobStatus mockedJobStatus) {
Job.JobStatus expectedJobStatus = (mockedJobStatus== Job.JobStatus.PAUSE) ? Job.JobStatus.IN_PROGRESS : mockedJobStatus;
- MockCommand underTest = new MockCommand(InternalState.IN_PROGRESS, Action.Delete, mockedJobStatus);
+ MockCommand underTest = new MockCommand(InternalState.IN_PROGRESS, Delete, mockedJobStatus);
when(underTest.getInProgressStatusService().call(any(), any(), any())).thenReturn(mockedJobStatus);
assertEquals(expectedJobStatus, underTest.inProgress());
}
@@ -282,22 +395,22 @@
@Test(dataProvider = "InProgressExceptionsDataProvider")
public void whenInProgressStatusServiceThrowException_InProgressReturnStatus(Exception exception, Job.JobStatus expectedJobStatus) {
- MockCommand underTest = new MockCommand(InternalState.IN_PROGRESS, Action.Delete, expectedJobStatus);
+ MockCommand underTest = new MockCommand(InternalState.IN_PROGRESS, Delete, expectedJobStatus);
when(underTest.getInProgressStatusService().call(any(), any(), any())).thenThrow(exception);
assertEquals(expectedJobStatus, underTest.inProgress());
}
@DataProvider
public static Object[][] testIsNeedToDeleteMySelfDataProvider() {
- return Stream.of(Action.values())
+ return Stream.of(values())
.map(status -> new Object[] { status })
.toArray(Object[][]::new);
}
@Test(dataProvider = "testIsNeedToDeleteMySelfDataProvider")
public void testIsNeedToDeleteMySelf(Action action) {
- boolean expectedResult = (action== Action.Delete);
- MockCommand underTest = new MockCommand(InternalState.DELETE_MYSELF, Action.Delete, Job.JobStatus.IN_PROGRESS);
+ boolean expectedResult = (action== Delete);
+ MockCommand underTest = new MockCommand(InternalState.DELETE_MYSELF, Delete, Job.JobStatus.IN_PROGRESS);
BaseResource mockedBaseResource = mock(BaseResource.class);
when(underTest.getSharedData().getRequest()).thenReturn(mockedBaseResource);
when(mockedBaseResource.getAction()).thenReturn(action);
@@ -315,9 +428,74 @@
@Test(dataProvider = "testWatchingDataProvider")
public void testWatching(String desc, Job.JobStatus childrenJobsStatus, Job.JobStatus expectedJobStatus) {
- MockCommand underTest = new MockCommand(InternalState.WATCHING, Action.Delete, Job.JobStatus.IN_PROGRESS);
+ MockCommand underTest = new MockCommand(InternalState.WATCHING, Delete, Job.JobStatus.IN_PROGRESS);
when(underTest.getWatchChildrenJobsBL().retrieveChildrenJobsStatus(any())).thenReturn(childrenJobsStatus);
assertEquals(expectedJobStatus, underTest.watchChildren());
}
+ @DataProvider
+ public static Object[][] testCalcInitialStateDataProvider() {
+ return new Object[][]{
+ {Delete, true, Delete, InternalState.CREATING_CHILDREN},
+ {Delete, false, Delete, InternalState.DELETE_MYSELF},
+ {Delete, false, Create, InternalState.TERMINAL},
+ {Delete, true, Create, InternalState.CREATING_CHILDREN},
+ {Create, true, Create, InternalState.CREATE_MYSELF},
+ {Create, false, Create, InternalState.CREATE_MYSELF},
+ {Create, false, Delete, InternalState.TERMINAL},
+ {Create, true, Delete, InternalState.CREATING_CHILDREN},
+ {Create, true, Resume, InternalState.RESUME_MYSELF},
+ {Delete, false, Resume, InternalState.TERMINAL},
+ };
+ }
+
+ @Test(dataProvider = "testCalcInitialStateDataProvider")
+ public void testCalcInitialState(Action phase, boolean isDescendantHasAction, Action action, InternalState expectedState) {
+ ResourceCommand underTest = mock(ResourceCommand.class);
+ when(underTest.calcInitialState(any(), any())).thenCallRealMethod();
+ when(underTest.isDescendantHasAction(eq(phase))).thenReturn(isDescendantHasAction);
+ when(underTest.getActionType()).thenReturn(action);
+ when(underTest.isNeedToDeleteMyself()).thenCallRealMethod();
+ when(underTest.isNeedToCreateMyself()).thenCallRealMethod();
+ when(underTest.isNeedToResumeMySelf()).thenCallRealMethod();
+
+ Map<String, String> commandData = ImmutableMap.of(INTERNAL_STATE, InternalState.INITIAL.name());
+ assertEquals(expectedState, underTest.calcInitialState(commandData, phase));
+ }
+
+
+ //throw exception when call to create children
+ //create children is just example, it could be any other method that called by ResourceCommand.invokeCommand
+ public static class MockCommandThrowExceptionOnCreateChildren extends MockCommandTestingStateMachine {
+
+ private final RuntimeException exceptionToThrow;
+
+ public MockCommandThrowExceptionOnCreateChildren(RuntimeException exceptionToThrow) {
+ super(InternalState.CREATING_CHILDREN, Delete, Job.JobStatus.COMPLETED, true);
+ this.exceptionToThrow = exceptionToThrow;
+ doAnswer(returnsFirstArg()).when(this.getWatchChildrenJobsBL()).cumulateJobStatus(any(), any());
+ }
+
+ @NotNull
+ @Override
+ public Job.JobStatus createChildren() {
+ throw exceptionToThrow;
+ }
+ }
+
+ @DataProvider
+ public static Object[][] exceptionAndStateProvider() {
+ return new Object[][]{
+ {new TryAgainException(new Exception()), Job.JobStatus.RESOURCE_IN_PROGRESS},
+ {new AbortingException(new Exception()), Job.JobStatus.FAILED},
+ };
+ }
+
+ @Test(dataProvider = "exceptionAndStateProvider")
+ public void whenKnownExceptionThrownInCommandInvocation_thenStateIsAsExpected(RuntimeException exception, Job.JobStatus expectedNextStatus) {
+ MockCommandTestingStateMachine underTest = new MockCommandThrowExceptionOnCreateChildren(exception);
+ NextCommand nextCommand = underTest.call();
+ assertEquals(expectedNextStatus, nextCommand.getStatus());
+ }
+
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceInProgressStatusCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceInProgressStatusCommandTest.java
deleted file mode 100644
index 5b036f5..0000000
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/ResourceInProgressStatusCommandTest.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.vid.job.command;
-
-import org.mockito.InjectMocks;
-import org.mockito.MockitoAnnotations;
-import org.onap.vid.job.Job;
-import org.onap.vid.job.NextCommand;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-
-
-public class ResourceInProgressStatusCommandTest {
-
- @InjectMocks
- private ResourceInProgressStatusCommand commandUnderTest = new ResourceInProgressStatusCommand();
-
- @BeforeMethod
- public void initMocks() {
- MockitoAnnotations.initMocks(this);
- }
-
- @DataProvider
- public static Object[][] givenStatusToExpectedStatus() {
- return new Object[][]{
- {Job.JobStatus.IN_PROGRESS, Job.JobStatus.IN_PROGRESS},
- {Job.JobStatus.FAILED, Job.JobStatus.FAILED},
- {Job.JobStatus.COMPLETED, Job.JobStatus.COMPLETED}
- };
- }
-
- @Test(dataProvider = "givenStatusToExpectedStatus")
- public void whenGetStatusFromMso_returnExpectedNextCommand(Job.JobStatus jobStatus, Job.JobStatus expectedNextStatus) {
- NextCommand nextCommand = commandUnderTest.processJobStatus(jobStatus);
- assertThat(nextCommand.getStatus(), is(expectedNextStatus));
- assertThat(nextCommand.getCommand(), is(commandUnderTest));
- }
-}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java
index 31dbc9f..787ff60 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/ServiceInProgressStatusCommandTest.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.
@@ -20,22 +20,22 @@
package org.onap.vid.job.command;
+import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.mockito.ArgumentCaptor;
-import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.job.*;
import org.onap.vid.job.impl.JobSharedData;
+import org.onap.vid.model.Action;
import org.onap.vid.model.serviceInstantiation.Network;
import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
import org.onap.vid.model.serviceInstantiation.Vnf;
-import org.onap.vid.mso.model.ModelInfo;
+import org.onap.vid.mso.RestMsoImplementation;
import org.onap.vid.properties.Features;
import org.onap.vid.properties.VidProperties;
import org.onap.vid.services.AsyncInstantiationBusinessLogic;
-import org.springframework.core.env.Environment;
+import org.onap.vid.services.AuditService;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
@@ -47,10 +47,9 @@
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Arrays;
-import java.util.Map;
-import java.util.TreeMap;
import java.util.UUID;
+import static java.util.Collections.emptyList;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.core.Is.is;
@@ -58,7 +57,11 @@
import static org.mockito.Matchers.eq;
import static org.mockito.Mockito.*;
import static org.onap.vid.job.Job.JobStatus.*;
+import static org.onap.vid.job.command.ResourceCommandKt.*;
+import static org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator.*;
+import static org.onap.vid.model.Action.Create;
import static org.onap.vid.testUtils.TestUtils.testWithSystemProperty;
+import static org.testng.AssertJUnit.assertEquals;
public class ServiceInProgressStatusCommandTest {
@@ -79,44 +82,28 @@
private JobSharedData sharedData;
@Mock
- private Environment environment;
-
- @Mock
private ServiceInstantiation request;
@Mock
private InProgressStatusService inProgressStatusService;
- @InjectMocks
- private ServiceInProgressStatusCommand command = new ServiceInProgressStatusCommand();
+ @Mock
+ private WatchChildrenJobsBL watchChildrenJobsBL;
- @DataProvider
- public static Object[][] isNeedToCreateChildJobsDataProvider() {
- return new Object[][]{
- {new TreeMap<String,Vnf>() , true, true, false},
- {null , true, true, false},
- {ImmutableMap.of("a",mock(Vnf.class)), false, true, false},
- {ImmutableMap.of("a",mock(Vnf.class)), true, false, false},
- {ImmutableMap.of("a",mock(Vnf.class)), true, true, true},
- };
- }
+ @Mock
+ private MsoResultHandlerService msoResultHandlerService;
- @DataProvider
- public static Object[][] processJobStatusData() {
- return new Object[][]{
- /* {MSO jobStatus, jobStartTime, isNeedToCreateChildJobs(), property vid.job.max.hoursInProgress, expected nextCommand.getStatus() } */
- {IN_PROGRESS, false, IN_PROGRESS},
- {FAILED, false, FAILED},
- {PAUSE, false, IN_PROGRESS},
- {COMPLETED, false, COMPLETED},
- {COMPLETED, true, IN_PROGRESS},
- {RESOURCE_IN_PROGRESS, false, RESOURCE_IN_PROGRESS},
- {PENDING, false, PENDING},
- {STOPPED, false, STOPPED},
- {COMPLETED_WITH_ERRORS, false, COMPLETED_WITH_ERRORS},
- {CREATING, false, CREATING}
- };
- }
+ @Mock
+ private MsoRequestBuilder msoRequestBuilder;
+
+ @Mock
+ private RestMsoImplementation restMsoImplementation;
+
+ @Mock
+ private AuditService auditService;
+
+ private ALaCarteServiceCommand command;
+
@DataProvider
public static Object[][] isExpiredJobStatusData() {
@@ -138,32 +125,31 @@
@BeforeMethod
public void initMocks() {
MockitoAnnotations.initMocks(this);
- }
-
- @Test(dataProvider = "isNeedToCreateChildJobsDataProvider" )
- public void testIsNeedToCreateChildJobs(Map<String, Vnf> serviceVnfs, boolean isALaCarte,
- boolean isFeatureEnabled, boolean expected) {
- MockitoAnnotations.initMocks(this);
- ServiceInstantiation serviceInstantiation = mock(ServiceInstantiation.class);
- when(serviceInstantiation.getVnfs()).thenReturn(serviceVnfs);
- when(serviceInstantiation.isALaCarte()).thenReturn(isALaCarte);
- when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VNF)).thenReturn(isFeatureEnabled);
- assertThat(command.isNeedToCreateChildJobs(serviceInstantiation), is(expected));
+ command = new ALaCarteServiceCommand(
+ inProgressStatusService,
+ watchChildrenJobsBL,
+ asyncInstantiationBL,
+ jobsBrokerService,
+ msoRequestBuilder,
+ msoResultHandlerService,
+ jobAdapter,
+ restMsoImplementation,
+ auditService
+ );
}
@Test
public void whenGetFromMsoCompletedAndALaCarte_generateNewJobsForVnfs() {
UUID uuid = UUID.randomUUID();
String userId = "mockedUserID";
- Vnf vnf1 = mock(Vnf.class);
- Vnf vnf2 = mock(Vnf.class);
- Network network1 = mock(Network.class);
- ServiceInstantiation serviceInstantiation = mock(ServiceInstantiation.class);
- when(serviceInstantiation.getVnfs()).thenReturn(ImmutableMap.of("a", vnf1, "b", vnf2));
- when(serviceInstantiation.getNetworks()).thenReturn(ImmutableMap.of("c", network1));
- when(serviceInstantiation.isALaCarte()).thenReturn(true);
- when(serviceInstantiation.getModelInfo()).thenReturn(new ModelInfo());
-
+ String testApi = "VNF_API";
+ Vnf vnf1 = createVnf(emptyList(), Create);
+ Vnf vnf2 = createVnf(emptyList(), Create);
+ Network network = createNetwork(Create);
+ ServiceInstantiation serviceInstantiation = createService(
+ ImmutableList.of(vnf1, vnf2),
+ ImmutableList.of(network),
+ emptyList());
when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VNF)).thenReturn(true);
UUID uuid1 = UUID.fromString("12345678-1234-1234-1234-123456789012");
@@ -171,15 +157,25 @@
UUID uuid3 = UUID.fromString("12345678-1234-1234-1234-123456789014");
when(jobsBrokerService.add(any())).thenReturn(uuid1).thenReturn(uuid2).thenReturn(uuid3);
- JobSharedData sharedData = new JobSharedData(uuid, userId, serviceInstantiation);
- command.init(sharedData, "", "");
+ JobSharedData sharedData = new JobSharedData(uuid, userId, serviceInstantiation, testApi);
+ command.init(sharedData, ImmutableMap.of(
+ ACTION_PHASE, Action.Create.name(),
+ INTERNAL_STATE, InternalState.IN_PROGRESS.name()
+ ));
when(inProgressStatusService.call(any(), eq(sharedData), any())).thenReturn(Job.JobStatus.COMPLETED);
+ when(watchChildrenJobsBL.cumulateJobStatus(Job.JobStatus.COMPLETED, COMPLETED_WITH_NO_ACTION)).thenReturn(COMPLETED);
+ when(watchChildrenJobsBL.cumulateJobStatus(Job.JobStatus.COMPLETED_WITH_NO_ACTION, COMPLETED)).thenReturn(COMPLETED);
+ when(msoResultHandlerService.getRequest(eq(sharedData))).thenReturn(serviceInstantiation);
NextCommand nextCommand = command.call();
+ assertEquals(IN_PROGRESS, nextCommand.getStatus());
+ nextCommand = nextCommand.getCommand().call();
ArgumentCaptor<JobAdapter.AsyncJobRequest> argumentCaptor = ArgumentCaptor.forClass(JobAdapter.AsyncJobRequest.class);
- verify(jobAdapter, times(2)).createChildJob(eq(JobType.VnfInstantiation), eq(Job.JobStatus.CREATING), argumentCaptor.capture(), eq(sharedData), any());
- verify(jobAdapter, times(1)).createChildJob(eq(JobType.NetworkInstantiation), eq(Job.JobStatus.CREATING), argumentCaptor.capture(), eq(sharedData), any());
- assertThat(argumentCaptor.getAllValues(), containsInAnyOrder(vnf1, vnf2, network1));
+ verify(jobAdapter, times(1)).createChildJob(eq(JobType.NetworkInstantiation), argumentCaptor.capture(), eq(sharedData), any(), eq(0));
+ verify(jobAdapter, times(1)).createChildJob(eq(JobType.VnfInstantiation), argumentCaptor.capture(), eq(sharedData), any(), eq(1));
+ verify(jobAdapter, times(1)).createChildJob(eq(JobType.VnfInstantiation), argumentCaptor.capture(), eq(sharedData), any(), eq(2));
+
+ assertThat(argumentCaptor.getAllValues(), containsInAnyOrder(vnf1, vnf2, network));
verify(jobsBrokerService, times(3)).add(any());
@@ -187,41 +183,14 @@
verify(asyncInstantiationBL, never()).updateServiceInfo(any(), any());
assertThat(nextCommand.getStatus(), is(Job.JobStatus.IN_PROGRESS));
- assertThat(nextCommand.getCommand().getType(), is(new WatchingCommand().getType()));
- assertThat(nextCommand.getCommand().getData().get("childrenJobs"), is(Arrays.asList(uuid1.toString(), uuid2.toString(), uuid3.toString())));
- assertThat(nextCommand.getCommand().getData().get("isService"), is(true));
- }
-
- @Test(dataProvider = "processJobStatusData")
- public void processJobStatusTest(Job.JobStatus jobStatus, boolean isNeedToCreateChildJobs, Job.JobStatus expectedStatus) {
-
- when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VNF)).thenReturn(true);
- // All mocks under are used for isNeedToCreateChildJobs=true case
- when(sharedData.getRequest()).thenReturn(request);
- when(request.isALaCarte()).thenReturn(true);
- Map vnfs = mock(Map.class);
- ModelInfo modelInfo = mock(ModelInfo.class);
-
- // if vnfs.isEmpty -> isNeedToCreateChildJobs will return false
- when(vnfs.isEmpty()).thenReturn(!isNeedToCreateChildJobs);
-
- when(request.getVnfs()).thenReturn(vnfs);
- when(request.getModelInfo()).thenReturn(modelInfo);
- command.instanceId = "MockInstId";
-
- NextCommand nextCommand = command.processJobStatus(jobStatus);
- Assert.assertEquals(nextCommand.getStatus(), expectedStatus);
- if (isNeedToCreateChildJobs) {
- Assert.assertEquals(nextCommand.getCommand().getClass(), WatchingCommand.class);
- } else {
- Assert.assertEquals(nextCommand.getCommand(), command);
- }
+ assertThat(nextCommand.getCommand().getType(), is(JobType.ALaCarteService));
+ assertThat(nextCommand.getCommand().getData().get(CHILD_JOBS), is(Arrays.asList(uuid1.toString(), uuid2.toString(), uuid3.toString())));
}
@Test(dataProvider = "isExpiredJobStatusData")
public void isExpiredJobStatusTest(ZonedDateTime jobStartTime, String configValue, boolean expectedResult) throws Exception {
testWithSystemProperty(VidProperties.VID_JOB_MAX_HOURS_IN_PROGRESS, configValue, ()->
- Assert.assertEquals(command.getExpiryChecker().isExpired(jobStartTime), expectedResult)
+ Assert.assertEquals(command.getExpiryChecker().isExpired(jobStartTime), expectedResult)
);
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/WatchChildrenJobsBLTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/WatchChildrenJobsBLTest.java
index 630c464..a9a961d 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/WatchChildrenJobsBLTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/command/WatchChildrenJobsBLTest.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.
@@ -23,10 +23,10 @@
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import org.onap.portalsdk.core.service.DataAccessService;
import org.onap.vid.job.Job.JobStatus;
import org.onap.vid.job.impl.JobDaoImpl;
import org.onap.vid.utils.DaoUtils;
+import org.onap.portalsdk.core.service.DataAccessService;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/command/WatchingCommandTest.java b/vid-app-common/src/test/java/org/onap/vid/job/command/WatchingCommandTest.java
deleted file mode 100644
index cc0e660..0000000
--- a/vid-app-common/src/test/java/org/onap/vid/job/command/WatchingCommandTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * 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.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.vid.job.command;
-
-import org.mockito.InjectMocks;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.onap.portalsdk.core.service.DataAccessService;
-import org.onap.vid.job.Job;
-import org.onap.vid.job.NextCommand;
-import org.onap.vid.job.impl.JobSharedData;
-import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
-import org.onap.vid.services.AsyncInstantiationBusinessLogic;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import java.util.List;
-import java.util.UUID;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.core.Is.is;
-import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.*;
-
-public class WatchingCommandTest {
-
- @Mock
- private AsyncInstantiationBusinessLogic asyncInstantiationBL;
-
- @Mock
- private DataAccessService dataAccessService;
-
- @Mock
- private WatchChildrenJobsBL watchChildrenJobsBL;
-
- @InjectMocks
- private WatchingCommand watchingCommand = new WatchingCommand();
-
-
-
- @BeforeClass
- public void initMocks() {
- MockitoAnnotations.initMocks(this);
- }
-
- @DataProvider
- public static Object[][] testWatchingDataProvider() {
- return new Object[][]{
- {"all children final, no failed child, is service", Job.JobStatus.COMPLETED, true, Job.JobStatus.COMPLETED},
- {"all children final, there is failed child, is service", Job.JobStatus.COMPLETED_WITH_ERRORS, true, Job.JobStatus.COMPLETED_WITH_ERRORS},
- {"not all children final, is service", Job.JobStatus.IN_PROGRESS, true, Job.JobStatus.IN_PROGRESS},
- {"all children final, no failed child, not service", Job.JobStatus.COMPLETED, false, Job.JobStatus.COMPLETED},
- {"all children final, there is failed child, not service", Job.JobStatus.COMPLETED_WITH_ERRORS, false, Job.JobStatus.COMPLETED_WITH_ERRORS},
- {"not all children final, not service", Job.JobStatus.IN_PROGRESS, false, Job.JobStatus.RESOURCE_IN_PROGRESS},
- };
- }
-
-
-
- @Test(dataProvider = "testWatchingDataProvider")
- public void whenGetChildrenStatus_thenJobStatusAsExpected(String desc, Job.JobStatus childrenComulativeStatus, boolean isService, Job.JobStatus expectedCommandStatus) {
- UUID jobUUID = UUID.randomUUID();
- JobSharedData sharedData = new JobSharedData(jobUUID, "mockedUserID", mock(ServiceInstantiation.class));
- List<String> uuids = mock(List.class);
- watchingCommand.init(sharedData, uuids, isService);
- when(watchChildrenJobsBL.retrieveChildrenJobsStatus(eq(uuids))).thenReturn(childrenComulativeStatus);
- when(watchChildrenJobsBL.cumulateJobStatus(eq(childrenComulativeStatus),eq(Job.JobStatus.COMPLETED))).thenReturn(childrenComulativeStatus);
-
- //execute command and verify
- NextCommand nextCommand = watchingCommand.call();
- assertThat(nextCommand.getStatus(), is(expectedCommandStatus));
- if (!expectedCommandStatus.equals(Job.JobStatus.IN_PROGRESS) && isService) {
- verify(asyncInstantiationBL).updateServiceInfoAndAuditStatus(jobUUID, expectedCommandStatus);
- } else {
- verify(asyncInstantiationBL, never()).updateServiceInfoAndAuditStatus(jobUUID, expectedCommandStatus);
- }
- }
-}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java
index 0b1fff3..498708d 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/AsyncInstantiationIntegrationTest.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.
@@ -20,43 +20,55 @@
package org.onap.vid.job.impl;
+import com.fasterxml.jackson.databind.JsonNode;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.mutable.MutableInt;
+import org.jetbrains.annotations.NotNull;
+import org.mockito.ArgumentCaptor;
import org.mockito.Mockito;
+import org.mockito.hamcrest.MockitoHamcrest;
import org.onap.portalsdk.core.service.DataAccessService;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.asdc.AsdcCatalogException;
-import org.onap.vid.config.DataSourceConfig;
-import org.onap.vid.config.JobCommandsConfigWithMockedMso;
-import org.onap.vid.config.MockedAaiClientAndFeatureManagerConfig;
+import org.onap.vid.changeManagement.RequestDetailsWrapper;
import org.onap.vid.job.Job;
import org.onap.vid.job.Job.JobStatus;
import org.onap.vid.job.JobType;
import org.onap.vid.job.JobsBrokerService;
import org.onap.vid.job.command.CommandUtils;
import org.onap.vid.job.command.InternalState;
-import org.onap.vid.model.Action;
-import org.onap.vid.model.NameCounter;
-import org.onap.vid.model.RequestReferencesContainer;
-import org.onap.vid.model.ServiceInfo;
+import org.onap.vid.model.*;
+import org.onap.vid.model.serviceInstantiation.BaseResource;
+import org.onap.vid.model.serviceInstantiation.InstanceGroup;
import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
import org.onap.vid.mso.RestMsoImplementation;
import org.onap.vid.mso.RestObject;
import org.onap.vid.mso.model.RequestReferences;
import org.onap.vid.mso.rest.AsyncRequestStatus;
+import org.onap.vid.mso.rest.AsyncRequestStatusList;
import org.onap.vid.properties.Features;
-import org.onap.vid.services.AsyncInstantiationBaseTest;
import org.onap.vid.services.AsyncInstantiationBusinessLogic;
+import org.onap.vid.services.AuditService;
+import org.onap.vid.services.VersionService;
import org.onap.vid.utils.DaoUtils;
+import org.onap.vid.config.DataSourceConfig;
+import org.onap.vid.config.JobCommandsConfigWithMockedMso;
+import org.onap.vid.config.MockedAaiClientAndFeatureManagerConfig;
+import org.onap.vid.services.AsyncInstantiationBaseTest;
+import org.onap.vid.testUtils.TestUtils;
+import org.springframework.http.HttpMethod;
import org.springframework.test.context.ContextConfiguration;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
import org.togglz.core.manager.FeatureManager;
import javax.inject.Inject;
import javax.ws.rs.ProcessingException;
+import java.io.IOException;
import java.lang.reflect.Method;
import java.util.*;
import java.util.function.BiConsumer;
@@ -66,7 +78,8 @@
import java.util.stream.Stream;
import static java.util.stream.Collectors.*;
-import static net.javacrumbs.jsonunit.JsonMatchers.jsonPartEquals;
+import static net.javacrumbs.jsonunit.JsonAssert.assertJsonEquals;
+import static net.javacrumbs.jsonunit.JsonMatchers.*;
import static org.hamcrest.CoreMatchers.*;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.hasProperty;
@@ -77,7 +90,7 @@
import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.*;
import static org.onap.vid.job.Job.JobStatus.*;
-import static org.onap.vid.model.JobAuditStatus.SourceStatus.MSO;
+import static org.onap.vid.job.impl.JobSchedulerInitializer.WORKERS_TOPICS;
import static org.onap.vid.model.JobAuditStatus.SourceStatus.VID;
import static org.testng.AssertJUnit.*;
@@ -97,6 +110,9 @@
public static String SERVICE_INSTANCE_ID = UUID.randomUUID().toString();
@Inject
+ private VersionService versionService;
+
+ @Inject
private JobsBrokerService jobsBrokerService;
@Inject
@@ -109,6 +125,9 @@
private AsyncInstantiationBusinessLogic asyncInstantiationBL;
@Inject
+ private AuditService auditService;
+
+ @Inject
private RestMsoImplementation restMso;
@Inject
@@ -120,6 +139,7 @@
@BeforeClass
void initServicesInfoService() {
createInstanceParamsMaps();
+ when(versionService.retrieveBuildNumber()).thenReturn("fakeBuild");
}
@BeforeMethod
@@ -131,10 +151,12 @@
@BeforeMethod
void defineMocks() {
+ Mockito.reset(restMso);
+ Mockito.reset(aaiClient);
mockAaiClientAnyNameFree();
}
- //@Test
+ @Test
public void whenPushNewBulk_thenAllServicesAreInPending() {
pushMacroBulk();
@@ -144,8 +166,8 @@
private List<UUID> pushMacroBulk() {
ServiceInstantiation serviceInstantiation = generateMockMacroServiceInstantiationPayload(false,
- createVnfList(instanceParamsMapWithoutParams, Collections.EMPTY_LIST, true),
- 3, true,PROJECT_NAME, true);
+ createVnfList(instanceParamsMapWithoutParams, Collections.EMPTY_LIST, true),
+ 3, true,PROJECT_NAME, true);
return asyncInstantiationBL.pushBulkJob(serviceInstantiation, USER_ID);
}
@@ -167,6 +189,10 @@
return createResponse(statusCode, SERVICE_INSTANCE_ID, REQUEST_ID);
}
+ public static RestObject<RequestReferencesContainer> createResponseRandomIds(int statusCode) {
+ return createResponse(statusCode, UUID.randomUUID().toString(), UUID.randomUUID().toString());
+ }
+
public static RestObject<RequestReferencesContainer> createResponse(int statusCode, String instanceId, String requestId) {
RequestReferences requestReferences = new RequestReferences();
requestReferences.setRequestId(requestId);
@@ -180,7 +206,7 @@
ImmutableList<String> statusesToStrings(JobStatus... jobStatuses) {
return Stream.of(jobStatuses).map(
- Enum::toString).collect(ImmutableList.toImmutableList());
+ Enum::toString).collect(ImmutableList.toImmutableList());
}
/*
@@ -190,81 +216,85 @@
Make sure service state is Completed successfully once we got from MSO complete, and that next job is peeked.
Once a service in the bulk is failed, other services moved to Stopped, and no other jobs from the bulk are peeked.
*/
- //@Test
+ @Test
public void testStatusesOfMacroServiceInBulkDuringBulkLifeCycle() {
- when(restMso.PostForObject(any(), any(), eq(RequestReferencesContainer.class))).thenReturn(createResponse(200));
+
+ final String SERVICE_REQUEST_ID = UUID.randomUUID().toString();
+ final String SERVICE_INSTANCE_ID = UUID.randomUUID().toString();
+ final String SERVICE2_REQUEST_ID = UUID.randomUUID().toString();
+ final String SERVICE2_INSTANCE_ID = UUID.randomUUID().toString();
+
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), any(), eq(Optional.empty())))
+ .thenReturn(createResponse(200, SERVICE_INSTANCE_ID, SERVICE_REQUEST_ID));
+
ImmutableList<ImmutableList<String>> expectedStatusesForVid = ImmutableList.of(
- statusesToStrings(PENDING, IN_PROGRESS, COMPLETED),
- statusesToStrings(PENDING, IN_PROGRESS, FAILED),
- statusesToStrings(PENDING, STOPPED)
+ statusesToStrings(PENDING, IN_PROGRESS, COMPLETED),
+ statusesToStrings(PENDING, IN_PROGRESS, FAILED),
+ statusesToStrings(PENDING, STOPPED)
);
ImmutableList<ImmutableList<String>> expectedStatusesForMso = ImmutableList.of(
- ImmutableList.of(REQUESTED, IN_PROGRESS_STR, "not a state", FAILED_STR ,COMPLETE_STR),
- ImmutableList.of(REQUESTED, FAILED_STR),
- ImmutableList.of()
+ ImmutableList.of(REQUESTED, IN_PROGRESS_STR, "not a state", FAILED_STR ,COMPLETE_STR),
+ ImmutableList.of(REQUESTED, FAILED_STR),
+ ImmutableList.of()
);
List<UUID> uuids = pushMacroBulk();
- pullPendingJobAndAssertJobStatus(JobStatus.IN_PROGRESS, PENDING);
-
+ UUID firstJobUuid = uuids.get(0);
+ UUID secondJobUuid = uuids.get(1);
//assert that when get ProcessingException from restMso, status remain the same
- when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).thenThrow(new ProcessingException("fake message"));
- Job job = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS);
- UUID firstHandledJobUUID = job.getUuid();
- listServicesAndAssertStatus(JobStatus.IN_PROGRESS, PENDING, job);
+ when(restMso.GetForObject(endsWith(SERVICE_REQUEST_ID), eq(AsyncRequestStatus.class))).thenThrow(new ProcessingException("fake message"));
+ processJobsCountTimesAndAssertStatus(firstJobUuid, 10, IN_PROGRESS, PENDING);
//assert that when get IN_PROGRESS status from restMso, status remain IN_PROGRESS
- when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).thenReturn(asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR));
- job = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS);
- listServicesAndAssertStatus(JobStatus.IN_PROGRESS, PENDING, job);
+ when(restMso.GetForObject(endsWith(SERVICE_REQUEST_ID), eq(AsyncRequestStatus.class))).thenReturn(asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR));
+ processJobsCountTimesAndAssertStatus(firstJobUuid, 10, IN_PROGRESS, PENDING);
//assert that when get unrecognized status from restMso, status remain IN_PROGRESS
- when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).thenReturn(asyncRequestStatusResponseAsRestObject("not a state"));
- job = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS);
- listServicesAndAssertStatus(JobStatus.IN_PROGRESS, PENDING, job);
+ when(restMso.GetForObject(endsWith(SERVICE_REQUEST_ID), eq(AsyncRequestStatus.class))).thenReturn(asyncRequestStatusResponseAsRestObject("not a state"));
+ processJobsCountTimesAndAssertStatus(firstJobUuid, 10, IN_PROGRESS, PENDING);
//assert that when get non 200 status code during IN_PROGRESS, status remain IN_PROGRESS
- when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR, 404));
- job = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS);
- listServicesAndAssertStatus(JobStatus.IN_PROGRESS, PENDING, job);
+ when(restMso.GetForObject(endsWith(SERVICE_REQUEST_ID), eq(AsyncRequestStatus.class))).thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR, 404));
+ processJobsCountTimesAndAssertStatus(firstJobUuid, 10, IN_PROGRESS, PENDING);
//when get job COMPLETE from MSO, service status become COMPLETED
- when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- job = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, COMPLETED);
- List<ServiceInfo> serviceInfoList = listServicesAndAssertStatus(COMPLETED, PENDING, job);
-
-
+ when(restMso.GetForObject(endsWith(SERVICE_REQUEST_ID), eq(AsyncRequestStatus.class))).thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+ pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, COMPLETED);
+ List<ServiceInfo> serviceInfoList = listServicesAndAssertStatus(COMPLETED, PENDING, firstJobUuid);
+
+
//for use later in the test
Map<UUID, JobStatus> expectedJobStatusMap = serviceInfoList.stream().collect(
- Collectors.toMap(ServiceInfo::getJobId, x-> PENDING));
- expectedJobStatusMap.put(job.getUuid(), COMPLETED);
+ Collectors.toMap(ServiceInfo::getJobId, x-> PENDING));
+ expectedJobStatusMap.put(firstJobUuid, COMPLETED);
//when handling another PENDING job, statuses are : COMPLETED, IN_PROGRESS, PENDING
- job = pullJobProcessAndPushBack(PENDING, JobStatus.IN_PROGRESS);
- assertThat(job.getUuid(), not(equalTo(firstHandledJobUUID))); //assert different job was handled now
- expectedJobStatusMap.put(job.getUuid(), JobStatus.IN_PROGRESS);
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), any(), eq(Optional.empty())))
+ .thenReturn(createResponse(200, SERVICE2_INSTANCE_ID, SERVICE2_REQUEST_ID));
+ when(restMso.GetForObject(endsWith(SERVICE2_REQUEST_ID), eq(AsyncRequestStatus.class))).thenReturn(asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR));
+ processJobsCountTimes(10);
+
+ expectedJobStatusMap.put(secondJobUuid, JobStatus.IN_PROGRESS);
listServicesAndAssertStatus(expectedJobStatusMap);
+
//when get FAILED status from MSO statuses are : COMPLETED, FAILED, STOPPED
- when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(FAILED_STR));
- job = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.FAILED);
- expectedJobStatusMap.put(job.getUuid(), JobStatus.FAILED);
+ when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).thenReturn(asyncRequestStatusResponseAsRestObject(FAILED_STR));
+ pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.FAILED);
+ expectedJobStatusMap.put(secondJobUuid, JobStatus.FAILED);
expectedJobStatusMap = expectedJobStatusMap.entrySet().stream().collect(Collectors.toMap(
- e -> e.getKey(), e -> e.getValue() == PENDING ? JobStatus.STOPPED : e.getValue()
+ e -> e.getKey(), e -> e.getValue() == PENDING ? JobStatus.STOPPED : e.getValue()
));
listServicesAndAssertStatus(expectedJobStatusMap);
IntStream.range(0, uuids.size()).forEach(i -> {
UUID uuid = uuids.get(i);
- List<String> msoStatuses = asyncInstantiationBL.getAuditStatuses(uuid, MSO).stream().map(x -> x.getJobStatus()).collect(Collectors.toList());
- List<String> vidStatuses = asyncInstantiationBL.getAuditStatuses(uuid, VID).stream().map(x -> x.getJobStatus()).collect(Collectors.toList());
- assertThat(msoStatuses, is(expectedStatusesForMso.get(i)));
+ List<String> vidStatuses = auditService.getAuditStatuses(uuid, VID).stream().map(x -> x.getJobStatus()).collect(Collectors.toList());
assertThat(vidStatuses, is(expectedStatusesForVid.get(i)));
});
- //
+
+ //assert no more jobs to pull
assertFalse(jobsBrokerService.pull(PENDING, randomUuid()).isPresent());
assertFalse(jobsBrokerService.pull(JobStatus.IN_PROGRESS, randomUuid()).isPresent());
}
@@ -273,8 +303,8 @@
@DataProvider
public static Object[][] AlaCarteStatuses(Method test) {
return new Object[][]{
- {COMPLETE_STR, JobStatus.COMPLETED, JobStatus.COMPLETED},
- {FAILED_STR, JobStatus.COMPLETED_WITH_ERRORS, JobStatus.FAILED},
+ {COMPLETE_STR, JobStatus.COMPLETED},
+ {FAILED_STR, JobStatus.COMPLETED_WITH_ERRORS},
};
}
@@ -285,8 +315,8 @@
Make sure service state is Completed successfully once we got from MSO complete for the vnf job.
status Creating
*/
- //@Test(dataProvider = "AlaCarteStatuses")
- public void testStatusesOfServiceDuringALaCarteLifeCycleIgnoringVfModules(String msoVnfStatus, JobStatus expectedServiceStatus, JobStatus expectedVnfStatus) {
+ @Test(dataProvider = "AlaCarteStatuses")
+ public void testStatusesOfServiceDuringALaCarteLifeCycleIgnoringVfModules(String msoVnfStatus, JobStatus expectedServiceStatus) {
/*
[v] + push alacarte with 1 vnf
[v] verify STATUS pending
@@ -305,6 +335,7 @@
* not looking on audit (yet)
*/
+ reset(restMso);
when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VNF)).thenReturn(true);
when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VFMODULE)).thenReturn(false);
final String SERVICE_REQUEST_ID = UUID.randomUUID().toString();
@@ -315,39 +346,22 @@
//push alacarte with 1 vnf, verify STATUS pending
UUID uuid = pushALaCarteWithVnf();
singleServicesAndAssertStatus(JobStatus.PENDING, uuid);
-
//mock mso to answer 200 of create service instance request, verify STATUS in progress
- when(restMso.PostForObject(any(), endsWith("serviceInstances"), eq(RequestReferencesContainer.class))).thenReturn(
- createResponse(200, SERVICE_INSTANCE_ID, SERVICE_REQUEST_ID));
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.PENDING, JobStatus.IN_PROGRESS, JobType.InProgressStatus);
- singleServicesAndAssertStatus(JobStatus.IN_PROGRESS, uuid);
-
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), endsWith("serviceInstances"), any())).thenReturn(
+ createResponse(200, SERVICE_INSTANCE_ID, SERVICE_REQUEST_ID));
//mock mso to answer COMPLETE for service instance create, job status shall remain IN_PROGRESS and type shall be Watching
- reset(restMso);
when(restMso.GetForObject(endsWith(SERVICE_REQUEST_ID), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS, JobType.Watching);
- singleServicesAndAssertStatus(JobStatus.IN_PROGRESS, uuid);
-
+ thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
//mock mso to answer 200 of create vnf instance request, pull+execute vnf job, STATUS resource in progress
- reset(restMso);
- when(restMso.PostForObject(any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs"), eq(RequestReferencesContainer.class))).thenReturn(
- createResponse(200, UUID.randomUUID().toString(), VNF_REQUEST_ID));
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.CREATING, JobStatus.RESOURCE_IN_PROGRESS, JobType.VnfInProgressStatus);
-
- //verify service job STATUS in progress
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS, JobType.Watching);
- singleServicesAndAssertStatus(JobStatus.IN_PROGRESS, uuid);
-
- //mock mso to answer msoVnfStatus (COMPLETE/FAILED) for vnf creation status,
- //job status shall be final (COMPLETE/COMPLETE_WITH_ERRORS)
- reset(restMso);
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs"), any())).thenReturn(
+ createResponse(200, UUID.randomUUID().toString(), VNF_REQUEST_ID));
when(restMso.GetForObject(endsWith(VNF_REQUEST_ID), eq(AsyncRequestStatus.class))).thenReturn(
- asyncRequestStatusResponseAsRestObject(msoVnfStatus));
- pullJobProcessAndPushBack(JobStatus.RESOURCE_IN_PROGRESS, expectedVnfStatus, false);
- singleServicesAndAssertStatus(JobStatus.IN_PROGRESS, uuid);
- pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, expectedServiceStatus, true);
- singleServicesAndAssertStatus(expectedServiceStatus, uuid);
+ asyncRequestStatusResponseAsRestObject(msoVnfStatus));
+
+ processJobsCountTimesAndAssertStatus(uuid, 100, expectedServiceStatus);
+ verify(restMso, times(1)).restCall(eq(HttpMethod.POST), any(), any(), eq("/serviceInstantiation/v7/serviceInstances"), any());
+ verify(restMso, times(1)).restCall(eq(HttpMethod.POST), any(), any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs"), any());
+ verify(restMso, times(2)).GetForObject(any(), any());
}
@@ -361,13 +375,11 @@
And union these tests to single one.
*/
- //@Test
+ @Test
public void testALaCarteLifeCycle1Vnf2VfModules() {
String msoVnfStatus = COMPLETE_STR;
- JobStatus expectedServiceStatus = IN_PROGRESS;
- JobStatus expectedVnfStatus = RESOURCE_IN_PROGRESS;
when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VNF)).thenReturn(true);
when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VFMODULE)).thenReturn(true);
final String SERVICE_REQUEST_ID = UUID.randomUUID().toString();
@@ -383,39 +395,27 @@
//push alacarte with 1 vnf, verify STATUS pending
UUID uuid = pushALaCarteWithVnf();
singleServicesAndAssertStatus(JobStatus.PENDING, uuid);
+ reset(restMso);
/*---------- service -----------*/
//mock mso to answer 200 of create service instance request, verify STATUS in progress
- when(restMso.PostForObject(any(), endsWith("serviceInstances"), eq(RequestReferencesContainer.class))).thenReturn(
- createResponse(200, SERVICE_INSTANCE_ID, SERVICE_REQUEST_ID));
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.PENDING, JobStatus.IN_PROGRESS, JobType.InProgressStatus);
- singleServicesAndAssertStatus(JobStatus.IN_PROGRESS, uuid);
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), endsWith("serviceInstances"), any())).thenReturn(
+ createResponse(200, SERVICE_INSTANCE_ID, SERVICE_REQUEST_ID));
- //mock mso to answer COMPLETE for service instance create, job status shall remain IN_PROGRESS and type shall be Watching
- reset(restMso);
+ //mock mso to answer COMPLETE for service instance create
when(restMso.GetForObject(endsWith(SERVICE_REQUEST_ID), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS, JobType.Watching);
- singleServicesAndAssertStatus(JobStatus.IN_PROGRESS, uuid);
+ thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
/*---------- vnf -----------*/
- //mock mso to answer 200 of create vnf instance request, pull+execute vnf job, STATUS resource in progress
- reset(restMso);
- when(restMso.PostForObject(any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs"), eq(RequestReferencesContainer.class))).thenReturn(
- createResponse(200, VNF_INSTANCE_ID, VNF_REQUEST_ID));
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.CREATING, JobStatus.RESOURCE_IN_PROGRESS, JobType.VnfInProgressStatus);
-
- //verify service job STATUS in progress
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS, JobType.Watching);
- singleServicesAndAssertStatus(JobStatus.IN_PROGRESS, uuid);
+ //mock mso to answer 200 of create vnf instance request
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs"), any())).thenReturn(
+ createResponse(200, VNF_INSTANCE_ID, VNF_REQUEST_ID));
//mock mso to answer msoVnfStatus (COMPLETE/FAILED) for vnf creation status,
- //job status shall be final (COMPLETE/COMPLETE_WITH_ERRORS)
- reset(restMso);
when(restMso.GetForObject(endsWith(VNF_REQUEST_ID), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+ thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
try {
reset(commandUtils);
@@ -425,113 +425,164 @@
}
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.RESOURCE_IN_PROGRESS, JobStatus.RESOURCE_IN_PROGRESS, JobType.WatchingBaseModule);
- singleServicesAndAssertStatus(JobStatus.IN_PROGRESS, uuid);
- pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS, true);
- singleServicesAndAssertStatus(JobStatus.IN_PROGRESS, uuid);
-
/*---------- vf Module without volume group name (base) -----------*/
- //vg name not exist, so vf module created immediately
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.CREATING, JobStatus.RESOURCE_IN_PROGRESS, JobType.Watching);
-
- //verify vnf/volumeGroup job STATUS still watching with resource in progress
- pullMultipleJobsFindExpectedProcessAndPushBack(JobStatus.RESOURCE_IN_PROGRESS, JobType.Watching, JobStatus.RESOURCE_IN_PROGRESS, JobType.Watching);
-
//mock mso to answer 200 of create vfModule instance request, pull+execute volumeGroup job, STATUS resource in progress
- reset(restMso);
- when(restMso.PostForObject(any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs/" + VNF_INSTANCE_ID + "/vfModules"), eq(RequestReferencesContainer.class))).thenReturn(
- createResponse(200, UUID.randomUUID().toString(), VF_MODULE_REQUEST_ID));
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.CREATING, JobStatus.RESOURCE_IN_PROGRESS, JobType.ResourceInProgressStatus);
-
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs/" + VNF_INSTANCE_ID + "/vfModules"), any())).thenReturn(
+ createResponse(200, UUID.randomUUID().toString(), VG_REQUEST_ID));
//mock mso to answer for vf module orchestration request
- reset(restMso);
when(restMso.GetForObject(endsWith(VF_MODULE_REQUEST_ID), eq(AsyncRequestStatus.class))).thenReturn(
- asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- pullMultipleJobsFindExpectedProcessAndPushBack(JobStatus.RESOURCE_IN_PROGRESS, JobType.ResourceInProgressStatus, JobStatus.COMPLETED, JobType.ResourceInProgressStatus);
+ asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- //verify volume group become completed
- pullMultipleJobsFindExpectedProcessAndPushBack(JobStatus.RESOURCE_IN_PROGRESS, JobType.Watching, JobStatus.COMPLETED, JobType.Watching);
-
- //vnf become watching after volume group completed, and new volume group created
- pullMultipleJobsFindExpectedProcessAndPushBack(JobStatus.RESOURCE_IN_PROGRESS, JobType.WatchingBaseModule, JobStatus.RESOURCE_IN_PROGRESS, JobType.Watching);
-
- /*---------- volume group & vf module (non base) -----------*/
-
- /*---------- volume group -----------*/
-
- //mock mso to answer 200 of create volumeGroup instance request, pull+execute volumeGroup job, STATUS resource in progress
- reset(restMso);
- when(restMso.PostForObject(any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs/" + VNF_INSTANCE_ID + "/volumeGroups"), eq(RequestReferencesContainer.class))).thenReturn(
- createResponse(200, VG_INSTANCE_ID, VG_REQUEST_ID));
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.CREATING, JobStatus.RESOURCE_IN_PROGRESS, JobType.VolumeGroupInProgressStatus);
-
- //verify vnf job STATUS still watching with resource in progress
- pullMultipleJobsFindExpectedProcessAndPushBack(JobStatus.RESOURCE_IN_PROGRESS, JobType.Watching, JobStatus.RESOURCE_IN_PROGRESS, JobType.Watching);
-
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs/" + VNF_INSTANCE_ID + "/volumeGroups"), any())).thenReturn(
+ createResponse(200, VG_INSTANCE_ID, VG_REQUEST_ID));
//mock mso to answer for volume group orchestration request
- reset(restMso);
when(restMso.GetForObject(endsWith(VG_REQUEST_ID), eq(AsyncRequestStatus.class))).thenReturn(
- asyncRequestStatusResponseAsRestObject(msoVnfStatus));
- pullMultipleJobsFindExpectedProcessAndPushBack(JobStatus.RESOURCE_IN_PROGRESS, JobType.VolumeGroupInProgressStatus, JobStatus.RESOURCE_IN_PROGRESS, JobType.Watching);
+ asyncRequestStatusResponseAsRestObject(msoVnfStatus));
/*---------- vfModule -----------*/
//mock mso to answer 200 of create vfModule instance request, pull+execute volumeGroup job, STATUS resource in progress
- reset(restMso);
- when(restMso.PostForObject(any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs/" + VNF_INSTANCE_ID + "/vfModules"), eq(RequestReferencesContainer.class))).thenReturn(
- createResponse(200, UUID.randomUUID().toString(), VF_MODULE_REQUEST_ID2));
- pullJobProcessAndPushBackWithTypeAssertion(JobStatus.CREATING, JobStatus.RESOURCE_IN_PROGRESS, JobType.ResourceInProgressStatus);
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs/" + VNF_INSTANCE_ID + "/vfModules"), any())).thenReturn(
+ createResponse(200, UUID.randomUUID().toString(), VF_MODULE_REQUEST_ID2));
//mock mso to answer for vf module orchestration request
- reset(restMso);
when(restMso.GetForObject(endsWith(VF_MODULE_REQUEST_ID2), eq(AsyncRequestStatus.class))).thenReturn(
- asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- pullMultipleJobsFindExpectedProcessAndPushBack(JobStatus.RESOURCE_IN_PROGRESS, JobType.ResourceInProgressStatus, JobStatus.COMPLETED, JobType.ResourceInProgressStatus);
+ asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- //execute twice - 1 for parent volume group, 1 for parent vnf
- pullAllJobProcessAndPushBackByType(JobStatus.RESOURCE_IN_PROGRESS, JobType.Watching , JobStatus.COMPLETED);
-
- singleServicesAndAssertStatus(JobStatus.IN_PROGRESS, uuid);
- pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.COMPLETED, true);
- singleServicesAndAssertStatus(JobStatus.COMPLETED, uuid);
+ processJobsCountTimesAndAssertStatus(uuid, 200, COMPLETED);
+ verify(restMso, times(1)).restCall(eq(HttpMethod.POST), any(), any(), eq("/serviceInstantiation/v7/serviceInstances"), any());
+ verify(restMso, times(1)).restCall(eq(HttpMethod.POST), any(), any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs"), any());
+ verify(restMso, times(1)).restCall(eq(HttpMethod.POST), any(), any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs/" + VNF_INSTANCE_ID + "/volumeGroups"), any());
+ verify(restMso, times(2)).restCall(eq(HttpMethod.POST), any(), any(), endsWith(SERVICE_INSTANCE_ID + "/vnfs/" + VNF_INSTANCE_ID + "/vfModules"), any());
+ verify(restMso, times(5)).GetForObject(any(), any());
}
- //@Test
+ @Test
+ public void testALaCarteLifeCycle2Networks() {
+
+ //Create Service with 2 networks, and make sure they created in sequence (and not in parallel)
+ //Config MSO to response 200 only to first network creation. And answer 500 for second one.
+ //Then MSO return in_progress some times (like 10 times), and then return COMPLETE.
+ //Only when MSO return COMPLETE for first network, config MSO to return 200 for second network creation
+
+ final String SERVICE_REQUEST_ID = UUID.randomUUID().toString();
+ final String SERVICE_INSTANCE_ID = UUID.randomUUID().toString();
+ final String NETWORK_REQUEST_ID1 = UUID.randomUUID().toString();
+ final String NETWORK_INSTANCE_ID1 = UUID.randomUUID().toString();
+ //TODO use them later for different networks
+ final String NETWORK_REQUEST_ID2 = UUID.randomUUID().toString();
+ final String NETWORK_INSTANCE_ID2 = UUID.randomUUID().toString();
+
+
+ NetworkDetails networkDetails1 = new NetworkDetails("LukaDoncic", "1");
+ NetworkDetails networkDetails2 = new NetworkDetails("KevinDurant", "2");
+
+ reset(restMso);
+
+ /*---------- service -----------*/
+
+ //mock mso to answer 200 of create service instance request, verify STATUS in progress
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), endsWith("serviceInstances"), any())).thenReturn(
+ createResponse(200, SERVICE_INSTANCE_ID, SERVICE_REQUEST_ID));
+
+ //mock mso to answer COMPLETE for service instance create
+ when(restMso.GetForObject(endsWith(SERVICE_REQUEST_ID), eq(AsyncRequestStatus.class))).
+ thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+
+ final MutableInt secondNetworkCode = new MutableInt(500);
+ final MutableInt inProgressCount = new MutableInt(0);
+
+ /*---------- network 1-----------*/
+
+ //mock mso to answer 200 of first create network instance request
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class),
+ MockitoHamcrest.argThat(jsonPartMatches("requestDetails.requestInfo.instanceName", equalTo(networkDetails1.name))) ,
+ endsWith(SERVICE_INSTANCE_ID + "/networks"), any())).thenReturn(
+ createResponse(200, NETWORK_INSTANCE_ID1, NETWORK_REQUEST_ID1));
+
+ //mock mso to answer IN_PROGRESS 10 times, and only then COMPLETE for first network
+ //Once COMPLETE, second network creation will return 200
+ when(restMso.GetForObject(endsWith(NETWORK_REQUEST_ID1), eq(AsyncRequestStatus.class))).
+ thenAnswer(x->{
+ String status;
+ if (inProgressCount.getValue()<10) {
+ status = IN_PROGRESS_STR;
+ } else {
+ secondNetworkCode.setValue(200);
+ status = COMPLETE_STR;
+ }
+ inProgressCount.add(1);
+ return asyncRequestStatusResponseAsRestObject(status);
+ });
+
+ /*---------- network 2-----------*/
+
+ //mock MSO to return status code of secondNetworkCode (500 and 200 after first one COMPLETED)
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class),
+ MockitoHamcrest.argThat(jsonPartMatches("requestDetails.requestInfo.instanceName", equalTo(networkDetails2.name))) ,
+ endsWith(SERVICE_INSTANCE_ID + "/networks"), any())).thenAnswer(x->
+ createResponse(secondNetworkCode.intValue(), NETWORK_INSTANCE_ID2, NETWORK_REQUEST_ID2));
+
+// when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any() , endsWith(SERVICE_INSTANCE_ID + "/networks"), any())).thenReturn(
+// createResponse(200, NETWORK_INSTANCE_ID1, NETWORK_REQUEST_ID1));
+ //mock mso to answer COMPLETE for network creation status,
+
+ when(restMso.GetForObject(endsWith(NETWORK_REQUEST_ID2), eq(AsyncRequestStatus.class))).
+ thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+
+
+ /*---------- Create request and process it -----------*/
+ //push alacarte with 2 networks, verify STATUS pending
+ when(featureManager.isActive(Features.FLAG_EXP_CREATE_RESOURCES_IN_PARALLEL)).thenReturn(false);
+ ServiceInstantiation serviceInstantiation = generateALaCarteWithNetworksPayload(ImmutableList.of(networkDetails1, networkDetails2));
+ UUID uuid = asyncInstantiationBL.pushBulkJob(serviceInstantiation, USER_ID).get(0);
+ singleServicesAndAssertStatus(JobStatus.PENDING, uuid);
+
+ processJobsCountTimesAndAssertStatus(uuid, 200, COMPLETED);
+
+ //validate the mso request id is the right one
+ List<ServiceInfo> serviceInfoList = asyncInstantiationBL.getAllServicesInfo();
+ ServiceInfo serviceInfo = serviceInfoList.get(0);
+ assertThat(serviceInfo.getMsoRequestId(), is(UUID.fromString(SERVICE_REQUEST_ID)));
+
+ /*---------- verify -----------*/
+ verify(restMso, times(1)).restCall(eq(HttpMethod.POST), any(), any(), eq("/serviceInstantiation/v7/serviceInstances"), any());
+ verify(restMso, times(2)).restCall(eq(HttpMethod.POST), any(), any(), endsWith(SERVICE_INSTANCE_ID + "/networks"), any());
+ //get status
+ verify(restMso, times(1)).GetForObject(endsWith(SERVICE_REQUEST_ID), any());
+ verify(restMso, times(11)).GetForObject(endsWith(NETWORK_REQUEST_ID1), any());
+ verify(restMso, times(1)).GetForObject(endsWith(NETWORK_REQUEST_ID2), any());
+ }
+
+ @Test
public void testBadAaiResponseForSearchNamesAndBackToNormal() {
when(aaiClient.isNodeTypeExistsByName(any(), any())).thenThrow(aaiNodeQueryBadResponseException());
- pushMacroBulk(); //JOB shall become IN_PROGRESS but service info is still pending
- Job job = pullJobProcessAndPushBack(PENDING, JobStatus.IN_PROGRESS, true);
- listServicesAndAssertStatus(PENDING, PENDING, job);
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), any(), eq(Optional.empty()))).thenReturn(createResponse(200));
+ when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).
+ thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- //JOB shall remain in IN_PROGRESS
- job = pullJobProcessAndPushBack( JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS, true);
- //make sure the job command is still ServiceInstantiation
- assertThat(job.getType(), is(JobType.MacroServiceInstantiation));
- listServicesAndAssertStatus(PENDING, PENDING, job);
+ List<UUID> uuids = pushMacroBulk();
+ processJobsCountTimesAndAssertStatus(uuids.get(0), 5, IN_PROGRESS, PENDING); //JOB shall become IN_PROGRESS but service info is still pending
//simulate AAI back to normal, AAI return name is free, and MSO return good response
Mockito.reset(aaiClient); // must forget the "thenThrow"
when(aaiClient.isNodeTypeExistsByName(any(), any())).thenReturn(false);
- when(restMso.PostForObject(any(),any(), eq(RequestReferencesContainer.class))).thenReturn(createResponse(200));
- job = pullJobProcessAndPushBack( JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS, true);
- listServicesAndAssertStatus(JobStatus.IN_PROGRESS, PENDING, job);
+ processJobsCountTimesAndAssertStatus(uuids.get(0), 30, COMPLETED, COMPLETED);
- //when get job COMPLETE from MSO, service status become COMPLETED
- when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- job = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, COMPLETED);
- listServicesAndAssertStatus(COMPLETED, PENDING, job);
}
- //@Test
+ @Test
public void testAaiResponseNameUsedTillMaxRetries() {
when(aaiClient.isNodeTypeExistsByName(any(), any())).thenReturn(true);
+ //simulate MSO to return good result, for making sure we failed because of AAI error
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), any(), eq(Optional.empty()))).thenReturn(createResponse(200));
+ when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).
+ thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+
asyncInstantiationBL.setMaxRetriesGettingFreeNameFromAai(10);
- pushMacroBulk();
- //JOB shall become IN_PROGRESS but service info is still pending
- Job job = pullJobProcessAndPushBack(PENDING, JobStatus.FAILED, true);
- listServicesAndAssertStatus(JobStatus.FAILED, JobStatus.STOPPED, job);
+ List<UUID> uuids = pushMacroBulk();
+ processJobsCountTimesAndAssertStatus(uuids.get(0), 20, FAILED, STOPPED);
}
private Job pullJobProcessAndPushBack(JobStatus topic, JobStatus expectedNextJobStatus) {
@@ -559,22 +610,23 @@
return job.get();
}
+ private void simplePullJobProcessAndPushBack(JobStatus topic) {
+ Optional<Job> optionalJob = jobsBrokerService.pull(topic, randomUuid());
+ optionalJob.ifPresent(job->{
+ Job nextJob = jobWorker.executeJobAndGetNext(job);
+ jobsBrokerService.pushBack(nextJob);
+ });
+ }
+
private Job pullJobProcessAndPushBackWithTypeAssertion(JobStatus topic, JobStatus expectedNextJobStatus,
- JobType expectedNextJobType) {
+ JobType expectedNextJobType) {
Job job = pullJobProcessAndPushBack(topic, expectedNextJobStatus, false);
assertThat("job not ok: " + job.getData(), job.getType(), is(expectedNextJobType));
return job;
}
private Job pullJobProcessAndPushBackWithTypeAssertion(JobStatus topic, JobStatus expectedNextJobStatus,
- JobType expectedNextJobType, int retries) {
- return retryWithAssertionsLimit(retries, () -> {
- return pullJobProcessAndPushBackWithTypeAssertion(topic, expectedNextJobStatus, expectedNextJobType);
- });
- }
-
- private Job pullJobProcessAndPushBackWithTypeAssertion(JobStatus topic, JobStatus expectedNextJobStatus,
- JobType expectedNextJobType, Action actionPhase, InternalState internalState, int retries) {
+ JobType expectedNextJobType, Action actionPhase, InternalState internalState, int retries) {
return retryWithAssertionsLimit(retries, () -> {
Job job = pullJobProcessAndPushBackWithTypeAssertion(topic, expectedNextJobStatus, expectedNextJobType);
assertThat("job not ok: " + job.getData(), job.getData(), is(jsonPartEquals("actionPhase", actionPhase.name())));
@@ -598,49 +650,11 @@
// No success:
throw new AssertionError("No luck while all of these assertion errors: " + history.stream()
- .map(Throwable::getMessage)
- .map(s -> s.replace('\n', ' '))
- .map(s -> s.replaceAll("\\s{2,}"," "))
- .distinct()
- .collect(joining("\n ", "\n ", "")), history.peek());
- }
-
- private Job pullMultipleJobsFindExpectedProcessAndPushBack(JobStatus topic, JobType expectedCurrentJobType, JobStatus expectedNextJobStatus,
- JobType expectedNextJobType) {
- List<Job> pulledJobs = new ArrayList<>();
- Job lastJob = null;
- while (lastJob == null || lastJob.getType() != expectedCurrentJobType) {
- lastJob = pullJob(topic, false).get();
- if (lastJob.getType() != expectedCurrentJobType) {
- pulledJobs.add(lastJob);
- }
- }
-
- Job nextJob = jobWorker.executeJobAndGetNext(lastJob);
- assertThat(nextJob.getStatus(), is(expectedNextJobStatus));
- assertThat(nextJob.getType(), is(expectedNextJobType));
-
- jobsBrokerService.pushBack(nextJob);
- assertThat(jobsBrokerService.peek(nextJob.getUuid()).getStatus(), is(expectedNextJobStatus));
-
- pulledJobs.forEach(job ->
- jobsBrokerService.pushBack(job)
- );
-
- return nextJob;
- }
-
- private void pullAllJobProcessAndPushBackByType(JobStatus topic, JobType commandType, JobStatus expectedFinalStatus) {
- Map<UUID, JobStatus> jobStatusMap = new HashMap<>();
- Optional<Job> job = pullJob(topic, false);
- for (int i=0; i<1000 && job.isPresent() && job.get().getType() == commandType; i++) {
- Job nextJob = jobWorker.executeJobAndGetNext(job.get());
- jobStatusMap.put(nextJob.getUuid(), nextJob.getStatus());
- jobsBrokerService.pushBack(nextJob);
- job = jobsBrokerService.pull(topic, UUID.randomUUID().toString());
- }
- assertThat(jobStatusMap.values(), everyItem(is(expectedFinalStatus)));
-
+ .map(Throwable::getMessage)
+ .map(s -> s.replace('\n', ' '))
+ .map(s -> s.replaceAll("\\s{2,}"," "))
+ .distinct()
+ .collect(joining("\n ", "\n ", "")), history.peek());
}
private Optional<Job> pullJob(JobStatus topic, boolean pullingAssertion) {
@@ -665,49 +679,37 @@
}
- //@Test
+ @Test
public void whenPushNewBulk_andGetNoResponseFromMsoOnCreation_thenServiceMoveToFailedAndOtherToStopped() {
- when(restMso.PostForObject(any(), any(), eq(RequestReferencesContainer.class))).thenReturn(createResponse(500));
- pushBulkPullPendingJobAndAssertJobStatus(JobStatus.FAILED, JobStatus.STOPPED);
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), any(), eq(Optional.empty()))).thenReturn(createResponse(500));
+ //assert that when get ProcessingException from restMso, status remain the same
+ List<UUID> uuids = pushMacroBulk();
+ processJobsCountTimesAndAssertStatus(uuids.get(0), 30, JobStatus.FAILED, JobStatus.STOPPED);
}
- //@Test
+ @Test
public void whenMsoStatusIsPendingManualTask_ThenJobStatusIsPaused() {
- when(restMso.PostForObject(any(), any(), eq(RequestReferencesContainer.class))).thenReturn(createResponse(200));
-
- Job firstJob = pushBulkPullPendingJobAndAssertJobStatus(JobStatus.IN_PROGRESS, PENDING);
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), any(), eq(Optional.empty()))).thenReturn(createResponse(200));
+ when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).
+ thenReturn(asyncRequestStatusResponseAsRestObject(PENDING_MANUAL_TASK));
//assert that when get ProcessingException from restMso, status remain the same
- when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(PENDING_MANUAL_TASK));
- Job job = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS);
- listServicesAndAssertStatus(PAUSE, PENDING, job);
+ List<UUID> uuids = pushMacroBulk();
+ processJobsCountTimesAndAssertStatus(uuids.get(0), 30, PAUSE, PENDING);
- //The paused job is pulled and remain in pause state. Other jobs from bulk remain pending
- job = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS);
- listServicesAndAssertStatus(PAUSE, PENDING, job);
//the job get IN_PROGRESS response (simulate activate operation) and status changed to IN_PROGRESS
when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR));
- job = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.IN_PROGRESS);
- listServicesAndAssertStatus(JobStatus.IN_PROGRESS, PENDING, job);
+ thenReturn(asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR));
+ processJobsCountTimesAndAssertStatus(uuids.get(0), 30, IN_PROGRESS, PENDING);
+ //the job get COMPLETE response this job is copmpleted and then also other jobs
when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- job = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, COMPLETED);
- listServicesAndAssertStatus(COMPLETED, PENDING, job);
-
- //Pulling PENDING job return another job
- assertThat(jobsBrokerService.pull(PENDING, randomUuid()).get().getUuid(), not(equalTo(job.getUuid())));
-
-
- ImmutableList<String> expectedStatusesForMso = ImmutableList.of(REQUESTED, PENDING_MANUAL_TASK, IN_PROGRESS_STR, COMPLETE_STR);
- List<String> msoStatuses = asyncInstantiationBL.getAuditStatuses(firstJob.getUuid(), MSO).stream().map(x -> x.getJobStatus()).collect(Collectors.toList());
- assertThat(msoStatuses, is(expectedStatusesForMso));
+ thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+ processJobsCountTimesAndAssertStatus(uuids.get(0), 200, COMPLETED, COMPLETED);
ImmutableList<String> expectedStatusesForVid = statusesToStrings(PENDING, IN_PROGRESS, PAUSE, IN_PROGRESS, COMPLETED);
- List<String> vidStatuses = asyncInstantiationBL.getAuditStatuses(firstJob.getUuid(), VID).stream().map(x -> x.getJobStatus()).collect(Collectors.toList());
+ List<String> vidStatuses = auditService.getAuditStatuses(uuids.get(0), VID).stream().map(x -> x.getJobStatus()).collect(Collectors.toList());
assertThat(vidStatuses, is(expectedStatusesForVid));
}
@@ -718,65 +720,76 @@
private Job pullPendingJobAndAssertJobStatus(JobStatus pulledJobStatus, JobStatus otherJobsStatus) {
Job job = pullJobProcessAndPushBack(PENDING, pulledJobStatus, false);
- listServicesAndAssertStatus(pulledJobStatus, otherJobsStatus, job);
+ listServicesAndAssertStatus(pulledJobStatus, otherJobsStatus, job.getUuid());
return job;
}
- //@Test
+ @Test
public void test2BulksLifeCyclesAreIndependent() {
- pushMacroBulk();
- when(restMso.PostForObject(any(), any(), eq(RequestReferencesContainer.class))).thenReturn(createResponse(200));
- //push 2nd job, then when pulling first job the job become in_progress, other jobs (from 2 bulks) remain pending
- Job firstJob = pushBulkPullPendingJobAndAssertJobStatus(JobStatus.IN_PROGRESS, PENDING);
- //assert we can pull another job from pending from other template id
- Job secondJob = pullJobProcessAndPushBack(PENDING, JobStatus.IN_PROGRESS, false);
- assertThat(firstJob.getTemplateId(), not(equalTo(secondJob.getTemplateId())));
+ final String SERVICE1_REQUEST_ID = UUID.randomUUID().toString();
+ final String SERVICE1_INSTANCE_ID = UUID.randomUUID().toString();
+ final String SERVICE2_REQUEST_ID = UUID.randomUUID().toString();
+ final String SERVICE2_INSTANCE_ID = UUID.randomUUID().toString();
+ final String SERVICE3_4_REQUEST_ID = UUID.randomUUID().toString();
+ final String SERVICE3_4_INSTANCE_ID = UUID.randomUUID().toString();
- //assert no more PENDING jobs to pull
- assertFalse(jobsBrokerService.pull(PENDING, randomUuid()).isPresent());
- //when get FAILED status from MSO statuses for failed bulk are: FAILED, STOPPED, for other bulk: IN_PROGRESS, 2 pending
- when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(FAILED_STR));
- Job failedJob = pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, JobStatus.FAILED, false);
+ //create first bulk and make one job in progress
+ List<UUID> firstBulksIDs = pushMacroBulk();
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), any(), eq(Optional.empty())))
+ .thenReturn(createResponse(200, SERVICE1_INSTANCE_ID, SERVICE1_REQUEST_ID));
+ when(restMso.GetForObject(endsWith(SERVICE1_REQUEST_ID), eq(AsyncRequestStatus.class))).
+ thenReturn(asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR));
+ processJobsCountTimesAndAssertStatus(firstBulksIDs.get(0), 30, IN_PROGRESS, PENDING);
+
+ //create 2nd bulk, then when pulling first job the job become in_progress, other jobs (from 2 bulks) remain pending
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), any(), eq(Optional.empty())))
+ .thenReturn(createResponse(200, SERVICE2_INSTANCE_ID, SERVICE2_REQUEST_ID));
+ when(restMso.GetForObject(endsWith(SERVICE2_REQUEST_ID), eq(AsyncRequestStatus.class))).
+ thenReturn(asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR));
+ List<UUID> secondBulksIDs = pushMacroBulk();
+ processJobsCountTimes(30);
+ Map<JobStatus, Long> statusCount = getJobStatusesCount();
+ assertThat(statusCount.get(IN_PROGRESS), is(2L));
+ assertThat(statusCount.get(PENDING), is(4L));
+
+ //return failed to first job
+ //first bulk statuses shall be: FAILED, STOPPED, STOPPED
+ //second bulk statuses shall be: IN_PROGRESS, PENDING, PENDING
+ when(restMso.GetForObject(endsWith(SERVICE1_REQUEST_ID), eq(AsyncRequestStatus.class))).
+ thenReturn(asyncRequestStatusResponseAsRestObject(FAILED_STR));
+ processJobsCountTimes(30);
Map<UUID, List<ServiceInfo>> servicesByTemplateId =
- asyncInstantiationBL.getAllServicesInfo()
- .stream().collect(groupingBy(ServiceInfo::getTemplateId));
- assertServicesStatus(servicesByTemplateId.get(failedJob.getTemplateId()), JobStatus.FAILED, JobStatus.STOPPED, failedJob);
- Job successJob = failedJob.getUuid().equals(firstJob.getUuid()) ? secondJob : firstJob;
- assertServicesStatus(servicesByTemplateId.get(successJob.getTemplateId()), JobStatus.IN_PROGRESS, PENDING, successJob);
+ asyncInstantiationBL.getAllServicesInfo()
+ .stream().collect(groupingBy(ServiceInfo::getTemplateId));
+ ServiceInfo failedJob = asyncInstantiationBL.getAllServicesInfo().stream().filter(x->x.getJobId().equals(firstBulksIDs.get(0))).findFirst().get();
+ assertServicesStatus(servicesByTemplateId.get(failedJob.getTemplateId()), JobStatus.FAILED, JobStatus.STOPPED, failedJob.getJobId());
+ ServiceInfo successJob = asyncInstantiationBL.getAllServicesInfo().stream().filter(x->x.getJobId().equals(secondBulksIDs.get(0))).findFirst().get();
+ assertServicesStatus(servicesByTemplateId.get(successJob.getTemplateId()), JobStatus.IN_PROGRESS, PENDING, successJob.getJobId());
- //yet no more PENDING jobs to pull
- assertFalse(jobsBrokerService.pull(PENDING, randomUuid()).isPresent());
+ //return completed to all other jobs
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), any(), eq(Optional.empty())))
+ .thenReturn(createResponse(200, SERVICE3_4_INSTANCE_ID, SERVICE3_4_REQUEST_ID));
+ when(restMso.GetForObject(endsWith(SERVICE2_REQUEST_ID), eq(AsyncRequestStatus.class))).
+ thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+ when(restMso.GetForObject(endsWith(SERVICE3_4_REQUEST_ID), eq(AsyncRequestStatus.class))).
+ thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- //assert that job from non failed bulk can progress.
- //When completed, failed bulk statuses: FAILED, STOPPED. Succeeded bulk statuses are : COMPLETED, 2 pending
- when(restMso.GetForObject(any(), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, COMPLETED, false);
- servicesByTemplateId =
- asyncInstantiationBL.getAllServicesInfo()
- .stream().collect(groupingBy(ServiceInfo::getTemplateId));
- assertServicesStatus(servicesByTemplateId.get(failedJob.getTemplateId()), JobStatus.FAILED, JobStatus.STOPPED, failedJob);
- assertServicesStatus(servicesByTemplateId.get(successJob.getTemplateId()), COMPLETED, PENDING, successJob);
-
- //advance other jobs of succeeded bulk till al of them reach to COMPLETED
- pullJobProcessAndPushBack(PENDING, JobStatus.IN_PROGRESS, false);
- pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, COMPLETED, false);
- pullJobProcessAndPushBack(PENDING, JobStatus.IN_PROGRESS, false);
- pullJobProcessAndPushBack(JobStatus.IN_PROGRESS, COMPLETED, false);
- servicesByTemplateId =
- asyncInstantiationBL.getAllServicesInfo()
- .stream().collect(groupingBy(ServiceInfo::getTemplateId));
- assertServicesStatus(servicesByTemplateId.get(failedJob.getTemplateId()), JobStatus.FAILED, JobStatus.STOPPED, failedJob);
- assertServicesStatus(servicesByTemplateId.get(successJob.getTemplateId()), COMPLETED, COMPLETED, successJob);
-
+ processJobsCountTimes(30);
+ servicesByTemplateId = asyncInstantiationBL.getAllServicesInfo().stream().collect(groupingBy(ServiceInfo::getTemplateId));
+ assertServicesStatus(servicesByTemplateId.get(failedJob.getTemplateId()), JobStatus.FAILED, JobStatus.STOPPED, failedJob.getJobId());
+ assertServicesStatus(servicesByTemplateId.get(successJob.getTemplateId()), COMPLETED, COMPLETED, successJob.getJobId());
//assert no more PENDING jobs nor IN_PROGRESS jobs to pull
assertFalse(jobsBrokerService.pull(PENDING, randomUuid()).isPresent());
assertFalse(jobsBrokerService.pull(JobStatus.IN_PROGRESS, randomUuid()).isPresent());
}
+ protected Map<JobStatus, Long> getJobStatusesCount() {
+ return asyncInstantiationBL.getAllServicesInfo().stream().collect(groupingBy(ServiceInfo::getJobStatus, counting()));
+ }
+
+ @Test
public void deploy2NewGroupsToServiceWith1ExistingGroup() {
/*
@@ -795,18 +808,7 @@
[v] + pull+execute (should NOT post to MSO)
[v] verify STATUS in progress; TYPE watching
...
- [v] verify job#2 *new* GROUP job STATUS completed with no action TYPE group INTERNAL STATE terminal PHASE delete
- [v] verify job#3 *new* GROUP job STATUS completed with no action TYPE group INTERNAL STATE terminal PHASE delete
- [v] verify job#4 *new* GROUP job STATUS completed with no action TYPE group INTERNAL STATE terminal PHASE delete
- [v] + pull+execute job#1 (should NOT post to MSO)
- [v] verify STATUS in progress; TYPE watching
- [v] verify job#5 *new* GROUP job STATUS creating TYPE group INTERNAL STATE initial PHASE create
- [v] verify job#6 *new* GROUP job STATUS creating TYPE group INTERNAL STATE initial PHASE create
- [v] verify job#7 *new* GROUP job STATUS creating TYPE group INTERNAL STATE initial PHASE create
-
- [v] + pull+execute job#5 (should NOT post to MSO)
- [v] verify job#5 STATUS completed with no action TYPE group INTERNAL STATE terminal PHASE create
[v] + pull+execute job#1
[v] verify job#1 STATUS in progress; TYPE watching
@@ -845,70 +847,265 @@
singleServicesAndAssertStatus(PENDING, uuid);
// take from pending, put in-progress -> 3 delete-child were born
- pullJobProcessAndPushBackWithTypeAssertion(PENDING, IN_PROGRESS, JobType.ALaCarteService, Action.Delete, InternalState.WATCHING, 1);
+ pullJobProcessAndPushBackWithTypeAssertion(PENDING, IN_PROGRESS, JobType.ALaCarteService, Action.Create, InternalState.INITIAL, 1);
verifyQueueSizes(ImmutableMap.of(
- IN_PROGRESS, 1, CREATING, 3
- ));
-
- Stream.of(1, 2, 3).forEach(i -> {
- // take each child creating, put in-progress
- verify_Job1InProgress.accept(Action.Delete, IN_PROGRESS);
- pullJobProcessAndPushBackWithTypeAssertion(CREATING, RESOURCE_IN_PROGRESS, JobType.InstanceGroup, Action.Delete, null, 1);
-
- // execute each in-progress -> job is completed
- verify_Job1InProgress.accept(Action.Delete, IN_PROGRESS);
- pullJobProcessAndPushBackWithTypeAssertion(RESOURCE_IN_PROGRESS, COMPLETED/*_WITH_NO_ACTION*/, JobType.InstanceGroup,1);
- });
- verifyQueueSizes(ImmutableMap.of(
- IN_PROGRESS, 1, COMPLETED, 3
+ IN_PROGRESS, 1
));
// take job #1 from phase delete to phase create -> 3 create-child were born
verify_Job1InProgress.accept(Action.Create, IN_PROGRESS);
verifyQueueSizes(ImmutableMap.of(
- IN_PROGRESS, 1, CREATING, 3, COMPLETED, 3
+ IN_PROGRESS, 1, PENDING_RESOURCE, 3
));
// prepare MSO mock
- when(restMso.PostForObject(any(), endsWith("instanceGroups"), eq(RequestReferencesContainer.class)))
- .thenReturn(createResponse(200, GROUP1_INSTANCE_ID, GROUP1_REQUEST_ID))
- .thenReturn(createResponse(200, GROUP2_INSTANCE_ID, GROUP2_REQUEST_ID))
- .thenReturn(null);
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), endsWith("instanceGroups"), eq(Optional.empty())))
+ .thenReturn(createResponse(200, GROUP1_INSTANCE_ID, GROUP1_REQUEST_ID))
+ .thenReturn(createResponse(200, GROUP2_INSTANCE_ID, GROUP2_REQUEST_ID))
+ .thenReturn(null);
when(restMso.GetForObject(argThat(uri -> StringUtils.endsWithAny(uri, GROUP1_REQUEST_ID, GROUP2_REQUEST_ID)), eq(AsyncRequestStatus.class))).
- thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+ thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
- // take first "none" child from creating to completed
+ // take first "none" child from creating to COMPLETED_WITH_NO_ACTION
// note there's no concrete mechanism that makes the first child be
- // the "action=None" case, but that's what happens, and following line
+ // the "action=None" case, but that's what happens, and following lines
// relies on that fact.
- pullJobProcessAndPushBackWithTypeAssertion(CREATING, COMPLETED_WITH_NO_ACTION, JobType.InstanceGroupInstantiation, 1);
+ pullJobProcessAndPushBackWithTypeAssertion(PENDING_RESOURCE, COMPLETED_WITH_NO_ACTION, JobType.InstanceGroup, Action.Create, null, 1);
// take each of next two children from creating to in-progress, then to completed
// verify job #1 is watching, and MSO is getting requests
Stream.of(1, 2).forEach(i -> {
verify_Job1InProgress.accept(Action.Create, IN_PROGRESS);
- pullJobProcessAndPushBackWithTypeAssertion(CREATING, RESOURCE_IN_PROGRESS, JobType.ResourceInProgressStatus);
- verify(restMso, times(i)).PostForObject(any(), any(), any());
+ pullJobProcessAndPushBackWithTypeAssertion(PENDING_RESOURCE, RESOURCE_IN_PROGRESS, JobType.InstanceGroup, Action.Create, InternalState.IN_PROGRESS, 1);
+ verify(restMso, times(i)).restCall(any(), any(), any(), any(), any());
verify_Job1InProgress.accept(Action.Create, IN_PROGRESS);
- pullJobProcessAndPushBackWithTypeAssertion(RESOURCE_IN_PROGRESS, COMPLETED, JobType.ResourceInProgressStatus);
+ pullJobProcessAndPushBackWithTypeAssertion(RESOURCE_IN_PROGRESS, COMPLETED, JobType.InstanceGroup, Action.Create, null, 3);
verify(restMso, times(i)).GetForObject(any(), any());
});
// job #1 is done as all children are done
verify_Job1InProgress.accept(Action.Create, COMPLETED);
- verifyQueueSizes(ImmutableMap.of(COMPLETED, 7));
+ verifyQueueSizes(ImmutableMap.of(COMPLETED, 3, COMPLETED_WITH_NO_ACTION, 1));
}
+ @DataProvider
+ public static Object[][] createAndDeleteIntegrationTestDataProvider(Method test) {
+ return new Object[][]{
+ {"create and delete both bad http code", createResponse(400), createResponse(500), null, null, FAILED, 0},
+ {"create and delete success and status is success ", createResponseRandomIds(202), createResponseRandomIds(202),
+ asyncRequestStatusResponseAsRestObject(COMPLETE_STR), asyncRequestStatusResponseAsRestObject(COMPLETE_STR), COMPLETED, 2},
+ {"create and delete success, create status FAILED, delete status COMPLETED", createResponseRandomIds(202), createResponseRandomIds(202),
+ asyncRequestStatusResponseAsRestObject(FAILED_STR), asyncRequestStatusResponseAsRestObject(COMPLETE_STR), COMPLETED_WITH_ERRORS, 2},
+ {"create and delete success, create status FAILED, delete status FAILED", createResponseRandomIds(202), createResponseRandomIds(202),
+ asyncRequestStatusResponseAsRestObject(FAILED_STR), asyncRequestStatusResponseAsRestObject(FAILED_STR), FAILED, 2},
+ {"create success but delete failed and status is success ", createResponseRandomIds(202), createResponseRandomIds(400),
+ asyncRequestStatusResponseAsRestObject(COMPLETE_STR), null, COMPLETED_WITH_ERRORS, 1},
+ {"delete success but create failed and status is success ", createResponseRandomIds(400), createResponseRandomIds(202),
+ null, asyncRequestStatusResponseAsRestObject(COMPLETE_STR), COMPLETED_WITH_ERRORS, 1},
+ {"delete success but create failed and status of delete is FAILED ", createResponseRandomIds(400), createResponseRandomIds(202),
+ null, asyncRequestStatusResponseAsRestObject(FAILED_STR), FAILED, 1}
+ };
+ }
+
+ //this test is going along with AsyncInstantiationALaCarteApiTest.viewEditVnfGroup__verifyStatusAndAudit API test
+ //The API test has only the happy flow scenario, while this test also test additional MSO responses (mostly non happy)
+ @Test(dataProvider="createAndDeleteIntegrationTestDataProvider")
+ public void vnfGropingIntegrationTest(
+ String desc,
+ RestObject<RequestReferencesContainer> createGroupResponse,
+ RestObject<RequestReferencesContainer> deleteGroupResponse,
+ RestObject<AsyncRequestStatus> createStatusResponse,
+ RestObject<AsyncRequestStatus> deleteStatusResponse,
+ JobStatus expectedJobStatus,
+ int getStatusCounter) throws IOException {
+
+ UUID jobUUID = createAndDeleteIntegrationTest("/payload_jsons/VnfGroupCreate1Delete1None1Request.json",
+ "/serviceInstantiation/v7/instanceGroups",
+ createGroupResponse,
+ "/serviceInstantiation/v7/instanceGroups/VNF_GROUP1_INSTANCE_ID",
+ deleteGroupResponse,
+ createStatusResponse,
+ deleteStatusResponse,
+ expectedJobStatus,
+ getStatusCounter);
+
+ ServiceInstantiation bulkForRetry = asyncInstantiationBL.getBulkForRetry(jobUUID);
+ InstanceGroup vnfGroupShouldBeDeleted = bulkForRetry.getVnfGroups().get("groupingservicefortest..ResourceInstanceGroup..0:001");
+ InstanceGroup vnfGroupShouldBeCreated = bulkForRetry.getVnfGroups().get("groupingservicefortest..ResourceInstanceGroup..0");
+
+ if (deleteStatusResponse == null || deleteStatusResponse.get().request.requestStatus.getRequestState().equals(FAILED_STR)) {
+ assertThat(vnfGroupShouldBeDeleted.getAction(), equalTo(Action.Delete));
+ assertErrorForResource(vnfGroupShouldBeDeleted, deleteGroupResponse, deleteStatusResponse);
+ }
+
+ if (createStatusResponse == null || createStatusResponse.get().request.requestStatus.getRequestState().equals(FAILED_STR)) {
+ assertThat(vnfGroupShouldBeCreated.getAction(), equalTo(Action.Create));
+ assertErrorForResource(vnfGroupShouldBeCreated, createGroupResponse, createStatusResponse);
+ }
+ }
+
+ //this test is going along with AsyncInstantiationALaCarteApiTest3.delete1Create1VnfFromService API test
+ //The API test has only the happy flow scenario, while this test also test additional MSO responses (mostly non happy)
+ @Test(dataProvider="createAndDeleteIntegrationTestDataProvider")
+ public void vnfsIntegrationTest(
+ String desc,
+ RestObject<RequestReferencesContainer> createVnfResponse,
+ RestObject<RequestReferencesContainer> deleteVnfResponse,
+ RestObject<AsyncRequestStatus> createStatusResponse,
+ RestObject<AsyncRequestStatus> deleteStatusResponse,
+ JobStatus expectedJobStatus,
+ int getStatusCounter) throws IOException {
+
+ createAndDeleteIntegrationTest("/payload_jsons/vnfDelete1Create1Request.json",
+ "/serviceInstantiation/v7/serviceInstances/f8791436-8d55-4fde-b4d5-72dd2cf13cfb/vnfs",
+ createVnfResponse,
+ "/serviceInstantiation/v7/serviceInstances/f8791436-8d55-4fde-b4d5-72dd2cf13cfb/vnfs/VNF_INSTANCE_ID",
+ deleteVnfResponse,
+ createStatusResponse,
+ deleteStatusResponse,
+ expectedJobStatus,
+ getStatusCounter);
+ }
+
+ @Test(dataProvider="createAndDeleteIntegrationTestDataProvider")
+ public void vfModulesIntegrationTest(
+ String desc,
+ RestObject<RequestReferencesContainer> createVfModuleResponse,
+ RestObject<RequestReferencesContainer> deleteVfModuleResponse,
+ RestObject<AsyncRequestStatus> createStatusResponse,
+ RestObject<AsyncRequestStatus> deleteStatusResponse,
+ JobStatus expectedJobStatus,
+ int getStatusCounter) throws IOException, AsdcCatalogException {
+
+ when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VFMODULE)).thenReturn(true);
+ reset(commandUtils);
+ when(commandUtils.isVfModuleBaseModule("6b528779-44a3-4472-bdff-9cd15ec93450", "f8360508-3f17-4414-a2ed-6bc71161e8db")).thenReturn(true);
+ when(commandUtils.isVfModuleBaseModule("6b528779-44a3-4472-bdff-9cd15ec93450", "25284168-24bb-4698-8cb4-3f509146eca5")).thenReturn(false);
+
+ createAndDeleteIntegrationTest("/payload_jsons/vfModuleDelete1Create1None1Request.json",
+ "/serviceInstantiation/v7/serviceInstances/f8791436-8d55-4fde-b4d5-72dd2cf13cfb/vnfs/VNF_INSTANCE_ID/vfModules",
+ createVfModuleResponse,
+ "/serviceInstantiation/v7/serviceInstances/f8791436-8d55-4fde-b4d5-72dd2cf13cfb/vnfs/VNF_INSTANCE_ID/vfModules/VF_MODULE_INSTANCE_ID",
+ deleteVfModuleResponse,
+ createStatusResponse,
+ deleteStatusResponse,
+ expectedJobStatus,
+ getStatusCounter);
+ }
+
+ //this test is going along with AsyncInstantiationALaCarteApiTest.delete1Create1NetworkFromService API test
+ //The API test has only the happy flow scenario, while this test also test additional MSO responses (mostly non happy)
+ @Test(dataProvider="createAndDeleteIntegrationTestDataProvider")
+ public void networksIntegrationTest(
+ String desc,
+ RestObject<RequestReferencesContainer> createNetworkResponse,
+ RestObject<RequestReferencesContainer> deleteNetworkResponse,
+ RestObject<AsyncRequestStatus> createStatusResponse,
+ RestObject<AsyncRequestStatus> deleteStatusResponse,
+ JobStatus expectedJobStatus,
+ int getStatusCounter) throws IOException {
+
+ createAndDeleteIntegrationTest("/payload_jsons/networkDelete1Create1Request.json",
+ "/serviceInstantiation/v7/serviceInstances/f8791436-8d55-4fde-b4d5-72dd2cf13cfb/networks",
+ createNetworkResponse,
+ "/serviceInstantiation/v7/serviceInstances/f8791436-8d55-4fde-b4d5-72dd2cf13cfb/networks/NETWORK_INSTANCE_ID",
+ deleteNetworkResponse,
+ createStatusResponse,
+ deleteStatusResponse,
+ expectedJobStatus,
+ getStatusCounter);
+ }
+
+ private UUID createAndDeleteIntegrationTest(String payload,
+ String createPath,
+ RestObject<RequestReferencesContainer> createResponse,
+ String deletePath,
+ RestObject<RequestReferencesContainer> deleteResponse,
+ RestObject<AsyncRequestStatus> createStatusResponse,
+ RestObject<AsyncRequestStatus> deleteStatusResponse,
+ JobStatus expectedJobStatus,
+ int getStatusCounter) throws IOException {
+ UUID jobUUID = asyncInstantiationBL.pushBulkJob(
+ TestUtils.readJsonResourceFileAsObject(payload, ServiceInstantiation.class), "userId")
+ .get(0);
+
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), eq(createPath), any())).thenReturn(createResponse);
+ when(restMso.restCall(eq(HttpMethod.DELETE), eq(RequestReferencesContainer.class), any(), eq(deletePath), any())).thenReturn(deleteResponse);
+ if (createStatusResponse!=null) {
+ when(restMso.GetForObject(endsWith(createResponse.get().getRequestReferences().getRequestId()), eq(AsyncRequestStatus.class))).thenReturn(createStatusResponse);
+ }
+ if (deleteStatusResponse!=null) {
+ when(restMso.GetForObject(endsWith(deleteResponse.get().getRequestReferences().getRequestId()), eq(AsyncRequestStatus.class))).thenReturn(deleteStatusResponse);
+ }
+
+ processJobsCountTimesAndAssertStatus(jobUUID, 40, expectedJobStatus);
+
+ verify(restMso, times(1)).restCall(eq(HttpMethod.POST), any(), any(), eq(createPath), any());
+ verify(restMso, times(1)).restCall(eq(HttpMethod.DELETE), any(), any(), eq(deletePath), any());
+ verify(restMso, times(getStatusCounter)).GetForObject(any(), any());
+
+ return jobUUID;
+ }
+
+ @Test
+ public void whenCreateTransportService_thanExpectedPre1806MacroRequestSent() throws IOException {
+ UUID jobUUID = asyncInstantiationBL.pushBulkJob(generatePre1806MacroTransportServiceInstantiationPayload(null, null),"az2016").get(0);
+ RestObject<RequestReferencesContainer> createResponse = createResponseRandomIds(202);
+
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), eq("/serviceInstantiation/v7/serviceInstances"), any()))
+ .thenReturn(createResponse);
+ when(restMso.GetForObject(endsWith(createResponse.get().getRequestReferences().getRequestId()), eq(AsyncRequestStatus.class)))
+ .thenReturn(asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+ processJobsCountTimesAndAssertStatus(jobUUID, 20, COMPLETED);
+
+ JsonNode expectedJson = TestUtils.readJsonResourceFileAsObject("/payload_jsons/pre_1806_macro_without_cloudConfiguration.json", JsonNode.class);
+ ArgumentCaptor<RequestDetailsWrapper> requestCaptor = ArgumentCaptor.forClass(RequestDetailsWrapper.class);
+ verify(restMso).restCall(any(), any(), requestCaptor.capture(), any(), any());
+ requestCaptor.getAllValues().forEach(x->assertJsonEquals(expectedJson, x));
+ }
+
+ private void assertErrorForResource(BaseResource resource,
+ RestObject<RequestReferencesContainer> deleteOrCreateResponse,
+ RestObject<AsyncRequestStatus> statusResponse) {
+ JobAuditStatus auditStatus = auditService.getResourceAuditStatus(resource.getTrackById());
+ assertThat(auditStatus, is(notNullValue()));
+ assertThat(auditStatus.getJobStatus(), equalTo(FAILED_STR));
+ if (statusResponse == null) {
+ String errorMessage = "Http Code:" + deleteOrCreateResponse.getStatusCode() + ", " + RAW_DATA_FROM_MSO;
+ assertThat(auditStatus.getAdditionalInfo(), equalTo(errorMessage));
+ assertThat(auditStatus.getRequestId(), is(nullValue()));
+ } else {
+ assertThat(auditStatus.getRequestId().toString(), equalTo(statusResponse.get().request.requestId));
+ }
+ }
+
+ protected void processJobsCountTimesAndAssertStatus(UUID serviceJobId, int times, JobStatus expectedStatus) {
+ processJobsCountTimes(times);
+ singleServicesAndAssertStatus(expectedStatus, serviceJobId);
+ }
+
+ private void processJobsCountTimes(int times) {
+ for (int i = 0; i < times; i++) {
+ WORKERS_TOPICS.forEach(this::simplePullJobProcessAndPushBack);
+ }
+ }
+
+ protected void processJobsCountTimesAndAssertStatus(UUID serviceJobId, int times, JobStatus expectedStatus, JobStatus otherJobsStatus) {
+ processJobsCountTimes(times);
+ listServicesAndAssertStatus(expectedStatus, otherJobsStatus, serviceJobId);
+ }
+
+
private void verifyQueueSizes(ImmutableMap<JobStatus, Integer> expected) {
final Collection<Job> peek = jobsBrokerService.peek();
final Map<JobStatus, Long> jobTypes = peek.stream().collect(groupingBy(Job::getStatus, counting()));
- assertThat(jobTypes, is(expected));
+ assertThat(jobTypes, jsonEquals(expected));
}
- private List<ServiceInfo> listServicesAndAssertStatus(JobStatus pulledJobStatus, JobStatus otherJobsStatus, Job job) {
+ private List<ServiceInfo> listServicesAndAssertStatus(JobStatus pulledJobStatus, JobStatus otherJobsStatus, UUID jobUUID) {
List<ServiceInfo> serviceInfoList = asyncInstantiationBL.getAllServicesInfo();
- assertServicesStatus(serviceInfoList, pulledJobStatus, otherJobsStatus, job);
+ assertServicesStatus(serviceInfoList, pulledJobStatus, otherJobsStatus, jobUUID);
return serviceInfoList;
}
@@ -922,9 +1119,15 @@
return serviceInfo;
}
- private void assertServicesStatus(List<ServiceInfo> serviceInfoList, JobStatus pulledJobStatus, JobStatus otherJobsStatus, Job job) {
+ private boolean isServiceOnStatus(JobStatus expectedStatus) {
+ List<ServiceInfo> serviceInfoList = asyncInstantiationBL.getAllServicesInfo();
+ assertEquals(1, serviceInfoList.size());
+ return serviceInfoList.get(0).getJobStatus()==expectedStatus;
+ }
+
+ private void assertServicesStatus(List<ServiceInfo> serviceInfoList, JobStatus pulledJobStatus, JobStatus otherJobsStatus, UUID jobUUID) {
serviceInfoList.forEach(si->{
- if (si.getJobId().equals(job.getUuid())) {
+ if (si.getJobId().equals(jobUUID)) {
assertThat(si.getJobStatus(), is(pulledJobStatus));
}
else {
@@ -935,11 +1138,104 @@
private void listServicesAndAssertStatus(Map<UUID, JobStatus> expectedJobStatusMap) {
Map<UUID, JobStatus> actualStatuses = asyncInstantiationBL.getAllServicesInfo()
- .stream().collect(Collectors.toMap(ServiceInfo::getJobId, ServiceInfo::getJobStatus));
+ .stream().collect(Collectors.toMap(ServiceInfo::getJobId, ServiceInfo::getJobStatus));
assertThat(actualStatuses.entrySet(), equalTo(expectedJobStatusMap.entrySet()));
}
private String randomUuid() {
return UUID.randomUUID().toString();
}
+
+ @Test
+ public void whenResumeService_thanExpectedResumeRequestSent() throws IOException {
+ String instanceId = "a565e6ad-75d1-4493-98f1-33234b5c17e2"; //from feRequestResumeMacroService.json
+ String originalRequestId = "894089b8-f7f4-418d-81da-34186fd32670"; //from msoResponseGetRequestsOfServiceInstance.json
+ String resumeRequestId = randomUuid();
+ String userId = TestUtils.generateRandomAlphaNumeric(6);
+
+ //prepare mocks for get all requests for instance id
+ RestObject<AsyncRequestStatusList> getRequestByIdResponse = createAsyncRequestStatusListByInstanceId();
+ when(restMso.GetForObject(
+ eq("/orchestrationRequests/v7?filter=serviceInstanceId:EQUALS:" + instanceId),
+ eq(AsyncRequestStatusList.class)))
+ .thenReturn(getRequestByIdResponse);
+
+ //prepare mocks resume request
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), isNull(), eq(String.format("/orchestrationRequests/v7/%s/resume", originalRequestId)), eq(Optional.of(userId))))
+ .thenReturn(createResponse(202, instanceId, resumeRequestId));
+
+ //prepare mocks for get resume status
+ when(restMso.GetForObject(eq("/orchestrationRequests/v7/" + resumeRequestId), eq(AsyncRequestStatus.class)))
+ .thenReturn(asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR),
+ asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR),
+ asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+
+
+ UUID jobUUID = asyncInstantiationBL.pushBulkJob(generateResumeMacroPayload(), userId).get(0);
+ processJobsCountTimesAndAssertStatus(jobUUID, 20, COMPLETED);
+ verify(restMso).GetForObject(
+ eq("/orchestrationRequests/v7?filter=serviceInstanceId:EQUALS:" + instanceId),
+ eq(AsyncRequestStatusList.class));
+ verify(restMso).restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), isNull(), eq(String.format("/orchestrationRequests/v7/%s/resume", originalRequestId)), eq(Optional.of(userId)));
+ verify(restMso, times(3)).GetForObject(eq("/orchestrationRequests/v7/" + resumeRequestId), eq(AsyncRequestStatus.class));
+ }
+
+ @Test
+ public void givenResumeRequest_whenMsoReturnBadResponse_thanJobIsFailed() throws IOException {
+ //there is no mocks for restMSO which means restMso return bad response...
+ UUID jobUUID = asyncInstantiationBL.pushBulkJob(generateResumeMacroPayload(), "abc").get(0);
+ processJobsCountTimesAndAssertStatus(jobUUID, 20, FAILED);
+ }
+
+ @NotNull
+ private RestObject<AsyncRequestStatusList> createAsyncRequestStatusListByInstanceId() throws IOException {
+ AsyncRequestStatusList asyncRequestStatusList = TestUtils.readJsonResourceFileAsObject(
+ "/payload_jsons/resume/msoResponseGetRequestsOfServiceInstance.json",
+ AsyncRequestStatusList.class);
+ RestObject<AsyncRequestStatusList> getRequestByIdResponse = new RestObject<>();
+ getRequestByIdResponse.set(asyncRequestStatusList);
+ getRequestByIdResponse.setStatusCode(200);
+ return getRequestByIdResponse;
+ }
+
+ private ServiceInstantiation generateResumeMacroPayload() throws IOException {
+ return TestUtils.readJsonResourceFileAsObject("/payload_jsons/resume/feRequestResumeMacroService.json", ServiceInstantiation.class);
+ }
+
+ @Test
+ public void whenUpgradingAvfModule_thanExpectedReplaceRequestSent() throws IOException {
+ String instanceId = "5d49c3b1-fc90-4762-8c98-e800170baa55"; //from feRequestResumeMacroService.json
+ String replaceRequestId = randomUuid();
+ String userId = "az2016";
+
+
+ //prepare mocks resume request
+ when(restMso.restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), any(), eq("/serviceInstantiation/v7/serviceInstances/e9993045-cc96-4f3f-bf9a-71b2a400a956/vnfs/5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5/vfModules/5d49c3b1-fc90-4762-8c98-e800170baa55/replace"), eq(Optional.of(userId))))
+ .thenReturn(createResponse(202, instanceId, replaceRequestId));
+
+
+ when(restMso.GetForObject(eq("/orchestrationRequests/v7/" + replaceRequestId), eq(AsyncRequestStatus.class)))
+ .thenReturn(asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR),
+ asyncRequestStatusResponseAsRestObject(IN_PROGRESS_STR),
+ asyncRequestStatusResponseAsRestObject(COMPLETE_STR));
+
+ ///orchestrationRequests/v7/0174b25a-dd81-45b7-b4af-0057bcc30857
+
+ when(featureManager.isActive(Features.FLAG_ASYNC_ALACARTE_VFMODULE)).thenReturn(true);
+ enableAddCloudOwnerOnMsoRequest();
+
+ UUID jobUUID = asyncInstantiationBL.pushBulkJob(generateReplaceVfModulePayload(), userId).get(0);
+ processJobsCountTimesAndAssertStatus(jobUUID, 20, COMPLETED);
+
+
+
+ JsonNode expectedJson = TestUtils.readJsonResourceFileAsObject("/payload_jsons/vfmodule/replace_vfmodule.json", JsonNode.class);
+ ArgumentCaptor<RequestDetailsWrapper> requestCaptor = ArgumentCaptor.forClass(RequestDetailsWrapper.class);
+ verify(restMso).restCall(eq(HttpMethod.POST), eq(RequestReferencesContainer.class), requestCaptor.capture(), eq("/serviceInstantiation/v7/serviceInstances/e9993045-cc96-4f3f-bf9a-71b2a400a956/vnfs/5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5/vfModules/5d49c3b1-fc90-4762-8c98-e800170baa55/replace"), eq(Optional.of(userId)));
+ requestCaptor.getAllValues().forEach(x->assertJsonEquals(expectedJson, x));
+ }
+
+ private ServiceInstantiation generateReplaceVfModulePayload() throws IOException {
+ return TestUtils.readJsonResourceFileAsObject("/payload_jsons/vfmodule/replace_vfmodule_fe_input.json", ServiceInstantiation.class);
+ }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/DeleteOldJobsSchedulerInitializerTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/DeleteOldJobsSchedulerInitializerTest.java
new file mode 100644
index 0000000..4944efa
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/DeleteOldJobsSchedulerInitializerTest.java
@@ -0,0 +1,55 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.job.impl;
+
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.matchesPattern;
+import static org.mockito.Mockito.mock;
+import static org.onap.vid.testUtils.TestUtils.testWithSystemProperty;
+import static org.testng.Assert.assertEquals;
+
+import org.onap.vid.job.JobsBrokerService;
+import org.quartz.JobDetail;
+import org.quartz.impl.triggers.CronTriggerImpl;
+import org.testng.annotations.Test;
+
+public class DeleteOldJobsSchedulerInitializerTest {
+
+ @Test
+ public void testCreateJobDetail() throws Exception {
+ testWithSystemProperty("vid.asyncJob.howLongToKeepOldJobsInDays", "7", ()-> {
+ JobsBrokerService mockBroker = mock(JobsBrokerService.class);
+ DeleteOldJobsSchedulerInitializer underTest = new DeleteOldJobsSchedulerInitializer(mockBroker, null);
+ JobDetail jobDetail = underTest.createJobDetail();
+ assertEquals(DeleteOldJobsWorker.class, jobDetail.getJobClass());
+ assertEquals(mockBroker, jobDetail.getJobDataMap().get("jobsBrokerService"));
+ assertEquals(604800L, jobDetail.getJobDataMap().get("secondsAgo"));
+ });
+ }
+
+ @Test
+ public void testCreateTrigger() {
+ DeleteOldJobsSchedulerInitializer underTest = new DeleteOldJobsSchedulerInitializer(null, null);
+ CronTriggerImpl trigger = (CronTriggerImpl) underTest.createTrigger();
+ assertThat(trigger.getCronExpression(), matchesPattern("0 [1-5]?[0-9] 6 \\? \\* \\*"));
+ }
+
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/DeleteOldJobsWorkerTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/DeleteOldJobsWorkerTest.java
new file mode 100644
index 0000000..229e0ca
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/DeleteOldJobsWorkerTest.java
@@ -0,0 +1,43 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * VID
+ * ================================================================================
+ * Copyright (C) 2017 - 2019 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * 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.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.vid.job.impl;
+
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+
+import org.onap.vid.job.JobsBrokerService;
+import org.quartz.JobExecutionException;
+import org.testng.annotations.Test;
+
+public class DeleteOldJobsWorkerTest {
+
+ @Test
+ public void whenExecuteInternal_thenCallToDeleteOldFinalJobs() throws JobExecutionException {
+ JobsBrokerService mockBroker = mock(JobsBrokerService.class);
+ long secondsAgo = 42L;
+ DeleteOldJobsWorker underTest = new DeleteOldJobsWorker();
+ underTest.setJobsBrokerService(mockBroker);
+ underTest.setSecondsAgo(secondsAgo);
+ underTest.executeInternal(null);
+ verify(mockBroker).deleteOldFinalJobs(secondsAgo);
+ }
+
+}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/JobAdapterTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/JobAdapterTest.java
index f6785c3..4e11b7e 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/impl/JobAdapterTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/JobAdapterTest.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.
@@ -26,10 +26,15 @@
import org.onap.vid.job.JobAdapter;
import org.onap.vid.job.JobType;
import org.onap.vid.job.command.JobCommandFactoryTest;
+import org.onap.vid.properties.Features;
+import org.onap.vid.testUtils.TestUtils;
import org.testng.annotations.Test;
+import org.togglz.core.manager.FeatureManager;
import java.util.UUID;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotEquals;
import static org.testng.AssertJUnit.assertNotNull;
@@ -38,12 +43,14 @@
@Test
public void testCreateServiceInstantiationJob() {
- JobAdapter jobAdapter = new JobAdapterImpl();
+ FeatureManager featureManager = mock(FeatureManager.class);
+ JobAdapter jobAdapter = new JobAdapterImpl(featureManager);
JobType jobType = JobType.NoOp;
JobAdapter.AsyncJobRequest request = new JobCommandFactoryTest.MockedRequest(42,"nothing");
UUID templateId = UUID.randomUUID();
String userId = "ou012t";
+ String testApi = "VNF_API";
String optimisticUniqueServiceInstanceName = "optimisticUniqueServiceInstanceName";
int indexInBulk = RandomUtils.nextInt();
Job job = jobAdapter.createServiceInstantiationJob(
@@ -51,6 +58,7 @@
request,
templateId,
userId,
+ testApi,
optimisticUniqueServiceInstanceName,
indexInBulk
);
@@ -59,6 +67,7 @@
assertEquals(job.getSharedData().getRequest(), request);
assertEquals(job.getSharedData().getRequestType(), request.getClass());
assertEquals(job.getSharedData().getUserId(), userId);
+ assertEquals(job.getSharedData().getTestApi(), testApi);
assertEquals(job.getSharedData().getJobUuid(), job.getUuid());
assertEquals(job.getSharedData().getRootJobId(), job.getUuid());
assertNotNull(job.getUuid());
@@ -68,13 +77,16 @@
assertEquals(job.getStatus(), Job.JobStatus.PENDING);
}
- @Test
- public void testCreateChildJob() {
-
- JobAdapter jobAdapter = new JobAdapterImpl();
+ @Test(dataProvider = "trueAndFalse", dataProviderClass = TestUtils.class)
+ public void testCreateChildJob(boolean isFlagExpCreateResourcesInParallel) {
+ FeatureManager featureManager = mock(FeatureManager.class);
+ when(featureManager.isActive(Features.FLAG_EXP_CREATE_RESOURCES_IN_PARALLEL)).thenReturn(isFlagExpCreateResourcesInParallel);
+ Job.JobStatus expectedJobStatus = isFlagExpCreateResourcesInParallel ? Job.JobStatus.CREATING : Job.JobStatus.PENDING_RESOURCE;
+ JobAdapter jobAdapter = new JobAdapterImpl(featureManager);
UUID templateId = UUID.randomUUID();
String userId = "ou012t";
+ String testApi = "VNF_API";
String optimisticUniqueServiceInstanceName = "optimisticUniqueServiceInstanceName";
int indexInBulk = RandomUtils.nextInt();
Job grandJob = jobAdapter.createServiceInstantiationJob(
@@ -82,39 +94,44 @@
new JobCommandFactoryTest.MockedRequest(99, "anything"),
templateId,
userId,
+ testApi,
optimisticUniqueServiceInstanceName,
indexInBulk
);
- Job.JobStatus jobStatus = Job.JobStatus.PAUSE;
JobType jobType = JobType.NoOp;
JobAdapter.AsyncJobRequest request = new JobCommandFactoryTest.MockedRequest(42,"nothing");
- Job parentJob = jobAdapter.createChildJob(jobType, jobStatus, request, grandJob.getSharedData(), ImmutableMap.of());
+ Job parentJob = jobAdapter.createChildJob(jobType, request, grandJob.getSharedData(), ImmutableMap.of(), 1);
assertEquals(parentJob.getType(), jobType);
assertEquals(parentJob.getSharedData().getRequest(), request);
assertEquals(parentJob.getSharedData().getRequestType(), request.getClass());
assertEquals(parentJob.getSharedData().getUserId(), userId);
+ assertEquals(parentJob.getSharedData().getTestApi(), testApi);
assertEquals(parentJob.getSharedData().getJobUuid(), parentJob.getUuid());
assertNotNull(parentJob.getUuid());
assertNotEquals(parentJob.getUuid(), grandJob.getUuid());
- assertEquals(parentJob.getStatus(), jobStatus);
+ assertEquals(parentJob.getStatus(), expectedJobStatus);
+ assertEquals(parentJob.getTemplateId(), grandJob.getUuid());
+ assertEquals(parentJob.getIndexInBulk().intValue(), 1);
assertEquals(parentJob.getSharedData().getRootJobId(), grandJob.getUuid());
- Job.JobStatus jobStatus2 = Job.JobStatus.IN_PROGRESS;
JobType jobType2 = JobType.AggregateState;
JobAdapter.AsyncJobRequest request2 = new JobCommandFactoryTest.MockedRequest(66,"abc");
- Job job = jobAdapter.createChildJob(jobType2, jobStatus2, request2, parentJob.getSharedData(), ImmutableMap.of());
+ Job job = jobAdapter.createChildJob(jobType2, request2, parentJob.getSharedData(), ImmutableMap.of(), 0);
assertEquals(job.getType(), jobType2);
assertEquals(job.getSharedData().getRequest(), request2);
assertEquals(job.getSharedData().getRequestType(), request2.getClass());
assertEquals(job.getSharedData().getUserId(), userId);
+ assertEquals(job.getSharedData().getTestApi(), testApi);
assertEquals(job.getSharedData().getJobUuid(), job.getUuid());
assertNotNull(job.getUuid());
assertNotEquals(job.getUuid(), parentJob.getUuid());
- assertEquals(job.getStatus(), jobStatus2);
+ assertEquals(job.getStatus(), expectedJobStatus);
assertEquals(job.getSharedData().getRootJobId(), grandJob.getUuid());
+ assertEquals(job.getTemplateId(), parentJob.getUuid());
+ assertEquals(job.getIndexInBulk().intValue(), 0);
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/job/impl/JobWorkerTest.java b/vid-app-common/src/test/java/org/onap/vid/job/impl/JobWorkerTest.java
index dc44d15..e234ee9 100644
--- a/vid-app-common/src/test/java/org/onap/vid/job/impl/JobWorkerTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/job/impl/JobWorkerTest.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.
@@ -33,6 +33,7 @@
import org.onap.vid.job.command.JobCommandFactory;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import org.togglz.core.manager.FeatureManager;
import java.util.Map;
import java.util.UUID;
@@ -51,6 +52,9 @@
@Mock
private JobCommandFactory jobCommandFactory;
+ @Mock
+ private FeatureManager featureManager;
+
private final JobCommand jobCommand = mock(JobCommand.class);
private Job jobUnderTest;
private JobAdapter.AsyncJobRequest originalData;
@@ -68,11 +72,12 @@
};
originalType = JobType.MacroServiceInstantiation;
- jobUnderTest = new JobAdapterImpl().createServiceInstantiationJob(
+ jobUnderTest = new JobAdapterImpl(featureManager).createServiceInstantiationJob(
originalType,
originalData,
UUID.randomUUID(),
"my user id",
+ "VNF_API",
"optimisticUniqueServiceInstanceName",
RandomUtils.nextInt()
);
@@ -119,4 +124,4 @@
assertThat(nextJob, jobMatcher);
assertThat(jobAfter, equalTo(jobBefore));
}
-}
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/model/JobAuditStatusTest.java b/vid-app-common/src/test/java/org/onap/vid/model/JobAuditStatusTest.java
index 2c41120..2f9e31e 100644
--- a/vid-app-common/src/test/java/org/onap/vid/model/JobAuditStatusTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/model/JobAuditStatusTest.java
@@ -35,11 +35,11 @@
@DataProvider
public static Object[][] AdditionalInfoSizes() {
return new Object[][]{
- {5, 5},
- {1999,1999},
- {2000, 2000},
- {2001, 2000},
- {10000, 2000}
+ {5, 5},
+ {1999,1999},
+ {2000, 2000},
+ {2001, 2000},
+ {10000, 2000}
};
}
@@ -53,7 +53,7 @@
@Test(dataProvider = "AdditionalInfoSizes")
public void testAdditionalInfoMaxLengthInConstructor(int originalSize, int finalSize) {
final String additionalInfo = StringUtils.repeat("a", originalSize);
- JobAuditStatus jobAuditStatus = new JobAuditStatus(UUID.randomUUID(), "myJobStatus", JobAuditStatus.SourceStatus.MSO, UUID.randomUUID(), additionalInfo, new Date());
+ JobAuditStatus jobAuditStatus = JobAuditStatus.createForTest(UUID.randomUUID(), "myJobStatus", JobAuditStatus.SourceStatus.MSO, UUID.randomUUID(), additionalInfo, new Date());
assertThat(jobAuditStatus.getAdditionalInfo().length(), is(finalSize));
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/model/aaiTree/VpnBindingKtTest.kt b/vid-app-common/src/test/java/org/onap/vid/model/aaiTree/VpnBindingKtTest.kt
new file mode 100644
index 0000000..90c61d7
--- /dev/null
+++ b/vid-app-common/src/test/java/org/onap/vid/model/aaiTree/VpnBindingKtTest.kt
@@ -0,0 +1,16 @@
+package org.onap.vid.model.aaiTree
+
+import org.testng.Assert.assertEquals
+import org.testng.annotations.Test
+
+class VpnBindingKtTest {
+
+ @Test
+ fun whenFailedToParseRouteTarget_DefaultValuesAreReturned() {
+ val aaiTreeNode = AAITreeNode();
+ aaiTreeNode.type = NodeType.VPN_BINDING
+ aaiTreeNode.additionalProperties["route-targets"] = 3 //just an object that can't be parsed into list of route targets
+ val vpnBinding = from(aaiTreeNode);
+ assertEquals(vpnBinding.routeTargets, listOf(RouteTarget("ParsingFailure", "ParsingFailure")))
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
index 207e635..4ddbc0f 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoBusinessLogicImplTest.java
@@ -21,49 +21,33 @@
package org.onap.vid.mso;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
+import static org.assertj.core.api.Assertions.tuple;
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.hasEntry;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.argThat;
+import static org.mockito.ArgumentMatchers.endsWith;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.BDDMockito.given;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.onap.vid.controller.MsoController.CONFIGURATION_ID;
+import static org.onap.vid.controller.MsoController.REQUEST_TYPE;
+import static org.onap.vid.controller.MsoController.SVC_INSTANCE_ID;
+import static org.onap.vid.controller.MsoController.VNF_INSTANCE_ID;
+import static org.onap.vid.mso.MsoBusinessLogicImpl.validateEndpointPath;
+
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import io.joshworks.restclient.http.HttpResponse;
-import org.apache.commons.io.IOUtils;
-import org.jetbrains.annotations.NotNull;
-import org.mockito.hamcrest.MockitoHamcrest;
-import org.onap.vid.changeManagement.WorkflowRequestDetail;
-import org.onap.vid.model.SOWorkflowList;
-import org.onap.vid.model.probes.ExternalComponentStatus;
-import org.onap.vid.mso.rest.RequestList;
-import org.onap.vid.mso.rest.RequestWrapper;
-import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-import org.mockito.ArgumentMatcher;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-import org.onap.portalsdk.core.util.SystemProperties;
-import org.onap.vid.changeManagement.ChangeManagementRequest;
-import org.onap.vid.controller.OperationalEnvironmentController;
-import org.onap.vid.exceptions.GenericUncheckedException;
-import org.onap.vid.model.RequestReferencesContainer;
-import org.onap.vid.model.SoftDeleteRequest;
-import org.onap.vid.mso.model.CloudConfiguration;
-import org.onap.vid.mso.model.ModelInfo;
-import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo;
-import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo;
-import org.onap.vid.mso.model.RequestInfo;
-import org.onap.vid.mso.model.RequestParameters;
-import org.onap.vid.mso.model.RequestReferences;
-import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails;
-import org.onap.vid.mso.rest.Request;
-import org.onap.vid.mso.rest.RequestDetails;
-import org.onap.vid.mso.rest.RequestDetailsWrapper;
-import org.onap.vid.mso.rest.Task;
-import org.onap.vid.properties.Features;
-import org.springframework.http.HttpStatus;
-import org.springframework.test.context.ContextConfiguration;
-import org.togglz.core.manager.FeatureManager;
-
-import javax.ws.rs.BadRequestException;
import java.io.IOException;
import java.net.URL;
import java.nio.file.Path;
@@ -74,29 +58,40 @@
import java.util.Map;
import java.util.UUID;
import java.util.stream.Collectors;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.assertj.core.api.Assertions.tuple;
-import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
-import static org.hamcrest.Matchers.allOf;
-import static org.hamcrest.Matchers.hasEntry;
-import static org.junit.Assert.assertEquals;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyBoolean;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.argThat;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.ArgumentMatchers.endsWith;
-import static org.mockito.BDDMockito.given;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.mock;
-import static org.onap.vid.controller.MsoController.CONFIGURATION_ID;
-import static org.onap.vid.controller.MsoController.REQUEST_TYPE;
-import static org.onap.vid.controller.MsoController.SVC_INSTANCE_ID;
-import static org.onap.vid.controller.MsoController.VNF_INSTANCE_ID;
-import static org.onap.vid.mso.MsoBusinessLogicImpl.validateEndpointPath;
+import javax.ws.rs.BadRequestException;
+import org.apache.commons.io.IOUtils;
+import org.jetbrains.annotations.NotNull;
+import org.mockito.ArgumentMatcher;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.mockito.hamcrest.MockitoHamcrest;
+import org.onap.portalsdk.core.util.SystemProperties;
+import org.onap.vid.changeManagement.ChangeManagementRequest;
+import org.onap.vid.changeManagement.WorkflowRequestDetail;
+import org.onap.vid.controller.OperationalEnvironmentController;
+import org.onap.vid.exceptions.GenericUncheckedException;
+import org.onap.vid.model.SOWorkflowList;
+import org.onap.vid.model.SoftDeleteRequest;
+import org.onap.vid.model.probes.ExternalComponentStatus;
+import org.onap.vid.mso.model.CloudConfiguration;
+import org.onap.vid.mso.model.ModelInfo;
+import org.onap.vid.mso.model.OperationalEnvironmentActivateInfo;
+import org.onap.vid.mso.model.OperationalEnvironmentDeactivateInfo;
+import org.onap.vid.mso.model.RequestInfo;
+import org.onap.vid.mso.model.RequestParameters;
+import org.onap.vid.mso.rest.OperationalEnvironment.OperationEnvironmentRequestDetails;
+import org.onap.vid.mso.rest.Request;
+import org.onap.vid.mso.rest.RequestDetails;
+import org.onap.vid.mso.rest.RequestDetailsWrapper;
+import org.onap.vid.mso.rest.RequestList;
+import org.onap.vid.mso.rest.RequestWrapper;
+import org.onap.vid.mso.rest.Task;
+import org.springframework.http.HttpStatus;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
@ContextConfiguration(classes = {SystemProperties.class})
public class MsoBusinessLogicImplTest extends AbstractTestNGSpringContextTests {
@@ -104,9 +99,6 @@
private static final ObjectMapper objectMapper = new ObjectMapper();
@Mock
- private FeatureManager featureManager;
-
- @Mock
private MsoInterface msoInterface;
@Mock
@@ -126,7 +118,7 @@
@BeforeClass
public void setUp() {
MockitoAnnotations.initMocks(this);
- msoBusinessLogic = new MsoBusinessLogicImpl(msoInterface, featureManager);
+ msoBusinessLogic = new MsoBusinessLogicImpl(msoInterface);
}
@Test
@@ -282,39 +274,48 @@
assertThat(response).isEqualToComparingFieldByField(expectedResponse);
}
- @Test
- public void shouldProperlyDeleteSvcInstanceWithProperParametersAndFalseFeatureFlag() {
+ @DataProvider
+ public Object[][] deleteSvcInstanceShouldDelete() {
+ return new Object[][]{{"Active"}, {"unexpected-status"}};
+ }
+
+ @DataProvider
+ public Object[][] deleteSvcInstanceShouldUnassign() {
+ return new Object[][]{{"Created"}, {"Pendingdelete"}, {"pending-Delete"}, {"Assigned"}};
+ }
+
+
+ @Test(dataProvider = "deleteSvcInstanceShouldDelete")
+ public void shouldProperlyDeleteSvcInstanceWithProperParametersShouldDelete(String status) {
// given
- String endpointTemplate = "/serviceInstances/v5/%s";
+ String endpointTemplate = "/serviceInstantiation/v7/serviceInstances/%s";
String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d";
String svcEndpoint = String.format(endpointTemplate, serviceInstanceId);
RequestDetails requestDetails = new RequestDetails();
MsoResponseWrapper expectedResponse = createOkResponse();
given(msoInterface.deleteSvcInstance(requestDetails, svcEndpoint)).willReturn(expectedResponse);
- given(featureManager.isActive(Features.FLAG_UNASSIGN_SERVICE)).willReturn(false);
// when
MsoResponseWrapper msoResponseWrapper = msoBusinessLogic
- .deleteSvcInstance(requestDetails, serviceInstanceId, "unAssignOrDeleteParams");
+ .deleteSvcInstance(requestDetails, serviceInstanceId, status);
// then
assertThat(msoResponseWrapper).isEqualToComparingFieldByField(expectedResponse);
}
- @Test
- public void shouldProperlyDeleteSvcInstanceWithProperParametersAndTrueFeatureFlag() {
+ @Test(dataProvider = "deleteSvcInstanceShouldUnassign")
+ public void shouldProperlyDeleteSvcInstanceWithProperParametersShouldUnassign(String status) {
// given
- String endpointTemplate = "/serviceInstantiation/v5/serviceInstances/%s/unassign";
+ String endpointTemplate = "/serviceInstantiation/v7/serviceInstances/%s/unassign";
String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d";
String svcEndpoint = String.format(endpointTemplate, serviceInstanceId);
RequestDetails requestDetails = new RequestDetails();
MsoResponseWrapper expectedResponse = createOkResponse();
given(msoInterface.unassignSvcInstance(requestDetails, svcEndpoint)).willReturn(expectedResponse);
- given(featureManager.isActive(Features.FLAG_UNASSIGN_SERVICE)).willReturn(true);
// when
MsoResponseWrapper msoResponseWrapper = msoBusinessLogic
- .deleteSvcInstance(requestDetails, serviceInstanceId, "assigned");
+ .deleteSvcInstance(requestDetails, serviceInstanceId, status);
// then
assertThat(msoResponseWrapper).isEqualToComparingFieldByField(expectedResponse);
@@ -323,7 +324,7 @@
@Test
public void shouldProperlyDeleteVnfWithProperParameters() {
// when
- String endpointTemplate = "/serviceInstances/v5/%s/vnfs/%s";
+ String endpointTemplate = "/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s";
String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d";
String vnfInstanceId = "testVnfInstanceTempId";
String vnfEndpoint = String.format(endpointTemplate, serviceInstanceId, vnfInstanceId);
@@ -342,7 +343,7 @@
@Test
public void shouldProperlyDeleteVfModuleWithProperParameters() {
// when
- String endpointTemplate = "/serviceInstances/v7/%s/vnfs/%s/vfModules/%s";
+ String endpointTemplate = "/serviceInstantiation/v7/serviceInstances/%s/vnfs/%s/vfModules/%s";
String serviceInstanceId = "3f93c7cb-2fd0-4557-9514-e189b7b04f9d";
String vnfInstanceId = "testVnfInstanceTempId";
String vfModuleId = "testVfModuleId";
@@ -906,58 +907,6 @@
}
@Test
- public void shouldProperlyDeactivateAndCloudDeleteWithProperParameters() {
- // given
- String serviceInstanceId = "testServiceId";
- String vnfInstanceId = "testVnfInstanceId";
- String vfModuleInstanceId = "testVfModuleInstanceId";
- RequestDetails requestDetails = new RequestDetails();
-
- String path = msoBusinessLogic.getDeactivateAndCloudDeletePath(serviceInstanceId, vnfInstanceId, vfModuleInstanceId);
-
- RequestReferences requestReferences = new RequestReferences();
- requestReferences.setInstanceId("testInstance");
- requestReferences.setRequestId("testRequest");
-
- HttpResponse<RequestReferencesContainer> expectedResponse = HttpResponse.fallback(new RequestReferencesContainer(requestReferences));
-
- MsoResponseWrapper2 responseWrapped = new MsoResponseWrapper2<>(expectedResponse);
-
- given(msoInterface.post(eq(path), any(RequestDetails.class), eq(RequestReferencesContainer.class))).willReturn(expectedResponse);
-
- // when
- MsoResponseWrapper2 response = msoBusinessLogic.deactivateAndCloudDelete(serviceInstanceId, vnfInstanceId, vfModuleInstanceId, requestDetails);
-
- // then
- assertThat(response).isEqualToComparingFieldByField(responseWrapped);
- }
-
- @Test
- public void shouldProperlyActivateFabricConfigurationWithProperParameters() {
- // given
- String serviceInstanceId = "testServiceId";
- RequestDetails requestDetails = new RequestDetails();
-
- String path = msoBusinessLogic.getActivateFabricConfigurationPath(serviceInstanceId);
-
- RequestReferences requestReferences = new RequestReferences();
- requestReferences.setInstanceId("testInstance");
- requestReferences.setRequestId("testRequest");
-
- HttpResponse<RequestReferencesContainer> expectedResponse = HttpResponse.fallback(new RequestReferencesContainer(requestReferences));
-
- MsoResponseWrapper2 responseWrapped = new MsoResponseWrapper2<>(expectedResponse);
-
- given(msoInterface.post(eq(path), any(RequestDetails.class), eq(RequestReferencesContainer.class))).willReturn(expectedResponse);
-
- // when
- MsoResponseWrapper2 response = msoBusinessLogic.activateFabricConfiguration(serviceInstanceId, requestDetails);
-
- // then
- assertThat(response).isEqualToComparingFieldByField(responseWrapped);
- }
-
- @Test
public void shouldProperlyUpdateVnfSoftwareWithProperParameters() {
// given
String serviceInstanceId = "testServiceId";
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java
index 891192c..0ea5f29 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/MsoOperationalEnvironmentTest.java
@@ -25,6 +25,13 @@
import com.fasterxml.jackson.databind.SerializationFeature;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableListMultimap;
+import java.io.IOException;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.stream.Collectors;
import org.apache.commons.io.IOUtils;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
@@ -40,17 +47,9 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
public class MsoOperationalEnvironmentTest {
- private MsoBusinessLogic msoBusinessLogic = new MsoBusinessLogicImpl(null,null);
+ private MsoBusinessLogic msoBusinessLogic = new MsoBusinessLogicImpl(null);
private static final Logger logger = LogManager.getLogger(MsoOperationalEnvironmentTest.class);
@Test(dataProvider = "getOperationalEnvironmentActivationPermutations")
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
index d4abfae..6cf7d48 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/MsoRestClientNewTest.java
@@ -38,8 +38,8 @@
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
-import java.util.Properties;
import java.util.UUID;
+import org.apache.commons.configuration.PropertiesConfiguration;
import org.glassfish.grizzly.http.util.HttpStatus;
import org.junit.AfterClass;
import org.junit.BeforeClass;
@@ -61,7 +61,7 @@
private static StubServer server;
private static StubServer securedServer;
- private static Properties props = new Properties();
+ private static PropertiesConfiguration props = new PropertiesConfiguration();
private static String msoCreateServiceInstanceJson;
private static String msoScaleOutVfModule;
private final static String CREATE_INSTANCE_RESPONSE_STR =
@@ -76,7 +76,7 @@
@BeforeClass
- public static void start() throws IOException {
+ public static void start() throws Exception {
server = new StubServer().run();
securedServer = new StubServer().secured().run();
@@ -109,7 +109,7 @@
@Test
public void testCreateSvcInstance() throws Exception {
- String endpoint = props.getProperty(MsoProperties.MSO_REST_API_CONFIGURATIONS);
+ String endpoint = props.getString(MsoProperties.MSO_REST_API_CONFIGURATIONS);
endpoint = endpoint.replace(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
server,
@@ -122,7 +122,7 @@
@Test
public void testCreateVnf() throws Exception {
- String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE);
+ String endpoint = props.getString(MsoProperties.MSO_REST_API_VNF_INSTANCE);
endpoint = endpoint.replace(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
server,
@@ -136,7 +136,7 @@
@Test
public void testCreateNwInstance() throws Exception {
- String endpoint = props.getProperty(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);
+ String endpoint = props.getString(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);
String nw_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
server,
@@ -149,7 +149,7 @@
@Test
public void testCreateVolumeGroupInstance() throws Exception {
- String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
+ String endpoint = props.getString(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
String vnf_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
vnf_endpoint = vnf_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID);
try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
@@ -163,7 +163,7 @@
@Test
public void testCreateVfModuleInstance() throws Exception {
- String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
+ String endpoint = props.getString(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
String partial_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
String vf_module_endpoint =
partial_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID);
@@ -195,7 +195,7 @@
@Ignore
@Test
public void testDeleteSvcInstance() throws Exception {
- String endpoint = props.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+ String endpoint = props.getString(MsoProperties.MSO_REST_API_SVC_INSTANCE);
endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
@@ -211,7 +211,7 @@
@Ignore
@Test
public void testDeleteVnf() throws Exception {
- String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VNF_INSTANCE);
+ String endpoint = props.getString(MsoProperties.MSO_REST_API_VNF_INSTANCE);
endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
@@ -226,7 +226,7 @@
@Ignore
@Test
public void testDeleteVfModule() throws Exception {
- String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
+ String endpoint = props.getString(MsoProperties.MSO_REST_API_VF_MODULE_INSTANCE);
String part_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
String vf_modules_endpoint = part_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID);
String delete_vf_endpoint = vf_modules_endpoint + '/' + SAMPLE_VNF_MODULE_ID;
@@ -243,7 +243,7 @@
@Ignore
@Test
public void testDeleteVolumeGroupInstance() throws Exception {
- String endpoint = props.getProperty(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
+ String endpoint = props.getString(MsoProperties.MSO_REST_API_VOLUME_GROUP_INSTANCE);
String svc_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
String vnf_endpoint = svc_endpoint.replaceFirst(MsoController.VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID);
String delete_volume_group_endpoint = vnf_endpoint + "/" + SAMPLE_VNF_MODULE_ID;
@@ -260,7 +260,7 @@
@Ignore
@Test
public void testDeleteNwInstance() throws Exception {
- String endpoint = props.getProperty(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);
+ String endpoint = props.getString(MsoProperties.MSO_REST_API_NETWORK_INSTANCE);
String svc_endpoint = endpoint.replaceFirst(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
String delete_nw_endpoint = svc_endpoint + "/" + SAMPLE_NETWORK_INSTANCE_ID;
@@ -275,7 +275,7 @@
@Test
public void testGetOrchestrationRequest() {
- String p = props.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQ);
+ String p = props.getString(MsoProperties.MSO_REST_API_GET_ORC_REQ);
String path = p + "/" + SAMPLE_REQUEST_ID;
try(MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
@@ -289,7 +289,7 @@
@Test
public void testGetManualTasksByRequestId() {
- String p = props.getProperty(MsoProperties.MSO_REST_API_GET_ORC_REQ);
+ String p = props.getString(MsoProperties.MSO_REST_API_GET_ORC_REQ);
String path = p + "/" + UUID.randomUUID();
String validResponse = ""
+ "{ "
@@ -376,7 +376,7 @@
@Test
public void testSetConfigurationActiveStatus() throws Exception {
- String endpoint = "/serviceInstances/v5/<service_instance_id>/configurations/<configuration_id>";
+ String endpoint = "/serviceInstances/v7/<service_instance_id>/configurations/<configuration_id>";
endpoint = endpoint.replace(MsoController.SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
endpoint = endpoint.replace(MsoController.CONFIGURATION_ID, SAMPLE_CONFIGURATION_ID);
endpoint = endpoint + "/activate";
@@ -448,7 +448,7 @@
@Test
public void testRemoveRelationshipFromServiceInstance() throws Exception {
- String serviceEndpoint = props.getProperty(MsoProperties.MSO_REST_API_SVC_INSTANCE);
+ String serviceEndpoint = props.getString(MsoProperties.MSO_REST_API_SVC_INSTANCE);
String removeRelationshipsPath = serviceEndpoint + "/" + SERVICE_INSTANCE_ID + "/removeRelationships";
try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
@@ -476,7 +476,7 @@
}
@Test
public void testScaleOutVfModule() throws IOException {
- String serviceEndpoint = props.getProperty(MsoProperties.MSO_REST_API_VF_MODULE_SCALE_OUT);
+ String serviceEndpoint = props.getString(MsoProperties.MSO_REST_API_VF_MODULE_SCALE_OUT);
String partial_endpoint = serviceEndpoint.replaceFirst(SVC_INSTANCE_ID, SERVICE_INSTANCE_ID);
String vf_module_endpoint = partial_endpoint.replaceFirst(VNF_INSTANCE_ID, SAMPLE_VNF_INSTANCE_ID);
try (MsoRestClientTestUtil closure = new MsoRestClientTestUtil(
diff --git a/vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java b/vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java
index 575ceab..7f30b0f 100644
--- a/vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/mso/rest/RequestDetailsTest.java
@@ -20,23 +20,24 @@
package org.onap.vid.mso.rest;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import org.assertj.core.api.AssertionsForClassTypes;
-import org.onap.vid.exceptions.NotFoundException;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-import java.util.Collections;
-import java.util.List;
-import java.util.Map;
-
import static com.google.code.beanmatchers.BeanMatchers.hasValidBeanEqualsExcluding;
import static com.google.code.beanmatchers.BeanMatchers.hasValidGettersAndSettersExcluding;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.testng.AssertJUnit.assertEquals;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import org.assertj.core.api.AssertionsForClassTypes;
+import org.onap.vid.exceptions.NotFoundException;
+import org.onap.vid.testUtils.TestUtils;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
public class RequestDetailsTest {
@@ -48,6 +49,10 @@
private static final ImmutableList<String> LCP_CLOUD_REGION_ID_PATH =
ImmutableList.of("requestDetails", "cloudConfiguration", "lcpCloudRegionId");
+ @BeforeClass
+ public static void registerValueGenerator() {
+ TestUtils.registerCloudConfigurationValueGenerator();
+ }
@BeforeMethod
public void setUp() {
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java
index 9cd9eba..c2a3f5d 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AAITreeNodeBuilderTest.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.
@@ -20,77 +20,100 @@
package org.onap.vid.services;
+import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.util.concurrent.MoreExecutors;
+
+import org.apache.commons.lang3.tuple.Pair;
+import org.jetbrains.annotations.NotNull;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
+import org.mockito.stubbing.Answer;
import org.onap.vid.aai.AaiClientInterface;
+import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship;
+import org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.RelationshipList;
+import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.model.aaiTree.AAITreeNode;
+import org.onap.vid.model.aaiTree.NodeType;
+import org.onap.vid.mso.model.CloudConfiguration;
+import org.onap.vid.utils.Tree;
import org.onap.vid.utils.Unchecked;
-import org.testng.Assert;
-import org.testng.annotations.BeforeTest;
+import org.onap.vid.testUtils.TestUtils;
+import org.springframework.http.HttpMethod;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.io.IOException;
import java.util.HashMap;
-import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
import java.util.concurrent.ConcurrentSkipListSet;
-import java.util.concurrent.ThreadPoolExecutor;
-import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import static java.util.Comparator.comparing;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
+import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
+import static net.javacrumbs.jsonunit.core.Option.IGNORING_EXTRA_FIELDS;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.empty;
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.when;
import static org.onap.vid.services.AAIServiceTree.AAI_TREE_PATHS;
+import static org.onap.vid.utils.KotlinUtilsKt.JACKSON_OBJECT_MAPPER;
+import static org.testng.Assert.assertNull;
+import static org.testng.Assert.assertTrue;
public class AAITreeNodeBuilderTest {
- AAITreeNodeBuilder aaiTreeNodeBuilder;
+ private AAITreeNodeBuilder aaiTreeNodeBuilder;
@Mock
- AaiClientInterface aaiClientMock;
+ private AaiClientInterface aaiClientMock;
- @Mock
- ThreadPoolExecutor threadPoolMock;
+ private ExecutorService executorService;
+ private static final ObjectMapper mapper = new ObjectMapper();
- @BeforeTest
+ @BeforeClass
public void initMocks() {
MockitoAnnotations.initMocks(this);
aaiTreeNodeBuilder = new AAITreeNodeBuilder(aaiClientMock);
+ executorService = MoreExecutors.newDirectExecutorService();
+ }
+
+ private void buildNodeAndAssert(JsonNode inputNode, AAITreeNode expectedNode, NodeType nodeType){
+ ConcurrentSkipListSet<AAITreeNode> nodesAccumulator = new ConcurrentSkipListSet<>(comparing(AAITreeNode::getUniqueNodeKey));
+ when(aaiClientMock.typedAaiRest(Unchecked.toURI("anyUrl"), JsonNode.class, null, HttpMethod.GET, false)).thenReturn(inputNode);
+ AAITreeNode actualNode = aaiTreeNodeBuilder.buildNode(
+ nodeType,
+ "anyUrl",
+ null,
+ HttpMethod.GET,
+ nodesAccumulator,
+ executorService,
+ AAI_TREE_PATHS.getSubTree(new AAIServiceTree.AaiRelationship(nodeType))
+ ).get(0);
+ assertThat(actualNode, jsonEquals(expectedNode).when(IGNORING_ARRAY_ORDER, IGNORING_EXTRA_FIELDS).whenIgnoringPaths("relationshipList","children[0].relationshipList"));
}
@Test
- public void buildNode_buildGroupNode_NodeIsAsExpected(){
- ConcurrentSkipListSet<AAITreeNode> nodesAccumulator = new ConcurrentSkipListSet<>(comparing(AAITreeNode::getUniqueNodeKey));
- ConcurrentLinkedQueue<String> visitedNodes = new ConcurrentLinkedQueue<>();
- when(aaiClientMock.typedAaiGet(Unchecked.toURI("anyUrl"), JsonNode.class)).thenReturn(createGroupJson());
-
- AAITreeNode groupNode = aaiTreeNodeBuilder.buildNode("instance-group",
- "anyUrl",
- nodesAccumulator,
- threadPoolMock,
- visitedNodes,
- new AtomicInteger(0),
- AAI_TREE_PATHS).get(0);
-
- AAITreeNode expectedGroupNode = createExpectedGroupNode();
- assertNodeIsAsExpected(expectedGroupNode,groupNode);
- }
-
- private void assertNodeIsAsExpected(AAITreeNode expectedGroupNode, AAITreeNode groupNode) {
- Assert.assertEquals(groupNode.getId(), expectedGroupNode.getId());
- Assert.assertEquals(groupNode.getType(), expectedGroupNode.getType());
- Assert.assertEquals(groupNode.getName(), expectedGroupNode.getName());
- Assert.assertEquals(groupNode.getModelVersionId(), expectedGroupNode.getModelVersionId());
- Assert.assertEquals(groupNode.getModelInvariantId(), expectedGroupNode.getModelInvariantId());
- Assert.assertEquals(groupNode.getInMaint(), expectedGroupNode.getInMaint());
- Assert.assertEquals(groupNode.getAdditionalProperties(), expectedGroupNode.getAdditionalProperties());
+ public void buildNode_buildGroupNode_NodeIsAsExpected() {
+ buildNodeAndAssert(createGroupJson(), createExpectedGroupNode(), NodeType.INSTANCE_GROUP);
}
private AAITreeNode createExpectedGroupNode() {
AAITreeNode expectedNode = new AAITreeNode();
expectedNode.setId("c4fcf022-31a0-470a-b5b8-c18335b7af32");
- expectedNode.setType("instance-group");
+ expectedNode.setType(NodeType.INSTANCE_GROUP);
expectedNode.setName("Test vE-Flex");
expectedNode.setModelVersionId("Test vE-Flex");
expectedNode.setModelInvariantId("dd182d7d-6949-4b90-b3cc-5befe400742e");
@@ -103,8 +126,6 @@
additionalProperties.put("resource-version","1533315433086");
additionalProperties.put("instance-group-function","vTSBC Customer Landing Network Collection");
expectedNode.setAdditionalProperties(additionalProperties);
-
-
return expectedNode;
}
@@ -125,22 +146,7 @@
" \"inMaint\": \"false\"," +
" \"instance-group-function\": \"vTSBC Customer Landing Network Collection\"," +
" \"relationship-list\": {" +
- " \"relationship\": [{" +
- " \"related-to\": \"generic-vnf\"," +
- " \"relationship-label\": \"org.onap.relationships.inventory.MemberOf\" ," +
- " \"related-link\": \"/aai/v14/network/generic-vnfs/generic-vnf/8c54c369-2876-4423-9b33-80f783f29082\" ," +
- " \"relationship-data\": [{" +
- " \"relationship-key\": \"generic-vnf.vnf-id\"," +
- " \"relationship-value\": \"8c54c369-2876-4423-9b33-80f783f29082\"" +
- " }" +
- " ]," +
- " \"related-to-property\": [{" +
- " \"property-key\": \"generic-vnf.vnf-name\"," +
- " \"property-value\": \"zrdm5bffad01\"" +
- " }" +
- " ]" +
- " }" +
- " ]" +
+ " \"relationship\": []" +
" }" +
" }");
} catch (IOException e) {
@@ -148,4 +154,363 @@
}
return groupNode;
}
+
+ @Test
+ public void whenReadNetworkNode_thenNodeIsAsExpected() throws IOException {
+ JsonNode mockedAaiResponse = TestUtils.readJsonResourceFileAsObject("/getTopology/network.json", JsonNode.class);
+
+ AAITreeNode expectedNetworkNode = new AAITreeNode();
+ expectedNetworkNode.setId("94c86b39-bbbf-4027-8120-ff37c6d2493a");
+ expectedNetworkNode.setName("AUK51a_oam_calea_net_1");
+ expectedNetworkNode.setOrchestrationStatus("Assigned");
+ expectedNetworkNode.setModelInvariantId("b9a9b549-0ee4-49fc-b4f2-5edc6701da68");
+ expectedNetworkNode.setModelVersionId("77010093-df36-4dcb-8428-c3d02bf3f88d");
+ expectedNetworkNode.setModelCustomizationId("e5f33853-f84c-4cdd-99f2-93846957aa18");
+ expectedNetworkNode.setType(NodeType.NETWORK);
+ expectedNetworkNode.setCloudConfiguration(new CloudConfiguration("auk51a", "b530fc990b6d4334bd45518bebca6a51", "att-nc"));
+
+ buildNodeAndAssert(mockedAaiResponse, expectedNetworkNode, NodeType.NETWORK);
+ }
+
+ @Test
+ public void whenCloudRegionMissing_otherPlacementFieldsReadAsExpected() throws IOException {
+
+ AAITreeNode node = new AAITreeNode();
+ Optional<Relationship> tenantRelationShip = Optional.of(
+ JACKSON_OBJECT_MAPPER.readValue("{" +
+ " \"related-to\": \"tenant\"," +
+ " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
+ " \"related-link\": \"/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-nc/auk51a/tenants/tenant/b530fc990b6d4334bd45518bebca6a51\"," +
+ " \"relationship-data\": [{" +
+ " \"relationship-key\": \"cloud-region.cloud-owner\"," +
+ " \"relationship-value\": \"att-nc\"" +
+ " }, {" +
+ " \"relationship-key\": \"tenant.tenant-id\"," +
+ " \"relationship-value\": \"b530fc990b6d4334bd45518bebca6a51\"" +
+ " }" +
+ " ]," +
+ " \"related-to-property\": [{" +
+ " \"property-key\": \"tenant.tenant-name\"," +
+ " \"property-value\": \"ecomp_ispt\"" +
+ " }" +
+ " ]" +
+ " }", Relationship.class)
+ );
+ aaiTreeNodeBuilder.enrichPlacementDataUsingTenantInfo(node, tenantRelationShip);
+ assertEquals(new CloudConfiguration(null, "b530fc990b6d4334bd45518bebca6a51", "att-nc"), node.getCloudConfiguration());
+ }
+
+ @Test
+ public void whenTenantMissing_otherPlacementFieldsReadAsExpected() throws IOException {
+
+ AAITreeNode node = new AAITreeNode();
+ Optional<Relationship> tenantRelationShip = Optional.of(
+ JACKSON_OBJECT_MAPPER.readValue("{" +
+ " \"related-to\": \"tenant\"," +
+ " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
+ " \"related-link\": \"/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-nc/auk51a/tenants/tenant/b530fc990b6d4334bd45518bebca6a51\"," +
+ " \"relationship-data\": [{" +
+ " \"relationship-key\": \"cloud-region.cloud-owner\"," +
+ " \"relationship-value\": \"att-nc\"" +
+ " }, {" +
+ " \"relationship-key\": \"cloud-region.cloud-region-id\"," +
+ " \"relationship-value\": \"auk51a\"" +
+ " }" +
+ " ]," +
+ " \"related-to-property\": [{" +
+ " \"property-key\": \"tenant.tenant-name\"," +
+ " \"property-value\": \"ecomp_ispt\"" +
+ " }" +
+ " ]" +
+ " }", Relationship.class)
+ );
+ aaiTreeNodeBuilder.enrichPlacementDataUsingTenantInfo(node, tenantRelationShip);
+ assertEquals(new CloudConfiguration("auk51a", null, "att-nc"), node.getCloudConfiguration());
+ }
+
+ @Test
+ public void whenCloudOwnerMissing_otherPlacementFieldsReadAsExpected() throws IOException {
+
+ AAITreeNode node = new AAITreeNode();
+ Optional<Relationship> tenantRelationShip = Optional.of(
+ JACKSON_OBJECT_MAPPER.readValue("{" +
+ " \"related-to\": \"tenant\"," +
+ " \"relationship-label\": \"org.onap.relationships.inventory.Uses\"," +
+ " \"related-link\": \"/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-nc/auk51a/tenants/tenant/b530fc990b6d4334bd45518bebca6a51\"," +
+ " \"relationship-data\": [{" +
+ " \"relationship-key\": \"tenant.tenant-id\"," +
+ " \"relationship-value\": \"b530fc990b6d4334bd45518bebca6a51\"" +
+ " }, {" +
+ " \"relationship-key\": \"cloud-region.cloud-region-id\"," +
+ " \"relationship-value\": \"auk51a\"" +
+ " }" +
+ " ]," +
+ " \"related-to-property\": [{" +
+ " \"property-key\": \"tenant.tenant-name\"," +
+ " \"property-value\": \"ecomp_ispt\"" +
+ " }" +
+ " ]" +
+ " }", Relationship.class)
+ );
+ aaiTreeNodeBuilder.enrichPlacementDataUsingTenantInfo(node, tenantRelationShip);
+ assertEquals(new CloudConfiguration("auk51a", "b530fc990b6d4334bd45518bebca6a51", null), node.getCloudConfiguration());
+ }
+
+ @Test
+ public void whenThereIsNoTenantRelationship_thenPlacementIsNull() throws IOException {
+ AAITreeNode node = new AAITreeNode();
+ aaiTreeNodeBuilder.enrichPlacementData(node);
+ assertNull(node.getCloudConfiguration());
+ }
+
+
+ @Test
+ public void whenReadVnfNodeWithVfModule_thenNodeIsAsExpected() throws IOException {
+ JsonNode mockedAaiGetVnfResponse = TestUtils.readJsonResourceFileAsObject("/getTopology/vnf.json", JsonNode.class);
+
+ //add mock for vfModule of the VNF
+ JsonNode mockedAaiGetVfModuleResponse = TestUtils.readJsonResourceFileAsObject("/getTopology/vfModule.json", JsonNode.class);
+ when(aaiClientMock.typedAaiGet(Unchecked.toURI("anyUrl/vf-modules"), JsonNode.class)).thenReturn(mockedAaiGetVfModuleResponse);
+
+ CloudConfiguration expectedCloudConfiguration = new CloudConfiguration("dyh3b", "c8035f5ee95d4c62bbc8074c044122b9", "irma-aic");
+
+ AAITreeNode expectedVnfNode = createExpectedVnfTreeNode(expectedCloudConfiguration);
+
+ AAITreeNode expectedVfModule = new AAITreeNode();
+ expectedVfModule.setId("2cb6d41e-2bef-4cb2-80ce-c7815bcdcf4e");
+ expectedVfModule.setName("dyh3brarf8000v_base");
+ expectedVfModule.setOrchestrationStatus("Active");
+ expectedVfModule.setModelInvariantId("3ecca473-b0c0-46ae-b0b7-bd2969d8b79f");
+ expectedVfModule.setModelVersionId("5c35b764-e266-4498-af87-a88c4ba92dc4");
+ expectedVfModule.setModelCustomizationId("06b4ece0-f6f8-4003-b445-653418292101");
+ expectedVfModule.setType(NodeType.VF_MODULE);
+ expectedVfModule.setInMaint(false);
+ expectedVfModule.setCloudConfiguration(expectedCloudConfiguration);
+
+ expectedVnfNode.addChildren(ImmutableList.of(expectedVfModule));
+
+ buildNodeAndAssert(mockedAaiGetVnfResponse, expectedVnfNode, NodeType.GENERIC_VNF);
+ }
+
+ @NotNull
+ public static AAITreeNode createExpectedVnfTreeNode(CloudConfiguration expectedCloudConfiguration) {
+ AAITreeNode expectedVnfNode = new AAITreeNode();
+ expectedVnfNode.setId("9a7a4dc1-8e5f-43fe-a360-7734c5f51382");
+ expectedVnfNode.setName("dyh3brarf8000v");
+ expectedVnfNode.setOrchestrationStatus("Active");
+ expectedVnfNode.setModelInvariantId("b711997f-36b3-4a9b-8b37-71a0fc2ebd6d");
+ expectedVnfNode.setModelVersionId("7f23e4f7-e44c-44df-b066-4cedc6950bfe");
+ expectedVnfNode.setModelCustomizationId("401350be-0f56-481c-86d8-f32d573fec26");
+ expectedVnfNode.setType(NodeType.GENERIC_VNF);
+ expectedVnfNode.setInMaint(true);
+ expectedVnfNode.setProvStatus("PREPROV");
+ expectedVnfNode.setCloudConfiguration(expectedCloudConfiguration);
+ return expectedVnfNode;
+ }
+
+ @DataProvider
+ public static Object[][] isArrayDataProvider() {
+ return new Object[][] {
+ {"Json Array", buildArrayJson(NodeType.GENERIC_VNF), true},
+ {"Json Object", buildOneLevelJson(NodeType.GENERIC_VNF), false},
+ {"Json Array with another node type", buildArrayJson(NodeType.SERVICE_INSTANCE), false},
+ {"null json", null, false}
+ };
+ }
+
+ @Test(dataProvider = "isArrayDataProvider")
+ public void IsArrayType(String description, JsonNode jsonNode, boolean expectedResult) {
+ boolean isArray = aaiTreeNodeBuilder.isArray(jsonNode, NodeType.GENERIC_VNF);
+ assertEquals(expectedResult, isArray);
+ }
+
+ @Test
+ public void jsonToAaiNodeTest() {
+ NodeType nodeType = NodeType.SERVICE_INSTANCE;
+ JsonNode node = buildOneLevelJson(nodeType);
+ ConcurrentSkipListSet<AAITreeNode> nodesAccumulator = new ConcurrentSkipListSet<>(comparing(AAITreeNode::getUniqueNodeKey));
+
+ AAITreeNode aaiTreeNode = aaiTreeNodeBuilder.createAaiNode(nodeType, node, nodesAccumulator);
+
+ assertEquals("any-instance-id", aaiTreeNode.getId());
+ assertEquals("any-instance-name", aaiTreeNode.getName());
+ assertTrue(nodesAccumulator.contains(aaiTreeNode));
+ }
+
+ @Test
+ public void getNextLevelInPathsTreeTest() {
+ Tree<AAIServiceTree.AaiRelationship> firstLevelTree = getPathsTree();
+
+ Tree<AAIServiceTree.AaiRelationship> secondLevelTree = aaiTreeNodeBuilder.getNextLevelInPathsTree(firstLevelTree, NodeType.GENERIC_VNF.getType());
+ assertEquals(NodeType.GENERIC_VNF.getType(), secondLevelTree.getRootValue().type);
+
+ Tree<AAIServiceTree.AaiRelationship> thirdLevelTree = aaiTreeNodeBuilder.getNextLevelInPathsTree(secondLevelTree, NodeType.INSTANCE_GROUP.getType());
+ assertEquals(NodeType.INSTANCE_GROUP.getType(), thirdLevelTree.getRootValue().type);
+ }
+
+ @Test
+ public void getNextLevelInPathsTreeTest_givenIrrelevantNode_expectedNull() {
+ Tree<AAIServiceTree.AaiRelationship> pathsTree = getPathsTree();
+
+ Tree<AAIServiceTree.AaiRelationship> subTree = aaiTreeNodeBuilder.getNextLevelInPathsTree(pathsTree, NodeType.INSTANCE_GROUP.getType());
+
+ assertNull(subTree);
+ }
+
+ @Test
+ public void getRelationships_given2Relationships_expect1filtered() {
+ NodeType firstRelationship = NodeType.GENERIC_VNF;
+ NodeType secondRelationship = NodeType.INSTANCE_GROUP;
+ JsonNode jsonNode = buildOneLevelJson(NodeType.SERVICE_INSTANCE, firstRelationship, secondRelationship);
+
+ List<Relationship> relationships = aaiTreeNodeBuilder.getFilteredRelationships(jsonNode, getPathsTree());
+
+ assertEquals(1, relationships.size());
+ assertEquals(firstRelationship.getType(), relationships.get(0).getRelatedTo());
+ }
+
+ @Test
+ public void getRelationships_givenNoRelationships_expectedEmptyListTest() {
+ JsonNode jsonNode = buildOneLevelJson(NodeType.SERVICE_INSTANCE);
+
+ List<Relationship> relationships = aaiTreeNodeBuilder.getFilteredRelationships(jsonNode, getPathsTree());
+
+ assertThat(relationships, is(empty()));
+ }
+
+ @Test
+ public void getRelationships_given2RelationshipsNotExistInTreePaths_expectAllFiltered() {
+ NodeType firstRelationship = NodeType.CONFIGURATION;
+ NodeType secondRelationship = NodeType.INSTANCE_GROUP;
+ JsonNode jsonNode = buildOneLevelJson(NodeType.SERVICE_INSTANCE, firstRelationship, secondRelationship);
+
+ List<Relationship> relationships = aaiTreeNodeBuilder.getFilteredRelationships(jsonNode, getPathsTree());
+
+ assertThat(relationships, is(empty()));
+ }
+
+ @Test
+ public void aggregateAllOtherPropertiesTest() {
+ NodeType nodeType = NodeType.SERVICE_INSTANCE;
+ JsonNode jsonNode = buildOneLevelJson(nodeType, NodeType.GENERIC_VNF, NodeType.GENERIC_VNF);
+ ((ObjectNode) jsonNode).put("nf-role", "any-value");
+
+ Map<String, Object> additionalProps = aaiTreeNodeBuilder.aggregateAllOtherProperties(jsonNode, nodeType);
+ assertThat(additionalProps, is(ImmutableMap.of(
+ "nf-role", "any-value")));
+ }
+
+ @Test
+ public void parseNodeAndFilterRelationshipsTest() {
+ NodeType nodeType = NodeType.SERVICE_INSTANCE;
+ JsonNode jsonNode = buildOneLevelJson(NodeType.SERVICE_INSTANCE, NodeType.GENERIC_VNF, NodeType.NETWORK, NodeType.VF_MODULE);
+ ConcurrentSkipListSet<AAITreeNode> nodesAccumulator = new ConcurrentSkipListSet<>(comparing(AAITreeNode::getUniqueNodeKey));
+
+ Pair<AAITreeNode, List<Relationship>> resultNode = aaiTreeNodeBuilder.parseNodeAndFilterRelationships(jsonNode, nodeType,
+ nodesAccumulator, getPathsTree());
+
+ assertEquals(nodeType, resultNode.getKey().getType());
+ assertEquals(2, resultNode.getValue().size());
+ assertEquals(NodeType.GENERIC_VNF.getType(), resultNode.getValue().get(0).getRelatedTo());
+ assertEquals(NodeType.NETWORK.getType(), resultNode.getValue().get(1).getRelatedTo());
+ }
+
+ @Test(expectedExceptions = GenericUncheckedException.class ,expectedExceptionsMessageRegExp = "AAI node fetching failed.")
+ public void fetchChildrenAsyncTest_given2children_expected1Ok1Timeout() {
+ ConcurrentSkipListSet<AAITreeNode> nodesAccumulator = new ConcurrentSkipListSet<>(comparing(AAITreeNode::getUniqueNodeKey));
+ ExecutorService threadPool = Executors.newFixedThreadPool(5);
+
+ AAITreeNode rootNode = createExpectedGroupNode();
+ JsonNode relationshipJson = getRelationships(NodeType.GENERIC_VNF, NodeType.NETWORK);
+ List<Relationship> relationships = mapper.convertValue(relationshipJson, RelationshipList.class).getRelationship();
+
+ when(aaiClientMock.typedAaiRest(Unchecked.toURI(relationships.get(0).getRelatedLink()), JsonNode.class, null, HttpMethod.GET, false))
+ .thenReturn(buildOneLevelJson(NodeType.GENERIC_VNF));
+
+ when(aaiClientMock.typedAaiRest(Unchecked.toURI(relationships.get(1).getRelatedLink()), JsonNode.class, null, HttpMethod.GET, false))
+ .thenAnswer((Answer<JsonNode>) invocation -> {
+ Thread.sleep(2000);
+ return buildOneLevelJson(NodeType.NETWORK);
+ });
+
+ aaiTreeNodeBuilder.fetchChildrenAsync(threadPool, nodesAccumulator, rootNode, relationships, getPathsTree(), 1);
+
+ assertEquals(2, rootNode.getChildren().size());
+ assertEquals(NodeType.GENERIC_VNF, rootNode.getChildren().get(0).getType());
+ assertEquals(NodeType.NETWORK, rootNode.getChildren().get(1).getType());
+ }
+
+ @DataProvider
+ public Object[][] testIsListOfKeyResultsDataProvider() {
+ return new Object[][]{
+ {"Node has results with several values",
+ "{\"results\":[{\"l3-network\":{}},{\"l3-network\":{}},{\"l3-network\":{}}]}",
+ true},
+ {"Node has results with no values",
+ "{\"results\":[]}",
+ true},
+ {"Node has results, but it isn't an array",
+ "{\"results\":{\"some-field\":{}}}",
+ false},
+ {"Node doesn't have results",
+ "{\"l3-network\":[{},{}]}",
+ false},
+ {"Node is null",
+ "null",
+ false},
+ };
+ }
+
+ @Test(dataProvider = "testIsListOfKeyResultsDataProvider")
+ public void testIsListOfKeyResults(String testCase, String input, boolean expectedResult) throws IOException {
+ assertEquals(testCase + ": " + input,
+ expectedResult, aaiTreeNodeBuilder.isListOfKeyResults(new ObjectMapper().readTree(input)));
+ }
+
+ private Tree<AAIServiceTree.AaiRelationship> getPathsTree() {
+ Tree<AAIServiceTree.AaiRelationship> pathsTree = new Tree<>(new AAIServiceTree.AaiRelationship(NodeType.SERVICE_INSTANCE));
+ pathsTree.addPath(AAIServiceTree.toAaiRelationshipList(NodeType.GENERIC_VNF, NodeType.INSTANCE_GROUP));
+ pathsTree.addPath(AAIServiceTree.toAaiRelationshipList(NodeType.NETWORK));
+
+ return pathsTree;
+ }
+
+ private static JsonNode buildOneLevelJson(NodeType nodeType, NodeType...relationships) {
+ ObjectNode objectNode = mapper.createObjectNode();
+ objectNode.put(nodeType.getId(), "any-instance-id");
+ objectNode.put(nodeType.getName(), "any-instance-name");
+ if (relationships.length > 0 ) {
+ objectNode.putPOJO("relationship-list", getRelationships(relationships));
+ }
+ return objectNode;
+ }
+
+ private static JsonNode buildArrayJson(NodeType nodeType) {
+ ObjectNode objectNode = mapper.createObjectNode();
+ ArrayNode arrayNode = objectNode.putArray(nodeType.getType());
+ arrayNode.add(buildOneLevelJson(nodeType));
+ arrayNode.add(buildOneLevelJson(nodeType));
+
+ return objectNode;
+ }
+
+ private static JsonNode getRelationship(String nodeType) {
+ ObjectNode relationship = mapper.createObjectNode();
+ relationship.put("related-to", nodeType);
+ relationship.put("relationship-label", "org.onap.relationships.inventory.ComposedOf");
+ relationship.put("related-link", "/aai/v12/network/" + nodeType + "s/" + nodeType + "/cf6f60cd-808d-44e6-978b-c663e00dba8d");
+ return relationship;
+ }
+
+ private static JsonNode getRelationships(NodeType...nodeTypes) {
+ ObjectNode relationshipList = mapper.createObjectNode();
+ ArrayNode relationships = relationshipList.putArray("relationship");
+
+ for (NodeType nodeType: nodeTypes) {
+ relationships.add(getRelationship(nodeType.getType()));
+ }
+
+ return relationshipList;
+ }
+
}
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 bb47180..09a5368 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
@@ -21,16 +21,36 @@
package org.onap.vid.services;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isNull;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+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;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import javax.ws.rs.core.Response;
import org.apache.http.HttpStatus;
import org.jetbrains.annotations.NotNull;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
+import org.mockito.Spy;
import org.mockito.junit.MockitoJUnitRunner;
import org.onap.vid.aai.AaiClientInterface;
import org.onap.vid.aai.AaiGetVnfResponse;
@@ -70,721 +90,711 @@
import org.onap.vid.model.aaiTree.RelatedVnf;
import org.onap.vid.model.aaiTree.ServiceInstance;
import org.onap.vid.roles.RoleValidator;
-
-import javax.ws.rs.core.Response;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import static org.assertj.core.api.Assertions.assertThat;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.anyString;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
+import org.springframework.http.HttpMethod;
@RunWith(MockitoJUnitRunner.class)
public class AaiServiceImplTest {
- private static final String GLOBAL_CUSTOMER_ID = "GLOBAL_CUSTOMER_ID";
- private static final String CLOUD_REGION_ID = "CLOUD_REGION_ID";
- private static final String VNF_TYPE = "VNF_TYPE";
- private static final String TENANT_ID = "TENANT_ID";
- private static final String TENANT_NAME = "TENANT_NAME";
- private static final String SERVICE_TYPE = "SERVICE_TYPE";
- private static final String CORRECT_VALUE = "CORRECT_VALUE";
- private static final String SUBSCRIBER_ID = "SUBSCRIBER_ID_EXPECTED";
- private static final String STATUS_TEXT = "STATUS_TEXT";
- private static final String GLOBAL_SUBSCRIBER_ID = "GLOBAL_SUBSCRIBER_ID";
- private static final String GLOBAL_SUBSCRIBER_ID_NULL_RESPONSE = "ID_NULL";
- private static final String VNF_INSTANCE_ID_OK = "VNF_INSTANCE_ID_OK";
- private static final String VNF_INSTANCE_ID_FAIL = "VNF_INSTANCE_ID_FAIL";
- private static final String PARENT_NAME = "PARENT_NAME";
- private static final String PARENT_ID = "PARENT_ID";
- private static final String INVARIANT_ID = "INVARIANT_ID";
- private static final String GROUP_TYPE_FAILING = "GROUP_TYPE_FAILING";
- private static final String GROUP_ROLE_OK = "GROUP_ROLE_OK";
- private static final String GROUP_ROLE_FAILING = "GROUP_ROLE_FAILING";
- private static final String group_type_ok = "GROUP_TYPE_OK";
- private static final String CLOUD_TYPE = "CLOUD_TYPE";
+ private static final String GLOBAL_CUSTOMER_ID = "GLOBAL_CUSTOMER_ID";
+ private static final String CLOUD_REGION_ID = "CLOUD_REGION_ID";
+ private static final String VNF_TYPE = "VNF_TYPE";
+ private static final String TENANT_ID = "TENANT_ID";
+ private static final String TENANT_NAME = "TENANT_NAME";
+ private static final String SERVICE_TYPE = "SERVICE_TYPE";
+ private static final String CORRECT_VALUE = "CORRECT_VALUE";
+ private static final String SUBSCRIBER_ID = "SUBSCRIBER_ID_EXPECTED";
+ private static final String STATUS_TEXT = "STATUS_TEXT";
+ private static final String GLOBAL_SUBSCRIBER_ID = "GLOBAL_SUBSCRIBER_ID";
+ private static final String GLOBAL_SUBSCRIBER_ID_NULL_RESPONSE = "ID_NULL";
+ private static final String VNF_INSTANCE_ID_OK = "VNF_INSTANCE_ID_OK";
+ private static final String VNF_INSTANCE_ID_FAIL = "VNF_INSTANCE_ID_FAIL";
+ private static final String PARENT_NAME = "PARENT_NAME";
+ private static final String PARENT_ID = "PARENT_ID";
+ private static final String INVARIANT_ID = "INVARIANT_ID";
+ private static final String GROUP_TYPE_FAILING = "GROUP_TYPE_FAILING";
+ private static final String GROUP_ROLE_OK = "GROUP_ROLE_OK";
+ private static final String GROUP_ROLE_FAILING = "GROUP_ROLE_FAILING";
+ private static final String group_type_ok = "GROUP_TYPE_OK";
+ private static final String CLOUD_TYPE = "CLOUD_TYPE";
- @Mock
- private HttpResponse<SubscriberList> responseAllSubscribers;
- @Mock
- private AaiResponse<OperationalEnvironmentList> aaiResponseOpEnvList;
- @Mock
- private AaiResponse aaiResponse;
- @Mock
- private AaiResponse<JsonNode> aaiResponseJsonNode;
- @Mock
- private RoleValidator roleValidator;
+ @Mock
+ private HttpResponse<SubscriberList> responseAllSubscribers;
+ @Mock
+ private AaiResponse<OperationalEnvironmentList> aaiResponseOpEnvList;
+ @Mock
+ private AaiResponse aaiResponse;
+ @Mock
+ private AaiResponse<JsonNode> aaiResponseJsonNode;
+ @Mock
+ private RoleValidator roleValidator;
- @Mock
- private AaiClientInterface aaiClient;
- @Mock
- private AaiOverTLSClientInterface aaiOverTLSClient;
- @Mock
- private AaiResponseTranslator aaiResponseTranslator;
- @Mock
- private AAIServiceTree aaiServiceTree;
+ @Mock
+ private AaiClientInterface aaiClient;
+ @Mock
+ private AaiOverTLSClientInterface aaiOverTLSClient;
+ @Mock
+ private AaiResponseTranslator aaiResponseTranslator;
+ @Mock
+ private AAIServiceTree aaiServiceTree;
+ @Spy
+ private ExecutorService executorService = Executors.newFixedThreadPool(1);
- @InjectMocks
- private AaiServiceImpl aaiService;
+ @InjectMocks
+ private AaiServiceImpl aaiService;
+ @Test
+ public void shouldGetFullSubscriberListWithoutValidator() {
+ when(aaiOverTLSClient.getAllSubscribers()).thenReturn(responseAllSubscribers);
- @Test
- public void shouldGetFullSubscriberListWithoutValidator() {
- when(aaiOverTLSClient.getAllSubscribers()).thenReturn(responseAllSubscribers);
+ HttpResponse<SubscriberList> actualResponse = aaiService.getFullSubscriberList();
- HttpResponse<SubscriberList> actualResponse = aaiService.getFullSubscriberList();
+ assertThat(actualResponse).isEqualTo(responseAllSubscribers);
+ }
- assertThat(actualResponse).isEqualTo(responseAllSubscribers);
- }
+ @Test
+ public void shouldGetFullSubscriberListWithValidator() {
+ Subscriber subscriber = createSubscriber();
+ SubscriberList subscriberList = new SubscriberList(Collections.singletonList(subscriber));
- @Test
- public void shouldGetFullSubscriberListWithValidator() {
- 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);
+ SubscriberFilteredResults expectedSubscribers = new SubscriberFilteredResults(roleValidator, subscriberList,
+ STATUS_TEXT, HttpStatus.SC_OK);
- when(aaiOverTLSClient.getAllSubscribers()).thenReturn(responseAllSubscribers);
- when(responseAllSubscribers.getBody()).thenReturn(subscriberList);
- when(responseAllSubscribers.getStatusText()).thenReturn(STATUS_TEXT);
- when(responseAllSubscribers.getStatus()).thenReturn(HttpStatus.SC_OK);
- SubscriberFilteredResults expectedSubscribers = new SubscriberFilteredResults(roleValidator, subscriberList,
- STATUS_TEXT, HttpStatus.SC_OK);
+ SubscriberFilteredResults actualSubscribers = aaiService.getFullSubscriberList(roleValidator);
- SubscriberFilteredResults actualSubscribers = aaiService.getFullSubscriberList(roleValidator);
+ assertThat(actualSubscribers.getHttpCode()).isEqualTo(expectedSubscribers.getHttpCode());
+ assertThat(actualSubscribers.getErrorMessage()).isEqualTo(expectedSubscribers.getErrorMessage());
+ }
- assertThat(actualSubscribers.getHttpCode()).isEqualTo(expectedSubscribers.getHttpCode());
- assertThat(actualSubscribers.getErrorMessage()).isEqualTo(expectedSubscribers.getErrorMessage());
- }
+ @Test
+ public void shouldGetOperationalEnvironments() {
+ when(aaiClient.getOperationalEnvironments(anyString(), anyString()))
+ .thenReturn(aaiResponseOpEnvList);
- @Test
- public void shouldGetOperationalEnvironments() {
- when(aaiClient.getOperationalEnvironments(anyString(), anyString()))
- .thenReturn(aaiResponseOpEnvList);
+ AaiResponse<OperationalEnvironmentList> expectedEnvList =
+ aaiService.getOperationalEnvironments(anyString(), anyString());
- AaiResponse<OperationalEnvironmentList> expectedEnvList =
- aaiService.getOperationalEnvironments(anyString(), anyString());
+ assertThat(expectedEnvList).isEqualTo(aaiResponseOpEnvList);
+ }
- assertThat(expectedEnvList).isEqualTo(aaiResponseOpEnvList);
- }
+ @Test
+ public void shouldGetSubscriberData() {
+ Services services = createAaiResponseServices();
+ AaiResponse<Services> aaiResponseServices = new AaiResponse<>(services, null, HttpStatus.SC_OK);
- @Test
- public void shouldGetSubscriberData() {
- Services services = createAaiResponseServices();
- AaiResponse<Services> aaiResponseServices = new AaiResponse<>(services, null, HttpStatus.SC_OK);
+ when(aaiClient.getSubscriberData(SUBSCRIBER_ID, false)).thenReturn(aaiResponseServices);
+ when(roleValidator.isServicePermitted(eq(GLOBAL_CUSTOMER_ID), anyString())).thenReturn(Boolean.TRUE);
- when(aaiClient.getSubscriberData(SUBSCRIBER_ID)).thenReturn(aaiResponseServices);
- when(roleValidator.isServicePermitted(eq(GLOBAL_CUSTOMER_ID), anyString())).thenReturn(Boolean.TRUE);
+ AaiResponse actualResponse = aaiService.getSubscriberData(SUBSCRIBER_ID, roleValidator, false);
+ List<ServiceSubscription> actualServiceSubscriptions = ((AaiResponse<Services>) actualResponse)
+ .getT().serviceSubscriptions.serviceSubscription;
- AaiResponse actualResponse = aaiService.getSubscriberData(SUBSCRIBER_ID, roleValidator);
- List<ServiceSubscription> actualServiceSubscriptions = ((AaiResponse<Services>) actualResponse)
- .getT().serviceSubscriptions.serviceSubscription;
+ assertThat(actualResponse).isEqualTo(aaiResponseServices);
+ assertThat(actualServiceSubscriptions).allMatch(s -> s.isPermitted);
+ }
- assertThat(actualResponse).isEqualTo(aaiResponseServices);
- assertThat(actualServiceSubscriptions).allMatch(s -> s.isPermitted);
- }
+ @Test
+ public void shouldGetServiceInstanceEmptySearchResults() {
+ ServiceInstancesSearchResults serviceInstancesSearchResults = new ServiceInstancesSearchResults();
+ AaiResponse<ServiceInstancesSearchResults> emptyResponse = new AaiResponse<>(serviceInstancesSearchResults,
+ null, HttpStatus.SC_OK);
- @Test
- public void shouldGetServiceInstanceEmptySearchResults() {
- ServiceInstancesSearchResults serviceInstancesSearchResults = new ServiceInstancesSearchResults();
- AaiResponse<ServiceInstancesSearchResults> emptyResponse = new AaiResponse<>(serviceInstancesSearchResults,
- null, HttpStatus.SC_OK);
+ AaiResponse actualResponse = aaiService.getServiceInstanceSearchResults(null, null,
+ null, null, null);
- AaiResponse actualResponse = aaiService.getServiceInstanceSearchResults(null, null,
- null, null, null);
+ assertThat(actualResponse).isEqualToComparingFieldByFieldRecursively(emptyResponse);
+ }
- assertThat(actualResponse).isEqualToComparingFieldByFieldRecursively(emptyResponse);
- }
+ @Test
+ public void shouldGetVersionByInvariantId() {
+ Response response = mock(Response.class);
+ when(aaiClient.getVersionByInvariantId(any())).thenReturn(response);
- @Test
- public void shouldGetVersionByInvariantId() {
- Response response = mock(Response.class);
- when(aaiClient.getVersionByInvariantId(any())).thenReturn(response);
+ Response actualResponse = aaiService.getVersionByInvariantId(any());
- Response actualResponse = aaiService.getVersionByInvariantId(any());
+ assertThat(actualResponse).isEqualTo(response);
+ }
- assertThat(actualResponse).isEqualTo(response);
- }
+ @Test
+ public void shouldGetSpecificPnf() {
+ AaiResponse<Pnf> expectedResponse = new AaiResponse<>(Pnf.builder().build(), null, HttpStatus.SC_OK);
+ when(aaiClient.getSpecificPnf(anyString())).thenReturn(expectedResponse);
- @Test
- public void shouldGetSpecificPnf() {
- AaiResponse<Pnf> expectedResponse = new AaiResponse<>(Pnf.builder().build(), null, HttpStatus.SC_OK);
- when(aaiClient.getSpecificPnf(anyString())).thenReturn(expectedResponse);
+ AaiResponse<Pnf> actualResponse = aaiService.getSpecificPnf(anyString());
- AaiResponse<Pnf> actualResponse = aaiService.getSpecificPnf(anyString());
+ assertThat(actualResponse).isEqualTo(expectedResponse);
+ }
- assertThat(actualResponse).isEqualTo(expectedResponse);
- }
+ @Test
+ public void shouldGetPnfData() {
+ when(aaiClient.getPNFData(anyString(), anyString(), anyString(), anyString(), anyString(), anyString(),
+ anyString())).thenReturn(aaiResponse);
- @Test
- public void shouldGetPnfData() {
- when(aaiClient.getPNFData(anyString(), anyString(), anyString(), anyString(), anyString(), anyString(),
- anyString())).thenReturn(aaiResponse);
+ AaiResponse actualResponse = aaiService.getPNFData(anyString(), anyString(), anyString(), anyString(),
+ anyString(), anyString(), anyString());
- AaiResponse actualResponse = aaiService.getPNFData(anyString(), anyString(), anyString(), anyString(),
- anyString(), anyString(), anyString());
+ assertThat(actualResponse).isEqualTo(aaiResponse);
+ }
- assertThat(actualResponse).isEqualTo(aaiResponse);
- }
+ @Test
+ public void shouldGetServices() {
+ org.onap.vid.aai.model.AaiGetServicesRequestModel.Service s1 =
+ createService("ID1", "V1", "D1");
+ org.onap.vid.aai.model.AaiGetServicesRequestModel.Service s2 =
+ createService("ID2", "V2", "D2");
- @Test
- public void shouldGetServices() {
- org.onap.vid.aai.model.AaiGetServicesRequestModel.Service s1 =
- createService("ID1", "V1", "D1");
- org.onap.vid.aai.model.AaiGetServicesRequestModel.Service s2 =
- createService("ID2", "V2", "D2");
+ GetServicesAAIRespone services = new GetServicesAAIRespone();
+ services.service = Arrays.asList(s1, s2);
- GetServicesAAIRespone services = new GetServicesAAIRespone();
- services.service = Arrays.asList(s1, s2);
+ AaiResponse<GetServicesAAIRespone> aaiResponseServices =
+ new AaiResponse<>(services, null, HttpStatus.SC_OK);
- AaiResponse<GetServicesAAIRespone> aaiResponseServices =
- new AaiResponse<>(services, null, HttpStatus.SC_OK);
+ when(aaiClient.getServices()).thenReturn(aaiResponseServices);
- when(aaiClient.getServices()).thenReturn(aaiResponseServices);
+ Object actualObjectOfResponse = aaiService.getServices(roleValidator).getT();
- Object actualObjectOfResponse = aaiService.getServices(roleValidator).getT();
+ assertThat(actualObjectOfResponse).isNotNull();
+ assertThat(((GetServicesAAIRespone) actualObjectOfResponse).service).allMatch(s -> s.isPermitted);
+ }
- assertThat(actualObjectOfResponse).isNotNull();
- assertThat(((GetServicesAAIRespone) actualObjectOfResponse).service).allMatch(s -> s.isPermitted);
- }
+ @Test
+ public void shouldGetTenants() {
+ GetTenantsResponse tenant1 = new GetTenantsResponse("REGION_ID1", "CLOUD_OWNER1",
+ "TENANT_NAME1", "TENANT_ID1", true);
+ GetTenantsResponse tenant2 = new GetTenantsResponse("REGION_ID2", "CLOUD_OWNER2",
+ "TENANT_NAME2", "TENANT_ID2", false);
+ GetTenantsResponse[] tenants = {tenant1, tenant2};
+ AaiResponse<GetTenantsResponse[]> aaiGetTenantsResponse = new AaiResponse<>(tenants,
+ null, HttpStatus.SC_OK);
- @Test
- public void shouldGetTenants() {
- GetTenantsResponse tenant1 = new GetTenantsResponse("REGION_ID1", "CLOUD_OWNER1",
- "TENANT_NAME1", "TENANT_ID1", true);
- GetTenantsResponse tenant2 = new GetTenantsResponse("REGION_ID2", "CLOUD_OWNER2",
- "TENANT_NAME2", "TENANT_ID2", false);
- GetTenantsResponse[] tenants = {tenant1, tenant2};
- AaiResponse<GetTenantsResponse[]> aaiGetTenantsResponse = new AaiResponse<>(tenants,
- null, HttpStatus.SC_OK);
+ when(aaiClient.getTenants(anyString(), anyString())).thenReturn(aaiGetTenantsResponse);
+ when(roleValidator.isTenantPermitted(anyString(), anyString(), anyString()))
+ .thenReturn(Boolean.TRUE);
- when(aaiClient.getTenants(anyString(), anyString())).thenReturn(aaiGetTenantsResponse);
- when(roleValidator.isTenantPermitted(anyString(), anyString(), anyString()))
- .thenReturn(Boolean.TRUE);
+ GetTenantsResponse[] actualResponses = aaiService
+ .getTenants(anyString(), anyString(), roleValidator).getT();
- GetTenantsResponse[] actualResponses = aaiService
- .getTenants(anyString(), anyString(), roleValidator).getT();
+ assertThat(actualResponses).isNotNull();
+ assertThat(actualResponses.length).isEqualTo(2);
+ assertThat(actualResponses).allMatch(tenant -> tenant.isPermitted);
+ }
- assertThat(actualResponses).isNotNull();
- assertThat(actualResponses.length).isEqualTo(2);
- assertThat(actualResponses).allMatch(tenant -> tenant.isPermitted);
- }
+ @Test
+ public void shouldGetVNFDataWithoutFiltering() {
+ when(aaiClient.getVNFData(anyString(), anyString(), anyString())).thenReturn(aaiResponse);
- @Test
- public void shouldGetVNFDataWithoutFiltering() {
- when(aaiClient.getVNFData(anyString(), anyString(), anyString())).thenReturn(aaiResponse);
+ AaiResponse actualResponse = aaiService.getVNFData(anyString(), anyString(), anyString());
- AaiResponse actualResponse = aaiService.getVNFData(anyString(), anyString(), anyString());
+ assertThat(actualResponse).isEqualTo(aaiResponse);
+ }
- assertThat(actualResponse).isEqualTo(aaiResponse);
- }
+ @Test
+ public void shouldGetVNFDataWithFiltering() {
+ VnfResult vnfResult1 = createVnfResult("ID1", "generic-vnf");
+ VnfResult vnfResult2 = createVnfResult("ID2", "service-instance");
+ VnfResult vnfResult3 = createVnfResult("ID3", "anything-else");
- @Test
- public void shouldGetVNFDataWithFiltering() {
- VnfResult vnfResult1 = createVnfResult("ID1", "generic-vnf");
- VnfResult vnfResult2 = createVnfResult("ID2", "service-instance");
- VnfResult vnfResult3 = createVnfResult("ID3", "anything-else");
+ List<VnfResult> vnfResults = Arrays.asList(vnfResult1, vnfResult2, vnfResult3);
+ AaiResponse<AaiGetVnfResponse> aaiResponseGetVnfResponse = createAaiResponseVnfResponse(vnfResults);
- List<VnfResult> vnfResults = Arrays.asList(vnfResult1, vnfResult2, vnfResult3);
- AaiResponse<AaiGetVnfResponse> aaiResponseGetVnfResponse = createAaiResponseVnfResponse(vnfResults);
+ vnfResults = Arrays.asList(vnfResult1, vnfResult2);
+ AaiResponse<AaiGetVnfResponse> expectedResponseWithReturnedVnfs = createAaiResponseVnfResponse(vnfResults);
+ AaiResponse expectedResponseWithoutReturnedVnfs = new AaiResponse();
- vnfResults = Arrays.asList(vnfResult1, vnfResult2);
- AaiResponse<AaiGetVnfResponse> expectedResponseWithReturnedVnfs = createAaiResponseVnfResponse(vnfResults);
- AaiResponse expectedResponseWithoutReturnedVnfs = new AaiResponse();
+ when(aaiClient.getVNFData(GLOBAL_SUBSCRIBER_ID, SERVICE_TYPE)).thenReturn(aaiResponseGetVnfResponse);
+ when(aaiClient.getVNFData(GLOBAL_SUBSCRIBER_ID_NULL_RESPONSE, SERVICE_TYPE)).thenReturn(null);
- when(aaiClient.getVNFData(GLOBAL_SUBSCRIBER_ID, SERVICE_TYPE)).thenReturn(aaiResponseGetVnfResponse);
- when(aaiClient.getVNFData(GLOBAL_SUBSCRIBER_ID_NULL_RESPONSE, SERVICE_TYPE)).thenReturn(null);
+ AaiResponse<AaiGetVnfResponse> actualResponseWithReturnedVnfs =
+ aaiService.getVNFData(GLOBAL_SUBSCRIBER_ID, SERVICE_TYPE);
+ AaiResponse<AaiGetVnfResponse> actualResponseWithoutReturnedVnfs =
+ aaiService.getVNFData(GLOBAL_SUBSCRIBER_ID_NULL_RESPONSE, SERVICE_TYPE);
- AaiResponse<AaiGetVnfResponse> actualResponseWithReturnedVnfs =
- aaiService.getVNFData(GLOBAL_SUBSCRIBER_ID, SERVICE_TYPE);
- AaiResponse<AaiGetVnfResponse> actualResponseWithoutReturnedVnfs =
- aaiService.getVNFData(GLOBAL_SUBSCRIBER_ID_NULL_RESPONSE, SERVICE_TYPE);
+ assertThat(actualResponseWithReturnedVnfs)
+ .isEqualToComparingFieldByFieldRecursively(expectedResponseWithReturnedVnfs);
+ assertThat(actualResponseWithoutReturnedVnfs)
+ .isEqualToComparingFieldByField(expectedResponseWithoutReturnedVnfs);
+ }
- assertThat(actualResponseWithReturnedVnfs)
- .isEqualToComparingFieldByFieldRecursively(expectedResponseWithReturnedVnfs);
- assertThat(actualResponseWithoutReturnedVnfs)
- .isEqualToComparingFieldByField(expectedResponseWithoutReturnedVnfs);
- }
+ @Test
+ public void shouldGetAaiZones() {
+ when(aaiClient.getAllAicZones()).thenReturn(aaiResponse);
- @Test
- public void shouldGetAaiZones() {
- when(aaiClient.getAllAicZones()).thenReturn(aaiResponse);
+ AaiResponse actualResponse = aaiService.getAaiZones();
- AaiResponse actualResponse = aaiService.getAaiZones();
+ assertThat(actualResponse).isEqualTo(aaiResponse);
+ }
- assertThat(actualResponse).isEqualTo(aaiResponse);
- }
+ @Test
+ public void shouldGetAicZoneForPnf() {
+ ServiceRelationships relationsService = createServiceRelationships();
+ AaiResponse<ServiceRelationships> expectedServiceInstanceResp =
+ new AaiResponse<>(relationsService, null, HttpStatus.SC_OK);
+ AaiResponse<String> expectedResponse = new AaiResponse<>(CORRECT_VALUE, null, HttpStatus.SC_OK);
- @Test
- public void shouldGetAicZoneForPnf() {
- ServiceRelationships relationsService = createServiceRelationships();
- AaiResponse<ServiceRelationships> expectedServiceInstanceResp =
- new AaiResponse<>(relationsService, null, HttpStatus.SC_OK);
- AaiResponse<String> expectedResponse = new AaiResponse<>(CORRECT_VALUE, null, HttpStatus.SC_OK);
+ when(aaiClient.getServiceInstance(anyString(), anyString(), anyString()))
+ .thenReturn(expectedServiceInstanceResp);
- when(aaiClient.getServiceInstance(anyString(), anyString(), anyString()))
- .thenReturn(expectedServiceInstanceResp);
+ AaiResponse actualResponse = aaiService.getAicZoneForPnf(anyString(), anyString(), anyString());
- AaiResponse actualResponse = aaiService.getAicZoneForPnf(anyString(), anyString(), anyString());
+ assertThat(actualResponse).isEqualToComparingFieldByField(expectedResponse);
+ }
- assertThat(actualResponse).isEqualToComparingFieldByField(expectedResponse);
- }
+ @Test
+ public void shouldGetNodeTemplateInstances() {
+ when(aaiClient.getNodeTemplateInstances(anyString(), anyString(), anyString(),
+ anyString(), anyString())).thenReturn(aaiResponse);
- @Test
- public void shouldGetNodeTemplateInstances() {
- when(aaiClient.getNodeTemplateInstances(anyString(), anyString(), anyString(),
- anyString(), anyString())).thenReturn(aaiResponse);
+ AaiResponse expectedResponse = aaiService.getNodeTemplateInstances(anyString(), anyString(), anyString(),
+ anyString(), anyString());
- AaiResponse expectedResponse = aaiService.getNodeTemplateInstances(anyString(), anyString(), anyString(),
- anyString(), anyString());
+ assertThat(expectedResponse).isEqualTo(aaiResponse);
+ }
- assertThat(expectedResponse).isEqualTo(aaiResponse);
- }
+ @Test
+ public void shouldGetNetworkCollectionDetails() {
+ when(aaiClient.getNetworkCollectionDetails(anyString())).thenReturn(aaiResponse);
- @Test
- public void shouldGetNetworkCollectionDetails() {
- when(aaiClient.getNetworkCollectionDetails(anyString())).thenReturn(aaiResponse);
+ AaiResponse expectedResponse = aaiService.getNetworkCollectionDetails(anyString());
- AaiResponse expectedResponse = aaiService.getNetworkCollectionDetails(anyString());
+ assertThat(expectedResponse).isEqualTo(aaiResponse);
+ }
- assertThat(expectedResponse).isEqualTo(aaiResponse);
- }
+ @Test
+ public void shouldGetInstanceGroupsByCloudRegion() {
+ AaiGetInstanceGroupsByCloudRegion aaiGetInstanceGroupsByCloudRegion =
+ mock(AaiGetInstanceGroupsByCloudRegion.class);
+ AaiResponse<AaiGetInstanceGroupsByCloudRegion> expectedResponse =
+ new AaiResponse<>(aaiGetInstanceGroupsByCloudRegion, null, HttpStatus.SC_OK);
- @Test
- public void shouldGetInstanceGroupsByCloudRegion() {
- AaiGetInstanceGroupsByCloudRegion aaiGetInstanceGroupsByCloudRegion =
- mock(AaiGetInstanceGroupsByCloudRegion.class);
- AaiResponse<AaiGetInstanceGroupsByCloudRegion> expectedResponse =
- new AaiResponse<>(aaiGetInstanceGroupsByCloudRegion, null, HttpStatus.SC_OK);
+ when(aaiClient.getInstanceGroupsByCloudRegion(anyString(), anyString(), anyString()))
+ .thenReturn(expectedResponse);
+ AaiResponse<AaiGetInstanceGroupsByCloudRegion> actualResponse =
+ aaiService.getInstanceGroupsByCloudRegion(anyString(), anyString(), anyString());
- when(aaiClient.getInstanceGroupsByCloudRegion(anyString(), anyString(), anyString()))
- .thenReturn(expectedResponse);
- AaiResponse<AaiGetInstanceGroupsByCloudRegion> actualResponse =
- aaiService.getInstanceGroupsByCloudRegion(anyString(), anyString(), anyString());
+ assertThat(actualResponse).isEqualTo(expectedResponse);
+ }
- assertThat(actualResponse).isEqualTo(expectedResponse);
- }
+ @Test
+ public void shouldGetServicesByDistributionStatus() {
+ Result resultWithModelType = createResult("MODEL_TYPE1", "1");
+ Result resultWithEmptyModelType = createResult(null, "2");
+ Result resultWithoutModel = new Result();
+ resultWithoutModel.setModel(null);
+ Result resultWithoutValidModel = createResultWithoutValidModel();
+ List<Result> results = Arrays.asList(resultWithModelType, resultWithEmptyModelType, resultWithoutModel,
+ resultWithoutValidModel);
- @Test
- public void shouldGetServicesByDistributionStatus() {
- Result resultWithModelType = createResult("MODEL_TYPE1", "1");
- Result resultWithEmptyModelType = createResult(null, "2");
- Result resultWithoutModel = new Result();
- resultWithoutModel.setModel(null);
- Result resultWithoutValidModel = createResultWithoutValidModel();
- List<Result> results = Arrays.asList(resultWithModelType, resultWithEmptyModelType, resultWithoutModel,
- resultWithoutValidModel);
+ GetServiceModelsByDistributionStatusResponse serviceModels = new GetServiceModelsByDistributionStatusResponse();
+ serviceModels.setResults(results);
- GetServiceModelsByDistributionStatusResponse serviceModels = new GetServiceModelsByDistributionStatusResponse();
- serviceModels.setResults(results);
+ AaiResponse<GetServiceModelsByDistributionStatusResponse> serviceModelsByDistributionStatusResponse
+ = new AaiResponse<>(serviceModels, null, HttpStatus.SC_OK);
- AaiResponse<GetServiceModelsByDistributionStatusResponse> serviceModelsByDistributionStatusResponse
- = new AaiResponse<>(serviceModels, null, HttpStatus.SC_OK);
+ Service[] expectedServices = {
+ createService("MODEL_TYPE1", "1"),
+ createService("", "2")
+ };
- Service[] expectedServices = {
- createService("MODEL_TYPE1", "1"),
- createService("", "2")
- };
+ when(aaiClient.getServiceModelsByDistributionStatus()).thenReturn(serviceModelsByDistributionStatusResponse);
+ Collection<Service> actualServices = aaiService.getServicesByDistributionStatus();
- when(aaiClient.getServiceModelsByDistributionStatus()).thenReturn(serviceModelsByDistributionStatusResponse);
- Collection<Service> actualServices = aaiService.getServicesByDistributionStatus();
+ assertThat(actualServices)
+ .hasSize(2)
+ .usingFieldByFieldElementComparator()
+ .containsExactly(expectedServices);
+ }
- assertThat(actualServices)
- .hasSize(2)
- .usingFieldByFieldElementComparator()
- .containsExactly(expectedServices);
- }
+ @Test
+ public void shouldReturnEmptyListOfServices() {
+ AaiResponse<GetServiceModelsByDistributionStatusResponse> emptyResponse
+ = new AaiResponse<>(null, null, HttpStatus.SC_OK);
- @Test
- public void shouldReturnEmptyListOfServices() {
- AaiResponse<GetServiceModelsByDistributionStatusResponse> emptyResponse
- = new AaiResponse<>(null, null, HttpStatus.SC_OK);
+ when(aaiClient.getServiceModelsByDistributionStatus()).thenReturn(emptyResponse);
+ Collection<Service> actualServices = aaiService.getServicesByDistributionStatus();
- when(aaiClient.getServiceModelsByDistributionStatus()).thenReturn(emptyResponse);
- Collection<Service> actualServices = aaiService.getServicesByDistributionStatus();
+ assertThat(actualServices).isEqualTo(Collections.EMPTY_LIST);
+ }
- assertThat(actualServices).isEqualTo(Collections.EMPTY_LIST);
- }
+ @Test
+ public void shouldGetServiceInstanceAssociatedPnfs() {
+ ServiceRelationships relationsList = createServiceRelationships();
+ LogicalLinkResponse logicalLinkResponse = new LogicalLinkResponse();
+ logicalLinkResponse.setRelationshipList(relationsList.getRelationshipList());
- @Test
- public void shouldGetServiceInstanceAssociatedPnfs() {
- ServiceRelationships relationsList = createServiceRelationships();
- LogicalLinkResponse logicalLinkResponse = new LogicalLinkResponse();
- logicalLinkResponse.setRelationshipList(relationsList.getRelationshipList());
+ AaiResponse<LogicalLinkResponse> aaiResponseLogicalLinkResponse =
+ new AaiResponse<>(logicalLinkResponse, null, HttpStatus.SC_OK);
+ AaiResponse<ServiceRelationships> aaiResponseServiceRelations =
+ new AaiResponse<>(relationsList, null, HttpStatus.SC_OK);
- AaiResponse<LogicalLinkResponse> aaiResponseLogicalLinkResponse =
- new AaiResponse<>(logicalLinkResponse, null, HttpStatus.SC_OK);
- AaiResponse<ServiceRelationships> aaiResponseServiceRelations =
- new AaiResponse<>(relationsList, null, HttpStatus.SC_OK);
+ when(aaiClient.getServiceInstance(anyString(), anyString(), anyString()))
+ .thenReturn(aaiResponseServiceRelations);
+ when(aaiClient.getLogicalLink(anyString())).thenReturn(aaiResponseLogicalLinkResponse);
- when(aaiClient.getServiceInstance(anyString(), anyString(), anyString()))
- .thenReturn(aaiResponseServiceRelations);
- when(aaiClient.getLogicalLink(anyString())).thenReturn(aaiResponseLogicalLinkResponse);
+ List<String> expectedPnfs = Collections.singletonList(CORRECT_VALUE);
+ List<String> actualPnfs = aaiService.getServiceInstanceAssociatedPnfs(anyString(), anyString(), anyString());
+ assertThat(actualPnfs).isEqualTo(expectedPnfs);
+ }
- List<String> expectedPnfs = Collections.singletonList(CORRECT_VALUE);
- List<String> actualPnfs = aaiService.getServiceInstanceAssociatedPnfs(anyString(), anyString(), anyString());
+ @Test
+ public void shouldGetPortMirroringConfigData() {
+ AaiResponseTranslator.PortMirroringConfigData expectedData
+ = mock(AaiResponseTranslator.PortMirroringConfigData.class);
- assertThat(actualPnfs).isEqualTo(expectedPnfs);
- }
+ when(aaiClient.getCloudRegionAndSourceByPortMirroringConfigurationId(anyString()))
+ .thenReturn(aaiResponseJsonNode);
+ when(aaiResponseTranslator.extractPortMirroringConfigData(aaiResponseJsonNode)).thenReturn(expectedData);
- @Test
- public void shouldGetPortMirroringConfigData() {
- AaiResponseTranslator.PortMirroringConfigData expectedData
- = mock(AaiResponseTranslator.PortMirroringConfigData.class);
+ AaiResponseTranslator.PortMirroringConfigData actualData = aaiService.getPortMirroringConfigData(anyString());
+ assertThat(actualData).isEqualTo(expectedData);
+ }
- when(aaiClient.getCloudRegionAndSourceByPortMirroringConfigurationId(anyString())).thenReturn(aaiResponseJsonNode);
- when(aaiResponseTranslator.extractPortMirroringConfigData(aaiResponseJsonNode)).thenReturn(expectedData);
- AaiResponseTranslator.PortMirroringConfigData actualData = aaiService.getPortMirroringConfigData(anyString());
- assertThat(actualData).isEqualTo(expectedData);
- }
+ @Test
+ public void shouldGetInstanceGroupsByVnfInstanceId() {
+ List<InstanceGroupInfo> instanceGroupInfo = Collections.singletonList(new InstanceGroupInfo(CORRECT_VALUE));
+ AaiGetRelatedInstanceGroupsByVnfId relatedInstanceGroups = new AaiGetRelatedInstanceGroupsByVnfId();
+ relatedInstanceGroups.setRelationshipList(createRelationshipList());
+ AaiResponse<AaiGetRelatedInstanceGroupsByVnfId> correctCodeResponse =
+ new AaiResponse<>(relatedInstanceGroups, null, HttpStatus.SC_OK);
- @Test
- public void shouldGetInstanceGroupsByVnfInstanceId() {
- List<InstanceGroupInfo> instanceGroupInfo = Collections.singletonList(new InstanceGroupInfo(CORRECT_VALUE));
- AaiGetRelatedInstanceGroupsByVnfId relatedInstanceGroups = new AaiGetRelatedInstanceGroupsByVnfId();
- relatedInstanceGroups.setRelationshipList(createRelationshipList());
-
- AaiResponse<AaiGetRelatedInstanceGroupsByVnfId> correctCodeResponse =
- new AaiResponse<>(relatedInstanceGroups, null, HttpStatus.SC_OK);
-
- AaiResponse<List<InstanceGroupInfo>> expectedCorrectCodeResponse =
- new AaiResponse<>(instanceGroupInfo, null, HttpStatus.SC_OK);
- AaiResponse<AaiGetRelatedInstanceGroupsByVnfId> expectedIncorrectCodeResponse =
- new AaiResponse<>(relatedInstanceGroups, null, HttpStatus.SC_PAYMENT_REQUIRED);
- List<InstanceGroupInfo> expectedCorrectResponseObject = expectedCorrectCodeResponse.getT();
+ AaiResponse<List<InstanceGroupInfo>> expectedCorrectCodeResponse =
+ new AaiResponse<>(instanceGroupInfo, null, HttpStatus.SC_OK);
+ AaiResponse<AaiGetRelatedInstanceGroupsByVnfId> expectedIncorrectCodeResponse =
+ new AaiResponse<>(relatedInstanceGroups, null, HttpStatus.SC_PAYMENT_REQUIRED);
+ List<InstanceGroupInfo> expectedCorrectResponseObject = expectedCorrectCodeResponse.getT();
- when(aaiClient.getInstanceGroupsByVnfInstanceId(VNF_INSTANCE_ID_OK)).thenReturn(correctCodeResponse);
- when(aaiClient.getInstanceGroupsByVnfInstanceId(VNF_INSTANCE_ID_FAIL)).thenReturn(expectedIncorrectCodeResponse);
+ when(aaiClient.getInstanceGroupsByVnfInstanceId(VNF_INSTANCE_ID_OK)).thenReturn(correctCodeResponse);
+ when(aaiClient.getInstanceGroupsByVnfInstanceId(VNF_INSTANCE_ID_FAIL))
+ .thenReturn(expectedIncorrectCodeResponse);
- AaiResponse actualCorrectCodeResponse = aaiService.getInstanceGroupsByVnfInstanceId(VNF_INSTANCE_ID_OK);
- AaiResponse actualIncorrectCodeResponse = aaiService.getInstanceGroupsByVnfInstanceId(VNF_INSTANCE_ID_FAIL);
+ AaiResponse actualCorrectCodeResponse = aaiService.getInstanceGroupsByVnfInstanceId(VNF_INSTANCE_ID_OK);
+ AaiResponse actualIncorrectCodeResponse = aaiService.getInstanceGroupsByVnfInstanceId(VNF_INSTANCE_ID_FAIL);
- List<InstanceGroupInfo> actualCorrectResponseObject =
- (List<InstanceGroupInfo>) actualCorrectCodeResponse.getT();
+ List<InstanceGroupInfo> actualCorrectResponseObject =
+ (List<InstanceGroupInfo>) actualCorrectCodeResponse.getT();
- assertThat(actualCorrectResponseObject)
- .usingFieldByFieldElementComparator()
- .hasSameElementsAs(expectedCorrectResponseObject);
+ assertThat(actualCorrectResponseObject)
+ .usingFieldByFieldElementComparator()
+ .hasSameElementsAs(expectedCorrectResponseObject);
- assertThat(actualIncorrectCodeResponse).isEqualTo(expectedIncorrectCodeResponse);
- }
+ assertThat(actualIncorrectCodeResponse).isEqualTo(expectedIncorrectCodeResponse);
+ }
- @Test
- public void shouldGetHomingDataByVfModule() {
- GetTenantsResponse expectedResponse = new GetTenantsResponse();
- when(aaiClient.getHomingDataByVfModule(anyString(), anyString())).thenReturn(expectedResponse);
+ @Test
+ public void shouldGetHomingDataByVfModule() {
+ GetTenantsResponse expectedResponse = new GetTenantsResponse();
+ when(aaiClient.getHomingDataByVfModule(anyString(), anyString())).thenReturn(expectedResponse);
- GetTenantsResponse actualResponse = aaiService.getHomingDataByVfModule(anyString(), anyString());
- assertThat(actualResponse).isEqualTo(expectedResponse);
- }
+ GetTenantsResponse actualResponse = aaiService.getHomingDataByVfModule(anyString(), anyString());
+ assertThat(actualResponse).isEqualTo(expectedResponse);
+ }
- @Test
- public void shouldSearchGroupMembers() {
- Properties properties = createProperties();
- Map<String, Properties> regionsAndTenants = createRegionsAndTenantsMap(properties);
+ @Test
+ public void shouldSearchGroupMembers() {
+ Properties properties = createProperties();
+ Map<String, Properties> regionsAndTenants = createRegionsAndTenantsMap(properties);
- AAITreeNode validTreeNode = new AAITreeNode();
- addAdditionalPropertiesToAaiTreeNode(validTreeNode);
- List<AAITreeNode> validNodes = Arrays.asList(validTreeNode, validTreeNode);
+ AAITreeNode validTreeNode = new AAITreeNode();
+ addAdditionalPropertiesToAaiTreeNode(validTreeNode);
+ List<AAITreeNode> validNodes = Arrays.asList(validTreeNode, validTreeNode);
- AAITreeNode validBranch = createTree(validNodes);
- addAdditionalPropertiesToAaiTreeNode(validBranch);
- List<AAITreeNode> testedBranches = Collections.singletonList(validBranch);
+ AAITreeNode validBranch = createTree(validNodes);
+ addAdditionalPropertiesToAaiTreeNode(validBranch);
+ List<AAITreeNode> testedBranches = Collections.singletonList(validBranch);
- AAITreeNode testedTree = createTree(testedBranches);
+ AAITreeNode testedTree = createTree(testedBranches);
- RelatedVnf expectedVnf = createExpectedVnf(validBranch);
- List<RelatedVnf> expectedResult = Collections.singletonList(expectedVnf);
+ RelatedVnf expectedVnf = createExpectedVnf(validBranch);
+ List<RelatedVnf> expectedResult = Collections.singletonList(expectedVnf);
- when(aaiServiceTree.buildAAITree(anyString(), any())).thenReturn(Collections.singletonList(testedTree));
- when(aaiClient.getCloudRegionAndTenantByVnfId(anyString())).thenReturn(regionsAndTenants);
+ when(aaiServiceTree.buildAAITree(anyString(), isNull(), eq(HttpMethod.GET), any(), anyBoolean()))
+ .thenReturn(Collections.singletonList(testedTree));
+ when(aaiClient.getCloudRegionAndTenantByVnfId(anyString())).thenReturn(regionsAndTenants);
- List<RelatedVnf> actualGroupMembers = aaiService.searchGroupMembers(GLOBAL_CUSTOMER_ID, SERVICE_TYPE,
- INVARIANT_ID, GROUP_TYPE_FAILING, GROUP_ROLE_FAILING);
+ List<RelatedVnf> actualGroupMembers = aaiService.searchGroupMembers(GLOBAL_CUSTOMER_ID, SERVICE_TYPE,
+ INVARIANT_ID, GROUP_TYPE_FAILING, GROUP_ROLE_FAILING);
- assertThat(actualGroupMembers)
- .usingFieldByFieldElementComparator()
- .hasSameElementsAs(expectedResult);
- }
+ assertThat(actualGroupMembers)
+ .usingFieldByFieldElementComparator()
+ .hasSameElementsAs(expectedResult);
+ }
- @Test
- public void shouldGetPortMirroringSourcePorts() {
- PortDetailsTranslator.PortDetails details = mock(PortDetailsTranslator.PortDetails.class);
- List<PortDetailsTranslator.PortDetails> expectedDetailsList = Arrays.asList(
- details, details, details
- );
+ @Test
+ public void shouldGetPortMirroringSourcePorts() {
+ PortDetailsTranslator.PortDetails details = mock(PortDetailsTranslator.PortDetails.class);
+ List<PortDetailsTranslator.PortDetails> expectedDetailsList = Arrays.asList(
+ details, details, details
+ );
- when(aaiClient.getPortMirroringSourcePorts(anyString())).thenReturn(expectedDetailsList);
- List<PortDetailsTranslator.PortDetails> actualDetails = aaiService.getPortMirroringSourcePorts(anyString());
+ when(aaiClient.getPortMirroringSourcePorts(anyString())).thenReturn(expectedDetailsList);
+ List<PortDetailsTranslator.PortDetails> actualDetails = aaiService.getPortMirroringSourcePorts(anyString());
- assertThat(actualDetails).isEqualTo(expectedDetailsList);
- }
+ assertThat(actualDetails).isEqualTo(expectedDetailsList);
+ }
- @Test
- public void shouldGetAAIServiceTree() throws JsonProcessingException {
- ServiceInstance serviceInstance = mock(ServiceInstance.class);
- String expectedResult = new ObjectMapper().writeValueAsString(serviceInstance);
+ @Test
+ public void shouldGetAAIServiceTree() throws JsonProcessingException {
+ ServiceInstance serviceInstance = mock(ServiceInstance.class);
+ String expectedResult = new ObjectMapper().writeValueAsString(serviceInstance);
- when(aaiServiceTree.getServiceInstanceTopology(anyString(), anyString(), anyString()))
- .thenReturn(serviceInstance);
- String actualResult = aaiService.getAAIServiceTree(anyString(), anyString(), anyString());
+ when(aaiServiceTree.getServiceInstanceTopology(anyString(), anyString(), anyString()))
+ .thenReturn(serviceInstance);
+ String actualResult = aaiService.getAAIServiceTree(anyString(), anyString(), anyString());
- assertThat(actualResult).isEqualTo(expectedResult);
- }
+ assertThat(actualResult).isEqualTo(expectedResult);
+ }
- @NotNull
- private Map<String, Properties> createRegionsAndTenantsMap(Properties properties) {
- Map<String, Properties> regionsAndTenants = new HashMap<>();
- regionsAndTenants.put("tenant", properties);
- regionsAndTenants.put("cloud-region", properties);
- return regionsAndTenants;
- }
+ @NotNull
+ private Map<String, Properties> createRegionsAndTenantsMap(Properties properties) {
+ Map<String, Properties> regionsAndTenants = new HashMap<>();
+ regionsAndTenants.put("tenant", properties);
+ regionsAndTenants.put("cloud-region", properties);
+ return regionsAndTenants;
+ }
- private Properties createProperties() {
- Properties properties = new Properties();
- properties.setTenantId(TENANT_ID);
- properties.setTenantName(TENANT_NAME);
- properties.setCloudRegionId(CLOUD_REGION_ID);
- return properties;
- }
+ private Properties createProperties() {
+ Properties properties = new Properties();
+ properties.setTenantId(TENANT_ID);
+ properties.setTenantName(TENANT_NAME);
+ properties.setCloudRegionId(CLOUD_REGION_ID);
+ return properties;
+ }
- @NotNull
- private RelatedVnf createExpectedVnf(AAITreeNode validBranch) {
- RelatedVnf expectedVnf = RelatedVnf.from(validBranch);
- expectedVnf.setTenantId(TENANT_ID);
- expectedVnf.setTenantName(TENANT_NAME);
- expectedVnf.setLcpCloudRegionId(CLOUD_REGION_ID);
- expectedVnf.setServiceInstanceId(PARENT_ID);
- expectedVnf.setServiceInstanceName(PARENT_NAME);
- expectedVnf.setInstanceType(VNF_TYPE);
+ @NotNull
+ private RelatedVnf createExpectedVnf(AAITreeNode validBranch) {
+ RelatedVnf expectedVnf = RelatedVnf.from(validBranch);
+ expectedVnf.setTenantId(TENANT_ID);
+ expectedVnf.setTenantName(TENANT_NAME);
+ expectedVnf.setLcpCloudRegionId(CLOUD_REGION_ID);
+ expectedVnf.setServiceInstanceId(PARENT_ID);
+ expectedVnf.setServiceInstanceName(PARENT_NAME);
+ expectedVnf.setInstanceType(VNF_TYPE);
- return expectedVnf;
- }
+ return expectedVnf;
+ }
- private AAITreeNode createTree(List<AAITreeNode> children) {
- AAITreeNode tree = new AAITreeNode();
- tree.addChildren(children);
- tree.setId(PARENT_ID);
- tree.setName(PARENT_NAME);
- return tree;
- }
+ private AAITreeNode createTree(List<AAITreeNode> children) {
+ AAITreeNode tree = new AAITreeNode();
+ tree.addChildren(children);
+ tree.setId(PARENT_ID);
+ tree.setName(PARENT_NAME);
+ tree.setType(SERVICE_INSTANCE);
+ return tree;
+ }
- private void addAdditionalPropertiesToAaiTreeNode(AAITreeNode tree) {
- Map<String, Object> additionalProperties = new HashMap<>();
- additionalProperties.put("instance-group-role", GROUP_ROLE_OK);
- additionalProperties.put("instance-group-type", group_type_ok);
- additionalProperties.put("vnf-type", VNF_TYPE);
- additionalProperties.put("cloud-region", CLOUD_TYPE);
- tree.setAdditionalProperties(additionalProperties);
- }
+ private void addAdditionalPropertiesToAaiTreeNode(AAITreeNode tree) {
+ Map<String, Object> additionalProperties = new HashMap<>();
+ additionalProperties.put("instance-group-role", GROUP_ROLE_OK);
+ additionalProperties.put("instance-group-type", group_type_ok);
+ additionalProperties.put("vnf-type", VNF_TYPE);
+ additionalProperties.put("cloud-region", CLOUD_TYPE);
+ tree.setAdditionalProperties(additionalProperties);
+ }
- private org.onap.vid.asdc.beans.Service createService(String category, String suffix) {
- return new Service.ServiceBuilder()
- .setUuid("MODELVER_VERSION_ID" + suffix)
- .setInvariantUUID("MODEL_INVARIANT_NAME" + suffix)
- .setCategory(category)
- .setVersion("MODELVER_VERSION" + suffix)
- .setName("MODELVER_NAME" + suffix)
- .setDistributionStatus("MODELVER_DIST_STATUS" + suffix)
- .setToscaModelURL(null)
- .setLifecycleState(null)
- .setArtifacts(null)
- .setResources(null)
- .build();
- }
+ private org.onap.vid.asdc.beans.Service createService(String category, String suffix) {
+ return new Service.ServiceBuilder()
+ .setUuid("MODELVER_VERSION_ID" + suffix)
+ .setInvariantUUID("MODEL_INVARIANT_NAME" + suffix)
+ .setCategory(category)
+ .setVersion("MODELVER_VERSION" + suffix)
+ .setName("MODELVER_NAME" + suffix)
+ .setDistributionStatus("MODELVER_DIST_STATUS" + suffix)
+ .setToscaModelURL(null)
+ .setLifecycleState(null)
+ .setArtifacts(null)
+ .setResources(null)
+ .build();
+ }
- @NotNull
- private Result createResultWithoutValidModel() {
- ModelVers modelVers = new ModelVers();
- modelVers.setModelVer(Collections.singletonList(new ModelVer()));
+ @NotNull
+ private Result createResultWithoutValidModel() {
+ ModelVers modelVers = new ModelVers();
+ modelVers.setModelVer(Collections.singletonList(new ModelVer()));
- Model model = new Model();
- model.setModelVers(modelVers);
+ Model model = new Model();
+ model.setModelVers(modelVers);
- Result result1 = new Result();
- result1.setModel(model);
- return result1;
- }
+ Result result1 = new Result();
+ result1.setModel(model);
+ return result1;
+ }
- @NotNull
- private Result createResult(String modelType, String suffix) {
- ModelVer modelVer = new ModelVer();
- modelVer.setModelVersionId("MODELVER_VERSION_ID" + suffix);
- modelVer.setModelVersion("MODELVER_VERSION" + suffix);
- modelVer.setModelName("MODELVER_NAME" + suffix);
- modelVer.setDistributionStatus("MODELVER_DIST_STATUS" + suffix);
+ @NotNull
+ private Result createResult(String modelType, String suffix) {
+ ModelVer modelVer = new ModelVer();
+ modelVer.setModelVersionId("MODELVER_VERSION_ID" + suffix);
+ modelVer.setModelVersion("MODELVER_VERSION" + suffix);
+ modelVer.setModelName("MODELVER_NAME" + suffix);
+ modelVer.setDistributionStatus("MODELVER_DIST_STATUS" + suffix);
- ModelVers modelVers = new ModelVers();
- modelVers.setModelVer(Collections.singletonList(modelVer));
+ ModelVers modelVers = new ModelVers();
+ modelVers.setModelVer(Collections.singletonList(modelVer));
- Model model = new Model();
- model.setModelType(modelType);
- model.setModelInvariantId("MODEL_INVARIANT_NAME" + suffix);
- model.setModelVers(modelVers);
+ Model model = new Model();
+ model.setModelType(modelType);
+ model.setModelInvariantId("MODEL_INVARIANT_NAME" + suffix);
+ model.setModelVers(modelVers);
- Result result = new Result();
- result.setModel(model);
- return result;
- }
+ Result result = new Result();
+ result.setModel(model);
+ return result;
+ }
- @NotNull
- private ServiceRelationships createServiceRelationships() {
- RelationshipList relationsList = createRelationshipList(CORRECT_VALUE);
- ServiceRelationships relationsService = new ServiceRelationships();
- relationsService.setRelationshipList(relationsList);
- return relationsService;
- }
+ @NotNull
+ private ServiceRelationships createServiceRelationships() {
+ RelationshipList relationsList = createRelationshipList(CORRECT_VALUE);
+ ServiceRelationships relationsService = new ServiceRelationships();
+ relationsService.setRelationshipList(relationsList);
+ return relationsService;
+ }
- @NotNull
- private RelationshipList createRelationshipList(String expectedValue) {
- List<RelationshipData> relationsDataList = createRelationshipDataList(expectedValue);
- return createRelationshipList(relationsDataList);
- }
+ @NotNull
+ private RelationshipList createRelationshipList(String expectedValue) {
+ List<RelationshipData> relationsDataList = createRelationshipDataList(expectedValue);
+ return createRelationshipList(relationsDataList);
+ }
- @NotNull
- private RelationshipList createRelationshipList(List<RelationshipData> relationsDataList) {
- Relationship relation1 = crateRelationship("any", relationsDataList);
- Relationship relation2 = crateRelationship("zone", relationsDataList);
- Relationship relation3 = crateRelationship("logical-link", relationsDataList);
- Relationship relation4 = crateRelationship("lag-interface", relationsDataList);
- Relationship relation5 = crateRelationship("pnf", relationsDataList);
+ @NotNull
+ private RelationshipList createRelationshipList(List<RelationshipData> relationsDataList) {
+ Relationship relation1 = crateRelationship("any", relationsDataList);
+ Relationship relation2 = crateRelationship("zone", relationsDataList);
+ Relationship relation3 = crateRelationship("logical-link", relationsDataList);
+ Relationship relation4 = crateRelationship("lag-interface", relationsDataList);
+ Relationship relation5 = crateRelationship("pnf", relationsDataList);
- RelationshipList relationsList = new RelationshipList();
- relationsList.setRelationship(Arrays.asList(relation1, relation2, relation3, relation4, relation5));
- return relationsList;
- }
+ RelationshipList relationsList = new RelationshipList();
+ relationsList.setRelationship(Arrays.asList(relation1, relation2, relation3, relation4, relation5));
+ return relationsList;
+ }
- @NotNull
- private List<RelationshipData> createRelationshipDataList(String expectedValue) {
- RelationshipData relationData1 = createRelationshipData("any-key", "incorrect_key");
- RelationshipData relationData2 = createRelationshipData("zone.zone-id", expectedValue);
- RelationshipData relationData3 = createRelationshipData("logical-link.link-name", expectedValue);
- RelationshipData relationData4 = createRelationshipData("pnf.pnf-name", expectedValue);
+ @NotNull
+ private List<RelationshipData> createRelationshipDataList(String expectedValue) {
+ RelationshipData relationData1 = createRelationshipData("any-key", "incorrect_key");
+ RelationshipData relationData2 = createRelationshipData("zone.zone-id", expectedValue);
+ RelationshipData relationData3 = createRelationshipData("logical-link.link-name", expectedValue);
+ RelationshipData relationData4 = createRelationshipData("pnf.pnf-name", expectedValue);
- return Arrays.asList(relationData1, relationData2, relationData3, relationData4);
- }
+ return Arrays.asList(relationData1, relationData2, relationData3, relationData4);
+ }
- @NotNull
- private Relationship crateRelationship(String relatedTo, List<RelationshipData> relationsDataList) {
- Relationship relation = new Relationship();
- relation.setRelatedTo(relatedTo);
- relation.setRelationDataList(relationsDataList);
- return relation;
- }
+ @NotNull
+ private Relationship crateRelationship(String relatedTo, List<RelationshipData> relationsDataList) {
+ Relationship relation = new Relationship();
+ relation.setRelatedTo(relatedTo);
+ relation.setRelationDataList(relationsDataList);
+ return relation;
+ }
- @NotNull
- private RelationshipData createRelationshipData(String key, String value) {
- RelationshipData relationData = new RelationshipData();
- relationData.setRelationshipKey(key);
- relationData.setRelationshipValue(value);
- return relationData;
- }
+ @NotNull
+ private RelationshipData createRelationshipData(String key, String value) {
+ RelationshipData relationData = new RelationshipData();
+ relationData.setRelationshipKey(key);
+ relationData.setRelationshipValue(value);
+ return relationData;
+ }
- private org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.RelationshipList createRelationshipList() {
- RelatedToProperty property1 =
- createRelatedToProperty("instance-group.instance-group-name", CORRECT_VALUE);
- RelatedToProperty property2 =
- createRelatedToProperty("anything-key", "anything-value");
- List<RelatedToProperty> properties = Arrays.asList(property1, property2);
+ private org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.RelationshipList createRelationshipList() {
+ RelatedToProperty property1 =
+ createRelatedToProperty("instance-group.instance-group-name", CORRECT_VALUE);
+ RelatedToProperty property2 =
+ createRelatedToProperty("anything-key", "anything-value");
+ List<RelatedToProperty> properties = Arrays.asList(property1, property2);
- org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship relationship1 =
- createRelationship("instance-group", properties);
- org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship relationship2 =
- createRelationship("any-key", properties);
+ org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship relationship1 =
+ createRelationship("instance-group", properties);
+ org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship relationship2 =
+ createRelationship("any-key", properties);
- List<org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship> relationships =
- Arrays.asList(relationship1, relationship2);
+ List<org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship> relationships =
+ Arrays.asList(relationship1, relationship2);
- org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.RelationshipList relationshipList =
- new org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.RelationshipList();
- relationshipList.setRelationship(relationships);
+ org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.RelationshipList relationshipList =
+ new org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.RelationshipList();
+ relationshipList.setRelationship(relationships);
- return relationshipList;
- }
+ return relationshipList;
+ }
- @NotNull
- private org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship createRelationship(String relatedTo,
- List<RelatedToProperty> relatedToPropertyList) {
- org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship relationship1 =
- new org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship();
- relationship1.setRelatedTo(relatedTo);
- relationship1.setRelatedToPropertyList(relatedToPropertyList);
- return relationship1;
- }
+ @NotNull
+ private org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship createRelationship(String relatedTo,
+ List<RelatedToProperty> relatedToPropertyList) {
+ org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship relationship1 =
+ new org.onap.vid.aai.model.AaiGetNetworkCollectionDetails.Relationship();
+ relationship1.setRelatedTo(relatedTo);
+ relationship1.setRelatedToPropertyList(relatedToPropertyList);
+ return relationship1;
+ }
- @NotNull
- private RelatedToProperty createRelatedToProperty(String key, String value) {
- RelatedToProperty prop = new RelatedToProperty();
- prop.setPropertyKey(key);
- prop.setPropertyValue(value);
- return prop;
- }
+ @NotNull
+ private RelatedToProperty createRelatedToProperty(String key, String value) {
+ RelatedToProperty prop = new RelatedToProperty();
+ prop.setKey(key);
+ prop.setValue(value);
+ return prop;
+ }
- @NotNull
- private AaiResponse<AaiGetVnfResponse> createAaiResponseVnfResponse(List<VnfResult> vnfResults) {
- AaiGetVnfResponse vnfResponse = new AaiGetVnfResponse();
- vnfResponse.setResults(vnfResults);
- return new AaiResponse<>(vnfResponse, null, HttpStatus.SC_OK);
- }
+ @NotNull
+ private AaiResponse<AaiGetVnfResponse> createAaiResponseVnfResponse(List<VnfResult> vnfResults) {
+ AaiGetVnfResponse vnfResponse = new AaiGetVnfResponse();
+ vnfResponse.setResults(vnfResults);
+ return new AaiResponse<>(vnfResponse, null, HttpStatus.SC_OK);
+ }
- private VnfResult createVnfResult(String id, String nodeType) {
- VnfResult result = new VnfResult();
- result.setJsonId(id);
- result.setJsonNodeType(nodeType);
- return result;
- }
+ private VnfResult createVnfResult(String id, String nodeType) {
+ VnfResult result = new VnfResult();
+ result.setJsonId(id);
+ result.setJsonNodeType(nodeType);
+ return result;
+ }
- private org.onap.vid.aai.model.AaiGetServicesRequestModel.Service createService(String serviceId,
- String resourceVersion,
- String serviceDescription) {
- org.onap.vid.aai.model.AaiGetServicesRequestModel.Service service
- = new org.onap.vid.aai.model.AaiGetServicesRequestModel.Service();
- service.isPermitted = false;
- service.resourceVersion = resourceVersion;
- service.serviceDescription = serviceDescription;
- service.serviceId = serviceId;
- return service;
- }
+ private org.onap.vid.aai.model.AaiGetServicesRequestModel.Service createService(String serviceId,
+ String resourceVersion,
+ String serviceDescription) {
+ org.onap.vid.aai.model.AaiGetServicesRequestModel.Service service
+ = new org.onap.vid.aai.model.AaiGetServicesRequestModel.Service();
+ service.isPermitted = false;
+ service.resourceVersion = resourceVersion;
+ service.serviceDescription = serviceDescription;
+ service.serviceId = serviceId;
+ return service;
+ }
- @NotNull
- private Services createAaiResponseServices() {
- ServiceSubscription sub1 = new ServiceSubscription();
- sub1.isPermitted = false;
- sub1.serviceType = "serviceSubsType1";
+ @NotNull
+ private Services createAaiResponseServices() {
+ ServiceSubscription sub1 = new ServiceSubscription();
+ sub1.isPermitted = false;
+ sub1.serviceType = "serviceSubsType1";
- ServiceSubscription sub2 = new ServiceSubscription();
- sub2.isPermitted = true;
- sub2.serviceType = "serviceSubsType2";
+ ServiceSubscription sub2 = new ServiceSubscription();
+ sub2.isPermitted = true;
+ sub2.serviceType = "serviceSubsType2";
- ServiceSubscriptions serviceSubs = new ServiceSubscriptions();
- serviceSubs.serviceSubscription = Collections.singletonList(sub2);
+ ServiceSubscriptions serviceSubs = new ServiceSubscriptions();
+ serviceSubs.serviceSubscription = Collections.singletonList(sub2);
- Services services = new Services();
- services.globalCustomerId = GLOBAL_CUSTOMER_ID;
- services.resourceVersion = "v-1";
- services.subscriberName = "name-1";
- services.subscriberType = "type-1";
- services.serviceSubscriptions = serviceSubs;
- return services;
- }
+ Services services = new Services();
+ services.globalCustomerId = GLOBAL_CUSTOMER_ID;
+ services.resourceVersion = "v-1";
+ services.subscriberName = "name-1";
+ services.subscriberType = "type-1";
+ services.serviceSubscriptions = serviceSubs;
+ return services;
+ }
- @NotNull
- private Subscriber createSubscriber() {
- Subscriber subscriber = new Subscriber();
- subscriber.globalCustomerId = "id-1";
- subscriber.resourceVersion = "v-1";
- subscriber.subscriberName = "name-1";
- subscriber.subscriberType = "type-1";
- return subscriber;
- }
+ @NotNull
+ private Subscriber createSubscriber() {
+ Subscriber subscriber = new Subscriber();
+ subscriber.globalCustomerId = "id-1";
+ subscriber.resourceVersion = "v-1";
+ subscriber.subscriberName = "name-1";
+ subscriber.subscriberType = "type-1";
+ return subscriber;
+ }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
index 401a56c..4cab998 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBaseTest.java
@@ -25,11 +25,16 @@
import org.onap.vid.aai.AaiClientInterface;
import org.onap.vid.aai.ExceptionWithRequestInfo;
import org.onap.vid.model.Action;
+import org.onap.vid.model.VidNotions;
+import org.onap.vid.model.VidNotions.InstantiationType;
+import org.onap.vid.model.VidNotions.InstantiationUI;
+import org.onap.vid.model.VidNotions.ModelCategory;
import org.onap.vid.model.serviceInstantiation.*;
import org.onap.vid.mso.RestObject;
import org.onap.vid.mso.model.ModelInfo;
import org.onap.vid.mso.rest.AsyncRequestStatus;
import org.onap.vid.mso.rest.RequestStatus;
+import org.onap.vid.properties.Features;
import org.onap.vid.utils.TimeUtils;
import org.springframework.http.HttpMethod;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
@@ -38,14 +43,18 @@
import javax.inject.Inject;
import java.time.ZonedDateTime;
import java.util.*;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+import static java.util.Collections.emptyList;
import static java.util.Collections.emptyMap;
-import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.*;
import static org.mockito.Mockito.when;
public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests {
public static final String OWNING_ENTITY_ID = "038d99af-0427-42c2-9d15-971b99b9b489";
+ public static final String JULIO_ERICKSON = "JULIO ERICKSON";
public static final String PACKET_CORE = "PACKET CORE";
public static final String PROJECT_NAME = "{some project name}";
public static final String SUBSCRIBER_ID = "{some subscriber id}";
@@ -98,7 +107,7 @@
return new ServiceInstantiation ( modelInfo,
AsyncInstantiationBusinessLogicTest.OWNING_ENTITY_ID,
- AsyncInstantiationBusinessLogicTest.PACKET_CORE,
+ AsyncInstantiationBusinessLogicTest.JULIO_ERICKSON,
projectName,
AsyncInstantiationBusinessLogicTest.SUBSCRIBER_ID,
AsyncInstantiationBusinessLogicTest.SUBSCRIBER_NAME,
@@ -114,6 +123,7 @@
vnfs,
networks,
vnfGroups,
+ null,
instanceParams,
isPause,
bulkSize,
@@ -121,8 +131,8 @@
isAlacarte,
testApi,
instanceId,
- action.name()
- );
+ action.name(),
+ UUID.randomUUID().toString(), null, null, null);
}
private List<Map<String,String>> createInstanceParams() {
@@ -146,10 +156,12 @@
if (isAlacarte) {
vfModuleInfo.setModelInvariantId("22222222-f63c-463e-ba94-286933b895f9");
vfModuleInfo.setModelVersion("10.0");
- return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), "mdt1", null, "88a6ca3ee0394ade9403f075db23167e", instanceParams, supplementaryParams, false, true, null);
+ return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), "mdt1", null,
+ "88a6ca3ee0394ade9403f075db23167e", instanceParams, supplementaryParams, false, true, null, UUID.randomUUID().toString(), null, null);
}
- return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), null, null, null, instanceParams, supplementaryParams, false, false, null);
+ return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), null, null, null,
+ instanceParams, supplementaryParams, false, false, null, UUID.randomUUID().toString(), null, null);
}
protected ModelInfo createVnfModelInfo(boolean isAlacarte) {
@@ -167,19 +179,20 @@
return vnfModelInfo;
}
- private ModelInfo createNetworkModelInfo(boolean isAlacarte) {
- ModelInfo vnfModelInfo = new ModelInfo();
- vnfModelInfo.setModelType("network");
- vnfModelInfo.setModelName("2016-73_MOW-AVPN-vPE-BV-L");
- vnfModelInfo.setModelVersionId("7f40c192-f63c-463e-ba94-286933b895f8");
- vnfModelInfo.setModelCustomizationName("2016-73_MOW-AVPN-vPE-BV-L 0");
- vnfModelInfo.setModelCustomizationId("ab153b6e-c364-44c0-bef6-1f2982117f04");
+ private ModelInfo createNetworkModelInfo(boolean isAlacarte, String modelCustomizationId)
+ {
+ ModelInfo modelInfo = new ModelInfo();
+ modelInfo.setModelType("network");
+ modelInfo.setModelName("2016-73_MOW-AVPN-vPE-BV-L");
+ modelInfo.setModelVersionId("7f40c192-f63c-463e-ba94-286933b895f8");
+ modelInfo.setModelCustomizationName("2016-73_MOW-AVPN-vPE-BV-L 0");
+ modelInfo.setModelCustomizationId(modelCustomizationId);
//added two conditional fields according to MSO AID - needed only in alacarte
if (isAlacarte) {
- vnfModelInfo.setModelInvariantId("11111111-f63c-463e-ba94-286933b895f9");
- vnfModelInfo.setModelVersion("10.0");
+ modelInfo.setModelInvariantId("11111111-f63c-463e-ba94-286933b895f9");
+ modelInfo.setModelVersion("10.0");
}
- return vnfModelInfo;
+ return modelInfo;
}
private ModelInfo createModelInfo() {
@@ -214,21 +227,33 @@
vfModules.get(vfModuleModelName).put(vfModuleModelName + ":002", vfModule2);
Vnf vnf = new Vnf(vnfModelInfo, "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", (isUserProvidedNaming ? VNF_NAME : null), Action.Create.name(),
- "platformName", "mdt1", null, "88a6ca3ee0394ade9403f075db23167e", vnfInstanceParams,"lineOfBusinessName" , false, null, vfModules);
+ "platformName", "mdt1", null, "88a6ca3ee0394ade9403f075db23167e", vnfInstanceParams,"lineOfBusinessName" , false, null, vfModules,
+ UUID.randomUUID().toString(), null, null);
vnfs.put(vnf.getModelInfo().getModelName(), vnf);
return vnfs;
}
- protected Map<String, Network> createNetworkList(List vnfInstanceParams, boolean isUserProvidedNaming, boolean isALaCarte) {
- Map<String, Network> networks = new HashMap<>();
- ModelInfo networkModelInfo = createNetworkModelInfo(isALaCarte);
+ public static class NetworkDetails {
- Network network = new Network(networkModelInfo, "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", isUserProvidedNaming ? VNF_NAME : null, Action.Create.name(),
- "platformName", "mdt1", null, "88a6ca3ee0394ade9403f075db23167e", vnfInstanceParams,"lineOfBusinessName" , false, null);
+ public NetworkDetails(String name, String modelCustomizationId) {
+ this.name = name;
+ this.modelCustomizationId = modelCustomizationId;
+ }
- networks.put(network.getModelInfo().getModelName(), network);
- return networks;
+ public String name;
+ public String modelCustomizationId;
+ }
+
+
+ protected Map<String, Network> createNetworkList(List instanceParams, List<NetworkDetails> networkDetails, boolean isALaCarte) {
+ Stream<Network> networkStream = networkDetails.stream().map(
+ details->new Network(createNetworkModelInfo(isALaCarte, details.modelCustomizationId), "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ details.name, Action.Create.name(),
+ "platformName", "mdt1", null, "88a6ca3ee0394ade9403f075db23167e", instanceParams,"lineOfBusinessName" ,
+ false, null, UUID.randomUUID().toString(), null, null));
+// I can't tell why compiler don't like the statement if it's only one line...
+ return networkStream.collect(Collectors.toMap(network -> network.getModelInfo().getModelCustomizationId(), network -> network));
}
protected InstanceGroup createInstanceGroup(boolean isUserProvidedNaming, Action action) {
@@ -241,7 +266,7 @@
modelInfo.setModelInvariantId("11111111-f63c-463e-ba94-286933b895f9");
modelInfo.setModelVersion("10.0");
- return new InstanceGroup(modelInfo, (isUserProvidedNaming ? VNF_GROUP_NAME : null), action.name(), false, null);
+ return new InstanceGroup(modelInfo, (isUserProvidedNaming ? VNF_GROUP_NAME : null), action.name(), false, null, emptyMap(), UUID.randomUUID().toString(), null, null);
}
protected ModelInfo createServiceModelInfo() {
@@ -277,11 +302,11 @@
return asyncRequestStatus;
}
- protected RestObject<AsyncRequestStatus> asyncRequestStatusResponseAsRestObject(String msoStatus) {
+ public static RestObject<AsyncRequestStatus> asyncRequestStatusResponseAsRestObject(String msoStatus) {
return asyncRequestStatusResponseAsRestObject(msoStatus, 200);
}
- protected RestObject<AsyncRequestStatus> asyncRequestStatusResponseAsRestObject(String msoStatus, int httpStatusCode) {
+ public static RestObject<AsyncRequestStatus> asyncRequestStatusResponseAsRestObject(String msoStatus, int httpStatusCode) {
RestObject<AsyncRequestStatus> restObject = new RestObject<>();
restObject.set(asyncRequestStatusResponse(msoStatus));
restObject.setStatusCode(httpStatusCode);
@@ -302,6 +327,12 @@
return serviceInstantiation;
}
+ protected ServiceInstantiation generateALaCarteWithNetworksPayload(List<NetworkDetails> networkDetails) {
+ Map<String, Network> networks = createNetworkList(emptyList(), networkDetails, true);
+ ServiceInstantiation serviceInstantiation = generateMockALaCarteServiceInstantiationPayload(false, emptyMap(), networks, emptyMap(), 1, true, PROJECT_NAME, false, "VNF_API");
+ return serviceInstantiation;
+ }
+
protected ServiceInstantiation generateALaCarteUpdateWith1ExistingGroup2NewGroupsPayload() {
final InstanceGroup instanceGroup1 = createInstanceGroup(true, Action.None);
final InstanceGroup instanceGroup2 = createInstanceGroup(false, Action.Create);
@@ -315,4 +346,38 @@
1, true, PROJECT_NAME, false, true, "VNF_API",
Action.None, "1234567890");
}
+
+ protected void enableAddCloudOwnerOnMsoRequest() {
+ enableAddCloudOwnerOnMsoRequest(true);
+ }
+
+ protected void enableAddCloudOwnerOnMsoRequest(boolean isActive) {
+ // always turn on the feature flag
+ when(featureManager.isActive(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST)).thenReturn(isActive);
+ when(aaiClient.getCloudOwnerByCloudRegionId(anyString())).thenReturn("irma-aic");
+ }
+
+ protected ServiceInstantiation generateALaCarteServiceInstantiationPayload() {
+ return generateMockALaCarteServiceInstantiationPayload(false, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, 1, true, PROJECT_NAME, false, "VNF_API");
+ }
+
+ protected ServiceInstantiation generateMacroMockServiceInstantiationPayload(boolean isPause, Map<String, Vnf> vnfs) {
+ return generateMockMacroServiceInstantiationPayload(isPause, vnfs, 1, true, PROJECT_NAME, false);
+ }
+
+ protected ServiceInstantiation generatePre1806MacroTransportServiceInstantiationPayload(String tenantId, String lcpCloudRegionId) {
+ List<Map<String, String>> instanceParams = ImmutableList.of(ImmutableMap.of("someUserParam","someValue", "anotherUserParam","anotherValue"));
+ ServiceInstantiation serviceInstantiation = new ServiceInstantiation(createServiceModelInfo(), "038d99af-0427-42c2-9d15-971b99b9b489",
+ "JULIO ERICKSON", "some_project_name", "some_subscriber_id", "some_subscriber_name",
+ "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", null, "MOG", lcpCloudRegionId, null, tenantId,
+ null, null, null, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, instanceParams, false, 1, false, false,
+ null, null, null, null, null, null,
+ new VidNotions(InstantiationUI.TRANSPORT_SERVICE, ModelCategory.Transport, InstantiationUI.TRANSPORT_SERVICE, InstantiationType.Macro)
+ );
+ return serviceInstantiation;
+ }
+
+ protected void mockAaiClientAaiStatusOK() {
+ when(aaiClient.isNodeTypeExistsByName(eq(AsyncInstantiationBusinessLogicImpl.NAME_FOR_CHECK_AAI_STATUS), any())).thenReturn(false);
+ }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java
index 21b8f3f..e2d182c 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AsyncInstantiationBusinessLogicTest.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.
@@ -20,69 +20,13 @@
package org.onap.vid.services;
-import static com.google.common.collect.Maps.newHashMap;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.contains;
-import static org.hamcrest.Matchers.hasItem;
-import static org.hamcrest.Matchers.hasItems;
-import static org.hamcrest.Matchers.hasProperty;
-import static org.hamcrest.Matchers.is;
-import static org.hamcrest.Matchers.matchesPattern;
-import static org.hamcrest.Matchers.not;
-import static org.hamcrest.core.Every.everyItem;
-import static org.hamcrest.core.IsEqual.equalTo;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.anyInt;
-import static org.mockito.Mockito.anyString;
-import static org.mockito.Mockito.doNothing;
-import static org.mockito.Mockito.doThrow;
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.onap.vid.job.Job.JobStatus.COMPLETED;
-import static org.onap.vid.job.Job.JobStatus.FAILED;
-import static org.onap.vid.job.Job.JobStatus.IN_PROGRESS;
-import static org.onap.vid.job.Job.JobStatus.PAUSE;
-import static org.onap.vid.job.Job.JobStatus.PENDING;
-import static org.onap.vid.job.Job.JobStatus.STOPPED;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import java.io.IOException;
-import java.lang.reflect.Method;
-import java.net.URL;
-import java.time.Instant;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.Callable;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.stream.Collectors;
-import java.util.stream.IntStream;
-import javax.inject.Inject;
-import net.javacrumbs.jsonunit.JsonAssert;
import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang3.time.DateUtils;
import org.hibernate.SessionFactory;
+import org.jetbrains.annotations.NotNull;
import org.json.JSONException;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
@@ -97,48 +41,64 @@
import org.onap.vid.changeManagement.RequestDetailsWrapper;
import org.onap.vid.config.DataSourceConfig;
import org.onap.vid.config.MockedAaiClientAndFeatureManagerConfig;
-import org.onap.vid.exceptions.GenericUncheckedException;
+import org.onap.vid.dal.AsyncInstantiationRepository;
import org.onap.vid.exceptions.MaxRetriesException;
+import org.onap.vid.exceptions.NotFoundException;
import org.onap.vid.exceptions.OperationNotAllowedException;
import org.onap.vid.job.Job;
import org.onap.vid.job.Job.JobStatus;
import org.onap.vid.job.JobAdapter;
import org.onap.vid.job.JobType;
import org.onap.vid.job.JobsBrokerService;
+import org.onap.vid.job.command.MsoRequestBuilder;
+import org.onap.vid.job.command.ResourceCommandTest.FakeResourceCreator;
import org.onap.vid.job.impl.JobDaoImpl;
import org.onap.vid.job.impl.JobSharedData;
-import org.onap.vid.model.Action;
-import org.onap.vid.model.JobAuditStatus;
-import org.onap.vid.model.JobAuditStatus.SourceStatus;
-import org.onap.vid.model.NameCounter;
-import org.onap.vid.model.ServiceInfo;
-import org.onap.vid.model.serviceInstantiation.InstanceGroup;
-import org.onap.vid.model.serviceInstantiation.Network;
+import org.onap.vid.model.*;
+import org.onap.vid.model.serviceInstantiation.BaseResource;
import org.onap.vid.model.serviceInstantiation.ServiceInstantiation;
-import org.onap.vid.model.serviceInstantiation.VfModule;
import org.onap.vid.model.serviceInstantiation.Vnf;
import org.onap.vid.mso.MsoOperationalEnvironmentTest;
-import org.onap.vid.mso.model.InstanceGroupInstantiationRequestDetails;
+import org.onap.vid.mso.RestObject;
import org.onap.vid.mso.model.ModelInfo;
-import org.onap.vid.mso.model.NetworkInstantiationRequestDetails;
-import org.onap.vid.mso.model.ServiceDeletionRequestDetails;
import org.onap.vid.mso.model.ServiceInstantiationRequestDetails;
-import org.onap.vid.mso.model.VfModuleInstantiationRequestDetails;
-import org.onap.vid.mso.model.VfModuleMacro;
-import org.onap.vid.mso.model.VnfInstantiationRequestDetails;
-import org.onap.vid.mso.model.VolumeGroupRequestDetails;
import org.onap.vid.mso.rest.AsyncRequestStatus;
+import org.onap.vid.mso.rest.RequestStatus;
import org.onap.vid.properties.Features;
import org.onap.vid.testUtils.TestUtils;
import org.onap.vid.utils.DaoUtils;
+import org.onap.vid.utils.TimeUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
+import org.testng.annotations.*;
+
+import javax.inject.Inject;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.net.URL;
+import java.time.*;
+import java.util.Optional;
+import java.util.*;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+
+import static net.javacrumbs.jsonunit.JsonAssert.assertJsonEquals;
+import static net.javacrumbs.jsonunit.JsonAssert.whenIgnoringPaths;
+import static net.javacrumbs.jsonunit.JsonMatchers.jsonEquals;
+import static net.javacrumbs.jsonunit.core.Option.IGNORING_ARRAY_ORDER;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.*;
+import static org.hamcrest.core.Every.everyItem;
+import static org.hamcrest.core.IsEqual.equalTo;
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.*;
+import static org.onap.vid.job.Job.JobStatus.*;
+import static org.onap.vid.testUtils.TestUtils.generateRandomAlphaNumeric;
+import static org.testng.Assert.*;
@ContextConfiguration(classes = {DataSourceConfig.class, SystemProperties.class, MockedAaiClientAndFeatureManagerConfig.class})
public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseTest {
@@ -152,24 +112,42 @@
@Mock
private JobsBrokerService jobsBrokerServiceMock;
+ private AsyncInstantiationRepository asyncInstantiationRepository;
+
+ private AuditService auditService;
@Autowired
private SessionFactory sessionFactory;
private AsyncInstantiationBusinessLogicImpl asyncInstantiationBL;
+ protected MsoRequestBuilder msoRequestBuilder;
+
private int serviceCount = 0;
private static final String UPDATE_SERVICE_INFO_EXCEPTION_MESSAGE =
- "Failed to retrieve job with uuid .* from ServiceInfo table. Instances found: .*";
+ "Failed to retrieve class .*ServiceInfo with jobId .* from table. no resource found";
private static final String DELETE_SERVICE_INFO_STATUS_EXCEPTION_MESSAGE =
"Service status does not allow deletion from the queue";
+ private String uuidRegex = "[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}";
+ private org.hamcrest.Matcher uuidRegexMatcher = is(matchesPattern(uuidRegex));
+
+
@BeforeClass
void initServicesInfoService() {
MockitoAnnotations.initMocks(this);
- asyncInstantiationBL = new AsyncInstantiationBusinessLogicImpl(dataAccessService, jobAdapterMock, jobsBrokerServiceMock, sessionFactory, aaiClient, featureManager, cloudOwnerService);
+ AsyncInstantiationRepository realAsyncInstantiationRepository = new AsyncInstantiationRepository(dataAccessService);
+ asyncInstantiationRepository = spy(realAsyncInstantiationRepository);
+
+ auditService = new AuditServiceImpl(null, asyncInstantiationRepository);
+
+ AsyncInstantiationBusinessLogicImpl realAsyncInstantiationBL = new AsyncInstantiationBusinessLogicImpl(jobAdapterMock, jobsBrokerServiceMock, sessionFactory, aaiClient, featureManager, cloudOwnerService, asyncInstantiationRepository, auditService);
+ asyncInstantiationBL = Mockito.spy(realAsyncInstantiationBL);
+
+ msoRequestBuilder = new MsoRequestBuilder(asyncInstantiationBL, cloudOwnerService, aaiClient, featureManager);
+
createInstanceParamsMaps();
}
@@ -182,16 +160,6 @@
enableAddCloudOwnerOnMsoRequest();
}
- private void enableAddCloudOwnerOnMsoRequest() {
- enableAddCloudOwnerOnMsoRequest(true);
- }
-
- private void enableAddCloudOwnerOnMsoRequest(boolean isActive) {
- // always turn on the feature flag
- when(featureManager.isActive(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST)).thenReturn(isActive);
- when(aaiClient.getCloudOwnerByCloudRegionId(anyString())).thenReturn("att-aic");
- }
-
@BeforeMethod
void resetServiceCount() {
serviceCount = 0;
@@ -215,13 +183,13 @@
uuid = UUID.randomUUID();
addNewJob(uuid);
createdDate = NOW.minusYears(1);
- addNewServiceInfo(uuid, userId, "Old", createdDate, createdDate, COMPLETED, false);
+ addNewServiceInfo(uuid, userId, "Old", createdDate, createdDate, COMPLETED, false, false);
uuid = UUID.randomUUID();
addNewJob(uuid);
createdDate = NOW.minusDays(20);
modifiedDate = NOW.minusDays(19);
- addNewServiceInfo(uuid, userId, "Hidden", createdDate, modifiedDate, PAUSE, true);
+ addNewServiceInfo(uuid, userId, "Hidden", createdDate, modifiedDate, PAUSE, true, false);
createNewTestServicesInfo(String.valueOf(userId));
}
@@ -236,20 +204,20 @@
addNewJob(uuid);
createdDate = NOW.minusDays(40);
- addNewServiceInfo(uuid, userId, "service instance 5", createdDate, createdDate, COMPLETED, false);
- addNewServiceInfo(uuid, userId, "service instance 6", createdDate, createdDate, STOPPED, false);
+ addNewServiceInfo(uuid, userId, "service instance 5", createdDate, createdDate, COMPLETED, false, false);
+ addNewServiceInfo(uuid, userId, "service instance 6", createdDate, createdDate, STOPPED, false, false);
uuid = UUID.randomUUID();
addNewJob(uuid);
createdDate = NOW.minusDays(20);
modifiedDate = NOW.minusDays(10);
- addNewServiceInfo(uuid, userId, "service instance 4", createdDate, modifiedDate, STOPPED, false);
- addNewServiceInfo(uuid, userId, "service instance 2", createdDate, modifiedDate, COMPLETED, false);
- addNewServiceInfo(uuid, userId, "service instance 3", createdDate, modifiedDate, PAUSE, false);
+ addNewServiceInfo(uuid, userId, "service instance 4", createdDate, modifiedDate, STOPPED, false, false);
+ addNewServiceInfo(uuid, userId, "service instance 2", createdDate, modifiedDate, COMPLETED, false, false);
+ addNewServiceInfo(uuid, userId, "service instance 3", createdDate, modifiedDate, PAUSE, false, false);
modifiedDate = NOW.minusDays(19);
- addNewServiceInfo(uuid, userId, "service instance 1", createdDate, modifiedDate, FAILED, false);
+ addNewServiceInfo(uuid, userId, "service instance 1", createdDate, modifiedDate, FAILED, false, false);
// Job to a different user
@@ -257,7 +225,7 @@
addNewJob(uuid);
createdDate = NOW.minusMonths(2);
- addNewServiceInfo(uuid, "2221", "service instance 7", createdDate, createdDate, COMPLETED, false);
+ addNewServiceInfo(uuid, "2221", "service instance 7", createdDate, createdDate, COMPLETED, false, false);
}
@@ -269,7 +237,7 @@
uuid = UUID.randomUUID();
addNewJob(uuid, status);
- addNewServiceInfo(uuid, null, "service instance 1", NOW, NOW, status, false);
+ addNewServiceInfo(uuid, null, "service instance 1", NOW, NOW, status, false, false);
return uuid;
@@ -292,7 +260,7 @@
.toLocalDateTime();
}
- private void addNewServiceInfo(UUID uuid, String userId, String serviceName, LocalDateTime createDate, LocalDateTime statusModifiedDate, Job.JobStatus status, boolean isHidden) {
+ private void addNewServiceInfo(UUID uuid, String userId, String serviceName, LocalDateTime createDate, LocalDateTime statusModifiedDate, JobStatus status, boolean isHidden, boolean retryEnabled) {
ServiceInfo serviceInfo = new ServiceInfo();
serviceInfo.setJobId(uuid);
serviceInfo.setUserId(userId);
@@ -302,6 +270,7 @@
serviceInfo.setPause(false);
serviceInfo.setOwningEntityId("1234");
serviceInfo.setCreatedBulkDate(toDate(createDate));
+ serviceInfo.setRetryEnabled(retryEnabled);
serviceInfo.setHidden(isHidden);
dataAccessService.saveDomainObject(serviceInfo, getPropsMap());
@@ -334,6 +303,39 @@
dataAccessService.saveDomainObject(jobDao, getPropsMap());
}
+ private ServiceInstantiation addOriginalService(UUID jobId, String userID){
+ addNewServiceInfo(jobId, userID, "name", LocalDateTime.now(), LocalDateTime.now(), COMPLETED_WITH_ERRORS, false, true);
+ assertThat(asyncInstantiationRepository.getServiceInfoByJobId(jobId).isRetryEnabled(), is(true));
+ ServiceInstantiation originalServiceInstantiation = prepareServiceInstantiation(true, 1);
+ doReturn(originalServiceInstantiation).when(asyncInstantiationRepository).getJobRequest(jobId);
+ return originalServiceInstantiation;
+ }
+
+ private void assertRetryDisabled(UUID jobId){
+ assertThat(asyncInstantiationRepository.getServiceInfoByJobId(jobId).isRetryEnabled(), is(false));
+ }
+
+ private void assertNewJobExistsAsExpectedAfterRetry(List<UUID> newJobIds, ServiceInstantiation expectedServiceInstantiation, UUID jobId, String userId){
+ assertThat(newJobIds, hasSize(1));
+ assertThat(newJobIds.get(0), not(equalTo(jobId)));
+
+ ArgumentCaptor<ServiceInstantiation> requestsCaptor = ArgumentCaptor.forClass(ServiceInstantiation.class);
+ ArgumentCaptor<UUID> uuidsCaptor = ArgumentCaptor.forClass(UUID.class);
+ ArgumentCaptor<JobType> jobTypeCaptor = ArgumentCaptor.forClass(JobType.class);
+
+ verify(asyncInstantiationRepository).addJobRequest(uuidsCaptor.capture(), requestsCaptor.capture());
+ verify(jobAdapterMock).createServiceInstantiationJob(jobTypeCaptor.capture(), requestsCaptor.capture(), uuidsCaptor.capture(), eq(userId), any(), anyString(), anyInt());
+ verify(jobsBrokerServiceMock).add(any());
+
+ requestsCaptor.getAllValues().forEach(x->assertJsonEquals(expectedServiceInstantiation, x, whenIgnoringPaths(
+ "trackById",
+ "vnfs.2016-73_MOW-AVPN-vPE-BV-L.trackById",
+ "vnfs.2016-73_MOW-AVPN-vPE-BV-L.vfModules.201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0.201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0:001.trackById",
+ "vnfs.2016-73_MOW-AVPN-vPE-BV-L.vfModules.201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0.201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0:002.trackById"
+ )));
+
+ }
+
@Test
public void testServiceInfoAreOrderedAsExpected() {
int userId = 2222;
@@ -344,6 +346,12 @@
}
@Test
+ public void whenNewServiceInfoCreated_isRetryEnablesIsFalse() {
+ UUID uuid = createServicesInfoWithDefaultValues(PENDING);
+ assertFalse(asyncInstantiationRepository.getServiceInfoByJobId(uuid).isRetryEnabled());
+ }
+
+ @Test
public void testServiceInfoAreFilteredAsExpected() {
int userId = 2222;
createNewTestServicesInfoForFilter(String.valueOf(userId));
@@ -364,9 +372,9 @@
defineMocks();
ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(isPause, createVnfList(vfModuleInstanceParamsMap, vnfInstanceParams, true), 2, true, PROJECT_NAME, false);
final URL resource = this.getClass().getResource("/payload_jsons/bulk_service_request_unique_names.json");
- when(jobAdapterMock.createServiceInstantiationJob(any(), any(), any(), any(), anyString(), any())).thenAnswer(invocation -> {
+ when(jobAdapterMock.createServiceInstantiationJob(any(), any(), any(), any(), any(), anyString(), any())).thenAnswer(invocation -> {
Object[] args = invocation.getArguments();
- return new MockedJob((String)args[4]);
+ return new MockedJob((String)args[5]);
});
when(jobsBrokerServiceMock.add(any(MockedJob.class))).thenAnswer((Answer<UUID>) invocation -> {
@@ -376,13 +384,13 @@
return job.getUuid();
});
- when(featureManager.isActive(Features.FLAG_SHIFT_VFMODULE_PARAMS_TO_VNF)).thenReturn(true);
+ when(asyncInstantiationBL.isPartOfBulk(any())).thenReturn(true);
List<UUID> uuids = asyncInstantiationBL.pushBulkJob(serviceInstantiationPayload, "az2016");
for (int i = 0; i < 2; i++) {
UUID currentUuid = uuids.get(i);
RequestDetailsWrapper<ServiceInstantiationRequestDetails> result =
- asyncInstantiationBL.generateMacroServiceInstantiationRequest(currentUuid, serviceInstantiationPayload,
+ msoRequestBuilder.generateMacroServiceInstantiationRequest(currentUuid, serviceInstantiationPayload,
MockedJob.getJob(currentUuid).getOptimisticUniqueServiceInstanceName(), "az2016");
String unique = i==0 ? "" : String.format("_00%s", i);
String expected = IOUtils.toString(resource, "UTF-8")
@@ -403,7 +411,9 @@
}
protected void verifySearchNodeTypeByName(String unique, String resourceName, ResourceType serviceInstance) {
- verify(aaiClient, times(1)).isNodeTypeExistsByName(resourceName + unique, serviceInstance);
+ String uniqueName = resourceName + unique;
+ verify(aaiClient, times(1)).isNodeTypeExistsByName(uniqueName, serviceInstance);
+ when(aaiClient.isNodeTypeExistsByName(uniqueName, serviceInstance)).thenReturn(true);
}
private HashMap<String, Object> getPropsMap() {
@@ -423,16 +433,7 @@
@Test(dataProvider="dataProviderForInstanceNames")
public void pushBulkJob_bulkWithSize3_instancesNamesAreExactlyAsExpected(boolean isUserProvidedNaming, List<String> expectedNames) {
- int bulkSize = 3;
-
- final ServiceInstantiation request = generateMockMacroServiceInstantiationPayload(
- false,
- createVnfList(instanceParamsMapWithoutParams, Collections.EMPTY_LIST, true),
- bulkSize, isUserProvidedNaming, PROJECT_NAME, true
- );
-
- // in "createServiceInstantiationJob()" we will probe the service, with the generated names
- configureMockitoWithMockedJob();
+ final ServiceInstantiation request = prepareServiceInstantiation(isUserProvidedNaming, 3);
asyncInstantiationBL.pushBulkJob(request, "myUserId");
@@ -441,7 +442,106 @@
assertEquals(serviceInfoList.stream().map(ServiceInfo::getServiceInstanceName).collect(Collectors.toList()), expectedNames);
}
- @Test(dataProvider = "aLaCarteAndMacroPayload")
+ protected ServiceInstantiation prepareServiceInstantiation(String projectName, boolean isUserProvidedNaming, int bulkSize) {
+ final ServiceInstantiation request = generateMockMacroServiceInstantiationPayload(
+ false,
+ createVnfList(instanceParamsMapWithoutParams, Collections.EMPTY_LIST, true),
+ bulkSize, isUserProvidedNaming, projectName, true
+ );
+
+ // in "createServiceInstantiationJob()" we will probe the service, with the generated names
+ configureMockitoWithMockedJob();
+ return request;
+ }
+
+ protected ServiceInstantiation prepareServiceInstantiation(boolean isUserProvidedNaming, int bulkSize) {
+ return prepareServiceInstantiation(PROJECT_NAME, isUserProvidedNaming, bulkSize);
+ }
+
+
+
+ @Test
+ public void whenPushBulkJob_thenJobRequestIsSaveInJobRequestDb() {
+ Mockito.reset(asyncInstantiationRepository);
+ int bulkSize = 3;
+ final ServiceInstantiation request = prepareServiceInstantiation(true, bulkSize);
+ when(jobsBrokerServiceMock.add(any())).thenReturn(UUID.randomUUID(), UUID.randomUUID(), UUID.randomUUID());
+ List<UUID> jobIds = asyncInstantiationBL.pushBulkJob(request, "abc");
+
+ ArgumentCaptor<JobAdapter.AsyncJobRequest> asyncJobRequestCaptor = ArgumentCaptor.forClass(JobAdapter.AsyncJobRequest.class);
+ ArgumentCaptor<ServiceInstantiation> requestsCaptor = ArgumentCaptor.forClass(ServiceInstantiation.class);
+ ArgumentCaptor<UUID> uuidsCaptor = ArgumentCaptor.forClass(UUID.class);
+ verify(asyncInstantiationRepository, times(bulkSize)).addJobRequest(uuidsCaptor.capture(), requestsCaptor.capture());
+ verify(jobsBrokerServiceMock, times(bulkSize)).add(any());
+ verify(jobAdapterMock, times(bulkSize)).createServiceInstantiationJob(any(), asyncJobRequestCaptor.capture(), any(), any(), any(), any(), any());
+
+ //verify that all for each job we saved an row in jobRequest table
+ assertThat(uuidsCaptor.getAllValues(), containsInAnyOrder(jobIds.toArray()));
+
+ //assert that each real job we created with the adaptor, request is save in jobRequest table
+ assertThat(requestsCaptor.getAllValues(), containsInAnyOrder(asyncJobRequestCaptor.getAllValues().toArray()));
+
+ assertThat(requestsCaptor.getAllValues(),everyItem(hasProperty("bulkSize", is(1))));
+
+ //assert that the requests that save in DB are the same as original request expect of the trackById
+ requestsCaptor.getAllValues().forEach(x->assertJsonEquals(request, x, whenIgnoringPaths(
+ "bulkSize",
+ "trackById",
+ "vnfs.2016-73_MOW-AVPN-vPE-BV-L.trackById",
+ "vnfs.2016-73_MOW-AVPN-vPE-BV-L.vfModules.201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0.201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0:001.trackById",
+ "vnfs.2016-73_MOW-AVPN-vPE-BV-L.vfModules.201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0.201673MowAvpnVpeBvL..AVPN_base_vPE_BV..module-0:002.trackById"
+ )));
+
+ //assert that each trackById on all bulk jobs is unique
+ Set<String> usedUUID = new HashSet<>();
+ requestsCaptor.getAllValues().forEach(x->assertTrackByIdRecursively(x, uuidRegexMatcher, usedUUID));
+ }
+
+ @Test
+ public void whenRetryJob_prevJobRetryIsDisabled() {
+ reset(asyncInstantiationRepository);
+ UUID jobId = UUID.randomUUID();
+ String userID = generateRandomAlphaNumeric(8);
+ addOriginalService(jobId, userID);
+ doReturn(mock(Map.class)).when(asyncInstantiationRepository).getResourceInfoByRootJobId(jobId);
+ asyncInstantiationBL.retryJob(jobId, userID);
+ assertRetryDisabled(jobId);
+ }
+
+ @Test
+ public void whenRetryJobWithEditedData_prevJobRetryIsDisabled() {
+ reset(asyncInstantiationRepository);
+ UUID jobId = UUID.randomUUID();
+ String userID = generateRandomAlphaNumeric(8);
+ addOriginalService(jobId, userID);
+ ServiceInstantiation editedServiceInstantiation = prepareServiceInstantiation("editedProjectName", true, 1);
+ asyncInstantiationBL.retryJob(editedServiceInstantiation, jobId, userID);
+ assertRetryDisabled(jobId);
+ }
+
+ @Test
+ public void retryJobWithEditedData_expectedNewJobDifferentData() {
+ reset(asyncInstantiationRepository);
+ UUID jobId = UUID.randomUUID();
+ String userID = generateRandomAlphaNumeric(8);
+ addOriginalService(jobId, userID);
+ ServiceInstantiation editedServiceInstantiation = prepareServiceInstantiation("editedProjectName", true, 1);
+ List<UUID> newJobIds = asyncInstantiationBL.retryJob(editedServiceInstantiation, jobId, userID);
+ assertNewJobExistsAsExpectedAfterRetry(newJobIds, editedServiceInstantiation, jobId, userID);
+ }
+
+ @Test
+ public void retryJob_expectedNewJob() {
+ reset(asyncInstantiationRepository);
+ UUID jobId = UUID.randomUUID();
+ String userID = "az2016";
+ ServiceInstantiation originalServiceInstantiation = addOriginalService(jobId, userID);
+ doReturn(mock(Map.class)).when(asyncInstantiationRepository).getResourceInfoByRootJobId(jobId);
+ List<UUID> newJobIds = asyncInstantiationBL.retryJob(jobId, userID);
+ assertNewJobExistsAsExpectedAfterRetry(newJobIds, originalServiceInstantiation, jobId, userID);
+ }
+
+ @Test (dataProvider = "aLaCarteAndMacroPayload")
public void generateMockServiceInstantiationPayload_serializeBackAndForth_sourceShouldBeTheSame(ServiceInstantiation serviceInstantiationPayload) throws IOException {
ObjectMapper mapper = new ObjectMapper();
final String asString = mapper.writeValueAsString(serviceInstantiationPayload);
@@ -449,7 +549,7 @@
final ServiceInstantiation asObject = mapper.readValue(asString, ServiceInstantiation.class);
final String asString2 = mapper.writeValueAsString(asObject);
- JsonAssert.assertJsonEquals(asString, asString2);
+ assertJsonEquals(asString, asString2);
}
@DataProvider
@@ -517,10 +617,6 @@
};
}
- private ServiceInstantiation generateMacroMockServiceInstantiationPayload(boolean isPause, Map<String, Vnf> vnfs) {
- return generateMockMacroServiceInstantiationPayload(isPause, vnfs, 1, true, PROJECT_NAME, false);
- }
-
@Test
public void testUpdateServiceInfo_WithExistingServiceInfo_ServiceInfoIsUpdated() {
UUID uuid = createFakedJobAndServiceInfo();
@@ -550,12 +646,12 @@
return uuid;
}
- @Test(expectedExceptions = GenericUncheckedException.class, expectedExceptionsMessageRegExp = UPDATE_SERVICE_INFO_EXCEPTION_MESSAGE)
+ @Test(expectedExceptions = NotFoundException.class, expectedExceptionsMessageRegExp = UPDATE_SERVICE_INFO_EXCEPTION_MESSAGE)
public void testUpdateServiceInfo_WithNonExisting_ThrowException() {
asyncInstantiationBL.updateServiceInfo(UUID.randomUUID(), x -> x.setServiceInstanceName("not matter"));
}
- @Test(expectedExceptions = GenericUncheckedException.class, expectedExceptionsMessageRegExp = UPDATE_SERVICE_INFO_EXCEPTION_MESSAGE)
+ @Test(expectedExceptions = NotFoundException.class, expectedExceptionsMessageRegExp = UPDATE_SERVICE_INFO_EXCEPTION_MESSAGE)
public void testUpdateServiceInfo_WithDoubleServiceWithSameJobUuid_ThrowException() {
UUID uuid = createFakedJobAndServiceInfo();
ServiceInfo serviceInfo = new ServiceInfo();
@@ -584,219 +680,10 @@
@Test
public void testCreateVnfEndpoint_useProvidedInstanceId() {
String path = asyncInstantiationBL.getVnfInstantiationPath("myGreatId");
- assertThat(path, matchesPattern("/serviceInstances/v./myGreatId/vnfs"));
+ assertThat(path, equalTo("/serviceInstantiation/v7/serviceInstances/myGreatId/vnfs"));
}
- @Test
- public void createServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected() throws IOException {
- createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(true);
- }
- @Test
- public void createServiceInfo_WithUserProvidedNamingFalseAndNoVfmodules_ServiceInfoIsAsExpected() throws IOException {
- createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(false);
- }
-
- private void createMacroServiceInfo_WithUserProvidedNamingFalse_ServiceInfoIsAsExpected(boolean withVfmodules) throws IOException {
- when(featureManager.isActive(Features.FLAG_SHIFT_VFMODULE_PARAMS_TO_VNF)).thenReturn(true);
-
- ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(true,
- createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, Collections.EMPTY_LIST, false),
- 1,
- false, PROJECT_NAME, true);
- URL resource;
- if (withVfmodules) {
- resource = this.getClass().getResource("/payload_jsons/bulk_service_request_ecomp_naming.json");
- } else {
- // remove the vf modules
- serviceInstantiationPayload.getVnfs().values().forEach(vnf -> vnf.getVfModules().clear());
- resource = this.getClass().getResource("/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json");
- }
-
- RequestDetailsWrapper<ServiceInstantiationRequestDetails> result =
- asyncInstantiationBL.generateMacroServiceInstantiationRequest(null, serviceInstantiationPayload, serviceInstantiationPayload.getInstanceName(), "az2016");
-
- String expected = IOUtils.toString(resource, "UTF-8");
- MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
- }
-
- @Test
- public void createALaCarteService_WithUserProvidedNamingFalse_RequestDetailsIsAsExpected() throws IOException {
- ServiceInstantiation serviceInstantiationPayload = generateMockALaCarteServiceInstantiationPayload(false,
- newHashMap(),
- newHashMap(),
- newHashMap(),
- 1,
- false, PROJECT_NAME, true, null);
-
- RequestDetailsWrapper<ServiceInstantiationRequestDetails> result =
- asyncInstantiationBL.generateALaCarteServiceInstantiationRequest(null, serviceInstantiationPayload, serviceInstantiationPayload.getInstanceName(), "az2016");
-
- URL resource = this.getClass().getResource("/payload_jsons/bulk_alacarte_service_request_naming_false.json");
- String expected = IOUtils.toString(resource, "UTF-8");
- MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
- }
-
- @Test
- public void generateALaCarteServiceInstantiationRequest_withVnfList_HappyFllow() throws IOException {
- ServiceInstantiation serviceInstantiationPayload = generateALaCarteWithVnfsServiceInstantiationPayload();
- RequestDetailsWrapper<ServiceInstantiationRequestDetails> result =
- asyncInstantiationBL.generateALaCarteServiceInstantiationRequest(null, serviceInstantiationPayload, serviceInstantiationPayload.getInstanceName(), "az2016");
-
- String serviceExpected = IOUtils.toString(this.getClass().getResource("/payload_jsons/bulk_alacarte_service_request.json"), "UTF-8");
- MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(serviceExpected, result);
- }
-
- @Test(dataProvider = "createVnfParameters")
- public void createVnfRequestDetails_detailsAreAsExpected(boolean isFlagAddCloudOwnerActive, boolean isUserProvidedNaming, String file) throws IOException {
-
- final List<Vnf> vnfList = new ArrayList<>(createVnfList(new HashMap<>(), null, isUserProvidedNaming, true).values());
- ModelInfo siModelInfo = createServiceModelInfo();
- String serviceInstanceId = "aa3514e3-5a33-55df-13ab-12abad84e7aa";
-
- //we validate that the asyncInstantiationBL call to getUniqueName by simulate that aai retrun that original
- //vnf name is used, and only next picked name is free.
- Mockito.reset(aaiClient);
- mockAaiClientAaiStatusOK();
- when(aaiClient.isNodeTypeExistsByName(eq(VNF_NAME), eq(ResourceType.GENERIC_VNF))).thenReturn(true);
- when(aaiClient.isNodeTypeExistsByName(eq(VNF_NAME+"_001"), eq(ResourceType.GENERIC_VNF))).thenReturn(false);
- enableAddCloudOwnerOnMsoRequest(isFlagAddCloudOwnerActive);
-
- String expected = IOUtils.toString(this.getClass().getResource(file), "UTF-8");
- final RequestDetailsWrapper<VnfInstantiationRequestDetails> result = asyncInstantiationBL.generateVnfInstantiationRequest(vnfList.get(0), siModelInfo, serviceInstanceId, "pa0916");
- MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
- }
-
- @DataProvider
- public static Object[][] createVnfParameters() {
- return new Object[][]{
- {true, true, "/payload_jsons/bulk_vnf_request.json"},
- {false, true, "/payload_jsons/bulk_vnf_request_without_cloud_owner.json"},
- {true, false, "/payload_jsons/bulk_vnf_request_without_instance_name.json"},
- };
- }
-
- @DataProvider
- public static Object[][] vfModuleRequestDetails(Method test) {
- return new Object[][]{
- {"cc3514e3-5a33-55df-13ab-12abad84e7cc", true, "/payload_jsons/vfmodule_instantiation_request.json"},
- {null, true, "/payload_jsons/vfmodule_instantiation_request_without_volume_group.json"},
- {null, false, "/payload_jsons/vfmodule_instantiation_request_without_instance_name.json"}
- };
- }
-
- @Test(dataProvider = "vfModuleRequestDetails")
- public void createVfModuleRequestDetails_detailsAreAsExpected(String volumeGroupInstanceId, boolean isUserProvidedNaming, String fileName) throws IOException {
-
- ModelInfo siModelInfo = createServiceModelInfo();
- ModelInfo vnfModelInfo = createVnfModelInfo(true);
- List<Map<String, String>> instanceParams = ImmutableList.of(ImmutableMap.of("vmx_int_net_len", "24",
- "vre_a_volume_size_0" , "120"));
- Map<String, String> supplementaryParams = ImmutableMap.of("vre_a_volume_size_0" , "100",
- "availability_zone_0" , "mtpocdv-kvm-az01");
- VfModule vfModule = createVfModule("201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1", "56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
- "72d9d1cd-f46d-447a-abdb-451d6fb05fa8", instanceParams, supplementaryParams,
- (isUserProvidedNaming ? "vmxnjr001_AVPN_base_vRE_BV_expansion": null), "myVgName", true);
-
- String serviceInstanceId = "aa3514e3-5a33-55df-13ab-12abad84e7aa";
- String vnfInstanceId = "bb3514e3-5a33-55df-13ab-12abad84e7bb";
-
- Mockito.reset(aaiClient);
- mockAaiClientAaiStatusOK();
- enableAddCloudOwnerOnMsoRequest();
- when(aaiClient.isNodeTypeExistsByName(eq("vmxnjr001_AVPN_base_vRE_BV_expansion"), eq(ResourceType.VF_MODULE))).thenReturn(false);
-
- String expected = IOUtils.toString(this.getClass().getResource(fileName), "UTF-8");
- final RequestDetailsWrapper<VfModuleInstantiationRequestDetails> result = asyncInstantiationBL.generateVfModuleInstantiationRequest(
- vfModule, siModelInfo, serviceInstanceId,
- vnfModelInfo, vnfInstanceId, volumeGroupInstanceId, "pa0916");
- MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
- }
-
- @DataProvider
- public static Object[][] expectedAggregatedParams() {
- return new Object[][]{
- {ImmutableMap.of("a", "b", "c", "d"), ImmutableMap.of("e", "f", "g", "h"), ImmutableList.of(ImmutableMap.of("c", "d", "a", "b", "e", "f", "g", "h"))},
- {ImmutableMap.of("a", "b", "c", "g"), ImmutableMap.of("c", "d", "e", "f"), ImmutableList.of(ImmutableMap.of("a", "b", "c", "d", "e", "f"))},
- {ImmutableMap.of(), ImmutableMap.of("c", "d", "e", "f"), ImmutableList.of(ImmutableMap.of("c", "d", "e", "f"))},
- {ImmutableMap.of("a", "b", "c", "g"), ImmutableMap.of(), ImmutableList.of(ImmutableMap.of("a", "b", "c", "g"))},
- {ImmutableMap.of(), ImmutableMap.of(), ImmutableList.of()},
- {null, ImmutableMap.of(), ImmutableList.of()},
- {ImmutableMap.of(), null, ImmutableList.of()},
- };
- }
-
- @Test(dataProvider = "expectedAggregatedParams")
- public void testAggregateInstanceParamsAndSuppFile(Map<String, String> instanceParams, Map<String, String> suppParams, List<VfModuleInstantiationRequestDetails.UserParamMap<String, String>> expected) {
- List<VfModuleInstantiationRequestDetails.UserParamMap<String, String>> aggParams = ((AsyncInstantiationBusinessLogicImpl)asyncInstantiationBL).aggregateAllInstanceParams(instanceParams, suppParams);
- assertThat("Aggregated params are not as expected", aggParams, equalTo(expected));
- }
-
- @DataProvider
- public static Object[][] expectedNetworkRequestDetailsParameters() {
- return new Object[][]{
- {true, "/payload_jsons/network_instantiation_request.json"},
- {false, "/payload_jsons/network_instantiation_request_without_instance_name.json"}
- };
- }
-
- @Test(dataProvider = "expectedNetworkRequestDetailsParameters")
- public void createNetworkRequestDetails_detailsAreAsExpected(boolean isUserProvidedNaming, String filePath) throws IOException {
-
- final List<Network> networksList = new ArrayList<>(createNetworkList(null, isUserProvidedNaming, true).values());
- ModelInfo siModelInfo = createServiceModelInfo();
- String serviceInstanceId = "aa3514e3-5a33-55df-13ab-12abad84e7aa";
-
- Mockito.reset(aaiClient);
- mockAaiClientAaiStatusOK();
- enableAddCloudOwnerOnMsoRequest();
- when(aaiClient.isNodeTypeExistsByName(eq(VNF_NAME), eq(ResourceType.L3_NETWORK))).thenReturn(true);
- when(aaiClient.isNodeTypeExistsByName(eq(VNF_NAME+"_001"), eq(ResourceType.L3_NETWORK))).thenReturn(false);
-
- String expected = IOUtils.toString(this.getClass().getResource(filePath), "UTF-8");
- final RequestDetailsWrapper<NetworkInstantiationRequestDetails> result = asyncInstantiationBL.generateNetworkInstantiationRequest(networksList.get(0), siModelInfo, serviceInstanceId, "pa0916");
- MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
- }
-
- @Test
- public void createInstanceGroupRequestDetails_detailsAreAsExpected() throws IOException {
-
- final InstanceGroup instanceGroup = createInstanceGroup(true, Action.Create);
- ModelInfo siModelInfo = createServiceModelInfo();
- String serviceInstanceId = "aa3514e3-5a33-55df-13ab-12abad84e7aa";
-
- Mockito.reset(aaiClient);
- mockAaiClientAaiStatusOK();
- enableAddCloudOwnerOnMsoRequest();
- when(aaiClient.isNodeTypeExistsByName(eq(VNF_GROUP_NAME), eq(ResourceType.INSTANCE_GROUP))).thenReturn(true);
- when(aaiClient.isNodeTypeExistsByName(eq(VNF_GROUP_NAME+"_001"), eq(ResourceType.INSTANCE_GROUP))).thenReturn(false);
-
- String expected = IOUtils.toString(this.getClass().getResource("/payload_jsons/instance_group_instantiation_request.json"), "UTF-8");
- final RequestDetailsWrapper<InstanceGroupInstantiationRequestDetails> result = asyncInstantiationBL.generateInstanceGroupInstantiationRequest(instanceGroup, siModelInfo, serviceInstanceId, "az2018");
- MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
- }
-
- @Test
- public void checkIfNullProjectNameSentToMso(){
- ServiceInstantiation serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(true,
- createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, Collections.EMPTY_LIST, false),
- 1,
- false,null,false);
- RequestDetailsWrapper<ServiceInstantiationRequestDetails> result =
- asyncInstantiationBL.generateMacroServiceInstantiationRequest(null, serviceInstantiationPayload, serviceInstantiationPayload.getInstanceName(), "az2016");
- JsonNode jsonNode = new ObjectMapper().valueToTree(result.requestDetails);
- Assert.assertTrue(jsonNode.get("project").isNull());
- serviceInstantiationPayload = generateMockMacroServiceInstantiationPayload(true,
- createVnfList(vfModuleInstanceParamsMapWithParamsToRemove, Collections.EMPTY_LIST, false),
- 1,
- false,"not null",false);
- result = asyncInstantiationBL.generateMacroServiceInstantiationRequest(null, serviceInstantiationPayload, serviceInstantiationPayload.getInstanceName(), "az2016");
- jsonNode = new ObjectMapper().valueToTree(result.requestDetails);
- Assert.assertTrue(jsonNode.get("project").get("projectName").asText().equalsIgnoreCase("not null"));
-
-
-
- }
@Test
public void pushBulkJob_macroServiceverifyCreatedDateBehavior_createdDateIsTheSameForAllServicesInSameBulk() {
@@ -853,7 +740,9 @@
Mockito.reset(jobAdapterMock);
final Job job = mock(Job.class);
when(job.getStatus()).thenReturn(PENDING);
- when(jobAdapterMock.createServiceInstantiationJob(any(), any(), any(), any(), any(), any())).thenReturn(job);
+ when(job.getUuid()).thenReturn(UUID.fromString("db2c5ed9-1c19-41ce-9cb7-edf0d878cdeb"));
+ when(jobAdapterMock.createServiceInstantiationJob(any(), any(), any(), any(), any(), any(), any())).thenReturn(job);
+ when(jobsBrokerServiceMock.add(job)).thenReturn(UUID.randomUUID());
}
@DataProvider
@@ -869,7 +758,11 @@
{"Paused", JobStatus.PAUSE},
{"Pause", JobStatus.PAUSE},
{"PENDING_MANUAL_TASK", JobStatus.PAUSE},
- {"UNLOCKED", JobStatus.IN_PROGRESS}
+ {"UNLOCKED", JobStatus.IN_PROGRESS},
+ {"AbORtEd", COMPLETED_WITH_ERRORS},
+ {"RoLlED_baCK", FAILED},
+ {"ROllED_BAcK_To_ASsIGnED", FAILED},
+ {"rOLLED_bACK_tO_CrEATeD", FAILED},
};
}
@@ -879,131 +772,6 @@
assertThat(asyncInstantiationBL.calcStatus(asyncRequestStatus), equalTo(expectedJobStatus));
}
- private void createNewAuditStatus(JobAuditStatus auditStatus)
- {
- Date createdDate= auditStatus.getCreated();
- dataAccessService.saveDomainObject(auditStatus, getPropsMap());
- setDateToStatus(auditStatus.getSource(), auditStatus.getJobStatus(), createdDate);
- }
-
-
-
- private static final String MSO_ARBITRARY_STATUS = "completed mso status";
-
- @DataProvider
- public static Object[][] auditStatuses(Method test) {
- return new Object[][]{
- {
- SourceStatus.VID,
- new String[]{ JobStatus.PENDING.toString(), JobStatus.IN_PROGRESS.toString()}
- },
- { SourceStatus.MSO,
- new String[]{ JobStatus.IN_PROGRESS.toString(), MSO_ARBITRARY_STATUS }
- }
- };
-
- }
-
- private void setDateToStatus(SourceStatus source, String status, Date date) {
- List<JobAuditStatus> jobAuditStatusList = dataAccessService.getList(JobAuditStatus.class, getPropsMap());
- DaoUtils.tryWithSessionAndTransaction(sessionFactory, session -> {
- jobAuditStatusList.stream()
- .filter(auditStatus -> source.equals(auditStatus.getSource()) && status.equals(auditStatus.getJobStatus()))
- .forEach(auditStatus -> {
- auditStatus.setCreated(date);
- session.saveOrUpdate(auditStatus);
- });
- return 1;
- });
- }
-
-
- @Test(dataProvider = "auditStatuses")
- public void givenSomeAuditStatuses_getStatusesOfSpecificSourceAndJobId_getSortedResultsMatchingToParameters(SourceStatus expectedSource, String [] expectedSortedStatuses){
- UUID jobUuid = UUID.randomUUID();
- List<JobAuditStatus> auditStatusList = com.google.common.collect.ImmutableList.of(
- new JobAuditStatus(jobUuid, IN_PROGRESS.toString(), SourceStatus.VID, toDate(LocalDateTime.now().minusHours(2))),
- new JobAuditStatus(jobUuid, IN_PROGRESS.toString(), SourceStatus.MSO, UUID.randomUUID(),"",toDate(LocalDateTime.now().minusHours(30))),
- new JobAuditStatus(jobUuid, MSO_ARBITRARY_STATUS, SourceStatus.MSO, UUID.randomUUID(),"",toDate(LocalDateTime.now().minusHours(3))),
- new JobAuditStatus(jobUuid, PENDING.toString(), SourceStatus.VID, toDate(LocalDateTime.now().minusHours(3))),
- new JobAuditStatus(UUID.randomUUID(), PENDING.toString(), SourceStatus.VID, toDate(LocalDateTime.now().minusHours(3))));
- auditStatusList.forEach((auditStatus) -> createNewAuditStatus(auditStatus));
- List<JobAuditStatus> statuses = asyncInstantiationBL.getAuditStatuses(jobUuid, expectedSource);
- List<String> statusesList = statuses.stream().map(status -> status.getJobStatus()).collect(Collectors.toList());
- Assert.assertTrue(statuses.stream().allMatch(status -> (status.getSource().equals(expectedSource)&& status.getJobId().equals(jobUuid))),"Only statuses of " + expectedSource + " for " + jobUuid + " should be returned. Returned statuses: " + String.join(",", statusesList ));
- assertThat(statusesList, contains(expectedSortedStatuses));
- }
-
-
-
- @Test
- public void addSomeVidStatuses_getThem_verifyGetInsertedWithoutDuplicates(){
- ImmutableList<JobStatus> statusesToBeInserted = ImmutableList.of(PENDING, IN_PROGRESS, IN_PROGRESS, COMPLETED);
- UUID jobUuid = UUID.randomUUID();
- statusesToBeInserted.forEach(status->
- {
- asyncInstantiationBL.auditVidStatus(jobUuid, status);
- });
- List<String> statusesFromDB = asyncInstantiationBL.getAuditStatuses(jobUuid, SourceStatus.VID).stream().map(auditStatus -> auditStatus.getJobStatus()).collect(Collectors.toList());
- List<String> statusesWithoutDuplicates = statusesToBeInserted.stream().distinct().map(x -> x.toString()).collect(Collectors.toList());
- assertThat(statusesFromDB, is(statusesWithoutDuplicates));
- }
-
- @DataProvider
- public static Object[][] msoAuditStatuses(Method test) {
- UUID jobUuid = UUID.randomUUID();
- UUID requestId = UUID.randomUUID();
- return new Object[][]{
- {
- jobUuid,
- ImmutableList.of(
- new JobAuditStatus(jobUuid, PENDING.toString(), SourceStatus.MSO, null, null),
- new JobAuditStatus(jobUuid, IN_PROGRESS.toString(), SourceStatus.MSO, requestId, null),
- new JobAuditStatus(jobUuid, IN_PROGRESS.toString(), SourceStatus.MSO, requestId, null),
- new JobAuditStatus(jobUuid, IN_PROGRESS.toString(), SourceStatus.MSO, requestId, null),
- new JobAuditStatus(jobUuid, COMPLETED.toString(), SourceStatus.MSO, requestId, null)),
- ImmutableList.of(PENDING.toString(), IN_PROGRESS.toString(), COMPLETED.toString()),
- "All distinct statuses should be without duplicates"
- },
- {
- jobUuid,
- ImmutableList.of(
- new JobAuditStatus(jobUuid, PENDING.toString(), SourceStatus.MSO, null, null),
- new JobAuditStatus(jobUuid, IN_PROGRESS.toString(), SourceStatus.MSO, requestId, null),
- new JobAuditStatus(jobUuid, IN_PROGRESS.toString(), SourceStatus.MSO, requestId, "aa"),
- new JobAuditStatus(jobUuid, IN_PROGRESS.toString(), SourceStatus.MSO, requestId, "aa"),
- new JobAuditStatus(jobUuid, IN_PROGRESS.toString(), SourceStatus.MSO, UUID.randomUUID(), "aa"),
- new JobAuditStatus(jobUuid, COMPLETED.toString(), SourceStatus.MSO, requestId, null)),
- ImmutableList.of(PENDING.toString(), IN_PROGRESS.toString(), IN_PROGRESS.toString(),IN_PROGRESS.toString(), COMPLETED.toString()),
- "Statuses should be without duplicates only with same requestId and additionalInfo"
-
- }
- };
- }
-
- @Test(dataProvider = "msoAuditStatuses")
- public void addSomeMsoStatuses_getThem_verifyGetInsertedWithoutDuplicates(UUID jobUuid, ImmutableList<JobAuditStatus> msoStatuses, ImmutableList<String> expectedStatuses, String assertionReason) {
- msoStatuses.forEach(status -> {
- asyncInstantiationBL.auditMsoStatus(status.getJobId(), status.getJobStatus(), status.getRequestId() != null ? status.getRequestId().toString() : null, status.getAdditionalInfo());
- });
- List<String> statusesFromDB = asyncInstantiationBL.getAuditStatuses(jobUuid, SourceStatus.MSO).stream().map(auditStatus -> auditStatus.getJobStatus()).collect(Collectors.toList());
- assertThat( assertionReason, statusesFromDB, is(expectedStatuses));
- }
-
- @Test
- public void addSameStatusOfVidAndMso_verifyThatBothWereAdded(){
- UUID jobUuid = UUID.randomUUID();
- JobStatus sameStatus = IN_PROGRESS;
- asyncInstantiationBL.auditMsoStatus(jobUuid, sameStatus.toString(),null,null);
- asyncInstantiationBL.auditVidStatus(jobUuid, sameStatus);
- List<JobAuditStatus> list = dataAccessService.getList(
- JobAuditStatus.class,
- String.format(" where JOB_ID = '%s'", jobUuid),
- null, null);
- Assert.assertEquals(list.size(),2);
- assertThat(list,everyItem(hasProperty("jobStatus", is(sameStatus.toString()))));
- }
-
@DataProvider
public static Object[][] msoRequestStatusFiles(Method test) {
return new Object[][]{
@@ -1026,7 +794,7 @@
doNothing().when(jobsBrokerServiceMock).delete(any());
UUID uuid = createServicesInfoWithDefaultValues(PENDING);
asyncInstantiationBL.deleteJob(uuid);
- assertNotNull(asyncInstantiationBL.getServiceInfoByJobId(uuid).getDeletedAt(), "service info wasn't deleted");
+ assertNotNull(asyncInstantiationRepository.getServiceInfoByJobId(uuid).getDeletedAt(), "service info wasn't deleted");
}
@Test(expectedExceptions = IllegalStateException.class, expectedExceptionsMessageRegExp = DELETE_SERVICE_INFO_STATUS_EXCEPTION_MESSAGE)
@@ -1036,7 +804,7 @@
try {
asyncInstantiationBL.deleteJob(uuid);
} catch (Exception e) {
- assertNull(asyncInstantiationBL.getServiceInfoByJobId(uuid).getDeletedAt(), "service info shouldn't deleted");
+ assertNull(asyncInstantiationRepository.getServiceInfoByJobId(uuid).getDeletedAt(), "service info shouldn't deleted");
throw e;
}
}
@@ -1081,7 +849,7 @@
try {
asyncInstantiationBL.hideServiceInfo(uuid);
} catch (Exception e) {
- assertFalse(asyncInstantiationBL.getServiceInfoByJobId(uuid).isHidden(), "service info shouldn't be hidden");
+ assertFalse(asyncInstantiationRepository.getServiceInfoByJobId(uuid).isHidden(), "service info shouldn't be hidden");
throw e;
}
}
@@ -1126,16 +894,23 @@
assertThat(asyncInstantiationBL.getUniqueName(name, type), equalTo(name+"_001"));
}
+ @Test(enabled = false) //skip till we will handle macro bulk again...
+ public void whenNamedNotInUsedInAai_getSameNameTwice() {
+ String name = someCommonStepsAndGetName();
+ ResourceType type = ResourceType.GENERIC_VNF;
+ when(aaiClient.isNodeTypeExistsByName(name, type)).thenReturn(false);
+ assertThat(asyncInstantiationBL.getUniqueName(name, type), equalTo(name));
+ assertThat(asyncInstantiationBL.getUniqueName(name, type), equalTo(name));
+ when(aaiClient.isNodeTypeExistsByName(name, type)).thenReturn(true);
+ assertThat(asyncInstantiationBL.getUniqueName(name, type), equalTo(name+"_001"));
+ }
+
private String someCommonStepsAndGetName() {
mockAaiClientAaiStatusOK();
return UUID.randomUUID().toString();
}
- private void mockAaiClientAaiStatusOK() {
- when(aaiClient.isNodeTypeExistsByName(eq(AsyncInstantiationBusinessLogicImpl.NAME_FOR_CHECK_AAI_STATUS), any())).thenReturn(false);
- }
-
- @Test(expectedExceptions=ExceptionWithRequestInfo.class)
+ @Test(expectedExceptions= ExceptionWithRequestInfo.class)
public void whenAaiBadResponseCode_throwInvalidAAIResponseException() {
String name = someCommonStepsAndGetName();
ResourceType type = ResourceType.SERVICE_INSTANCE;
@@ -1171,7 +946,7 @@
ArgumentCaptor<JobType> argumentCaptor = ArgumentCaptor.forClass(JobType.class);
asyncInstantiationBL.pushBulkJob(request, "myUserId");
- verify(jobAdapterMock).createServiceInstantiationJob(argumentCaptor.capture(),any(),any(),anyString(), anyString(), anyInt());
+ verify(jobAdapterMock).createServiceInstantiationJob(argumentCaptor.capture(),any(),any(),anyString(), anyString(), anyString(), anyInt());
assertTrue(argumentCaptor.getValue().equals(JobType.ALaCarteServiceInstantiation));
}
@@ -1184,198 +959,285 @@
ArgumentCaptor<JobType> argumentCaptor = ArgumentCaptor.forClass(JobType.class);
asyncInstantiationBL.pushBulkJob(request, "myUserId");
- verify(jobAdapterMock).createServiceInstantiationJob(argumentCaptor.capture(),any(),any(),anyString(), anyString(), anyInt());
+ verify(jobAdapterMock).createServiceInstantiationJob(argumentCaptor.capture(),any(),any(),anyString(), any(), anyString(), anyInt());
assertTrue(argumentCaptor.getValue().equals(JobType.MacroServiceInstantiation));
}
- @Test
- public void generateALaCarteServiceInstantiationRequest_verifyRequestIsAsExpected() throws IOException {
- ServiceInstantiation serviceInstantiationPayload = generateALaCarteServiceInstantiationPayload();
- final URL resource = this.getClass().getResource("/payload_jsons/bulk_alacarte_service_request.json");
- RequestDetailsWrapper<ServiceInstantiationRequestDetails> result =
- asyncInstantiationBL.generateALaCarteServiceInstantiationRequest(null, serviceInstantiationPayload, serviceInstantiationPayload.getInstanceName(), "az2016");
- String expected = IOUtils.toString(resource, "UTF-8");
- MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
- }
+
@Test
- public void generateALaCarteServiceDeletionRequest_verifyRequestIsAsExpected() throws IOException {
- final URL resource = this.getClass().getResource("/payload_jsons/bulk_alacarte_service_deletion_request.json");
- String expected = IOUtils.toString(resource, "UTF-8");
+ public void getALaCarteServiceDeletionPath_verifyPathIsAsExpected() {
- ServiceInstantiation serviceDeletionPayload = generateALaCarteServiceDeletionPayload();
- RequestDetailsWrapper<ServiceDeletionRequestDetails> result =
- asyncInstantiationBL.generateALaCarteServiceDeletionRequest(null, serviceDeletionPayload, "az2016");
-
- MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
- }
-
- @Test
- public void getALaCarteServiceDeletionPath_verifyPathIsAsExpected() throws IOException {
-
- String expected = "/serviceInstantiation/v./serviceInstances/f36f5734-e9df-4fbf-9f35-61be13f028a1";
+ String expected = "/serviceInstantiation/v7/serviceInstances/f36f5734-e9df-4fbf-9f35-61be13f028a1";
String result = asyncInstantiationBL.getServiceDeletionPath("f36f5734-e9df-4fbf-9f35-61be13f028a1");
- assertThat(result, matchesPattern(expected));
+ assertThat(expected,equalTo(result));
+ }
+
+ @Test
+ public void getResumeRequestPath_verifyPathIsAsExpected() {
+
+ String expected = "/orchestrationRequests/v7/rq1234d1-5a33-55df-13ab-12abad84e333/resume";
+
+ String result = asyncInstantiationBL.getResumeRequestPath("rq1234d1-5a33-55df-13ab-12abad84e333");
+
+ assertThat(expected, equalTo(result));
}
@Test
public void getInstanceGroupsDeletionPath_verifyPathIsAsExpected() {
-
assertEquals(asyncInstantiationBL.getInstanceGroupDeletePath("9aada4af-0f9b-424f-ae21-e693bd3e005b"),
"/serviceInstantiation/v7/instanceGroups/9aada4af-0f9b-424f-ae21-e693bd3e005b");
}
- @DataProvider
- public static Object[][] testBuildVnfInstanceParamsDataProvider(Method test) {
- return new Object[][]{
- {
- Collections.EMPTY_LIST,
- ImmutableList.of(
- ImmutableList.of(ImmutableMap.of("k1","v1","k2","v2")),
- ImmutableList.of(ImmutableMap.of("k3","v3","k2","v2"))
- ),
- true,
- ImmutableList.of(ImmutableMap.of("k1","v1","k2","v2","k3","v3"))
- },
- {
- ImmutableList.of(ImmutableMap.of("j1", "w1", "k1","v1", "vnf_name","w2", "vf_module_name","w3")), //vnf_name, vf_module_name are excluded
- ImmutableList.of(
- ImmutableList.of(ImmutableMap.of("k1","v1","k2","v2")),
- ImmutableList.of(ImmutableMap.of("k3","v3","k2","v2")),
- ImmutableList.of(Collections.EMPTY_MAP),
- Collections.singletonList(null)
- ),
- true,
- ImmutableList.of(ImmutableMap.of("k1","v1","k2","v2","k3","v3","j1", "w1"))
- },
- {
- Collections.EMPTY_LIST,
- Arrays.asList(null, null),
- true,
- Collections.EMPTY_LIST //mso is expect to empty list and not list with empty map
- },
- {
- ImmutableList.of(Collections.EMPTY_MAP),
- ImmutableList.of(
- ImmutableList.of(Collections.EMPTY_MAP),
- ImmutableList.of(Collections.EMPTY_MAP)
- ),
- true,
- Collections.EMPTY_LIST //mso is expect to empty list and not list with empty map
- },
- {
- Collections.EMPTY_LIST,
- ImmutableList.of(
- ImmutableList.of(ImmutableMap.of("k1","v1","k2","v2")),
- ImmutableList.of(ImmutableMap.of("k3","v3","k2","v2"))
- ),
- false,
- Collections.EMPTY_LIST //mso is expect to empty list and not list with empty map
- },
- {
- ImmutableList.of(ImmutableMap.of("j1", "w1", "k1","v1", "vnf_name","w2", "vf_module_name","w3")),
- ImmutableList.of(
- ImmutableList.of(Collections.EMPTY_MAP)
- ),
- false,
- ImmutableList.of(ImmutableMap.of("j1", "w1", "k1","v1"))
- },
- {
- ImmutableList.of(ImmutableMap.of("vnf_name","w2", "vf_module_name", "w3", "j2", "w2", "j4","w4")),
- ImmutableList.of(
- ImmutableList.of(ImmutableMap.of("k1","v1","k2","v2")),
- ImmutableList.of(ImmutableMap.of("k3","v3","k2","v2"))
- ),
- false,
- ImmutableList.of(ImmutableMap.of("j2", "w2", "j4","w4"))
- },
-
- };
- }
-
- @Test(dataProvider="testBuildVnfInstanceParamsDataProvider")
- public void testBuildVnfInstanceParams(List<Map<String, String>> currentVnfInstanceParams,
- List<List<Map<String, String>>> vfModulesInstanceParams,
- boolean isFeatureActive,
- List<Map<String,String>> expectedResult){
- when(featureManager.isActive(Features.FLAG_SHIFT_VFMODULE_PARAMS_TO_VNF)).thenReturn(isFeatureActive);
- List<VfModuleMacro> vfModules =
- vfModulesInstanceParams.stream().map(params-> new VfModuleMacro(new ModelInfo(), null, null, params)).collect(Collectors.toList());
- List<Map<String,String>> actual = asyncInstantiationBL.buildVnfInstanceParams(currentVnfInstanceParams, vfModules);
- assertThat(actual, equalTo(expectedResult));
-
- }
-
@Test
public void whenLcpRegionNotEmpty_thenCloudRegionIdOfResourceIsLegacy() {
String legacyCloudRegion = "legacyCloudRegion";
- Vnf vnf = new Vnf(new ModelInfo(), null, null, Action.Create.name(), null, "anyCloudRegion", legacyCloudRegion, null, null, null, false, null, null);
+ Vnf vnf = new Vnf(new ModelInfo(), null, null, Action.Create.name(), null, "anyCloudRegion", legacyCloudRegion,
+ null, null, null, false, null, null, UUID.randomUUID().toString(), null, null);
assertThat(vnf.getLcpCloudRegionId(), equalTo(legacyCloudRegion));
-
-
}
@Test
public void whenLcpRegionNotEmpty_thenCloudRegionIdOfServiceIsLegacy() {
String legacyCloudRegion = "legacyCloudRegion";
ServiceInstantiation service = new ServiceInstantiation(new ModelInfo(), null, null, null, null, null, null,
- null, null, "anyCloudRegion", legacyCloudRegion, null, null, null, null, null, null, null, null,
- false, 1,false, false, null, null, Action.Create.name());
+ null, null, "anyCloudRegion", legacyCloudRegion, null, null, null, null, null, null, null, null, null,
+ false, 1,false, false, null, null, Action.Create.name(), UUID.randomUUID().toString(), null, null, null);
assertThat(service.getLcpCloudRegionId(), equalTo(legacyCloudRegion));
}
- @Test
- public void createVolumeGroup_verifyResultAsExpected() throws IOException {
- final URL resource = this.getClass().getResource("/payload_jsons/volumegroup_instantiation_request.json");
- VfModule vfModule = createVfModule("201673MowAvpnVpeBvL..AVPN_vRE_BV..module-1",
- "56e2b103-637c-4d1a-adc8-3a7f4a6c3240",
- "72d9d1cd-f46d-447a-abdb-451d6fb05fa8",
- Collections.emptyList(),
- Collections.emptyMap(),
- "vmxnjr001_AVPN_base_vRE_BV_expansion",
- "myVgName",
- true);
- vfModule.getModelInfo().setModelInvariantId("ff5256d2-5a33-55df-13ab-12abad84e7ff");
- vfModule.getModelInfo().setModelVersion("1");
- ModelInfo vnfModelInfo = createVnfModelInfo(true);
- RequestDetailsWrapper<VolumeGroupRequestDetails> result =
- asyncInstantiationBL.generateVolumeGroupInstantiationRequest(vfModule,
- createServiceModelInfo(),
- "ff3514e3-5a33-55df-13ab-12abad84e7ff",
- vnfModelInfo,
- "vnfInstanceId",
- "az2016");
- String expected = IOUtils.toString(resource, "UTF-8");
- MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result);
+ @DataProvider
+ public static Object[][] getJobTypeByRequest_verifyResultAsExpectedDataProvider() {
+ return new Object[][]{
+ {false, Action.Create, JobType.MacroServiceInstantiation},
+ {true, Action.Create, JobType.ALaCarteServiceInstantiation},
+ {true, Action.Delete, JobType.ALaCarteService},
+ };
+ }
+
+ @Test(dataProvider = "getJobTypeByRequest_verifyResultAsExpectedDataProvider")
+ public void getJobTypeByRequest_verifyResultAsExpected(boolean isALaCarte, Action action, JobType expectedJobType) {
+ ServiceInstantiation service = createServiceWithIsALaCarteAndAction(isALaCarte, action);
+ assertThat(asyncInstantiationBL.getJobType(service), equalTo(expectedJobType));
+ }
+
+ @NotNull
+ protected ServiceInstantiation createServiceWithIsALaCarteAndAction(boolean isALaCarte, Action action) {
+ return new ServiceInstantiation(new ModelInfo(), null, null, null, null, null, null,
+ null, null, null, null, null, null, null, null, null, null, null, null, null,
+ false, 1, false, isALaCarte, null, null, action.name(),
+ UUID.randomUUID().toString(), null, null, null);
+ }
+
+ @DataProvider
+ public static Object[][] isRetryEnabledForStatusDataProvider(Method test) {
+ return new Object[][]{
+ {FAILED, true, true},
+ {COMPLETED_WITH_ERRORS, true, true},
+ {COMPLETED_WITH_NO_ACTION, true, false},
+ {COMPLETED, true, false},
+ {IN_PROGRESS, true, false},
+ {FAILED, false, false},
+ {COMPLETED_WITH_ERRORS, false, false},
+ {COMPLETED, false, false},
+ };
+ }
+
+ @Test(dataProvider = "isRetryEnabledForStatusDataProvider")
+ public void whenUpdateServiceInfoAndAuditStatus_thenServiceInfoRowIsUpdatedAndIsRetryIsRight(
+ JobStatus jobStatus, boolean isRetryfeatureEnabled, boolean expectedIsRetry) {
+ when(featureManager.isActive(Features.FLAG_1902_RETRY_JOB)).thenReturn(isRetryfeatureEnabled);
+ UUID uuid = createFakedJobAndServiceInfo();
+ asyncInstantiationBL.updateServiceInfoAndAuditStatus(uuid, jobStatus);
+ ServiceInfo serviceInfo = ((List<ServiceInfo>)dataAccessService.getList(ServiceInfo.class, getPropsMap())).
+ stream().filter(x->x.getJobId().equals(uuid)).findFirst().get();
+ assertEquals(jobStatus, serviceInfo.getJobStatus());
+
+ //we don't test serviceInfo.getStatusModifiedDate() because it's too complicated
+
+ assertEquals(expectedIsRetry, serviceInfo.isRetryEnabled());
}
@Test
- public void getJobTypeByRequest_verifyResultAsExpected(){
- ServiceInstantiation service = new ServiceInstantiation(new ModelInfo(), null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null,
- false, 1,false, false, null, null, Action.Create.name());
- JobType jobType = asyncInstantiationBL.getJobType(service) ;
- assertThat(jobType, equalTo(JobType.MacroServiceInstantiation));
- service = new ServiceInstantiation(new ModelInfo(), null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null,
- false, 1,false, true, null, null, Action.Create.name());
- jobType = asyncInstantiationBL.getJobType(service);
- assertThat(jobType, equalTo(JobType.ALaCarteServiceInstantiation));
- service = new ServiceInstantiation(new ModelInfo(), null, null, null, null, null, null,
- null, null, null, null, null, null, null, null, null, null, null, null,
- false, 1,false, true, null, null, Action.Delete.name());
- jobType = asyncInstantiationBL.getJobType(service);
- assertThat(jobType, equalTo(JobType.ALaCarteService));
+ public void givenServiceWithNullTrackByIds_whenReplaceTrackByIds_thenAllLevelsHasTrackByIdWithUUID() {
+ ServiceInstantiation serviceInstantiation = FakeResourceCreator.createServiceWith2InstancesInEachLevel(Action.Create);
+ //assert for the given that all trackById are null
+ assertTrackByIdRecursively(serviceInstantiation, is(nullValue()), new HashSet<>());
+ ServiceInstantiation modifiedServiceInstantiation = asyncInstantiationBL.prepareServiceToBeUnique(serviceInstantiation);
+ assertTrackByIdRecursively(modifiedServiceInstantiation, uuidRegexMatcher, new HashSet<>());
}
- protected ServiceInstantiation generateALaCarteServiceInstantiationPayload() {
- return generateMockALaCarteServiceInstantiationPayload(false, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, 1, true, PROJECT_NAME, false, "VNF_API");
+ private void assertTrackByIdRecursively(BaseResource baseResource, org.hamcrest.Matcher matcher, Set<String> usedUuids) {
+ assertThat(baseResource.getTrackById(), matcher);
+ if (baseResource.getTrackById()!=null) {
+ assertThat(usedUuids, not(hasItem(baseResource.getTrackById())));
+ usedUuids.add(baseResource.getTrackById());
+ }
+ baseResource.getChildren().forEach(x->assertTrackByIdRecursively(x, matcher, usedUuids));
}
- private ServiceInstantiation generateALaCarteServiceDeletionPayload() {
- return generateMockALaCarteServiceDeletionPayload(false, Collections.EMPTY_MAP, Collections.EMPTY_MAP, Collections.EMPTY_MAP, 1, true, PROJECT_NAME, false, "VNF_API", "1234567890");
+ @Test
+ public void givenServicefromDB_returnsTheBulkRequest() throws IOException {
+ ServiceInstantiation serviceInstantiation = TestUtils.readJsonResourceFileAsObject("/payload_jsons/VnfGroupCreate3Delete1None1Request.json", ServiceInstantiation.class);
+ UUID jobId = UUID.randomUUID();
+ doReturn(serviceInstantiation).when(asyncInstantiationRepository).getJobRequest(jobId);
+ doReturn(mock(Map.class)).when(asyncInstantiationRepository).getResourceInfoByRootJobId(jobId);
+ ServiceInstantiation modifiedServiceInstantiation = asyncInstantiationBL.getBulkForRetry(jobId);
+ assertThat(modifiedServiceInstantiation, jsonEquals(serviceInstantiation).when(IGNORING_ARRAY_ORDER));
+ }
+
+ @Test
+ public void givenServiceFromDB_returnsResolvedData() throws IOException {
+ ServiceInstantiation serviceInstantiation = TestUtils.readJsonResourceFileAsObject("/payload_jsons/VnfGroupCreate3Delete1None1Request.json", ServiceInstantiation.class);
+ ServiceInstantiation expectedServiceInstantiation = TestUtils.readJsonResourceFileAsObject("/payload_jsons/VnfGroupCreate3Delete1None1RequestResolvedForRetry.json", ServiceInstantiation.class);
+ UUID jobId = UUID.randomUUID();
+ AsyncRequestStatus asyncRequestStatus = TestUtils.readJsonResourceFileAsObject(
+ "/responses/mso/orchestrationRequestsVnf.json",
+ AsyncRequestStatus.class);
+ Map<String, ResourceInfo> mockedResourceInfoMap = ImmutableMap.of(
+ "groupingservicefortest..ResourceInstanceGroup..0:001", new ResourceInfo("groupingservicefortest..ResourceInstanceGroup..0:001",jobId,"VNF_GROUP1_INSTANCE_ID", COMPLETED, asyncRequestStatus),// TODO case: delete completed
+ "ag5aav86u4j", new ResourceInfo("ag5aav86u4j",jobId, null, FAILED, asyncRequestStatus),// case: failed
+ "asedrftjko", new ResourceInfo("asedrftjko",jobId, "VNF_GROUP1_INSTANCE_ID_3", COMPLETED, asyncRequestStatus),//case: completed after retry failed
+ "rgedfdged4", new ResourceInfo("rgedfdged4", jobId,"VNF_GROUP1_INSTANCE_ID_4", COMPLETED, asyncRequestStatus ));// case: create completed
+
+ doReturn(mockedResourceInfoMap).when(asyncInstantiationRepository).getResourceInfoByRootJobId(jobId);
+ ServiceInstantiation modifiedServiceInstantiation = asyncInstantiationBL.enrichBulkForRetry(serviceInstantiation,jobId);
+ assertThat(modifiedServiceInstantiation, jsonEquals(expectedServiceInstantiation).when(IGNORING_ARRAY_ORDER));
+ }
+
+ @DataProvider
+ public static Object[][] readStatusMsgDataProvider(Method test) throws IOException {
+ AsyncRequestStatus asyncRequestStatus = TestUtils.readJsonResourceFileAsObject(
+ "/responses/mso/orchestrationRequestsVnf.json",
+ AsyncRequestStatus.class);
+ return new Object[][]{
+ {null, null},
+ {new AsyncRequestStatus(), null},
+ {new AsyncRequestStatus(new AsyncRequestStatus.Request()), null},
+ {new AsyncRequestStatus(new AsyncRequestStatus.Request(new RequestStatus())), null},
+ {asyncRequestStatus, "Vnf has been created successfully."}
+ };
+ }
+
+ @Test(dataProvider = "readStatusMsgDataProvider")
+ public void resourceInfoReadStatusMsg_returnsStatusMsgOrNull(AsyncRequestStatus asyncRequestStatus, String expected) {
+ ResourceInfo resourceInfo = new ResourceInfo("groupingservicefortest..ResourceInstanceGroup..0:001",UUID.randomUUID(),"VNF_GROUP1_INSTANCE_ID", COMPLETED, asyncRequestStatus);
+ String msg= asyncInstantiationBL.readStatusMsg(resourceInfo);
+ assertThat(msg, equalTo( expected));
+ }
+
+ @Test
+ public void testAddResourceInfoForOkResponse() {
+ reset(asyncInstantiationRepository);
+ String serviceInstanceId = "service-instance-id";
+ UUID jobUuid = UUID.randomUUID();
+
+ asyncInstantiationBL.addResourceInfo(prepareSharedDataForAddResourceInfo(jobUuid), JobStatus.IN_PROGRESS, serviceInstanceId);
+
+ ArgumentCaptor<ResourceInfo> resourceInfoCaptor = ArgumentCaptor.forClass(ResourceInfo.class);
+ verify(asyncInstantiationRepository).saveResourceInfo(resourceInfoCaptor.capture());
+
+ ResourceInfo resourceInfo = resourceInfoCaptor.getValue();
+ assertResourceInfoValues(resourceInfo, serviceInstanceId, jobUuid, JobStatus.IN_PROGRESS);
+ assertThat(resourceInfo.getErrorMessage(), is(nullValue()));
+ }
+
+ private JobSharedData prepareSharedDataForAddResourceInfo(UUID jobUuid) {
+ ServiceInstantiation serviceInstantiation = mock(ServiceInstantiation.class);
+ when(serviceInstantiation.getTrackById()).thenReturn("track-by-id");
+ return new JobSharedData(jobUuid, "", serviceInstantiation, "");
+ }
+
+ private void assertResourceInfoValues(ResourceInfo resourceInfo, String serviceInstanceId, UUID jobUuid, JobStatus jobStatus) {
+ assertThat(resourceInfo.getInstanceId(), equalTo(serviceInstanceId));
+ assertThat(resourceInfo.getJobStatus(), equalTo(jobStatus));
+ assertThat(resourceInfo.getRootJobId(), equalTo(jobUuid));
+ assertThat(resourceInfo.getTrackById(), equalTo("track-by-id"));
+ }
+
+ @DataProvider
+ public static Object[][] addResourceInfoWithError() {
+ String message = "Failed to create service instance";
+ return new Object[][]{
+ {500, message},
+ {199, "{\"serviceException\":{\"messageId\":\"SVC2000\",\"text\":\"Error: " + message + "\"}}"}
+ };
+ }
+
+ @Test(dataProvider = "addResourceInfoWithError")
+ public void testAddResourceInfoForErrorResponse(int errorCode, String errorMessage) {
+ reset(asyncInstantiationRepository);
+ UUID jobUuid = UUID.randomUUID();
+
+ RestObject restObject = mock(RestObject.class);
+ when(restObject.getStatusCode()).thenReturn(errorCode);
+ when(restObject.getRaw()).thenReturn(errorMessage);
+ asyncInstantiationBL.addFailedResourceInfo(prepareSharedDataForAddResourceInfo(jobUuid), restObject);
+
+ ArgumentCaptor<ResourceInfo> resourceInfoCaptor = ArgumentCaptor.forClass(ResourceInfo.class);
+ verify(asyncInstantiationRepository).saveResourceInfo(resourceInfoCaptor.capture());
+
+ ResourceInfo resourceInfo = resourceInfoCaptor.getValue();
+ assertResourceInfoValues(resourceInfo, null, jobUuid, JobStatus.FAILED);
+ assertThat(resourceInfo.getErrorMessage().request.requestStatus.getStatusMessage(), containsString("Failed to create service instance"));
+ assertThat(resourceInfo.getErrorMessage().request.requestStatus.getStatusMessage(), containsString(String.valueOf(errorCode)));
+ ZonedDateTime parsedDate = TimeUtils.parseZonedDateTime(resourceInfo.getErrorMessage().request.requestStatus.getTimestamp());
+ assertThat(parsedDate.toLocalDate(), is(LocalDate.now()));
+
+ doReturn(resourceInfo).when(asyncInstantiationRepository).getResourceInfoByTrackId(any());
+ JobAuditStatus jobAuditStatus = auditService.getResourceAuditStatus(resourceInfo.getTrackById());
+ assertThat(jobAuditStatus.getJobStatus(), equalTo("FAILED"));
+ assertThat(jobAuditStatus.getAdditionalInfo(), containsString("Failed to create service instance"));
+ assertThat(jobAuditStatus.getAdditionalInfo(), containsString(String.valueOf(errorCode)));
+ assertTrue(DateUtils.isSameDay(jobAuditStatus.getCreatedDate(), new Date()));
+ }
+
+ @DataProvider
+ public static Object[][] updateResourceInfoParameters() {
+ return new Object[][] {
+ {JobStatus.COMPLETED, "Instance was created successfully"},
+ {JobStatus.FAILED, "Failed to create instance"}
+ };
+ }
+
+ @Test(dataProvider = "updateResourceInfoParameters")
+ public void testUpdateResourceInfo(JobStatus jobStatus, String message) {
+ reset(asyncInstantiationRepository);
+ UUID jobUuid = UUID.randomUUID();
+ JobSharedData sharedData = new JobSharedData(jobUuid, "", mock(ServiceInstantiation.class),"");
+
+ ResourceInfo resourceInfoMock = new ResourceInfo();
+ resourceInfoMock.setTrackById(UUID.randomUUID().toString());
+ doReturn(resourceInfoMock).when(asyncInstantiationRepository).getResourceInfoByTrackId(any());
+
+ AsyncRequestStatus asyncRequestStatus = asyncInstantiationBL.convertMessageToAsyncRequestStatus(message);
+
+ asyncInstantiationBL.updateResourceInfo(sharedData, jobStatus, asyncRequestStatus);
+
+ ArgumentCaptor<ResourceInfo> resourceInfoCaptor = ArgumentCaptor.forClass(ResourceInfo.class);
+ verify(asyncInstantiationRepository).saveResourceInfo(resourceInfoCaptor.capture());
+
+ ResourceInfo resourceInfo = resourceInfoCaptor.getValue();
+ assertThat(resourceInfo.getJobStatus(), equalTo(jobStatus));
+ if (jobStatus == JobStatus.FAILED) {
+ assertThat(resourceInfo.getErrorMessage(), is(not(nullValue())));
+ assertThat(resourceInfo.getErrorMessage().request.requestStatus.getStatusMessage(), equalTo(message));
+ ZonedDateTime parsedDate = TimeUtils.parseZonedDateTime(resourceInfo.getErrorMessage().request.requestStatus.getTimestamp());
+ assertThat(parsedDate.toLocalDate(), is(LocalDate.now()));
+ } else {
+ assertThat(resourceInfo.getErrorMessage(), is(nullValue()));
+ }
+
+ JobAuditStatus jobAuditStatus = auditService.getResourceAuditStatus(resourceInfo.getTrackById());
+ if (jobStatus == JobStatus.FAILED) {
+ assertThat(jobAuditStatus.getJobStatus(), equalTo("FAILED"));
+ assertThat(jobAuditStatus.getAdditionalInfo(), equalTo(message));
+ } else {
+ assertThat(jobAuditStatus, is(nullValue()));
+ }
+
}
static class MockedJob implements Job {
@@ -1426,7 +1288,7 @@
@Override
public JobSharedData getSharedData() {
- return new JobSharedData(uuid, "", null);
+ return new JobSharedData(uuid, "", null,"");
}
@Override
@@ -1463,4 +1325,13 @@
return optimisticUniqueServiceInstanceName;
}
}
+
+
+ @Test
+ public void testGetVfModuleReplacePath_asMSOexpected()
+ {
+ String path = asyncInstantiationBL.getVfModuleReplacePath("myService", "myVNF", "myVFModule");
+ assertThat(path, equalTo("/serviceInstantiation/v7/serviceInstances/myService/vnfs/myVNF/vfModules/myVFModule/replace"));
+
+ }
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/AuditServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/AuditServiceImplTest.java
index bdb2a28..ce5840b 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/AuditServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/AuditServiceImplTest.java
@@ -19,71 +19,88 @@
*/
package org.onap.vid.services;
-import org.glassfish.grizzly.http.util.HttpStatus;
import org.mockito.InjectMocks;
import org.mockito.Mock;
-import org.mockito.Mockito;
+import org.mockito.MockitoAnnotations;
+import org.onap.vid.dal.AsyncInstantiationRepository;
import org.onap.vid.model.JobAuditStatus;
+import org.onap.vid.mso.RestMsoImplementation;
+import org.onap.vid.mso.RestObject;
+import org.onap.vid.mso.rest.AsyncRequestStatus;
import org.onap.vid.mso.rest.AsyncRequestStatusList;
import org.onap.vid.testUtils.TestUtils;
-import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
-import java.io.IOException;
-import java.util.Date;
import java.util.List;
-import java.util.UUID;
-import static java.util.stream.Collectors.toList;
import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.*;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.MockitoAnnotations.initMocks;
+import static org.hamcrest.Matchers.equalTo;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.when;
public class AuditServiceImplTest {
+
@Mock
- private AsyncInstantiationBusinessLogic asyncInstantiationBL;
+ private RestMsoImplementation restMso;
+ @Mock
+ private AsyncInstantiationRepository asyncInstantiationRepository;
@InjectMocks
private AuditServiceImpl auditService;
- @BeforeClass
- public void init() {
- initMocks(this);
+ @BeforeMethod
+ public void setUp() {
+ restMso = null;
+ asyncInstantiationRepository = null;
+ auditService = null;
+ MockitoAnnotations.initMocks(this);
}
@Test
- public void setFailedAuditStatusFromMsoTest() {
+ public void testGetRequestsIdsByServiceIdAndRequestTypeAndScope() throws Exception {
- UUID jobUuid = UUID.randomUUID();
- String requestId = "1";
- int statusCode = HttpStatus.OK_200.getStatusCode();
- String msoResponse = "{}";
+ String instanceId = "d40c8a82-cc04-45e5-a0f6-0c9394c8f8d2";
+ //the request id in multipleOrchestrationRequestsServiceInstance.json
+ String expectedRequestId = "fab854bf-e53c-415e-b3cc-b6fcce8414b2";
+ String msoBasePath = "/someMsoPath/v2019?";
- auditService.setFailedAuditStatusFromMso(jobUuid, requestId, statusCode, msoResponse);
-
- verify(asyncInstantiationBL, times(1))
- .auditMsoStatus(
- Mockito.any(UUID.class),
- Mockito.anyString(),
- Mockito.anyString(),
- Mockito.anyString());
+ AsyncRequestStatusList asyncRequestStatusList = TestUtils.readJsonResourceFileAsObject(
+ "/responses/mso/multipleOrchestrationRequestsServiceInstance.json",
+ AsyncRequestStatusList.class);
+ RestObject<AsyncRequestStatusList> msoResponse = new RestObject<>();
+ msoResponse.set(asyncRequestStatusList);
+ msoResponse.setStatusCode(200);
+ when(restMso.GetForObject(eq(msoBasePath + "filter=serviceInstanceId:EQUALS:" + instanceId),
+ eq(AsyncRequestStatusList.class)))
+ .thenReturn(msoResponse);
+ TestUtils.testWithSystemProperty("mso.restapi.get.orc.reqs", msoBasePath, () -> {
+ List<AsyncRequestStatus.Request> result = auditService
+ .retrieveRequestsFromMsoByServiceIdAndRequestTypeAndScope(instanceId, "createInstance", "service");
+ assertThat(result.size(), equalTo(1));
+ assertThat(result.get(0).requestId, equalTo(expectedRequestId));
+ assertThat(result.get(0).startTime, equalTo("Mon, 04 Mar 2019 20:47:15 GMT"));
+ });
}
@Test
- public void testConvertMsoResponseStatusToJobAuditStatus_missingDateFromMso_shouldNoError() throws IOException {
- final AsyncRequestStatusList asyncRequestStatusList = TestUtils.readJsonResourceFileAsObject("/orchestrationRequestsByServiceInstanceId.json", AsyncRequestStatusList.class);
+ public void nextOrdinalAfter_givenNull_returnZero() {
+ assertThat(
+ auditService.nextOrdinalAfter(null),
+ equalTo(0)
+ );
+ }
- AuditServiceImpl auditService = new AuditServiceImpl(null, null);
+ @Test
+ public void nextOrdinalAfter_givenX_returnXplus1() {
+ final int x = 6;
+ final JobAuditStatus jobAuditStatus = new JobAuditStatus();
+ jobAuditStatus.setOrdinal(x);
- final List<JobAuditStatus> jobAuditStatuses = auditService.convertMsoResponseStatusToJobAuditStatus(asyncRequestStatusList.getRequestList(), "foo");
-
- final List<Date> dates = jobAuditStatuses.stream().map(JobAuditStatus::getCreatedDate).collect(toList());
- final List<String> statuses = jobAuditStatuses.stream().map(JobAuditStatus::getJobStatus).collect(toList());
-
- assertThat(dates, containsInAnyOrder(notNullValue(), notNullValue(), nullValue()));
- assertThat(statuses, containsInAnyOrder("COMPLETE", "COMPLETE", "IN_PROGRESS"));
+ assertThat(
+ auditService.nextOrdinalAfter(jobAuditStatus),
+ equalTo(x + 1)
+ );
}
}
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java b/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java
index 85cf23e..40546e9 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/JobsBrokerServiceTest.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.
@@ -21,57 +21,22 @@
package org.onap.vid.services;
-import static java.util.concurrent.TimeUnit.MILLISECONDS;
-import static java.util.stream.Collectors.toList;
-import static org.hamcrest.CoreMatchers.equalTo;
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.both;
-import static org.hamcrest.Matchers.containsInAnyOrder;
-import static org.onap.vid.job.Job.JobStatus.COMPLETED;
-import static org.onap.vid.job.Job.JobStatus.CREATING;
-import static org.onap.vid.job.Job.JobStatus.FAILED;
-import static org.onap.vid.job.Job.JobStatus.IN_PROGRESS;
-import static org.onap.vid.job.Job.JobStatus.PAUSE;
-import static org.onap.vid.job.Job.JobStatus.PENDING;
-import static org.onap.vid.job.Job.JobStatus.RESOURCE_IN_PROGRESS;
-import static org.onap.vid.job.Job.JobStatus.STOPPED;
-import static org.onap.vid.utils.Streams.not;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.AssertJUnit.assertEquals;
-
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
-import java.lang.reflect.Method;
-import java.time.LocalDateTime;
-import java.time.ZoneId;
-import java.util.Arrays;
-import java.util.Date;
-import java.util.List;
-import java.util.Optional;
-import java.util.Set;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentSkipListSet;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeoutException;
-import java.util.stream.IntStream;
-import java.util.stream.Stream;
-import javax.inject.Inject;
import org.apache.commons.lang.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;
import org.apache.commons.lang3.builder.ReflectionToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
+import org.apache.commons.lang3.tuple.Pair;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.hibernate.SessionFactory;
+import org.jetbrains.annotations.NotNull;
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
import org.onap.portalsdk.core.domain.support.DomainVo;
import org.onap.portalsdk.core.service.DataAccessService;
import org.onap.portalsdk.core.util.SystemProperties;
-import org.onap.vid.config.DataSourceConfig;
-import org.onap.vid.config.JobAdapterConfig;
import org.onap.vid.exceptions.GenericUncheckedException;
import org.onap.vid.exceptions.OperationNotAllowedException;
import org.onap.vid.job.Job;
@@ -80,8 +45,12 @@
import org.onap.vid.job.JobsBrokerService;
import org.onap.vid.job.command.JobCommandFactoryTest;
import org.onap.vid.job.impl.JobDaoImpl;
+import org.onap.vid.job.impl.JobSchedulerInitializer;
import org.onap.vid.job.impl.JobsBrokerServiceInDatabaseImpl;
+import org.onap.vid.services.VersionService;
import org.onap.vid.utils.DaoUtils;
+import org.onap.vid.config.DataSourceConfig;
+import org.onap.vid.config.JobAdapterConfig;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.testng.AbstractTestNGSpringContextTests;
import org.testng.Assert;
@@ -90,6 +59,31 @@
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
+import javax.inject.Inject;
+import java.lang.reflect.Method;
+import java.time.LocalDateTime;
+import java.time.ZoneId;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.stream.Collectors;
+import java.util.stream.IntStream;
+import java.util.stream.Stream;
+
+import static java.util.concurrent.TimeUnit.MILLISECONDS;
+import static java.util.stream.Collectors.toList;
+import static org.hamcrest.CoreMatchers.equalTo;
+import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.both;
+import static org.hamcrest.Matchers.containsInAnyOrder;
+import static org.mockito.Mockito.when;
+import static org.onap.vid.job.Job.JobStatus.*;
+import static org.onap.vid.utils.Streams.not;
+import static org.onap.vid.testUtils.TestUtils.generateRandomAlphaNumeric;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.AssertJUnit.assertEquals;
+import static org.testng.AssertJUnit.assertFalse;
+
@ContextConfiguration(classes = {DataSourceConfig.class, SystemProperties.class, JobAdapterConfig.class})
public class JobsBrokerServiceTest extends AbstractTestNGSpringContextTests {
@@ -101,7 +95,7 @@
private final Set<Long> threadsIds = new ConcurrentSkipListSet<>();
- private final long FEW = 1000;
+ private final long FEW = 500;
private final String JOBS_SHOULD_MATCH = "the jobs that added and those that pulled must be the same";
private final String JOBS_PEEKED_SHOULD_MATCH = "the jobs that added and those that peeked must be the same";
@@ -116,6 +110,23 @@
@Inject
private SessionFactory sessionFactory;
+ @Mock
+ private VersionService versionService;
+
+ @AfterMethod
+ public void threadsCounter() {
+ logger.info("participating threads count: " + threadsIds.size());
+ threadsIds.clear();
+ }
+
+ @BeforeMethod
+ public void initializeBroker() {
+ MockitoAnnotations.initMocks(this);
+ when(versionService.retrieveBuildNumber()).thenReturn("aBuildNumber");
+ broker = new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, 200, 0, versionService);
+ ((JobsBrokerServiceInDatabaseImpl) broker).deleteAll();
+ }
+
/*
- pulling jobs is limited to inserted ones
- putting back allows getting the job again
@@ -147,6 +158,7 @@
new JobCommandFactoryTest.MockedRequest(42,"nothing") ,
UUID.randomUUID(),
userId,
+ null,
"optimisticUniqueServiceInstanceName",
RandomUtils.nextInt());
}
@@ -234,18 +246,6 @@
threadsIds.add(Thread.currentThread().getId());
}
- @AfterMethod
- public void threadsCounter() {
- logger.info("participating threads count: " + threadsIds.size());
- threadsIds.clear();
- }
-
- @BeforeMethod
- public void initializeBroker() {
- broker = new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, 200, 0);
- ((JobsBrokerServiceInDatabaseImpl) broker).deleteAll();
- }
-
@Test
public void givenSingleJob_getIt_verifySameJob() {
final Job originalJob = waitForFutureJob(newJobAsync(broker));
@@ -254,6 +254,51 @@
assertThat(JOBS_SHOULD_MATCH, retrievedJob, is(originalJob));
}
+ @DataProvider
+ public static Object[][] allTopics() {
+ return JobSchedulerInitializer.WORKERS_TOPICS.stream()
+ .map(topic -> new Object[] { topic })
+ .toArray(Object[][]::new);
+ }
+
+ @Test(dataProvider = "allTopics")
+ public void givenJobFromSameBuild_pullJobs_jobIsPulled(Job.JobStatus topic) {
+ when(versionService.retrieveBuildNumber()).thenReturn("someVersion");
+ Job mockedJob = createMockJob("user id", topic);
+ UUID uuid = broker.add(mockedJob);
+ assertEquals(uuid, broker.pull(topic, UUID.randomUUID().toString()).get().getUuid());
+ }
+
+
+ @Test(dataProvider = "allTopics")
+ public void givenJobFromOtherBuild_pullJobs_noneIsPulled(Job.JobStatus topic) {
+ when(versionService.retrieveBuildNumber()).thenReturn("old");
+ Job mockedJob = createMockJob("user id", topic);
+ broker.add(mockedJob);
+ when(versionService.retrieveBuildNumber()).thenReturn("new");
+ assertFalse(broker.pull(topic, UUID.randomUUID().toString()).isPresent());
+ }
+
+ @Test
+ public void givenJobWithNullBuildAndJobWithRealBuild_pullJobs_jobsWithNonNullIsPulled() {
+ Job.JobStatus topic = PENDING;
+
+ //push job with null build
+ when(versionService.retrieveBuildNumber()).thenReturn(null);
+ broker.add(createMockJob("user id", topic));
+
+ //push job with "aBuild" build
+ when(versionService.retrieveBuildNumber()).thenReturn("aBuild");
+ UUID newJobId = broker.add(createMockJob("user id", topic));
+
+ //pull jobs while current build is still "aBuild". Only the non null build is pulled
+ assertEquals(newJobId, broker.pull(topic, UUID.randomUUID().toString()).get().getUuid());
+
+ //no more jobs to pull
+ assertFalse(broker.pull(topic, UUID.randomUUID().toString()).isPresent());
+ }
+
+
@Test
public void givenManyJobs_getJobsAndPushThemBack_alwaysSeeAllOfThemWithPeek() throws InterruptedException {
final List<Job> originalJobs = putALotOfJobs(broker);
@@ -346,10 +391,10 @@
() -> createNewJob(14, UUID.randomUUID(), "userId", STOPPED,null, oldestDate),
() -> createNewJob(22, UUID.randomUUID(), "userId", PENDING,null, oldestDate),
() -> createNewJob(33, UUID.randomUUID(), "userId", PENDING,null, LocalDateTime.now().minusHours(2))),
- 6,
- 5,
- PENDING,
- "Broker should pull the only pending - first pending job by oldest job - ignore deleted,completed, failed, in-progress and stopped statuses"
+ 6,
+ 5,
+ PENDING,
+ "Broker should pull the only pending - first pending job by oldest job - ignore deleted,completed, failed, in-progress and stopped statuses"
},
{ImmutableList.of(
(Jobber)() -> createNewJob(11, UUID.randomUUID(), "userId", IN_PROGRESS, UUID.randomUUID().toString(), oldestDate),
@@ -374,7 +419,7 @@
() -> createNewJob(22, UUID.randomUUID(), "userId", PENDING, UUID.randomUUID().toString(), oldestDate),
() -> createNewJob(33, UUID.randomUUID(), "userId", PENDING, null, LocalDateTime.now().minusHours(2)),
() -> createNewJob(12, UUID.randomUUID(), "userId", RESOURCE_IN_PROGRESS, UUID.randomUUID().toString(), oldestDate)
- ),
+ ),
3,
2,
PENDING,
@@ -411,10 +456,10 @@
(Jobber)() -> createNewJob(11, sameTemplate, "userId", FAILED, null, oldestDate, DELETED),
() -> createNewJob(22, sameTemplate, "userId", STOPPED,null, oldestDate),
() -> createNewJob(33, sameTemplate, "userId", PENDING,null, LocalDateTime.now().minusHours(2))),
- 3,
- 2,
- PENDING,
- "Broker should pull pending job when there is another job from this template that was deleted, although failed"
+ 3,
+ 2,
+ PENDING,
+ "Broker should pull pending job when there is another job from this template that was deleted, although failed"
},
{ ImmutableList.of(
(Jobber)() -> createNewJob(11, UUID.randomUUID(), "userA", IN_PROGRESS, null, oldestDate),
@@ -475,10 +520,10 @@
() -> createNewJob(33, UUID.randomUUID(), "userId", IN_PROGRESS, null, LocalDateTime.now().minusHours(2)),
() -> createNewJob(16, UUID.randomUUID(), "userId", RESOURCE_IN_PROGRESS, null, oldestDate)
),
- 20,
- 6,
- IN_PROGRESS,
- "Broker with in progress topic should pull only in-progress jobs - first in-progress job by oldest date - ignore all other statuses"
+ 20,
+ 6,
+ IN_PROGRESS,
+ "Broker with in progress topic should pull only in-progress jobs - first in-progress job by oldest date - ignore all other statuses"
},
{ImmutableList.of(
(Jobber)() -> createNewJob(11, UUID.randomUUID(), "userId", COMPLETED, null, oldestDate),
@@ -541,14 +586,9 @@
@Test(dataProvider = "jobs")
public void givenSomeJobs_pullNextJob_returnNextOrNothingAsExpected(List<Jobber> jobbers, int msoLimit, int expectedIndexSelected, Job.JobStatus topic, String assertionReason) {
- JobsBrokerServiceInDatabaseImpl broker = new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, msoLimit, 20);
- final List<JobDaoImpl> jobs = jobbers.stream().map(Jobber::toJob).collect(toList());
- for (JobDaoImpl job : jobs) {
- Date modifiedDate = job.getModified();
- broker.add(job);
- setModifiedDateToJob(job.getUuid(), modifiedDate);
- }
- Optional<Job> nextJob = broker.pull(topic, UUID.randomUUID().toString());
+ JobsBrokerServiceInDatabaseImpl aBroker = new JobsBrokerServiceInDatabaseImpl(dataAccessService, sessionFactory, msoLimit, 20, versionService);
+ final List<JobDaoImpl> jobs = addJobsWithModifiedDate(jobbers, aBroker);
+ Optional<Job> nextJob = aBroker.pull(topic, UUID.randomUUID().toString());
boolean shouldAnyBeSelected = expectedIndexSelected >= 0;
String pulledJobDesc = nextJob.map(job -> ". pulled job: " + job.toString()).orElse(". no job pulled");
Assert.assertEquals(nextJob.isPresent(), shouldAnyBeSelected, assertionReason+pulledJobDesc);
@@ -557,10 +597,206 @@
}
}
+ @NotNull
+ protected List<JobDaoImpl> addJobsWithModifiedDate(List<Jobber> jobbers, JobsBrokerService broker) {
+ final List<JobDaoImpl> jobs = jobbers.stream().map(Jobber::toJob).collect(toList());
+ return addJobsWithModifiedDateByJobDao(jobs, broker);
+ }
+
+ @NotNull
+ private List<JobDaoImpl> addJobsWithModifiedDateByJobDao(List<JobDaoImpl> jobs, JobsBrokerService broker) {
+ for (JobDaoImpl job : jobs) {
+ Date modifiedDate = job.getModified();
+ broker.add(job);
+ setModifiedDateToJob(job.getUuid(), modifiedDate);
+ }
+ return jobs;
+ }
+
+ @DataProvider
+ public static Object[][] jobsForTestingPendingResource(Method test) {
+ UUID templateId1 = UUID.fromString("311a9196-bbc5-47a1-8b11-bf0f9db1c7ca");
+ UUID templateId2 = UUID.fromString("4f1522f9-642e-49f7-af75-a2f344085bcc");
+ return new Object[][]{
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(12, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(1, templateId2, "userId", CREATING, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(2, UUID.randomUUID(), "userId", RESOURCE_IN_PROGRESS, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(3, UUID.randomUUID(), "userId", IN_PROGRESS, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(4, UUID.randomUUID(), "userId", COMPLETED, null, LocalDateTime.now().minusSeconds(1), false)
+ ),
+ 0,
+ "given there is only one in the queue in PENDING_RESOURCE and no other job with same templateId, then this job is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(2, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(3, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusSeconds(2), false),
+ () -> createNewJob(1, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now(), false)
+ ),
+ 2,
+ "given multiple jobs with same templateId in PENDING_RESOURCE, then job with lowest indexInBulk is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(1, templateId2, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(1, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now(), false)
+ ),
+ 1,
+ "given multiple jobs with same indexInBulk, then job with lowest templateId is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(1, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now(), false),
+ () -> createNewJob(2, templateId2, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusSeconds(1), false)
+ ),
+ 0,
+ "given multiple jobs with different indexInBulk and different templateId, then job with lowest indexInBulk is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(5, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(2), false),
+ () -> createNewJob(1, templateId1, "userId", PENDING_RESOURCE, "123", LocalDateTime.now(), false)
+ ),
+ -1,
+ "given there is already taken job with same templateId, then no job is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(2, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(2), false),
+ () -> createNewJob(1, templateId1, "userId", PENDING_RESOURCE, "123", LocalDateTime.now(), false),
+ () -> createNewJob(9, templateId2, "userId", PENDING_RESOURCE, null, LocalDateTime.now(), false),
+ () -> createNewJob(8, templateId2, "userId", PENDING_RESOURCE, null, LocalDateTime.now(), false)
+ ),
+ 3,
+ "given 4 jobs, 2 jobs templateId1 but one of them is taken, and 2 jobs with templateId2, then select job with templateId2"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(5, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(1), false),
+ () -> createNewJob(1, templateId1, "userId", PENDING_RESOURCE, "123", LocalDateTime.now(), true)
+ ),
+ 0,
+ "given 2 jobs with same templateId, one of them is taken but deleted, then the other job is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(5, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(1), false),
+ () -> createNewJob(1, templateId1, "userId", IN_PROGRESS, null, LocalDateTime.now(), false)
+ ),
+ -1,
+ "given 2 jobs with same templateId, one of them is IN_PROGRESS, then no job is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(5, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(1), false),
+ () -> createNewJob(1, templateId1, "userId", RESOURCE_IN_PROGRESS, null, LocalDateTime.now(), false)
+ ),
+ -1,
+ "given 2 jobs with same templateId, one of them is RESOURCE_IN_PROGRESS, then no job is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(6, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(2), false),
+ () -> createNewJob(5, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(1), false),
+ () -> createNewJob(1, templateId1, "userId", RESOURCE_IN_PROGRESS, null, LocalDateTime.now(), true)
+ ),
+ 1,
+ "given 3 jobs with same templateId, one of them is RESOURCE_IN_PROGRESS but deleted, then other job with lowest indexInBulk is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(6, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(2), false),
+ () -> createNewJob(5, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(1), false),
+ () -> createNewJob(1, templateId1, "userId", RESOURCE_IN_PROGRESS, null, LocalDateTime.now(), false),
+ () -> createNewJob(12, templateId2, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(2), false),
+ () -> createNewJob(11, templateId2, "userId", PENDING_RESOURCE, null, LocalDateTime.now(), false)
+ ),
+ 4,
+ "given 5 jobs, 3 with templateId1 that one of them is RESOURCE_IN_PROGRESS,"+
+ "2 with templateId2 both in PENDING_RESOURCE, then job with lowest indexInBulk from templateId2 is selected"
+
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(6, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(2), true)
+ ),
+ -1,
+ "given 1 job in PENDING_RESOURCE but it's deleted, then no job is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(20, templateId1, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(1, templateId1, "userId", CREATING, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(2, templateId1, "userId", COMPLETED, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(3, templateId1, "userId", FAILED, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(4, templateId1, "userId", COMPLETED_WITH_ERRORS, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(5, templateId1, "userId", STOPPED, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(6, templateId1, "userId", PAUSE, null, LocalDateTime.now().minusSeconds(1), false)
+ ),
+ 0,
+ "given multiple jobs with same templateId, 1 in PENDING_RESOURCE, and other are not in progress, "+
+ "then the job in PENDING_RESOURCE is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(1, UUID.randomUUID(), "userId", CREATING, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(2, UUID.randomUUID(), "userId", COMPLETED, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(3, UUID.randomUUID(), "userId", FAILED, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(4, UUID.randomUUID(), "userId", COMPLETED_WITH_ERRORS, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(5, UUID.randomUUID(), "userId", IN_PROGRESS, null, LocalDateTime.now().minusSeconds(1), false),
+ () -> createNewJob(6, UUID.randomUUID(), "userId", RESOURCE_IN_PROGRESS, null, LocalDateTime.now().minusSeconds(1), false)
+ ),
+ -1,
+ "given there is no job in PENDING_RESOURCE state, then no job is selected"
+ },
+ {ImmutableList.of( (Jobber)
+ () -> createNewJob(6, null, "userId", PENDING_RESOURCE, null, LocalDateTime.now().minusMinutes(2), false)
+ ),
+ -1,
+ "given there is 1 job in PENDING_RESOURCE but without templateId, then no job is selected"
+ },
+ };
+ }
+
+ @Test(dataProvider = "jobsForTestingPendingResource")
+ public void givenSomeJobs_pullPendingResource_returnNextOrNothingAsExpected(List<Jobber> jobbers, int expectedIndexSelected, String assertionReason) {
+ givenSomeJobs_pullNextJob_returnNextOrNothingAsExpected(jobbers, 1, expectedIndexSelected, PENDING_RESOURCE, assertionReason);
+ }
+
+ public static JobDaoImpl createNewJob(Job.JobStatus status, String takenBy, long secondsOffset, boolean deleted) {
+ return createNewJob(1, UUID.randomUUID(), "af456", status, takenBy, LocalDateTime.now().minusSeconds(secondsOffset), deleted);
+ }
+
+ @Test
+ public void givenSomeJobs_deleteOldFinalJobs_onlyExpectedJobsAreDeleted() {
+ long seconds = 999;
+ final List<Pair<JobDaoImpl,Boolean>> jobs = ImmutableList.of(
+ //not final
+ Pair.of(createNewJob(IN_PROGRESS, null, seconds+1, false), true),
+ Pair.of(createNewJob(RESOURCE_IN_PROGRESS, null, seconds+1, false), true),
+ Pair.of(createNewJob(PENDING, null, seconds+1, false), true),
+ Pair.of(createNewJob(CREATING, null, seconds+1, false), true),
+ Pair.of(createNewJob(PENDING_RESOURCE, null, seconds+1, false), true),
+ Pair.of(createNewJob(PAUSE, null, seconds+1, false), true),
+
+ //final
+ Pair.of(createNewJob(COMPLETED, null, seconds+1, false), false),
+ Pair.of(createNewJob(FAILED, null, seconds+1, false), false),
+ Pair.of(createNewJob(STOPPED, null, seconds+1, false), false),
+ Pair.of(createNewJob(COMPLETED_WITH_ERRORS, null, seconds+1, true), false),
+ Pair.of(createNewJob(COMPLETED_WITH_NO_ACTION, generateRandomAlphaNumeric(5), seconds+1, true), false),
+
+ //final but not old
+ Pair.of(createNewJob(COMPLETED, generateRandomAlphaNumeric(5), seconds-2, false), true),
+ Pair.of(createNewJob(COMPLETED, generateRandomAlphaNumeric(5), seconds-400, false), true),
+ Pair.of(createNewJob(COMPLETED, generateRandomAlphaNumeric(5), 0, false), true)
+ );
+ addJobsWithModifiedDateByJobDao(jobs.stream().map(Pair::getLeft).collect(Collectors.toList()), broker);
+ assertEquals(jobs.size(), broker.peek().size());
+
+ broker.deleteOldFinalJobs(seconds);
+ Stream<Pair<UUID, Job.JobStatus>> expectedJobs = jobs.stream()
+ .filter(Pair::getRight)
+ .map(x -> Pair.of(
+ x.getLeft().getUuid(),
+ x.getLeft().getStatus()
+ ));
+ assertThat(broker.peek().stream().map(x->Pair.of(x.getUuid(), x.getStatus())).collect(Collectors.toList()),
+ containsInAnyOrder(expectedJobs.toArray()));
+ }
+
@DataProvider
public Object[][] topics() {
return Arrays.stream(Job.JobStatus.values())
- .filter(not(t -> ImmutableList.of(PENDING, IN_PROGRESS, CREATING, RESOURCE_IN_PROGRESS).contains(t)))
+ .filter(not(t -> ImmutableList.of(PENDING, IN_PROGRESS, CREATING, RESOURCE_IN_PROGRESS, PENDING_RESOURCE).contains(t)))
.map(v -> new Object[]{v}).collect(toList()).toArray(new Object[][]{});
}
@@ -660,7 +896,7 @@
}
@Test(dataProvider = "jobStatusesForSuccessDelete", expectedExceptions = NoJobException.class)
- public void givenOneJob_deleteIt_canPeekOnItButCantPull(Job.JobStatus status) {
+ public void givenOneJob_deleteIt_canPeekOnItButCantPull(Job.JobStatus status) {
final Job job = waitForFutureJob(newJobAsync(broker, status));
broker.delete(job.getUuid());
assertNotNull(((JobDaoImpl) broker.peek(job.getUuid())).getDeletedAt(), "job should be deleted");
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/PortDetailsTranslatorTest.java b/vid-app-common/src/test/java/org/onap/vid/services/PortDetailsTranslatorTest.java
index 117e444..33b8c7e 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/PortDetailsTranslatorTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/PortDetailsTranslatorTest.java
@@ -53,7 +53,7 @@
" {" +
" \"id\": \"4876980240\"," +
" \"node-type\": \"l-interface\"," +
- " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
+ " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
" \"properties\": {" +
" \"interface-name\": \"zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
" \"selflink\": \"https://network-aic.rdm5b.cci.att.com:9696/v2.0/ports/6de7bf87-6faa-4984-9492-18d1188b3d4a\"," +
@@ -89,7 +89,7 @@
" {" +
" \"id\": \"4876980240\"," +
" \"node-type\": \"l-interface\"," +
- " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
+ " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
" \"properties\": {" +
" \"interface-name\": null," +
" \"selflink\": \"https://network-aic.rdm5b.cci.att.com:9696/v2.0/ports/6de7bf87-6faa-4984-9492-18d1188b3d4a\"," +
@@ -122,7 +122,7 @@
" {" +
" \"id\": \"4876980240\"," +
" \"node-type\": \"l-interface\"," +
- " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
+ " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
" \"properties\": {" +
" \"interface-name\": \"zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
" \"selflink\": \"https://network-aic.rdm5b.cci.att.com:9696/v2.0/ports/6de7bf87-6faa-4984-9492-18d1188b3d4a\"," +
@@ -155,7 +155,7 @@
" {" +
" \"id\": \"4876980240\"," +
" \"node-type\": \"l-interface\"," +
- " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
+ " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
" \"properties\": {" +
" \"interface-name\": \"\"," +
" \"selflink\": \"https://network-aic.rdm5b.cci.att.com:9696/v2.0/ports/6de7bf87-6faa-4984-9492-18d1188b3d4a\"," +
@@ -188,7 +188,7 @@
" {" +
" \"id\": \"4876980240\"," +
" \"node-type\": \"l-interface\"," +
- " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/att-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
+ " \"url\": \"/aai/v12/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/rdm5b/tenants/tenant/460f35aeb53542dc9f77105066483e83/vservers/vserver/15e46e2f-4b98-4e06-9644-f0e6e35cc79a/l-interfaces/l-interface/zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
" \"properties\": {" +
" \"interface-name\": \"zrdm5bfprbVLBA005-vlbagent_aff_int_pktmirror_1_port-dr5jhyxva5ib\"," +
" \"selflink\": \"https://network-aic.rdm5b.cci.att.com:9696/v2.0/ports/6de7bf87-6faa-4984-9492-18d1188b3d4a\"," +
diff --git a/vid-app-common/src/test/java/org/onap/vid/services/RoleGenaratorServiceImplTest.java b/vid-app-common/src/test/java/org/onap/vid/services/RoleGenaratorServiceImplTest.java
index 2ad68dd..2bf73ee 100644
--- a/vid-app-common/src/test/java/org/onap/vid/services/RoleGenaratorServiceImplTest.java
+++ b/vid-app-common/src/test/java/org/onap/vid/services/RoleGenaratorServiceImplTest.java
@@ -75,7 +75,7 @@
ServiceSubscription serviceSubscription = createServiceSubscription();
AaiResponse<Services> subscriberResponse = createServicesAaiResponse(serviceSubscription);
- doReturn(subscriberResponse).when(aaiClientInterface).getSubscriberData(subscriber.globalCustomerId);
+ doReturn(subscriberResponse).when(aaiClientInterface).getSubscriberData(subscriber.globalCustomerId,false);
String result = testSubject.generateRoleScript(firstRun);
Assert.assertTrue(StringUtils.isNotBlank(result));
@@ -91,7 +91,7 @@
ServiceSubscription serviceSubscription = createServiceSubscription();
AaiResponse<Services> subscriberResponse = createServicesAaiResponse(serviceSubscription);
- doReturn(subscriberResponse).when(aaiClientInterface).getSubscriberData(subscriber.globalCustomerId);
+ doReturn(subscriberResponse).when(aaiClientInterface).getSubscriberData(subscriber.globalCustomerId, false);
String result = testSubject.generateRoleScript(firstRun);
Assert.assertTrue(StringUtils.isNotBlank(result));
diff --git a/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java b/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java
index 756d175..5fc5832 100644
--- a/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java
+++ b/vid-app-common/src/test/java/org/onap/vid/testUtils/TestUtils.java
@@ -20,10 +20,14 @@
package org.onap.vid.testUtils;
+import static com.fasterxml.jackson.module.kotlin.ExtensionsKt.jacksonObjectMapper;
import static java.util.function.Function.identity;
import static java.util.stream.Collectors.toList;
import static java.util.stream.Collectors.toMap;
import static org.apache.commons.beanutils.PropertyUtils.getPropertyDescriptors;
+import static org.apache.commons.lang3.RandomStringUtils.randomAlphabetic;
+import static org.apache.commons.text.CharacterPredicates.DIGITS;
+import static org.apache.commons.text.CharacterPredicates.LETTERS;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.RETURNS_DEFAULTS;
import static org.mockito.Mockito.mock;
@@ -33,6 +37,7 @@
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
+import com.google.code.beanmatchers.BeanMatchers;
import com.google.common.collect.ImmutableList;
import java.beans.PropertyDescriptor;
import java.io.ByteArrayInputStream;
@@ -50,7 +55,9 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.apache.commons.beanutils.BeanUtils;
+import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.reflect.MethodUtils;
+import org.apache.commons.text.RandomStringGenerator;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.json.JSONArray;
@@ -62,8 +69,9 @@
import org.mockito.stubbing.Answer;
import org.onap.portalsdk.core.util.SystemProperties;
import org.onap.vid.asdc.beans.Service;
+import org.onap.vid.mso.model.CloudConfiguration;
import org.springframework.core.env.Environment;
-import org.springframework.mock.env.MockEnvironment;
+import org.testng.annotations.DataProvider;
/**
* Created by Oren on 6/7/17.
@@ -127,13 +135,22 @@
return readJsonResourceFileAsObject(pathInResource, valueType, false);
}
- public static <T> T readJsonResourceFileAsObject(String pathInResource, Class<T> valueType, boolean ignoreUnknownProperties)
- throws IOException {
- ObjectMapper objectMapper = new ObjectMapper();
- objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, ignoreUnknownProperties);
+ public static <T> T readJsonResourceFileAsObject(String pathInResource, Class<T> valueType,
+ boolean failOnUnknownProperties)
+ throws IOException {
+ ObjectMapper objectMapper = jacksonObjectMapper()
+ .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, failOnUnknownProperties);
return objectMapper.readValue(
- TestUtils.class.getResource(pathInResource),
- valueType);
+ TestUtils.class.getResource(pathInResource),
+ valueType);
+ }
+
+ public static String readFileAsString(String pathInResource) {
+ try {
+ return IOUtils.toString(TestUtils.class.getResource(pathInResource), "UTF-8");
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
}
public static String[] allPropertiesOf(Class<?> aClass) {
@@ -169,6 +186,12 @@
}
}
+ public static void registerCloudConfigurationValueGenerator() {
+ BeanMatchers.registerValueGenerator(() -> new CloudConfiguration(
+ randomAlphabetic(7), randomAlphabetic(7), randomAlphabetic(7)
+ ), CloudConfiguration.class);
+ }
+
public static class JavaxRsClientMocks {
private final javax.ws.rs.client.Client fakeClient;
@@ -277,4 +300,18 @@
}
}
+ private static RandomStringGenerator generator = new RandomStringGenerator.Builder()
+ .withinRange('0', 'z')
+ .filteredBy(LETTERS, DIGITS)
+ .build();
+
+ public static String generateRandomAlphaNumeric(int length) {
+ return generator.generate(length);
+ }
+
+ @DataProvider
+ public static Object[][] trueAndFalse() {
+ return new Object[][]{{true}, {false}};
+ }
+
}
diff --git a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
index 9cb5208..bfd7ef9 100644
--- a/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
+++ b/vid-app-common/src/test/resources/WEB-INF/conf/system.properties
@@ -1,23 +1,4 @@
-# Properties read by ECOMP Core library, epsdk-core.jar
-
-##########################################################################
-# The following properties should NOT be changed by partner applications.
-##########################################################################
-
-application_user_id = 30000
-post_default_role_id = 16
-clustered = true
-
-#Enable Fusion Mobile capabilities for the application
-mobile_enable = false
-
-# Cache config file is needed on the classpath
-cache_config_file_path = /WEB-INF/classes/cache.ccf
-cache_switch = 199
-cache_load_on_startup = false
-
-user_name = fullName
-decryption_key = AGLDdG4D04BKm2IxIWEr8o==
+#DB Info
#db.userName=XXXX
#db.password=XXXX
#db.connectionURL=jdbc:oracle:thin:@XXXX/XX
@@ -63,6 +44,21 @@
#business_direct_menu_attribute_name = businessDirectMenuData
application_name = Virtual Infrastructure Deployment
+application_user_id = 30000
+post_default_role_id = 16
+clustered = true
+
+#Enable Fusion Mobile capabilities for the application
+mobile_enable = false
+
+# Cache config file is needed on the classpath
+cache_config_file_path = /WEB-INF/classes/cache.ccf
+cache_switch = 199
+cache_load_on_startup = false
+
+user_name = fullName
+
+decryption_key = AGLDdG4D04BKm2IxIWEr8o==
#element map files
@@ -113,7 +109,7 @@
camunda_cockpit_link = https://cloopwf.client.research.att.com:8443/camunda/app/cockpit/default/#/dashboard
# An Unique 128-bit value defined to identify a specific version
# of an application deployed on a specific virtual machine.
-# This value must be generated and updated by the application
+# This value must be generated and updated by the application
# which is using the ECOMP SDK at the time of its deployment.
# Online Unique UUID generator - https://www.uuidgenerator.net/
instance_uuid=8da691c9-987d-43ed-a358-00ac2f35685d
@@ -129,6 +125,19 @@
#ueb_app_key = sYH0NJnsKmJC1B2A
#ueb_app_secret = YOtknsT2wVFz9WISlSPDaAtd
+
+#Policy related properties
+#simulator
+policy.server.url=http://localhost:8080/pdp
+policy.get.config=/api/getConfig
+policy.ClientAuth=
+policy.client.mechId=
+policy.client.password=
+policy.username=
+policy.password=
+policy.Authorization=
+policy.environment=
+
#MSO related properties
#simulator
#mso.server.url=http://localhost:8089
@@ -145,47 +154,55 @@
mso.max.polls=10
mso.user.name=infraportal
mso.password.x=OBF:1ghz1kfx1j1w1m7w1i271e8q1eas1hzj1m4i1iyy1kch1gdz
-mso.restapi.svc.instance=/serviceInstances/v5
-mso.restapi.svc.instance.deleteAndUnassign=/serviceInstantiation/v5/serviceInstances
-mso.restapi.vnf.instance=/serviceInstances/v5/<service_instance_id>/vnfs
-mso.restapi.vnf.changemanagement.instance=/serviceInstances/v5/<service_instance_id>/vnfs/<vnf_instance_id>/<request_type>
-mso.restapi.network.instance=/serviceInstances/v5/<service_instance_id>/networks
-mso.restapi.vf.module.instance=/serviceInstances/v7/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules
+mso.restapi.svc.instance=/serviceInstances/v7
+mso.restapi.svc.instance.deleteAndUnassign=/serviceInstantiation/v7/serviceInstances
+mso.restapi.vnf.instance=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances/<service_instance_id>/vnfs
+mso.restapi.vnf.changemanagement.instance=/serviceInstances/v7/<service_instance_id>/vnfs/<vnf_instance_id>/<request_type>
+mso.restapi.network.instance=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances/<service_instance_id>/networks
mso.restapi.vf.module.scaleout=/serviceInstantiation/v7/serviceInstances/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules/scaleOut
+mso.restapi.vf.module.instance=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances/<service_instance_id>/vnfs/<vnf_instance_id>/vfModules
mso.restapi.workflow.invoke=/instanceManagement/v1/serviceInstances/<service_instance_id>/vnfs/<vnf_instance_id>/workflows/<workflow_UUID>
-mso.restapi.volume.group.instance=/serviceInstances/v5/<service_instance_id>/vnfs/<vnf_instance_id>/volumeGroups
-mso.restapi.instance.group=/serviceInstantiation/v7/instanceGroups
-mso.restapi.get.orc.req=/orchestrationRequests/v5
-mso.restapi.get.orc.reqs=/orchestrationRequests/v5?
+mso.restapi.volume.group.instance=/serviceInstances/v7/<service_instance_id>/vnfs/<vnf_instance_id>/volumeGroups
+mso.restapi.instance.group=${mso.restapi.serviceInstantiationApiRoot}/instanceGroups
+mso.restapi.get.orc.req=/orchestrationRequests/v7
+mso.restapi.get.orc.reqs=/orchestrationRequests/v7?
+mso.restapi.resume.orc.req=/orchestrationRequests/v7/<request_id>/resume
mso.restapi.get.man.tasks=/tasks/v1
mso.restapi.configurations=/serviceInstances/v6/<service_instance_id>/configurations
mso.restapi.configuration.instance=${mso.restapi.configurations}<configuration_id>
-
-mso.restapi.operationalEnvironment.activate=${mso.restapi.operationalEnvironment}/activate
-mso.restapi.operationalEnvironment=${mso.restapi.cloudResourcesApiRoot}/operationalEnvironments/<operational_environment_id>
-mso.restapi.cloudResourcesApiRoot=/cloudResources/v1
-mso.restapi.cloudResourcesRequestsApiRoot=/cloudResourcesRequests/v1
-mso.restapi.operationalEnvironment.cloudResourcesRequests.status=${mso.restapi.cloudResourcesRequestsApiRoot}?requestId=<request_id>
-mso.restapi.operationalEnvironment.deactivate=${mso.restapi.operationalEnvironment}/deactivate
-mso.restapi.operationalEnvironment.create=${mso.restapi.cloudResourcesApiRoot}/operationalEnvironments
+mso.restapi.changeManagement.workflowSpecifications=/workflowSpecifications/v1/workflows?vnfModelVersionId=<model_version_id>
mso.restapi.serviceInstantiationApiRoot=/serviceInstantiation/v7
mso.restapi.serviceInstanceCreate=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances
mso.restapi.serviceInstanceAssign=${mso.restapi.serviceInstantiationApiRoot}/serviceInstances/assign
-mso.restapi.changeManagement.workflowSpecifications=/workflowSpecifications/v1/workflows?vnfModelVersionId=<model_version_id>
+
+mso.restapi.cloudResourcesApiRoot=/cloudResources/v1
+mso.restapi.operationalEnvironment=${mso.restapi.cloudResourcesApiRoot}/operationalEnvironments/<operational_environment_id>
+
+mso.restapi.operationalEnvironment.activate=${mso.restapi.operationalEnvironment}/activate
+mso.restapi.operationalEnvironment.deactivate=${mso.restapi.operationalEnvironment}/deactivate
+mso.restapi.operationalEnvironment.create=${mso.restapi.cloudResourcesApiRoot}/operationalEnvironments
+
+mso.restapi.cloudResourcesRequestsApiRoot=/cloudResourcesRequests/v1
+mso.restapi.operationalEnvironment.cloudResourcesRequests.status=${mso.restapi.cloudResourcesRequestsApiRoot}?requestId=<request_id>
vid.truststore.filename=/opt/app/vid/etc/vid_keystore.jks
mso.dme2.client.timeout=30000
mso.dme2.client.read.timeout=120000
-scheduler.server.url=
+
+scheduler.server.url=http://localhost:8080/vidSimulator/scheduler
+
+##scheduler authentication credentials
+scheduler.user.name=test1
+scheduler.password=test2
+
scheduler.create.new.vnf.change.instance=/v1/ChangeManagement/schedules/
+scheduler.submit.new.vnf.change=/v1/ChangeManagement/schedules/{scheduleId}/approvals
+scheduler.delete.schedule=/v1/ChangeManagement/schedules/%s
scheduler.get.time.slots=/v1/ChangeManagement/schedules/
scheduler.get.schedules=/v1/ChangeManagement/schedules/scheduleDetails/
-
-#vid.truststore.filename=/Users/Oren/Downloads/vid_keystore2.jks
-
vid.truststore.passwd.x=OBF:1wgg1wfq1uus1uui1x131x0r1x1v1x1j1uvo1uve1wg81wfi
#mso.dme2.server.url=http://mso-api-handler-anap-v1.mso.ecomp.att.com/services/ecomp/mso?
mso.dme2.server.url=http://mso-api-handler-anap-v1.mso.ecomp.att.com/services/ecomp/mso?version=1607&envContext=TEST&routeOffer=st_mtsnj
@@ -203,3 +220,8 @@
# Only required for applications using WebJunction or FE/BE separation. For example:
# app_base_url = https://www.e-access.att.com/app_junction/app_context/
+vid.asyncJob.howLongToKeepOldJobsInDays=7
+
+# thread definition - count and timeout (in seconds)
+vid.thread.count=50
+vid.thread.timeout=30
diff --git a/vid-app-common/src/test/resources/cr-csar.JSON b/vid-app-common/src/test/resources/cr-csar.JSON
index b712cc7..97b39b2 100644
--- a/vid-app-common/src/test/resources/cr-csar.JSON
+++ b/vid-app-common/src/test/resources/cr-csar.JSON
@@ -21,7 +21,7 @@
"networks": {
},
- "collectionResource": {
+ "collectionResources": {
"MSO_Example 0": {
"uuid": "4f8068d9-fb13-49fc-9e39-634d2094b659",
"invariantUuid": "2fc1b3b8-b8ed-413e-add8-3d903cf2b458",
@@ -75,5 +75,8 @@
"pnfs": {
},
- "vnfGroups": {}
+ "vnfGroups": {},
+ "vrfs": {
+
+ }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/csars/1712_PASQUALE.zip b/vid-app-common/src/test/resources/csars/1712_PASQUALE.zip
new file mode 100644
index 0000000..bbfbd23
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/1712_PASQUALE.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/csarTransportWithPnfs.zip b/vid-app-common/src/test/resources/csars/csarTransportWithPnfs.zip
new file mode 100644
index 0000000..33225f9
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/csarTransportWithPnfs.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-AmpPhSvc-csar.zip b/vid-app-common/src/test/resources/csars/service-AmpPhSvc-csar.zip
new file mode 100644
index 0000000..d8969d6
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-AmpPhSvc-csar.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-Infravpn-csar.zip b/vid-app-common/src/test/resources/csars/service-Infravpn-csar.zip
new file mode 100644
index 0000000..403aacc
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-Infravpn-csar.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-JennyVtsbcVlanSvc-csar.zip b/vid-app-common/src/test/resources/csars/service-JennyVtsbcVlanSvc-csar.zip
new file mode 100644
index 0000000..a04f6db
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-JennyVtsbcVlanSvc-csar.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-MsoExampleService-csar.zip b/vid-app-common/src/test/resources/csars/service-MsoExampleService-csar.zip
new file mode 100644
index 0000000..83131de
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-MsoExampleService-csar.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-ServicecontainerContainsPprobe.zip b/vid-app-common/src/test/resources/csars/service-ServicecontainerContainsPprobe.zip
new file mode 100644
index 0000000..86b784b
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-ServicecontainerContainsPprobe.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-Servicecontainermultiplepprobes-csar.zip b/vid-app-common/src/test/resources/csars/service-Servicecontainermultiplepprobes-csar.zip
new file mode 100644
index 0000000..7882b64
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-Servicecontainermultiplepprobes-csar.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-VdorotheaSrv-csar.zip b/vid-app-common/src/test/resources/csars/service-VdorotheaSrv-csar.zip
new file mode 100644
index 0000000..5c5ee0f
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-VdorotheaSrv-csar.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-fabric-configuration.zip b/vid-app-common/src/test/resources/csars/service-fabric-configuration.zip
new file mode 100644
index 0000000..c53e4f7
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-fabric-configuration.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-vf-csar.zip b/vid-app-common/src/test/resources/csars/service-vf-csar.zip
new file mode 100644
index 0000000..05d4fd3
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-vf-csar.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-vf-with-annotations.zip b/vid-app-common/src/test/resources/csars/service-vf-with-annotations.zip
new file mode 100644
index 0000000..7473eeb
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-vf-with-annotations.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-vl-csar.zip b/vid-app-common/src/test/resources/csars/service-vl-csar.zip
new file mode 100644
index 0000000..220e02f
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-vl-csar.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/service-vnf-grouping-csar.zip b/vid-app-common/src/test/resources/csars/service-vnf-grouping-csar.zip
new file mode 100644
index 0000000..7f93dc8
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/service-vnf-grouping-csar.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/csars/vLoadBalancerMS-with-policy.TOSCA.zip b/vid-app-common/src/test/resources/csars/vLoadBalancerMS-with-policy.TOSCA.zip
new file mode 100644
index 0000000..da749d2
--- /dev/null
+++ b/vid-app-common/src/test/resources/csars/vLoadBalancerMS-with-policy.TOSCA.zip
Binary files differ
diff --git a/vid-app-common/src/test/resources/fabric-configuration.json b/vid-app-common/src/test/resources/fabric-configuration.json
index ff17ca0..cb44073 100644
--- a/vid-app-common/src/test/resources/fabric-configuration.json
+++ b/vid-app-common/src/test/resources/fabric-configuration.json
@@ -2,13 +2,13 @@
"service": {
"uuid": "12344bb4-a416-4b4e-997e-0059973630b9",
"invariantUuid": "12343f9e-3244-4d8f-a8e0-0e5d7a29eda9",
- "name": "ADIOD vMX vPE_BV Service 488",
+ "name": "PASQUALE vMX vPE_BV Service 488",
"version": "1.0",
"toscaModelURL": null,
"category": "Network L1-3",
"serviceType": "",
"serviceRole": "",
- "description": "ADIOD vMX vPE based on Juniper 17.2 release. Updated with updated VF for v8.0 of VLM",
+ "description": "PASQUALE vMX vPE based on Juniper 17.2 release. Updated with updated VF for v8.0 of VLM",
"serviceEcompNaming": "true",
"instantiationType": "ClientConfig",
"inputs": {
@@ -21,7 +21,7 @@
"networks": {
},
- "collectionResource": {},
+ "collectionResources": {},
"configurations": {
},
@@ -48,5 +48,8 @@
"pnfs": {
},
- "vnfGroups": {}
+ "vnfGroups": {},
+ "vrfs": {
+
+ }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/fabric-real-sriov-configuration.json b/vid-app-common/src/test/resources/fabric-real-sriov-configuration.json
index d6efc28..1b20c31 100644
--- a/vid-app-common/src/test/resources/fabric-real-sriov-configuration.json
+++ b/vid-app-common/src/test/resources/fabric-real-sriov-configuration.json
@@ -21,7 +21,7 @@
"networks": {
},
- "collectionResource": {},
+ "collectionResources": {},
"configurations": {
},
diff --git a/vid-app-common/src/test/resources/getTopology/network.json b/vid-app-common/src/test/resources/getTopology/network.json
new file mode 100644
index 0000000..ba9cf5c
--- /dev/null
+++ b/vid-app-common/src/test/resources/getTopology/network.json
@@ -0,0 +1,79 @@
+{
+ "network-id": "94c86b39-bbbf-4027-8120-ff37c6d2493a",
+ "network-name": "AUK51a_oam_calea_net_1",
+ "network-type": "SR-IOV-PROVIDER2-1",
+ "network-role": "oam_calea_net_1",
+ "network-technology": "STANDARD-SR-IOV",
+ "is-bound-to-vpn": false,
+ "resource-version": "1540925016770",
+ "orchestration-status": "Assigned",
+ "model-invariant-id": "b9a9b549-0ee4-49fc-b4f2-5edc6701da68",
+ "model-version-id": "77010093-df36-4dcb-8428-c3d02bf3f88d",
+ "model-customization-id": "e5f33853-f84c-4cdd-99f2-93846957aa18",
+ "physical-network-name": "sriovnet1",
+ "is-provider-network": true,
+ "is-shared-network": true,
+ "is-external-network": false,
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/4b7cc8d1-f8ec-4461-ac43-5805e4ca3126/service-data/networks/network/94c86b39-bbbf-4027-8120-ff37c6d2493a/network-data/network-topology/",
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v14/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Emanuel/service-instances/service-instance/4b7cc8d1-f8ec-4461-ac43-5805e4ca3126",
+ "relationship-data": [{
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
+ }, {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "Emanuel"
+ }, {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "4b7cc8d1-f8ec-4461-ac43-5805e4ca3126"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "AUK51a_oam_calea_net_service"
+ }
+ ]
+ }, {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-nc/auk51a/tenants/tenant/b530fc990b6d4334bd45518bebca6a51",
+ "relationship-data": [{
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-nc"
+ }, {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "auk51a"
+ }, {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "b530fc990b6d4334bd45518bebca6a51"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "tenant.tenant-name",
+ "property-value": "ecomp_ispt"
+ }
+ ]
+ }, {
+ "related-to": "cloud-region",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-nc/auk51a",
+ "relationship-data": [{
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "att-nc"
+ }, {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "auk51a"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "cloud-region.owner-defined-type",
+ "property-value": "lcp"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/vid-app-common/src/test/resources/getTopology/serviceWithCR/CR.json b/vid-app-common/src/test/resources/getTopology/serviceWithCR/CR.json
new file mode 100644
index 0000000..26d598c
--- /dev/null
+++ b/vid-app-common/src/test/resources/getTopology/serviceWithCR/CR.json
@@ -0,0 +1,62 @@
+{
+ "collection-id": "84a351ae-3601-45e2-98df-878d6c816abc",
+ "model-invariant-id": "081ceb56-eb71-4566-a72d-3e7cbee5cdf1",
+ "model-version-id": "ce8c98bc-4691-44fb-8ff0-7a47487c11c4",
+ "collection-name": "NcmVlanSvcYm161f_77_vTSBC Customer Landing Network Collection",
+ "collection-type": "L3-NETWORK",
+ "collection-role": "SUB_INTERFACE",
+ "collection-function": "vTSBC_function",
+ "orchestration-status": "Active",
+ "collection-customization-id": "bac6ffe5-c851-495f-a64a-28751400ff03",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v14/business/customers/customer/a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb/service-subscriptions/service-subscription/Emanuel/service-instances/service-instance/a565e6ad-75d1-4493-98f1-33234b5c17e2",
+ "relationship-data": [
+ {
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
+ },
+ {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "Emanuel"
+ },
+ {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "a565e6ad-75d1-4493-98f1-33234b5c17e2"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "NcmVlanSvcYm161f_77"
+ }
+ ]
+ },
+ {
+ "related-to": "instance-group",
+ "relationship-label": "org.onap.inventory.BelongsTo",
+ "related-link": "/aai/v14/network/instance-groups/instance-group/6b3536cf-3a12-457f-abb5-fa2203e0d923",
+ "relationship-data": [
+ {
+ "relationship-key": "instance-group.id",
+ "relationship-value": "6b3536cf-3a12-457f-abb5-fa2203e0d923"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "instance-group.description",
+ "property-value": "vTSBC Customer Landing Network Collection Desc"
+ },
+ {
+ "property-key": "instance-group.instance-group-name",
+ "property-value": "NcmVlanSvcYm161f_77_vTSBC Customer Landing Network Collection"
+ }
+ ]
+ }
+ ]
+ },
+ "resource-version": "1539158498209"
+}
diff --git a/vid-app-common/src/test/resources/getTopology/serviceWithCR/getTopologyWithCR.json b/vid-app-common/src/test/resources/getTopology/serviceWithCR/getTopologyWithCR.json
new file mode 100644
index 0000000..f038427
--- /dev/null
+++ b/vid-app-common/src/test/resources/getTopology/serviceWithCR/getTopologyWithCR.json
@@ -0,0 +1,95 @@
+{
+ "action": "None",
+ "instanceName": "NcmVlanSvcYm161f_77",
+ "instanceId": "a565e6ad-75d1-4493-98f1-33234b5c17e2",
+ "orchStatus": "Assigned",
+ "productFamilyId": null,
+ "lcpCloudRegionId": null,
+ "tenantId": null,
+ "cloudOwner": null,
+ "modelInfo": {
+ "modelInvariantId": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea",
+ "modelVersionId": "6e0bec91-09f3-43aa-9cf3-e617cd0146be",
+ "modelName": "NCM_VLAN_SVC_ym161f",
+ "modelType": "service",
+ "modelVersion": "8.0"
+ },
+ "globalSubscriberId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "subscriptionServiceType": "Emanuel",
+ "owningEntityId": null,
+ "owningEntityName": null,
+ "tenantName": null,
+ "aicZoneId": null,
+ "aicZoneName": null,
+ "projectName": null,
+ "rollbackOnFailure": null,
+ "isALaCarte": false,
+ "vnfs": {},
+ "networks": {},
+ "vrfs": {},
+ "vnfGroups": {},
+ "collectionResources": {
+ "84a351ae-3601-45e2-98df-878d6c816abc": {
+ "action": "None",
+ "instanceName": "NcmVlanSvcYm161f_77_vTSBC Customer Landing Network Collection",
+ "instanceId": "84a351ae-3601-45e2-98df-878d6c816abc",
+ "orchStatus": "Active",
+ "productFamilyId": null,
+ "lcpCloudRegionId": null,
+ "tenantId": null,
+ "cloudOwner": null,
+ "modelInfo": {
+ "modelInvariantId": "081ceb56-eb71-4566-a72d-3e7cbee5cdf1",
+ "modelVersionId": "ce8c98bc-4691-44fb-8ff0-7a47487c11c4",
+ "modelName": "NCM_VLAN_ym161f",
+ "modelType": "collection",
+ "modelVersion": "5.0"
+ },
+ "instanceType": null,
+ "provStatus": null,
+ "inMaint": false,
+ "uuid": "ce8c98bc-4691-44fb-8ff0-7a47487c11c4",
+ "originalName": "NCM_VLAN_ym161f 0",
+ "legacyRegion": null,
+ "lineOfBusiness": null,
+ "platformName": null,
+ "trackById": "84a351ae-3601-45e2-98df-878d6c816abc",
+ "ncfs": {
+ "6b3536cf-3a12-457f-abb5-fa2203e0d923": {
+ "action": "None",
+ "instanceName": "NcmVlanSvcYm161f_77_vTSBC Customer Landing Network Collection",
+ "instanceId": "6b3536cf-3a12-457f-abb5-fa2203e0d923",
+ "orchStatus": null,
+ "productFamilyId": null,
+ "lcpCloudRegionId": null,
+ "tenantId": null,
+ "cloudOwner": null,
+ "modelInfo": {
+ "modelInvariantId": "868b109c-9481-4a18-891b-af974db7705a",
+ "modelVersionId": "dd182d7d-6949-4b90-b3cc-5befe400742e",
+ "modelName": "ncm_vlan_ym161f..NetworkCollection..0",
+ "modelType": "instanceGroup",
+ "modelVersion": "1"
+ },
+ "instanceType": "L3-NETWORK",
+ "provStatus": null,
+ "inMaint": false,
+ "uuid": "dd182d7d-6949-4b90-b3cc-5befe400742e",
+ "originalName": "ncm_vlan_ym161f..NetworkCollection..0",
+ "legacyRegion": null,
+ "lineOfBusiness": null,
+ "platformName": null,
+ "trackById": "6b3536cf-3a12-457f-abb5-fa2203e0d923",
+ "instanceGroupRole": "SUB_INTERFACE",
+ "instanceGroupFunction": "vTSBC Customer Landing Network Collection",
+ "numberOfNetworks": 1
+ }
+ }
+ }
+ },
+ "validationCounter": 0,
+ "existingVNFCounterMap": {},
+ "existingNetworksCounterMap": {},
+ "existingVnfGroupCounterMap": {},
+ "existingVRFCounterMap": {}
+}
diff --git a/vid-app-common/src/test/resources/getTopology/serviceWithCR/instanceGroup-NCF.json b/vid-app-common/src/test/resources/getTopology/serviceWithCR/instanceGroup-NCF.json
new file mode 100644
index 0000000..8c4d3f2
--- /dev/null
+++ b/vid-app-common/src/test/resources/getTopology/serviceWithCR/instanceGroup-NCF.json
@@ -0,0 +1,43 @@
+{
+ "id": "6b3536cf-3a12-457f-abb5-fa2203e0d923",
+ "instance-group-role": "SUB_INTERFACE",
+ "model-invariant-id": "868b109c-9481-4a18-891b-af974db7705a",
+ "model-version-id": "dd182d7d-6949-4b90-b3cc-5befe400742e",
+ "description": "vTSBC Customer Landing Network Collection Desc",
+ "instance-group-type": "L3-NETWORK",
+ "resource-version": "1539158492730",
+ "instance-group-name": "NcmVlanSvcYm161f_77_vTSBC Customer Landing Network Collection",
+ "instance-group-function": "vTSBC Customer Landing Network Collection",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to-property": [
+ {
+ "property-value": "APPC-24595-T-IST-02AShared_cps_internal_net_1",
+ "property-key": "l3-network.network-name"
+ }
+ ],
+ "relationship-data": [
+ {
+ "relationship-value": "1fea0624-dac2-4997-904d-34ca1bc12fa9",
+ "relationship-key": "l3-network.network-id"
+ }
+ ],
+ "related-link": "/aai/v14/network/l3-networks/l3-network/1fea0624-dac2-4997-904d-34ca1bc12fa9",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-to": "l3-network"
+ },
+ {
+ "related-to": "collection",
+ "relationship-label": "org.onap.inventory.BelongsTo",
+ "related-link": "/aai/v14/network/collections/collection/84a351ae-3601-45e2-98df-878d6c816abc",
+ "relationship-data": [
+ {
+ "relationship-key": "collection.collection-id",
+ "relationship-value": "84a351ae-3601-45e2-98df-878d6c816abc"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/getTopology/serviceWithCR/service-design-and-creation.json b/vid-app-common/src/test/resources/getTopology/serviceWithCR/service-design-and-creation.json
new file mode 100644
index 0000000..d7bafeb
--- /dev/null
+++ b/vid-app-common/src/test/resources/getTopology/serviceWithCR/service-design-and-creation.json
@@ -0,0 +1,1057 @@
+{
+ "model": [
+ {
+ "model-invariant-id": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea",
+ "model-type": "service",
+ "resource-version": "1534274421300",
+ "model-vers": {
+ "model-ver": [
+ {
+ "model-version-id": "a92f899d-a3ec-465b-baed-1663b0a5aee1",
+ "model-name": "NCM_VLAN_SVC_ym161f",
+ "model-version": "3.0",
+ "distribution-status": "DISTRIBUTION_COMPLETE_OK",
+ "model-description": "Network Collection service for vLAN tagging",
+ "resource-version": "1534788756086",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "901e2641-c66c-4178-a6e8-cbe2877b0a2a",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534463243387",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "d2fda667-e92e-4cfa-9620-5da5de01a319",
+ "model-name": "NCM_VLAN_SVC_ym161f",
+ "model-version": "1.0",
+ "distribution-status": "DISTRIBUTION_COMPLETE_OK",
+ "model-description": "Network Collection service for vLAN tagging",
+ "resource-version": "1534444087221",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "d291ed5e-4f50-4f57-956d-ce0e67a059e5",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534274421311",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "d4a447e5-9791-47b9-b365-1abb19b4b626",
+ "model-name": "NCM_VLAN_SVC_ym161f",
+ "model-version": "4.0",
+ "model-description": "Network Collection service for vLAN tagging",
+ "resource-version": "1534863624237",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "0ef29f1f-836a-4fab-986c-5f1b96310a3d",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534863624242",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "0e97a118-b1b6-40d5-bbad-98cdd51b1c48",
+ "model-name": "NCM_VLAN_SVC_ym161f",
+ "model-version": "11.0",
+ "distribution-status": "DISTRIBUTION_COMPLETE_OK",
+ "model-description": "Network Collection service for vLAN tagging",
+ "resource-version": "1550783120267",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "0ea8ac21-64b8-4489-9d62-12e625d66995",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1543961990189",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "46093d8f-6dfa-4332-9c00-7e822c681b59",
+ "model-name": "NCM_VLAN_SVC_ym161f",
+ "model-version": "7.0",
+ "distribution-status": "DISTRIBUTION_COMPLETE_OK",
+ "model-description": "Network Collection service for vLAN tagging",
+ "resource-version": "1534885144462",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "d74a5dff-ef7f-4e32-9c13-d82fb2c617c9",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534885014144",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "12930bcc-5276-42bb-8ed6-1e43d7acae2c",
+ "model-name": "NCM_VLAN_SVC_ym161f",
+ "model-version": "10.0",
+ "distribution-status": "DISTRIBUTION_COMPLETE_OK",
+ "model-description": "Network Collection service for vLAN tagging",
+ "resource-version": "1539613511543",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "4d57798e-81b7-490e-bee8-48bd382a1349",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1539613450903",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "f8783bb2-6135-4c35-8320-64fa7deae76b",
+ "model-name": "NCM_VLAN_SVC_ym161f",
+ "model-version": "2.0",
+ "distribution-status": "DISTRIBUTION_COMPLETE_OK",
+ "model-description": "Network Collection service for vLAN tagging",
+ "resource-version": "1534450229751",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "c666f1dd-99ff-442a-9ba2-1ee2dabb9e25",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534450167963",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "0148e4c5-629b-4fef-9728-1e13fd630679",
+ "model-name": "NCM_VLAN_SVC_ym161f",
+ "model-version": "9.0",
+ "distribution-status": "DISTRIBUTION_COMPLETE_OK",
+ "model-description": "Network Collection service for vLAN tagging",
+ "resource-version": "1537901614540",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "6ae6fd91-2086-470d-8c36-9d668c41fd32",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1537882880185",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "1ceab842-7ded-49f1-a129-dce2ecef8c71",
+ "model-name": "NCM_VLAN_SVC_ym161f",
+ "model-version": "6.0",
+ "distribution-status": "DISTRIBUTION_COMPLETE_OK",
+ "model-description": "Network Collection service for vLAN tagging",
+ "resource-version": "1534883213652",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "5ca853fc-2984-45c7-b2e7-8514a56785ba",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534883154090",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "fd21f6b5-02f6-4ac0-9515-e1f01112da95",
+ "model-name": "NCM_VLAN_SVC_ym161f",
+ "model-version": "5.0",
+ "distribution-status": "DISTRIBUTION_COMPLETE_OK",
+ "model-description": "Network Collection service for vLAN tagging",
+ "resource-version": "1534872246413",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "0812b47d-7ef1-4a65-b6fb-9f3ff3bc3eee",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534872174141",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "6e0bec91-09f3-43aa-9cf3-e617cd0146be",
+ "model-name": "NCM_VLAN_SVC_ym161f",
+ "model-version": "8.0",
+ "distribution-status": "DISTRIBUTION_COMPLETE_OK",
+ "model-description": "Network Collection service for vLAN tagging",
+ "resource-version": "1536098608209",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "a0247d2e-3843-4753-be2f-4c252c99390e",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1536098548388",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/82194af1-3c2c-485a-8f44-420e22a9eaa4/model-vers/model-ver/46b92144-923a-4d20-b85a-3cbd847668a9",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "82194af1-3c2c-485a-8f44-420e22a9eaa4"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46b92144-923a-4d20-b85a-3cbd847668a9"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "service-instance"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-invariant-id": "868b109c-9481-4a18-891b-af974db7705a",
+ "model-type": "resource",
+ "resource-version": "1534795610752",
+ "model-vers": {
+ "model-ver": [
+ {
+ "model-version-id": "dd182d7d-6949-4b90-b3cc-5befe400742e",
+ "model-name": "ncm_vlan_ym161f..NetworkCollection..0",
+ "model-version": "1",
+ "distribution-status": "DISTRIBUTION_COMPLETE_OK",
+ "resource-version": "1534795610763"
+ },
+ {
+ "model-version-id": "e5fc56b7-e14c-45e5-b127-978c36a921c0",
+ "model-name": "ncm_vlan_ym161f..NetworkCollection..0",
+ "model-version": "1",
+ "resource-version": "1543961989136",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "9001ff96-1142-49c6-af5b-df4e2b23a305",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1543961989136",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/3bf1e610-45f7-4ad6-b833-ca4c5ee6a3fd/model-vers/model-ver/8e6ee9dc-9017-444a-83b3-219edb018128",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "3bf1e610-45f7-4ad6-b833-ca4c5ee6a3fd"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "8e6ee9dc-9017-444a-83b3-219edb018128"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "instance-group"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-element",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/081ceb56-eb71-4566-a72d-3e7cbee5cdf1/model-vers/model-ver/a580855f-8d1b-40d5-a75b-50709fbd17d3/model-elements/model-element/06014449-69d3-4aef-a96b-0a5130ba9483/model-elements/model-element/a050dc96-2c35-45c7-ba23-9279215d501e",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "081ceb56-eb71-4566-a72d-3e7cbee5cdf1"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "a580855f-8d1b-40d5-a75b-50709fbd17d3"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "06014449-69d3-4aef-a96b-0a5130ba9483"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "a050dc96-2c35-45c7-ba23-9279215d501e"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-invariant-id": "081ceb56-eb71-4566-a72d-3e7cbee5cdf1",
+ "model-type": "resource",
+ "resource-version": "1534788713816",
+ "model-vers": {
+ "model-ver": [
+ {
+ "model-version-id": "747d2a17-5771-4fd6-879d-c2e9e4c5cd4f",
+ "model-name": "NCM_VLAN_ym161f",
+ "model-version": "2.0",
+ "model-description": "Network Collection Service VF for VLAN TAgging",
+ "resource-version": "1534863623891",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "0dd28c63-cadf-48b2-afb0-a7bf7184ef5a",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534863623895",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/425b2158-e51d-4509-9945-dad4556474a3/model-vers/model-ver/2a160989-b202-47dd-874b-4a0f275998f7",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "425b2158-e51d-4509-9945-dad4556474a3"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "2a160989-b202-47dd-874b-4a0f275998f7"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "cloud-region"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-element",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/f6342be5-d66b-4d03-a1aa-c82c3094c4ea/model-vers/model-ver/d4a447e5-9791-47b9-b365-1abb19b4b626/model-elements/model-element/0ef29f1f-836a-4fab-986c-5f1b96310a3d/model-elements/model-element/700f890b-05c9-471a-b859-956655d28f47",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "d4a447e5-9791-47b9-b365-1abb19b4b626"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "0ef29f1f-836a-4fab-986c-5f1b96310a3d"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "700f890b-05c9-471a-b859-956655d28f47"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "a580855f-8d1b-40d5-a75b-50709fbd17d3",
+ "model-name": "NCM_VLAN_ym161f",
+ "model-version": "6.0",
+ "model-description": "Network Collection Service VF for VLAN TAgging",
+ "resource-version": "1543961989670",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "06014449-69d3-4aef-a96b-0a5130ba9483",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1543961989670",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/8bac3599-9a1c-4b7f-80e5-c1838f744c23/model-vers/model-ver/3f908abc-3a15-40d0-b674-2a639e52884d",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "8bac3599-9a1c-4b7f-80e5-c1838f744c23"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "3f908abc-3a15-40d0-b674-2a639e52884d"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "collection"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-element",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/f6342be5-d66b-4d03-a1aa-c82c3094c4ea/model-vers/model-ver/0e97a118-b1b6-40d5-bbad-98cdd51b1c48/model-elements/model-element/0ea8ac21-64b8-4489-9d62-12e625d66995/model-elements/model-element/d614653c-5f19-4668-ad98-cfbe012308e1",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "0e97a118-b1b6-40d5-bbad-98cdd51b1c48"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "0ea8ac21-64b8-4489-9d62-12e625d66995"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "d614653c-5f19-4668-ad98-cfbe012308e1"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "b84e2233-37bf-4c8d-b613-eb8a8820b725",
+ "model-name": "NCM_VLAN_ym161f",
+ "model-version": "4.0",
+ "model-description": "Network Collection Service VF for VLAN TAgging",
+ "resource-version": "1534883153714",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "f7c3f5bb-777a-4d9f-9401-a652f5006152",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534883153720",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/425b2158-e51d-4509-9945-dad4556474a3/model-vers/model-ver/2a160989-b202-47dd-874b-4a0f275998f7",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "425b2158-e51d-4509-9945-dad4556474a3"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "2a160989-b202-47dd-874b-4a0f275998f7"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "cloud-region"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-element",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/f6342be5-d66b-4d03-a1aa-c82c3094c4ea/model-vers/model-ver/1ceab842-7ded-49f1-a129-dce2ecef8c71/model-elements/model-element/5ca853fc-2984-45c7-b2e7-8514a56785ba/model-elements/model-element/030553aa-8d82-4b03-a3dc-bc210daadd5e",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "1ceab842-7ded-49f1-a129-dce2ecef8c71"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "5ca853fc-2984-45c7-b2e7-8514a56785ba"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "030553aa-8d82-4b03-a3dc-bc210daadd5e"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "5ededaad-905c-4356-b30d-471b0ae2a12a",
+ "model-name": "NCM_VLAN_ym161f",
+ "model-version": "3.0",
+ "model-description": "Network Collection Service VF for VLAN TAgging",
+ "resource-version": "1534872173817",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "31f558c6-d73a-43e4-aab0-c863ccd6b110",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534872173821",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/425b2158-e51d-4509-9945-dad4556474a3/model-vers/model-ver/2a160989-b202-47dd-874b-4a0f275998f7",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "425b2158-e51d-4509-9945-dad4556474a3"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "2a160989-b202-47dd-874b-4a0f275998f7"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "cloud-region"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-element",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/f6342be5-d66b-4d03-a1aa-c82c3094c4ea/model-vers/model-ver/fd21f6b5-02f6-4ac0-9515-e1f01112da95/model-elements/model-element/0812b47d-7ef1-4a65-b6fb-9f3ff3bc3eee/model-elements/model-element/110a5ba4-997b-45f0-8e53-d64d6b342be1",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "fd21f6b5-02f6-4ac0-9515-e1f01112da95"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "0812b47d-7ef1-4a65-b6fb-9f3ff3bc3eee"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "110a5ba4-997b-45f0-8e53-d64d6b342be1"
+ }
+ ]
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "67b91dcd-4fa5-4111-80c9-60d524740667",
+ "model-name": "NCM_VLAN_ym161f",
+ "model-version": "1.0",
+ "model-description": "Network Collection Service VF for VLAN TAgging",
+ "resource-version": "1534788713822",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "6fdf228e-89ce-4cf6-9bd7-399aa1b690b3",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534788713833",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/425b2158-e51d-4509-9945-dad4556474a3/model-vers/model-ver/2a160989-b202-47dd-874b-4a0f275998f7",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "425b2158-e51d-4509-9945-dad4556474a3"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "2a160989-b202-47dd-874b-4a0f275998f7"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "cloud-region"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ },
+ {
+ "model-version-id": "ce8c98bc-4691-44fb-8ff0-7a47487c11c4",
+ "model-name": "NCM_VLAN_ym161f",
+ "model-version": "5.0",
+ "model-description": "Network Collection Service VF for VLAN TAgging",
+ "resource-version": "1534885013739",
+ "model-elements": {
+ "model-element": [
+ {
+ "model-element-uuid": "4bd10473-a9de-4399-abe7-c9b24e48e0ee",
+ "new-data-del-flag": "T",
+ "cardinality": "unbounded",
+ "resource-version": "1534885013745",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-ver",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/425b2158-e51d-4509-9945-dad4556474a3/model-vers/model-ver/2a160989-b202-47dd-874b-4a0f275998f7",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "425b2158-e51d-4509-9945-dad4556474a3"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "2a160989-b202-47dd-874b-4a0f275998f7"
+ }
+ ],
+ "related-to-property": [
+ {
+ "property-key": "model-ver.model-name",
+ "property-value": "cloud-region"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ },
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "model-element",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/f6342be5-d66b-4d03-a1aa-c82c3094c4ea/model-vers/model-ver/12930bcc-5276-42bb-8ed6-1e43d7acae2c/model-elements/model-element/4d57798e-81b7-490e-bee8-48bd382a1349/model-elements/model-element/93eafb42-11b5-471d-8f8a-333408114a9a",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "12930bcc-5276-42bb-8ed6-1e43d7acae2c"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "4d57798e-81b7-490e-bee8-48bd382a1349"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "93eafb42-11b5-471d-8f8a-333408114a9a"
+ }
+ ]
+ },
+ {
+ "related-to": "model-element",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/f6342be5-d66b-4d03-a1aa-c82c3094c4ea/model-vers/model-ver/6e0bec91-09f3-43aa-9cf3-e617cd0146be/model-elements/model-element/a0247d2e-3843-4753-be2f-4c252c99390e/model-elements/model-element/cb986adf-5ca8-48a5-ac9b-b222d6d2e280",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "6e0bec91-09f3-43aa-9cf3-e617cd0146be"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "a0247d2e-3843-4753-be2f-4c252c99390e"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "cb986adf-5ca8-48a5-ac9b-b222d6d2e280"
+ }
+ ]
+ },
+ {
+ "related-to": "model-element",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/f6342be5-d66b-4d03-a1aa-c82c3094c4ea/model-vers/model-ver/0148e4c5-629b-4fef-9728-1e13fd630679/model-elements/model-element/6ae6fd91-2086-470d-8c36-9d668c41fd32/model-elements/model-element/a520808b-b8bc-4969-9eba-c85e2797f3dd",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "0148e4c5-629b-4fef-9728-1e13fd630679"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "6ae6fd91-2086-470d-8c36-9d668c41fd32"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "a520808b-b8bc-4969-9eba-c85e2797f3dd"
+ }
+ ]
+ },
+ {
+ "related-to": "model-element",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/ca26a7e6-064d-4e90-a5b9-32ffe819f826/model-vers/model-ver/e9a290ca-41f0-4117-a1b5-8b7cd5595ff7/model-elements/model-element/ff3fdeb9-24e9-406f-8761-1334c9ea29d1/model-elements/model-element/bc6ddc86-f948-4f47-a4e6-bededd8d5780",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "ca26a7e6-064d-4e90-a5b9-32ffe819f826"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "e9a290ca-41f0-4117-a1b5-8b7cd5595ff7"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "ff3fdeb9-24e9-406f-8761-1334c9ea29d1"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "bc6ddc86-f948-4f47-a4e6-bededd8d5780"
+ }
+ ]
+ },
+ {
+ "related-to": "model-element",
+ "relationship-label": "org.onap.relationships.inventory.IsA",
+ "related-link": "/aai/v14/service-design-and-creation/models/model/f6342be5-d66b-4d03-a1aa-c82c3094c4ea/model-vers/model-ver/46093d8f-6dfa-4332-9c00-7e822c681b59/model-elements/model-element/d74a5dff-ef7f-4e32-9c13-d82fb2c617c9/model-elements/model-element/f7bd32b4-bbbf-4788-9137-9dfa299e6111",
+ "relationship-data": [
+ {
+ "relationship-key": "model.model-invariant-id",
+ "relationship-value": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea"
+ },
+ {
+ "relationship-key": "model-ver.model-version-id",
+ "relationship-value": "46093d8f-6dfa-4332-9c00-7e822c681b59"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "d74a5dff-ef7f-4e32-9c13-d82fb2c617c9"
+ },
+ {
+ "relationship-key": "model-element.model-element-uuid",
+ "relationship-value": "f7bd32b4-bbbf-4788-9137-9dfa299e6111"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/vid-app-common/src/test/resources/getTopology/serviceWithCR/serviceWithCR.json b/vid-app-common/src/test/resources/getTopology/serviceWithCR/serviceWithCR.json
new file mode 100644
index 0000000..7b96729
--- /dev/null
+++ b/vid-app-common/src/test/resources/getTopology/serviceWithCR/serviceWithCR.json
@@ -0,0 +1,38 @@
+{
+ "service-instance-id": "a565e6ad-75d1-4493-98f1-33234b5c17e2",
+ "service-instance-name": "NcmVlanSvcYm161f_77",
+ "service-type": "INFRASTRUCTURE",
+ "environment-context": "General_Revenue-Bearing",
+ "workload-context": "Production",
+ "model-invariant-id": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea",
+ "model-version-id": "6e0bec91-09f3-43aa-9cf3-e617cd0146be",
+ "resource-version": "1539158502875",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/a565e6ad-75d1-4493-98f1-33234b5c17e2/service-data/service-topology/",
+ "orchestration-status": "Assigned",
+ "relationship-list": {
+ "relationship": [
+ {
+ "related-to": "collection",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v14/network/collections/collection/84a351ae-3601-45e2-98df-878d6c816abc",
+ "relationship-data": [
+ {
+ "relationship-key": "collection.collection-id",
+ "relationship-value": "84a351ae-3601-45e2-98df-878d6c816abc"
+ }
+ ]
+ },
+ {
+ "related-to": "owning-entity",
+ "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+ "related-link": "/aai/v14/business/owning-entities/owning-entity/e4257a94-21cc-40c5-adc9-e6f4ff868e31",
+ "relationship-data": [
+ {
+ "relationship-key": "owning-entity.owning-entity-id",
+ "relationship-value": "e4257a94-21cc-40c5-adc9-e6f4ff868e31"
+ }
+ ]
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/getTopology/serviceWithCR/serviceWithCRModel.json b/vid-app-common/src/test/resources/getTopology/serviceWithCR/serviceWithCRModel.json
new file mode 100644
index 0000000..6cca1cd
--- /dev/null
+++ b/vid-app-common/src/test/resources/getTopology/serviceWithCR/serviceWithCRModel.json
@@ -0,0 +1,72 @@
+{
+ "service": {
+ "uuid": "6e0bec91-09f3-43aa-9cf3-e617cd0146be",
+ "invariantUuid": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea",
+ "name": "NCM_VLAN_SVC_ym161f",
+ "version": "8.0",
+ "toscaModelURL": null,
+ "category": "Network L4+",
+ "serviceType": "INFRASTRUCTURE",
+ "serviceRole": "",
+ "description": "Network Collection service for vLAN tagging",
+ "serviceEcompNaming": "true",
+ "instantiationType": "Macro",
+ "inputs": {},
+ "vidNotions": {
+ "instantiationType": "Macro",
+ "instantiationUI": "serviceWithCollectionResource",
+ "modelCategory": "other",
+ "viewEditUI": "serviceWithCollectionResource"
+ }
+ },
+ "vnfs": {},
+ "networks": {},
+ "collectionResources": {
+ "NCM_VLAN_ym161f 0": {
+ "uuid": "ce8c98bc-4691-44fb-8ff0-7a47487c11c4",
+ "invariantUuid": "081ceb56-eb71-4566-a72d-3e7cbee5cdf1",
+ "description": "Network Collection Service VF for VLAN TAgging",
+ "name": "NCM_VLAN_ym161f",
+ "version": "5.0",
+ "customizationUuid": "bac6ffe5-c851-495f-a64a-28751400ff03",
+ "inputs": {},
+ "commands": {},
+ "properties": {
+ "ncm_vlan_ym161f..Fixed..0_quantity": "3",
+ "cr_function": "vTSBC_function",
+ "ncm_vlan_ym161f..NetworkCollection..0_network_collection_description": "vTSBC Customer Landing Network Collection Desc",
+ "cr_role": "SUB_INTERFACE",
+ "cr_type": "L3-NETWORK",
+ "ecomp_generated_naming": "false",
+ "ncm_vlan_ym161f..NetworkCollection..0_network_collection_function": "vTSBC Customer Landing Network Collection"
+ },
+ "type": "CR",
+ "category": "Generic",
+ "subcategory": "Infrastructure",
+ "resourceVendor": "ATT",
+ "resourceVendorRelease": "201810",
+ "resourceVendorModelNumber": "294455b",
+ "customizationUUID": "bac6ffe5-c851-495f-a64a-28751400ff03",
+ "networksCollection": {
+ "ncm_vlan_ym161f..NetworkCollection..0": {
+ "uuid": "dd182d7d-6949-4b90-b3cc-5befe400742e",
+ "invariantUuid": "868b109c-9481-4a18-891b-af974db7705a",
+ "name": "ncm_vlan_ym161f..NetworkCollection..0",
+ "version": "1",
+ "networkCollectionProperties": {
+ "networkCollectionFunction": "vTSBC Customer Landing Network Collection",
+ "networkCollectionDescription": "vTSBC Customer Landing Network Collection Desc"
+ }
+ }
+ }
+ }
+ },
+ "configurations": {},
+ "fabricConfigurations": {},
+ "serviceProxies": {},
+ "vfModules": {},
+ "volumeGroups": {},
+ "pnfs": {},
+ "vnfGroups": {},
+ "vrfs": {}
+}
diff --git a/vid-app-common/src/test/resources/getTopology/vfModule.json b/vid-app-common/src/test/resources/getTopology/vfModule.json
new file mode 100644
index 0000000..3fd9c08
--- /dev/null
+++ b/vid-app-common/src/test/resources/getTopology/vfModule.json
@@ -0,0 +1,66 @@
+{
+ "vf-module": [{
+ "vf-module-id": "2cb6d41e-2bef-4cb2-80ce-c7815bcdcf4e",
+ "vf-module-name": "dyh3brarf8000v_base",
+ "heat-stack-id": "dyh3brarf8000v_base/5a826d59-cafa-49fd-9860-dfc6eb7515ae",
+ "orchestration-status": "Active",
+ "is-base-vf-module": true,
+ "automated-assignment": false,
+ "resource-version": "1546547784901",
+ "model-invariant-id": "3ecca473-b0c0-46ae-b0b7-bd2969d8b79f",
+ "model-version-id": "5c35b764-e266-4498-af87-a88c4ba92dc4",
+ "model-customization-id": "06b4ece0-f6f8-4003-b445-653418292101",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/aea56040-8caf-41b3-a85b-97c44001499e/service-data/vnfs/vnf/9a7a4dc1-8e5f-43fe-a360-7734c5f51382/vnf-data/vf-modules/vf-module/2cb6d41e-2bef-4cb2-80ce-c7815bcdcf4e/vf-module-data/vf-module-topology/",
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "l3-network",
+ "relationship-label": "org.onap.relationships.inventory.DependsOn",
+ "related-link": "/aai/v14/network/l3-networks/l3-network/974345f8-75d5-4ae2-be72-600930bcbe6b",
+ "relationship-data": [{
+ "relationship-key": "l3-network.network-id",
+ "relationship-value": "974345f8-75d5-4ae2-be72-600930bcbe6b"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "l3-network.network-name",
+ "property-value": "APP-C-24595-T-IST-05B_oam_protected_net_1"
+ }
+ ]
+ }, {
+ "related-to": "vnfc",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v14/network/vnfcs/vnfc/dyh3brarf8000vm001",
+ "relationship-data": [{
+ "relationship-key": "vnfc.vnfc-name",
+ "relationship-value": "dyh3brarf8000vm001"
+ }
+ ]
+ }, {
+ "related-to": "vserver",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/dyh3b/tenants/tenant/c8035f5ee95d4c62bbc8074c044122b9/vservers/vserver/3e3985e1-2369-4191-9721-7858a478ab6d",
+ "relationship-data": [{
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "irma-aic"
+ }, {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "dyh3b"
+ }, {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "c8035f5ee95d4c62bbc8074c044122b9"
+ }, {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "3e3985e1-2369-4191-9721-7858a478ab6d"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "vserver.vserver-name",
+ "property-value": "dyh3brarf8000vm001"
+ }
+ ]
+ }
+ ]
+ }
+ }
+ ]
+}
diff --git a/vid-app-common/src/test/resources/getTopology/vnf.json b/vid-app-common/src/test/resources/getTopology/vnf.json
new file mode 100644
index 0000000..7b640da
--- /dev/null
+++ b/vid-app-common/src/test/resources/getTopology/vnf.json
@@ -0,0 +1,160 @@
+{
+ "vnf-id": "9a7a4dc1-8e5f-43fe-a360-7734c5f51382",
+ "vnf-name": "dyh3brarf8000v",
+ "vnf-type": "vRAR_1902_ap7134/vRAR_1902_ap7134 0",
+ "prov-status": "PREPROV",
+ "equipment-role": "vRAR",
+ "orchestration-status": "Active",
+ "in-maint": true,
+ "is-closed-loop-disabled": false,
+ "resource-version": "1547155053461",
+ "model-invariant-id": "b711997f-36b3-4a9b-8b37-71a0fc2ebd6d",
+ "model-version-id": "7f23e4f7-e44c-44df-b066-4cedc6950bfe",
+ "model-customization-id": "401350be-0f56-481c-86d8-f32d573fec26",
+ "nf-type": "REPORT",
+ "nf-function": "REVENUE-ASSURANCE",
+ "nf-role": "vRAR",
+ "nf-naming-code": "rarf",
+ "selflink": "restconf/config/GENERIC-RESOURCE-API:services/service/aea56040-8caf-41b3-a85b-97c44001499e/service-data/vnfs/vnf/9a7a4dc1-8e5f-43fe-a360-7734c5f51382/vnf-data/vnf-topology/",
+ "relationship-list": {
+ "relationship": [{
+ "related-to": "service-instance",
+ "relationship-label": "org.onap.relationships.inventory.ComposedOf",
+ "related-link": "/aai/v14/business/customers/customer/e433710f-9217-458d-a79d-1c7aff376d89/service-subscriptions/service-subscription/TYLER%20SILVIA/service-instances/service-instance/aea56040-8caf-41b3-a85b-97c44001499e",
+ "relationship-data": [{
+ "relationship-key": "customer.global-customer-id",
+ "relationship-value": "e433710f-9217-458d-a79d-1c7aff376d89"
+ }, {
+ "relationship-key": "service-subscription.service-type",
+ "relationship-value": "TYLER SILVIA"
+ }, {
+ "relationship-key": "service-instance.service-instance-id",
+ "relationship-value": "aea56040-8caf-41b3-a85b-97c44001499e"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "service-instance.service-instance-name",
+ "property-value": "vRAR_1902_un577h"
+ }
+ ]
+ }, {
+ "related-to": "vnfc",
+ "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+ "related-link": "/aai/v14/network/vnfcs/vnfc/dyh3brarf8000vm001",
+ "relationship-data": [{
+ "relationship-key": "vnfc.vnfc-name",
+ "relationship-value": "dyh3brarf8000vm001"
+ }
+ ]
+ }, {
+ "related-to": "platform",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v14/business/platforms/platform/FIRSTNET-DEDICATED",
+ "relationship-data": [{
+ "relationship-key": "platform.platform-name",
+ "relationship-value": "FIRSTNET-DEDICATED"
+ }
+ ]
+ }, {
+ "related-to": "line-of-business",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v14/business/lines-of-business/line-of-business/FIRSTNET",
+ "relationship-data": [{
+ "relationship-key": "line-of-business.line-of-business-name",
+ "relationship-value": "LINDSEY"
+ }
+ ]
+ }, {
+ "related-to": "tenant",
+ "relationship-label": "org.onap.relationships.inventory.BelongsTo",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/dyh3b/tenants/tenant/c8035f5ee95d4c62bbc8074c044122b9",
+ "relationship-data": [{
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "irma-aic"
+ }, {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "dyh3b"
+ }, {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "c8035f5ee95d4c62bbc8074c044122b9"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "tenant.tenant-name",
+ "property-value": "APP-C-24595-T-IST-05B"
+ }
+ ]
+ }, {
+ "related-to": "vserver",
+ "relationship-label": "tosca.relationships.HostedOn",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/dyh3b/tenants/tenant/c8035f5ee95d4c62bbc8074c044122b9/vservers/vserver/3e3985e1-2369-4191-9721-7858a478ab6d",
+ "relationship-data": [{
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "irma-aic"
+ }, {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "dyh3b"
+ }, {
+ "relationship-key": "tenant.tenant-id",
+ "relationship-value": "c8035f5ee95d4c62bbc8074c044122b9"
+ }, {
+ "relationship-key": "vserver.vserver-id",
+ "relationship-value": "3e3985e1-2369-4191-9721-7858a478ab6d"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "vserver.vserver-name",
+ "property-value": "dyh3brarf8000vm001"
+ }
+ ]
+ }, {
+ "related-to": "availability-zone",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/dyh3b/availability-zones/availability-zone/dyh3b-kvm-az02",
+ "relationship-data": [{
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "irma-aic"
+ }, {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "dyh3b"
+ }, {
+ "relationship-key": "availability-zone.availability-zone-name",
+ "relationship-value": "dyh3b-kvm-az02"
+ }
+ ]
+ }, {
+ "related-to": "availability-zone",
+ "relationship-label": "org.onap.relationships.inventory.Uses",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/dyh3b/availability-zones/availability-zone/dyh3b-kvm-az01",
+ "relationship-data": [{
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "irma-aic"
+ }, {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "dyh3b"
+ }, {
+ "relationship-key": "availability-zone.availability-zone-name",
+ "relationship-value": "dyh3b-kvm-az01"
+ }
+ ]
+ }, {
+ "related-to": "cloud-region",
+ "relationship-label": "org.onap.relationships.inventory.LocatedIn",
+ "related-link": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/dyh3b",
+ "relationship-data": [{
+ "relationship-key": "cloud-region.cloud-owner",
+ "relationship-value": "irma-aic"
+ }, {
+ "relationship-key": "cloud-region.cloud-region-id",
+ "relationship-value": "dyh3b"
+ }
+ ],
+ "related-to-property": [{
+ "property-key": "cloud-region.owner-defined-type",
+ "property-value": "lcp"
+ }
+ ]
+ }
+ ]
+ }
+}
diff --git a/vid-app-common/src/test/resources/orchestrationRequestsByServiceInstanceId.json b/vid-app-common/src/test/resources/orchestrationRequestsByServiceInstanceId.json
index 34f18f7..d20fc67 100644
--- a/vid-app-common/src/test/resources/orchestrationRequestsByServiceInstanceId.json
+++ b/vid-app-common/src/test/resources/orchestrationRequestsByServiceInstanceId.json
@@ -93,7 +93,7 @@
],
"cloudConfiguration": {
"tenantId": "460f35aeb53542dc9f77105066483e83",
- "cloudOwner": "att-aic",
+ "cloudOwner": "irma-aic" ,
"lcpCloudRegionId": "rdm5b"
},
"requestParameters": {},
@@ -177,7 +177,7 @@
],
"cloudConfiguration": {
"tenantId": "460f35aeb53542dc9f77105066483e83",
- "cloudOwner": "att-aic",
+ "cloudOwner": "irma-aic" ,
"lcpCloudRegionId": "rdm5b"
},
"requestParameters": {
diff --git a/vid-app-common/src/test/resources/payload_jsons/VnfGroupCreate1Delete1None1Request.json b/vid-app-common/src/test/resources/payload_jsons/VnfGroupCreate1Delete1None1Request.json
new file mode 100644
index 0000000..bc64545
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/VnfGroupCreate1Delete1None1Request.json
@@ -0,0 +1,123 @@
+{
+ "action": "None",
+ "isDirty": true,
+ "trackById":"aabbcc",
+ "vnfs": {},
+ "instanceParams": [],
+ "validationCounter": 0,
+ "existingNames": {
+ "service_instance_name": "",
+ "vnf_group3_instance_name": ""
+ },
+ "existingVNFCounterMap": {},
+ "existingVnfGroupCounterMap": {
+ "daeb6568-cef8-417f-9075-ed259ce59f48": 3
+ },
+ "existingNetworksCounterMap": {},
+ "networks": {},
+ "vnfGroups": {
+ "groupingservicefortest..ResourceInstanceGroup..0:001": {
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "trackById": "groupingservicefortest..ResourceInstanceGroup..0:001",
+ "instanceName": "VNF_GROUP1_INSTANCE_NAME",
+ "lcpCloudRegionId": null,
+ "legacyRegion": null,
+ "lineOfBusiness": null,
+ "action": "None_Delete",
+ "instanceId": "VNF_GROUP1_INSTANCE_ID",
+ "instanceType": "VNF_GROUP1_INSTANCE_TYPE",
+ "orchStatus": null,
+ "platformName": null,
+ "productFamilyId": null,
+ "provStatus": null,
+ "tenantId": null,
+ "inMaint": false,
+ "modelInfo": {
+ "modelType": "instanceGroup",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "instanceGroupRole": "VNF_GROUP1_INSTANCE_ROLE",
+ "instanceGroupFunction": "vTSBC Customer Landing Network Collection",
+ "vnfs":{}
+ },
+ "groupingservicefortest..ResourceInstanceGroup..0:002": {
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "trackById": "groupingservicefortest..ResourceInstanceGroup..0:002",
+ "instanceName": "VNF_GROUP2_INSTANCE_NAME",
+ "lcpCloudRegionId": null,
+ "legacyRegion": null,
+ "lineOfBusiness": null,
+ "action": "None",
+ "instanceId": "VNF_GROUP2_INSTANCE_ID",
+ "instanceType": "VNF_GROUP2_INSTANCE_TYPE",
+ "orchStatus": null,
+ "platformName": null,
+ "productFamilyId": null,
+ "provStatus": null,
+ "inMaint": false,
+ "modelInfo": {
+ "modelType": "instanceGroup",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "tenantId": null,
+ "instanceGroupRole": "VNF_GROUP2_INSTANCE_ROLE",
+ "instanceGroupFunction": "vTSBC Customer Landing Network Collection",
+ "vnfs": {}
+ },
+ "groupingservicefortest..ResourceInstanceGroup..0": {
+ "action": "Create",
+ "inMaint": false,
+ "rollbackOnFailure": "true",
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "isMissingData": false,
+ "trackById": "ag5aav86u4j",
+ "vnfGroupStoreKey": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "instanceName": "VNF_GROUP3_INSTANCE_NAME",
+ "modelInfo": {
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "modelName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelVersion": "1",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "instanceParams": [{}
+ ],
+ "vnfs":{}
+ }
+ },
+ "bulkSize": 1,
+ "instanceName": "SERVICE_INSTANCE_NAME",
+
+ "instanceId": "service-instance-id",
+ "orchStatus": "GARBAGE DATA",
+ "globalSubscriberId": "global-customer-id",
+ "subscriptionServiceType": "service-instance-type",
+ "owningEntityId": null,
+ "owningEntityName": null,
+ "productFamilyId": null,
+ "lcpCloudRegionId": null,
+ "tenantId": null,
+ "tenantName": null,
+ "aicZoneId": null,
+ "aicZoneName": null,
+ "projectName": null,
+ "rollbackOnFailure": false,
+ "isALaCarte": true,
+ "modelInfo": {
+ "modelInvariantId": "7ee41ce4-4827-44b0-a48e-2707a59905d2",
+ "modelVersionId": "4117a0b6-e234-467d-b5b9-fe2f68c8b0fc",
+ "modelName": "Grouping Service for Test",
+ "modelType": "service",
+ "modelVersion": "1.0"
+ },
+
+ "testApi": "VNF_API"
+}
diff --git a/vid-app-common/src/test/resources/payload_jsons/VnfGroupCreate3Delete1None1Request.json b/vid-app-common/src/test/resources/payload_jsons/VnfGroupCreate3Delete1None1Request.json
new file mode 100644
index 0000000..1906bc8
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/VnfGroupCreate3Delete1None1Request.json
@@ -0,0 +1,171 @@
+{
+ "action": "None",
+ "isDirty": true,
+ "trackById":"aabbcc",
+ "vnfs": {},
+ "instanceParams": [],
+ "validationCounter": 0,
+ "existingNames": {
+ "service_instance_name": "",
+ "vnf_group3_instance_name": ""
+ },
+ "existingVNFCounterMap": {},
+ "existingVnfGroupCounterMap": {
+ "daeb6568-cef8-417f-9075-ed259ce59f48": 3
+ },
+ "existingNetworksCounterMap": {},
+ "networks": {},
+ "vnfGroups": {
+ "groupingservicefortest..ResourceInstanceGroup..0:001": {
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "trackById": "groupingservicefortest..ResourceInstanceGroup..0:001",
+ "instanceName": "VNF_GROUP1_INSTANCE_NAME",
+ "lcpCloudRegionId": null,
+ "legacyRegion": null,
+ "lineOfBusiness": null,
+ "action": "None_Delete",
+ "instanceId": "VNF_GROUP1_INSTANCE_ID",
+ "instanceType": "VNF_GROUP1_INSTANCE_TYPE",
+ "orchStatus": null,
+ "platformName": null,
+ "productFamilyId": null,
+ "provStatus": null,
+ "tenantId": null,
+ "inMaint": false,
+ "modelInfo": {
+ "modelType": "instanceGroup",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "instanceGroupRole": "VNF_GROUP1_INSTANCE_ROLE",
+ "instanceGroupFunction": "vTSBC Customer Landing Network Collection",
+ "vnfs":{}
+ },
+ "groupingservicefortest..ResourceInstanceGroup..0:002": {
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "trackById": "groupingservicefortest..ResourceInstanceGroup..0:002",
+ "instanceName": "VNF_GROUP2_INSTANCE_NAME",
+ "lcpCloudRegionId": null,
+ "legacyRegion": null,
+ "lineOfBusiness": null,
+ "action": "None",
+ "instanceId": "VNF_GROUP2_INSTANCE_ID",
+ "instanceType": "VNF_GROUP2_INSTANCE_TYPE",
+ "orchStatus": null,
+ "platformName": null,
+ "productFamilyId": null,
+ "provStatus": null,
+ "inMaint": false,
+ "modelInfo": {
+ "modelType": "instanceGroup",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "tenantId": null,
+ "instanceGroupRole": "VNF_GROUP2_INSTANCE_ROLE",
+ "instanceGroupFunction": "vTSBC Customer Landing Network Collection",
+ "vnfs": {}
+ },
+ "groupingservicefortest..ResourceInstanceGroup..0": {
+ "action": "Create",
+ "inMaint": false,
+ "rollbackOnFailure": "true",
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "isMissingData": false,
+ "trackById": "ag5aav86u4j",
+ "vnfGroupStoreKey": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "instanceName": "VNF_GROUP3_INSTANCE_NAME",
+ "modelInfo": {
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "modelName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelVersion": "1",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "instanceParams": [{}
+ ],
+ "vnfs":{}
+ },
+ "groupingservicefortest..ResourceInstanceGroup..0:003": {
+ "action": "Create",
+ "isFailed": true,
+ "statusMessage": "failed!",
+ "inMaint": false,
+ "rollbackOnFailure": "true",
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "isMissingData": false,
+ "trackById": "asedrftjko",
+ "vnfGroupStoreKey": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "instanceName": "VNF_GROUP4_INSTANCE_NAME",
+ "modelInfo": {
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "modelName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelVersion": "1",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "instanceParams": [{}
+ ],
+ "vnfs":{}
+ },
+ "groupingservicefortest..ResourceInstanceGroup..0:004": {
+ "action": "Create",
+ "isFailed": false,
+ "statusMessage": null,
+ "inMaint": false,
+ "rollbackOnFailure": "true",
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "isMissingData": false,
+ "trackById": "rgedfdged4",
+ "vnfGroupStoreKey": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "instanceName": "VNF_GROUP5_INSTANCE_NAME",
+ "modelInfo": {
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "modelName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelVersion": "1",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "instanceParams": [{}
+ ],
+ "vnfs":{}
+ }
+ },
+ "bulkSize": 1,
+ "instanceName": "SERVICE_INSTANCE_NAME",
+
+ "instanceId": "service-instance-id",
+ "orchStatus": "GARBAGE DATA",
+ "globalSubscriberId": "global-customer-id",
+ "subscriptionServiceType": "service-instance-type",
+ "owningEntityId": null,
+ "owningEntityName": null,
+ "productFamilyId": null,
+ "lcpCloudRegionId": null,
+ "tenantId": null,
+ "tenantName": null,
+ "aicZoneId": null,
+ "aicZoneName": null,
+ "projectName": null,
+ "rollbackOnFailure": false,
+ "isALaCarte": true,
+ "modelInfo": {
+ "modelInvariantId": "7ee41ce4-4827-44b0-a48e-2707a59905d2",
+ "modelVersionId": "4117a0b6-e234-467d-b5b9-fe2f68c8b0fc",
+ "modelName": "Grouping Service for Test",
+ "modelType": "service",
+ "modelVersion": "1.0"
+ },
+
+ "testApi": "VNF_API"
+}
diff --git a/vid-app-common/src/test/resources/payload_jsons/VnfGroupCreate3Delete1None1RequestResolvedForRetry.json b/vid-app-common/src/test/resources/payload_jsons/VnfGroupCreate3Delete1None1RequestResolvedForRetry.json
new file mode 100644
index 0000000..6196cd7
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/VnfGroupCreate3Delete1None1RequestResolvedForRetry.json
@@ -0,0 +1,176 @@
+{
+ "action": "None",
+ "isDirty": true,
+ "trackById":"aabbcc",
+ "vnfs": {},
+ "instanceParams": [],
+ "validationCounter": 0,
+ "existingNames": {
+ "service_instance_name": "",
+ "vnf_group3_instance_name": ""
+ },
+ "existingVNFCounterMap": {},
+ "existingVnfGroupCounterMap": {
+ "daeb6568-cef8-417f-9075-ed259ce59f48": 3
+ },
+ "existingNetworksCounterMap": {},
+ "networks": {},
+ "vnfGroups": {
+ "groupingservicefortest..ResourceInstanceGroup..0:001": {
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "trackById": "groupingservicefortest..ResourceInstanceGroup..0:001",
+ "instanceName": "VNF_GROUP1_INSTANCE_NAME",
+ "lcpCloudRegionId": null,
+ "legacyRegion": null,
+ "lineOfBusiness": null,
+ "action": "None",
+ "statusMessage": "Vnf has been created successfully.",
+ "instanceId": "VNF_GROUP1_INSTANCE_ID",
+ "instanceType": "VNF_GROUP1_INSTANCE_TYPE",
+ "orchStatus": null,
+ "platformName": null,
+ "productFamilyId": null,
+ "provStatus": null,
+ "tenantId": null,
+ "inMaint": false,
+ "modelInfo": {
+ "modelType": "instanceGroup",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "instanceGroupRole": "VNF_GROUP1_INSTANCE_ROLE",
+ "instanceGroupFunction": "vTSBC Customer Landing Network Collection",
+ "vnfs":{}
+ },
+ "groupingservicefortest..ResourceInstanceGroup..0:002": {
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "trackById": "groupingservicefortest..ResourceInstanceGroup..0:002",
+ "instanceName": "VNF_GROUP2_INSTANCE_NAME",
+ "lcpCloudRegionId": null,
+ "legacyRegion": null,
+ "lineOfBusiness": null,
+ "action": "None",
+ "instanceId": "VNF_GROUP2_INSTANCE_ID",
+ "instanceType": "VNF_GROUP2_INSTANCE_TYPE",
+ "orchStatus": null,
+ "platformName": null,
+ "productFamilyId": null,
+ "provStatus": null,
+ "inMaint": false,
+ "modelInfo": {
+ "modelType": "instanceGroup",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "tenantId": null,
+ "instanceGroupRole": "VNF_GROUP2_INSTANCE_ROLE",
+ "instanceGroupFunction": "vTSBC Customer Landing Network Collection",
+ "vnfs": {}
+ },
+ "groupingservicefortest..ResourceInstanceGroup..0": {
+ "action": "Create",
+ "inMaint": false,
+ "rollbackOnFailure": "true",
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "isMissingData": false,
+ "trackById": "ag5aav86u4j",
+ "vnfGroupStoreKey": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "instanceName": "VNF_GROUP3_INSTANCE_NAME",
+ "isFailed": true,
+ "statusMessage": "Vnf has been created successfully.",
+ "modelInfo": {
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "modelName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelVersion": "1",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "instanceParams": [{}
+ ],
+ "vnfs":{}
+ },
+ "groupingservicefortest..ResourceInstanceGroup..0:003": {
+ "action": "None",
+ "isFailed": false,
+ "instanceId": "VNF_GROUP1_INSTANCE_ID_3",
+ "statusMessage": "Vnf has been created successfully.",
+ "inMaint": false,
+ "rollbackOnFailure": "true",
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "isMissingData": false,
+ "trackById": "asedrftjko",
+ "vnfGroupStoreKey": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "instanceName": "VNF_GROUP4_INSTANCE_NAME",
+ "modelInfo": {
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "modelName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelVersion": "1",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "instanceParams": [{}
+ ],
+ "vnfs":{}
+ },
+ "groupingservicefortest..ResourceInstanceGroup..0:004": {
+ "action": "None",
+ "isFailed": false,
+ "statusMessage": "Vnf has been created successfully.",
+ "instanceId": "VNF_GROUP1_INSTANCE_ID_4",
+ "inMaint": false,
+ "rollbackOnFailure": "true",
+ "originalName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "isMissingData": false,
+ "trackById": "rgedfdged4",
+ "vnfGroupStoreKey": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "instanceName": "VNF_GROUP5_INSTANCE_NAME",
+ "modelInfo": {
+ "modelInvariantId": "4bb2e27e-ddab-4790-9c6d-1f731bc14a45",
+ "modelVersionId": "daeb6568-cef8-417f-9075-ed259ce59f48",
+ "modelName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "modelVersion": "1",
+ "modelCustomizationName": "groupingservicefortest..ResourceInstanceGroup..0",
+ "uuid": "daeb6568-cef8-417f-9075-ed259ce59f48"
+ },
+ "instanceParams": [{}
+ ],
+ "vnfs":{}
+ }
+ },
+ "bulkSize": 1,
+ "instanceName": "SERVICE_INSTANCE_NAME",
+
+ "instanceId": "service-instance-id",
+ "orchStatus": "GARBAGE DATA",
+ "globalSubscriberId": "global-customer-id",
+ "subscriptionServiceType": "service-instance-type",
+ "owningEntityId": null,
+ "owningEntityName": null,
+ "productFamilyId": null,
+ "lcpCloudRegionId": null,
+ "tenantId": null,
+ "tenantName": null,
+ "aicZoneId": null,
+ "aicZoneName": null,
+ "projectName": null,
+ "rollbackOnFailure": false,
+ "isALaCarte": true,
+ "modelInfo": {
+ "modelInvariantId": "7ee41ce4-4827-44b0-a48e-2707a59905d2",
+ "modelVersionId": "4117a0b6-e234-467d-b5b9-fe2f68c8b0fc",
+ "modelName": "Grouping Service for Test",
+ "modelType": "service",
+ "modelVersion": "1.0"
+ },
+
+ "testApi": "VNF_API"
+}
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_alacarte_service_request.json b/vid-app-common/src/test/resources/payload_jsons/bulk_alacarte_service_request.json
index 9556852..4e3fc10 100644
--- a/vid-app-common/src/test/resources/payload_jsons/bulk_alacarte_service_request.json
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_alacarte_service_request.json
@@ -9,7 +9,7 @@
},
"owningEntity": {
"owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
- "owningEntityName": "PACKET CORE"
+ "owningEntityName": "JULIO ERICKSON"
},
"project": {
"projectName": "{some project name}"
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_alacarte_service_request_naming_false.json b/vid-app-common/src/test/resources/payload_jsons/bulk_alacarte_service_request_naming_false.json
index be697ed..5b1fdc1 100644
--- a/vid-app-common/src/test/resources/payload_jsons/bulk_alacarte_service_request_naming_false.json
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_alacarte_service_request_naming_false.json
@@ -9,7 +9,7 @@
},
"owningEntity": {
"owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
- "owningEntityName": "PACKET CORE"
+ "owningEntityName": "JULIO ERICKSON"
},
"subscriberInfo": {
"globalSubscriberId": "{some subscriber id}"
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_macro_service_request.json b/vid-app-common/src/test/resources/payload_jsons/bulk_macro_service_request.json
index 917900c..c0315d0 100644
--- a/vid-app-common/src/test/resources/payload_jsons/bulk_macro_service_request.json
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_macro_service_request.json
@@ -9,7 +9,7 @@
},
"owningEntity": {
"owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
- "owningEntityName": "PACKET CORE"
+ "owningEntityName": "JULIO ERICKSON"
},
"project": {
"projectName": "{some project name}"
@@ -51,7 +51,7 @@
},
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
- "cloudOwner": "att-aic",
+ "cloudOwner": "irma-aic",
"tenantId": "88a6ca3ee0394ade9403f075db23167e"
},
"platform": {
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json
index 55765a8..dd343f4 100644
--- a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_ecomp_naming.json
@@ -9,7 +9,7 @@
},
"owningEntity": {
"owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
- "owningEntityName": "PACKET CORE"
+ "owningEntityName": "JULIO ERICKSON"
},
"project": {
"projectName": "{some project name}"
@@ -48,7 +48,7 @@
},
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
- "cloudOwner": "att-aic",
+ "cloudOwner": "irma-aic",
"tenantId": "88a6ca3ee0394ade9403f075db23167e"
},
"platform": {
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json
index fdc8151..0ef15d7 100644
--- a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_no_vfmodule_ecomp_naming.json
@@ -9,7 +9,7 @@
},
"owningEntity": {
"owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
- "owningEntityName": "PACKET CORE"
+ "owningEntityName": "JULIO ERICKSON"
},
"project": {
"projectName": "{some project name}"
@@ -48,7 +48,7 @@
},
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
- "cloudOwner": "att-aic",
+ "cloudOwner": "irma-aic",
"tenantId": "88a6ca3ee0394ade9403f075db23167e"
},
"platform": {
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_unique_names.json b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_unique_names.json
index 643c104..c4f40a9 100644
--- a/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_unique_names.json
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_service_request_unique_names.json
@@ -9,7 +9,7 @@
},
"owningEntity": {
"owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
- "owningEntityName": "PACKET CORE"
+ "owningEntityName": "JULIO ERICKSON"
},
"project": {
"projectName": "{some project name}"
@@ -50,7 +50,7 @@
},
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
- "cloudOwner": "att-aic",
+ "cloudOwner": "irma-aic",
"tenantId": "88a6ca3ee0394ade9403f075db23167e"
},
"platform": {
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_vnf_request.json b/vid-app-common/src/test/resources/payload_jsons/bulk_vnf_request.json
index d7b6d86..5aa0211 100644
--- a/vid-app-common/src/test/resources/payload_jsons/bulk_vnf_request.json
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_vnf_request.json
@@ -12,7 +12,7 @@
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
"tenantId": "88a6ca3ee0394ade9403f075db23167e",
- "cloudOwner" : "att-aic"
+ "cloudOwner" : "irma-aic"
},
"requestInfo": {
"instanceName": "vmxnjr001_001",
diff --git a/vid-app-common/src/test/resources/payload_jsons/bulk_vnf_request_without_instance_name.json b/vid-app-common/src/test/resources/payload_jsons/bulk_vnf_request_without_instance_name.json
index 9921de5..7322d85 100644
--- a/vid-app-common/src/test/resources/payload_jsons/bulk_vnf_request_without_instance_name.json
+++ b/vid-app-common/src/test/resources/payload_jsons/bulk_vnf_request_without_instance_name.json
@@ -12,7 +12,7 @@
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
"tenantId": "88a6ca3ee0394ade9403f075db23167e",
- "cloudOwner": "att-aic"
+ "cloudOwner": "irma-aic"
},
"requestInfo": {
"productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
diff --git a/vid-app-common/src/test/resources/payload_jsons/instance_group_instantiation_request.json b/vid-app-common/src/test/resources/payload_jsons/instance_group_instantiation_request.json
index 7072d32..70e8f04 100644
--- a/vid-app-common/src/test/resources/payload_jsons/instance_group_instantiation_request.json
+++ b/vid-app-common/src/test/resources/payload_jsons/instance_group_instantiation_request.json
@@ -10,7 +10,7 @@
"modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04"
},
"requestInfo": {
- "instanceName": "VNF_GROUP_NAME_001",
+ "instanceName": "VNF_GROUP_NAME",
"source": "VID",
"suppressRollback": true,
"requestorId": "az2018"
@@ -30,7 +30,8 @@
}
],
"requestParameters": {
- "userParams": []
+ "userParams": [],
+ "testApi" : "VNF_API"
}
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/mso_request_create_configuration.json b/vid-app-common/src/test/resources/payload_jsons/mso_request_create_configuration.json
index e0942ba..c4849f0 100644
--- a/vid-app-common/src/test/resources/payload_jsons/mso_request_create_configuration.json
+++ b/vid-app-common/src/test/resources/payload_jsons/mso_request_create_configuration.json
@@ -39,7 +39,7 @@
"modelType": "vnf",
"modelInvariantId": "a7eac2b3-8444-40ee-92e3-b3359b32445c",
"modelVersionId": "2a2ea15f-07c6-4b89-bfca-e8aba39a34d6",
- "modelName": "vmmeService2",
+ "modelName": "vflorenceService2",
"modelVersion": "1.0",
"modelCustomizationId": "060be63d-5f9c-4fd0-8ef7-830d5e8eca17"
}
diff --git a/vid-app-common/src/test/resources/payload_jsons/mso_service_instantiation.json b/vid-app-common/src/test/resources/payload_jsons/mso_service_instantiation.json
index 537b8d6..926c435 100644
--- a/vid-app-common/src/test/resources/payload_jsons/mso_service_instantiation.json
+++ b/vid-app-common/src/test/resources/payload_jsons/mso_service_instantiation.json
@@ -13,7 +13,7 @@
},
"owningEntity": {
"owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
- "owningEntityName": "PACKET CORE"
+ "owningEntityName": "JULIO ERICKSON"
},
"project": {
"projectName": "TODO"
@@ -49,7 +49,7 @@
"modelVersion":"10.0"
},
"owningEntityId":"038d99af-0427-42c2-9d15-971b99b9b489",
- "owningEntityName":"PACKET CORE",
+ "owningEntityName":"JULIO ERICKSON",
"projectName":"{some project name}",
"globalSubscriberId":"{some subscriber id}",
"productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
diff --git a/vid-app-common/src/test/resources/payload_jsons/networkDelete1Create1Request.json b/vid-app-common/src/test/resources/payload_jsons/networkDelete1Create1Request.json
new file mode 100644
index 0000000..cc35dca
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/networkDelete1Create1Request.json
@@ -0,0 +1,117 @@
+{
+ "action":"None",
+ "isDirty":true,
+ "vnfs":{
+
+ },
+ "instanceParams":[
+ {
+ "2017488_pasqualevpe0_ASN":"AV_vPE"
+ }
+ ],
+ "validationCounter":0,
+ "existingNames":{
+ "123":"",
+ "instancename":"",
+ "yoav":""
+ },
+ "existingVNFCounterMap":{
+
+ },
+ "existingVnfGroupCounterMap":{
+
+ },
+ "existingNetworksCounterMap":{
+ "94fdd893-4a36-4d70-b16a-ec29c54c184f":1
+ },
+ "networks":{
+ "ExtVL 0":{
+ "rollbackOnFailure":"false",
+ "productFamilyId":"36b4733a-53f4-4cc8-8ff0-9172e5fc4b8e",
+ "lcpCloudRegionId":"hvf6",
+ "tenantId":"229bcdc6eaeb4ca59d55221141d01f8e",
+ "lineOfBusiness":"zzz1",
+ "platformName":"platform",
+ "originalName":"ExtVL 0",
+ "modelInfo":{
+ "modelInvariantId":"379f816b-a7aa-422f-be30-17114ff50b7c",
+ "modelVersionId":"ddc3f20c-08b5-40fd-af72-c6d14636b986",
+ "modelName":"ExtVL",
+ "modelVersion":"37.0",
+ "modelType":"network",
+ "modelCustomizationId":"94fdd893-4a36-4d70-b16a-ec29c54c184f",
+ "modelCustomizationName":"ExtVL 0"
+ },
+ "instanceName":"ExtVL 0",
+ "instanceId":"NETWORK_INSTANCE_ID",
+ "action":"None_Delete"
+ },
+ "ExtVL 0_1":{
+ "action":"Create",
+ "inMaint":false,
+ "rollbackOnFailure":"true",
+ "originalName":"ExtVL 0",
+ "isMissingData":false,
+ "trackById":"r21vcx0szoc",
+ "networkStoreKey":"ExtVL 0_1",
+ "instanceName":"ExtVL",
+ "productFamilyId":"a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "lcpCloudRegionId":"hvf6",
+ "tenantId":"229bcdc6eaeb4ca59d55221141d01f8e",
+ "platformName":"xxx1",
+ "lineOfBusiness":"zzz1",
+ "instanceParams":[
+ {
+
+ }
+ ],
+ "modelInfo":{
+ "modelInvariantId":"379f816b-a7aa-422f-be30-17114ff50b7c",
+ "modelVersionId":"ddc3f20c-08b5-40fd-af72-c6d14636b986",
+ "modelName":"ExtVL",
+ "modelVersion":"37.0",
+ "modelCustomizationId":"94fdd893-4a36-4d70-b16a-ec29c54c184f",
+ "modelCustomizationName":"ExtVL 0",
+ "uuid":"ddc3f20c-08b5-40fd-af72-c6d14636b986",
+ "modelUniqueId":"94fdd893-4a36-4d70-b16a-ec29c54c184f"
+ },
+ "uuid":"ddc3f20c-08b5-40fd-af72-c6d14636b986"
+ }
+ },
+ "vnfGroups":{
+
+ },
+ "bulkSize":1,
+ "instanceName":"InstanceName",
+ "globalSubscriberId":"e433710f-9217-458d-a79d-1c7aff376d89",
+ "subscriptionServiceType":"TYLER SILVIA",
+ "owningEntityId":"d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
+ "productFamilyId":"17cc1042-527b-11e6-beb8-9e71128cae77",
+ "lcpCloudRegionId":"AAIAIC25",
+ "tenantId":"092eb9e8e4b7412e8787dd091bc58e86",
+ "aicZoneId":"JAG1",
+ "projectName":"WATKINS",
+ "rollbackOnFailure":true,
+ "aicZoneName":"YUDFJULP-JAG1",
+ "owningEntityName":"WayneHolland",
+ "testApi":"GR_API",
+ "tenantName":"USP-SIP-IC-24335-T-01",
+ "modelInfo":{
+ "modelInvariantId":"e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
+ "modelVersionId":"6b528779-44a3-4472-bdff-9cd15ec93450",
+ "modelName":"action-data",
+ "modelVersion":"1.0",
+ "uuid":"6b528779-44a3-4472-bdff-9cd15ec93450"
+ },
+ "isALaCarte":true,
+ "name":"action-data",
+ "version":"1.0",
+ "description":"",
+ "category":"",
+ "uuid":"6b528779-44a3-4472-bdff-9cd15ec93450",
+ "invariantUuid":"e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
+ "serviceType":"",
+ "serviceRole":"",
+ "isMultiStepDesign":false,
+ "instanceId":"f8791436-8d55-4fde-b4d5-72dd2cf13cfb"
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/network_instantiation_request.json b/vid-app-common/src/test/resources/payload_jsons/network_instantiation_request.json
index 5a722ac..241ee07 100644
--- a/vid-app-common/src/test/resources/payload_jsons/network_instantiation_request.json
+++ b/vid-app-common/src/test/resources/payload_jsons/network_instantiation_request.json
@@ -12,10 +12,10 @@
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
"tenantId": "88a6ca3ee0394ade9403f075db23167e",
- "cloudOwner" : "att-aic"
+ "cloudOwner" : "irma-aic"
},
"requestInfo": {
- "instanceName": "vmxnjr001_001",
+ "instanceName": "vmxnjr001",
"productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
"source": "VID",
"suppressRollback": true,
@@ -42,7 +42,8 @@
}
],
"requestParameters": {
- "userParams": []
+ "userParams": [],
+ "testApi" : "VNF_API"
}
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/network_instantiation_request_without_instance_name.json b/vid-app-common/src/test/resources/payload_jsons/network_instantiation_request_without_instance_name.json
index db55736..8b69e0b 100644
--- a/vid-app-common/src/test/resources/payload_jsons/network_instantiation_request_without_instance_name.json
+++ b/vid-app-common/src/test/resources/payload_jsons/network_instantiation_request_without_instance_name.json
@@ -12,7 +12,7 @@
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
"tenantId": "88a6ca3ee0394ade9403f075db23167e",
- "cloudOwner" : "att-aic"
+ "cloudOwner" : "irma-aic"
},
"requestInfo": {
"productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
@@ -41,7 +41,8 @@
}
],
"requestParameters": {
- "userParams": []
+ "userParams": [],
+ "testApi" : "VNF_API"
}
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/pre_1806_macro_service_instantiation_request.json b/vid-app-common/src/test/resources/payload_jsons/pre_1806_macro_service_instantiation_request.json
new file mode 100644
index 0000000..9923230
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/pre_1806_macro_service_instantiation_request.json
@@ -0,0 +1,47 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "sriov",
+ "modelVersion": "1.0"
+ },
+ "cloudConfiguration": {
+ "cloudOwner": "irma-aic",
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "JULIO ERICKSON"
+ },
+ "project": {
+ "projectName": "some_project_name"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "some_subscriber_id",
+ "subscriberName": "some_subscriber_name"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "az2016"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "MOG",
+ "aLaCarte": false,
+ "userParams": [
+ {
+ "name": "someUserParam",
+ "value": "someValue"
+ },
+ {
+ "name": "anotherUserParam",
+ "value": "anotherValue"
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/pre_1806_macro_without_cloudConfiguration.json b/vid-app-common/src/test/resources/payload_jsons/pre_1806_macro_without_cloudConfiguration.json
new file mode 100644
index 0000000..472ccc9
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/pre_1806_macro_without_cloudConfiguration.json
@@ -0,0 +1,42 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "sriov",
+ "modelVersion": "1.0"
+ },
+ "owningEntity": {
+ "owningEntityId": "038d99af-0427-42c2-9d15-971b99b9b489",
+ "owningEntityName": "JULIO ERICKSON"
+ },
+ "project": {
+ "projectName": "some_project_name"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "some_subscriber_id",
+ "subscriberName": "some_subscriber_name"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "az2016"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "MOG",
+ "aLaCarte": false,
+ "userParams": [
+ {
+ "name": "someUserParam",
+ "value": "someValue"
+ },
+ {
+ "name": "anotherUserParam",
+ "value": "anotherValue"
+ }
+ ]
+ }
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/resume/feRequestResumeMacroService.json b/vid-app-common/src/test/resources/payload_jsons/resume/feRequestResumeMacroService.json
new file mode 100644
index 0000000..c2c84dc
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/resume/feRequestResumeMacroService.json
@@ -0,0 +1,107 @@
+{
+ "isDirty": false,
+ "instanceParams": [],
+ "existingNames": {
+ "ncmvlansvcym161f_77": ""
+ },
+ "vidNotions": {
+ "instantiationType": "Macro",
+ "instantiationUI": "serviceWithCollectionResource",
+ "modelCategory": "other",
+ "viewEditUI": "serviceWithCollectionResource"
+ },
+ "bulkSize": 1,
+ "action": "Resume",
+ "instanceName": "NcmVlanSvcYm161f_77",
+ "instanceId": "a565e6ad-75d1-4493-98f1-33234b5c17e2",
+ "orchStatus": "Assigned",
+ "productFamilyId": null,
+ "lcpCloudRegionId": null,
+ "tenantId": null,
+ "cloudOwner": null,
+ "modelInfo": {
+ "modelInvariantId": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea",
+ "modelVersionId": "6e0bec91-09f3-43aa-9cf3-e617cd0146be",
+ "modelName": "NCM_VLAN_SVC_ym161f",
+ "modelType": "service",
+ "modelVersion": "8.0"
+ },
+ "globalSubscriberId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "subscriptionServiceType": "Emanuel",
+ "owningEntityId": null,
+ "owningEntityName": null,
+ "tenantName": null,
+ "aicZoneId": null,
+ "aicZoneName": null,
+ "projectName": null,
+ "rollbackOnFailure": false,
+ "isALaCarte": false,
+ "vnfs": {},
+ "vrfs": {},
+ "networks": {},
+ "vnfGroups": {},
+ "validationCounter": 0,
+ "existingVNFCounterMap": {},
+ "existingVRFCounterMap": {},
+ "existingNetworksCounterMap": {},
+ "existingVnfGroupCounterMap": {},
+ "collectionResources": {
+ "84a351ae-3601-45e2-98df-878d6c816abc": {
+ "action": "None",
+ "instanceName": "NcmVlanSvcYm161f_77_vTSBC Customer Landing Network Collection",
+ "instanceId": "84a351ae-3601-45e2-98df-878d6c816abc",
+ "orchStatus": "Active",
+ "productFamilyId": null,
+ "lcpCloudRegionId": null,
+ "tenantId": null,
+ "cloudOwner": null,
+ "modelInfo": {
+ "modelInvariantId": "081ceb56-eb71-4566-a72d-3e7cbee5cdf1",
+ "modelVersionId": "ce8c98bc-4691-44fb-8ff0-7a47487c11c4",
+ "modelName": "NCM_VLAN_ym161f",
+ "modelType": "collection",
+ "modelVersion": "5.0"
+ },
+ "instanceType": null,
+ "provStatus": null,
+ "inMaint": false,
+ "uuid": "ce8c98bc-4691-44fb-8ff0-7a47487c11c4",
+ "originalName": "NCM_VLAN_ym161f 0",
+ "legacyRegion": null,
+ "lineOfBusiness": null,
+ "platformName": null,
+ "trackById": "84a351ae-3601-45e2-98df-878d6c816abc",
+ "ncfs": {
+ "6b3536cf-3a12-457f-abb5-fa2203e0d923": {
+ "action": "None",
+ "instanceName": "NcmVlanSvcYm161f_77_vTSBC Customer Landing Network Collection",
+ "instanceId": "6b3536cf-3a12-457f-abb5-fa2203e0d923",
+ "orchStatus": null,
+ "productFamilyId": null,
+ "lcpCloudRegionId": null,
+ "tenantId": null,
+ "cloudOwner": null,
+ "modelInfo": {
+ "modelInvariantId": "868b109c-9481-4a18-891b-af974db7705a",
+ "modelVersionId": "dd182d7d-6949-4b90-b3cc-5befe400742e",
+ "modelName": "ncm_vlan_ym161f..NetworkCollection..0",
+ "modelType": "instanceGroup",
+ "modelVersion": "1"
+ },
+ "instanceType": "L3-NETWORK",
+ "provStatus": null,
+ "inMaint": false,
+ "uuid": "dd182d7d-6949-4b90-b3cc-5befe400742e",
+ "originalName": "ncm_vlan_ym161f..NetworkCollection..0",
+ "legacyRegion": null,
+ "lineOfBusiness": null,
+ "platformName": null,
+ "trackById": "6b3536cf-3a12-457f-abb5-fa2203e0d923",
+ "instanceGroupRole": "SUB_INTERFACE",
+ "instanceGroupFunction": "vTSBC Customer Landing Network Collection",
+ "numberOfNetworks": 1
+ }
+ }
+ }
+ }
+}
diff --git a/vid-app-common/src/test/resources/payload_jsons/resume/msoResponseGetRequestsOfServiceInstance.json b/vid-app-common/src/test/resources/payload_jsons/resume/msoResponseGetRequestsOfServiceInstance.json
new file mode 100644
index 0000000..cb49dd8
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/resume/msoResponseGetRequestsOfServiceInstance.json
@@ -0,0 +1,62 @@
+{
+ "requestList": [
+ {
+ "request": {
+ "requestId": "894089b8-f7f4-418d-81da-34186fd32670",
+ "startTime": "Wed, 10 Oct 2018 08:01:21 GMT",
+ "finishTime": "Wed, 10 Oct 2018 08:01:43 GMT",
+ "requestScope": "service",
+ "requestType": "createInstance",
+ "requestDetails": {
+ "modelInfo": {
+ "modelInvariantId": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea",
+ "modelType": "service",
+ "modelName": "NCM_VLAN_SVC_ym161f",
+ "modelVersion": "8.0",
+ "modelVersionId": "6e0bec91-09f3-43aa-9cf3-e617cd0146be",
+ "modelUuid": "6e0bec91-09f3-43aa-9cf3-e617cd0146be",
+ "modelInvariantUuid": "f6342be5-d66b-4d03-a1aa-c82c3094c4ea"
+ },
+ "requestInfo": {
+ "productFamilyId": "db171b8f-115c-4992-a2e3-ee04cae357e0",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "cs0554"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
+ },
+ "cloudConfiguration": {
+ "tenantId": "d3b49834f7164cbe831bfbfa35ef649b",
+ "cloudOwner": "irma-aic",
+ "lcpCloudRegionId": "Two"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "Emanuel",
+ "userParams": [
+ {
+ "name": "aic_zone",
+ "value": "TTL58"
+ }
+ ],
+ "aLaCarte": false
+ },
+ "owningEntity": {
+ "owningEntityId": "e4257a94-21cc-40c5-adc9-e6f4ff868e31",
+ "owningEntityName": "EMANUEL-CORE"
+ }
+ },
+ "instanceReferences": {
+ "serviceInstanceId": "a565e6ad-75d1-4493-98f1-33234b5c17e2",
+ "requestorId": "cs0554"
+ },
+ "requestStatus": {
+ "requestState": "FAILED",
+ "statusMessage": "STATUS: Macro-Service-createInstance request was executed correctly.",
+ "percentProgress": 100,
+ "timestamp": "Wed, 10 Oct 2018 08:01:43 GMT"
+ }
+ }
+ }
+ ]
+}
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfModuleDelete1Create1None1Request.json b/vid-app-common/src/test/resources/payload_jsons/vfModuleDelete1Create1None1Request.json
new file mode 100644
index 0000000..642c2aa
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/vfModuleDelete1Create1None1Request.json
@@ -0,0 +1,139 @@
+{
+ "action": "None",
+ "isDirty": true,
+ "vnfs": {
+ "2017-488_PASQUALE-vPE 0": {
+ "vfModules": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot": {
+ "instanceName": "VFinstancenameZERO",
+ "instanceId": "VF_MODULE_INSTANCE_ID",
+ "action": "Create",
+ "lcpCloudRegionId": "AAIAIC25",
+ "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
+ "modelInfo": {
+ "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
+ "modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
+ "modelName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
+ "modelVersion": "5",
+ "modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
+ "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
+ },
+ "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db",
+ "provStatus": "Prov Status",
+ "orchStatus": "Active",
+ "inMaint": true
+ }
+ },
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc": {
+ "instanceName": "VFinstancename",
+ "instanceId": "VF_MODULE_INSTANCE_ID",
+ "action": "None_Delete",
+ "volumeGroupName": "VFinstancename_vol_abc",
+ "orchStatus": "Create",
+ "provStatus": "Prov Status",
+ "inMaint": false,
+ "lcpCloudRegionId": "AAIAIC25",
+ "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
+ "modelInfo": {
+ "modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
+ "modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5",
+ "modelName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
+ "modelVersion": "6",
+ "modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
+ "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
+ },
+ "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
+ }
+ },
+ "2017588_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-2": {
+ "2017588_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-2frgth": {
+ "instanceName": "VFinstancename",
+ "instanceId": "VF_MODULE_INSTANCE_ID1",
+ "action": "None",
+ "volumeGroupName": "VFinstancename_vol_abc",
+ "orchStatus": "Create",
+ "provStatus": "Prov Status",
+ "inMaint": false,
+ "lcpCloudRegionId": "AAIAIC25",
+ "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
+ "modelInfo": {
+ "modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
+ "modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5",
+ "modelName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
+ "modelVersion": "6",
+ "modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
+ "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
+ },
+ "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
+ }
+ }
+ },
+ "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
+ "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "lcpCloudRegionId": "AAIAIC25",
+ "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
+ "lineOfBusiness": "ONAP",
+ "platformName": "platform",
+ "modelInfo": {
+ "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
+ "modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
+ "modelName": "2017-488_PASQUALE-vPE",
+ "modelVersion": "5.0",
+ "modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
+ "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
+ "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09"
+ },
+ "orchStatus": "Created",
+ "inMaint": false,
+ "instanceId": "VNF_INSTANCE_ID",
+ "instanceName": "2017488_PASQUALEvPEVNFinstancename",
+ "action": "None",
+ "legacyRegion": "some legacy region"
+ }
+ },
+ "instanceParams": [],
+ "validationCounter": 0,
+ "existingNames": {
+ "mcankinstancename": ""
+ },
+ "existingVNFCounterMap": {
+ "afacccf6-397d-45d6-b5ae-94c39734b168": 1,
+ "69e09f68-8b63-4cc9-b9ff-860960b5db09": 3,
+ "b3c76f73-eeb5-4fb6-9d31-72a889f1811c": 1
+ },
+ "existingVnfGroupCounterMap": {},
+ "existingNetworksCounterMap": {},
+ "networks": {},
+ "vnfGroups": {},
+ "bulkSize": 1,
+ "instanceId": "f8791436-8d55-4fde-b4d5-72dd2cf13cfb",
+ "instanceName": "mCaNkinstancename",
+ "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "subscriptionServiceType": "TYLER SILVIA",
+ "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
+ "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "lcpCloudRegionId": "hvf6",
+ "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054",
+ "aicZoneId": "NFT1",
+ "projectName": "WATKINS",
+ "rollbackOnFailure": true,
+ "aicZoneName": "NFTJSSSS-NFT1",
+ "owningEntityName": "WayneHolland",
+ "tenantName": "AIN Web Tool-15-D-testalexandria",
+ "modelInfo": {
+ "modelInvariantId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
+ "modelVersionId": "6b528779-44a3-4472-bdff-9cd15ec93450",
+ "modelName": "action-data",
+ "modelVersion": "1.0",
+ "uuid": "6b528779-44a3-4472-bdff-9cd15ec93450"
+ },
+ "isALaCarte": true,
+ "orchStatus": "Active",
+ "modelInavariantId": "6b528779-44a3-4472-bdff-9cd15ec93450",
+ "testApi": "VNF_API"
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/replace_vfmodule.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/replace_vfmodule.json
new file mode 100644
index 0000000..c3ab694
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/replace_vfmodule.json
@@ -0,0 +1,52 @@
+{
+ "requestDetails": {
+ "requestInfo": {
+ "source": "VID",
+ "requestorId": "az2016",
+ "instanceName": "replace_module",
+ "suppressRollback": false
+ },
+ "relatedInstanceList": [{
+ "relatedInstance": {
+ "instanceId": "e9993045-cc96-4f3f-bf9a-71b2a400a956",
+ "modelInfo": {
+ "modelVersionId": "bad955c3-29b2-4a27-932e-28e942cc6480",
+ "modelVersion": "1",
+ "modelName": "Vf zolson5bpxmc02092017-Service",
+ "modelInvariantId": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b",
+ "modelType": "service"
+ }
+ }
+ }, {
+ "relatedInstance": {
+ "instanceId": "5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5",
+ "modelInfo": {
+ "modelName": "Vf zolson5bpxmc02092017-VF",
+ "modelVersion": "1",
+ "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7",
+ "modelType": "vnf",
+ "modelCustomizationName": "Vf zolson5bpxmc02092017-VF 0",
+ "modelVersionId": "d326f424-2312-4dd6-b7fe-364fadbd1ef5",
+ "modelCustomizationId": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade"
+ }
+ }
+ }],
+ "requestParameters": {
+ "userParams": [],
+ "testApi": "GR_API"
+ },
+ "modelInfo": {
+ "modelName": "VfZrdm5bpxmc02092017Vf..CORNELIUS_base..module-0",
+ "modelVersion": "1",
+ "modelInvariantId": "f7a867f2-596b-4f4a-a128-421e825a6190",
+ "modelType": "vfModule",
+ "modelVersionId": "eb5de6fb-9ecf-4009-b922-fae3a9ae7d46",
+ "modelCustomizationId": "074c64d0-7e13-4bcc-8bdb-ea922331102d"
+ },
+ "cloudConfiguration": {
+ "cloudOwner": "irma-aic",
+ "tenantId": "0422ffb57ba042c0800a29dc85ca70f8",
+ "lcpCloudRegionId": "regionOne"
+ }
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/replace_vfmodule_fe_input.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/replace_vfmodule_fe_input.json
new file mode 100644
index 0000000..92ccfe5
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/replace_vfmodule_fe_input.json
@@ -0,0 +1,92 @@
+{
+ "action": "None",
+ "isDirty": true,
+ "vnfs": {
+ "Vf zolson5bpxmc02092017-VF 0": {
+ "vfModules": {
+ "VfZrdm5bpxmc02092017Vf..CORNELIUS_base..module-0": {
+ "VfZrdm5bpxmc02092017Vf..CORNELIUS_base..module-0-?": {
+ "instanceName": "replace_module",
+ "instanceId": "5d49c3b1-fc90-4762-8c98-e800170baa55",
+ "action": "Replace",
+ "orchStatus": "Create",
+ "provStatus": "Prov Status",
+ "inMaint": false,
+ "rollbackOnFailure": true,
+ "lcpCloudRegionId": "regionOne",
+ "tenantId": "0422ffb57ba042c0800a29dc85ca70f8",
+ "modelInfo": {
+ "modelInvariantId": "f7a867f2-596b-4f4a-a128-421e825a6190",
+ "modelVersionId": "eb5de6fb-9ecf-4009-b922-fae3a9ae7d46",
+ "modelName": "VfZrdm5bpxmc02092017Vf..CORNELIUS_base..module-0",
+ "modelVersion": "1",
+ "modelCustomizationId": "074c64d0-7e13-4bcc-8bdb-ea922331102d",
+ "uuid": "eb5de6fb-9ecf-4009-b922-fae3a9ae7d46"
+ },
+ "uuid": "eb5de6fb-9ecf-4009-b922-fae3a9ae7d46"
+ }
+ }
+ },
+ "uuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5",
+ "productFamilyId": "bad955c3-29b2-4a27-932e-28e942cc6480",
+ "lcpCloudRegionId": "regionOne",
+ "tenantId": "0422ffb57ba042c0800a29dc85ca70f8",
+ "lineOfBusiness": "ONAP",
+ "platformName": "platform",
+ "modelInfo": {
+ "modelInvariantId": "23122c9b-dd7f-483f-bf0a-e069303db2f7",
+ "modelVersionId": "d326f424-2312-4dd6-b7fe-364fadbd1ef5",
+ "modelName": "Vf zolson5bpxmc02092017-VF",
+ "modelVersion": "1",
+ "modelCustomizationId": "96c23a4a-6887-4b2c-9cce-1e4ea35eaade",
+ "modelCustomizationName": "Vf zolson5bpxmc02092017-VF 0",
+ "uuid": "d326f424-2312-4dd6-b7fe-364fadbd1ef5"
+ },
+ "orchStatus": "Created",
+ "inMaint": false,
+ "rollbackOnFailure": true,
+ "instanceId": "5c9c2896-1fe6-4055-b7ec-d0a01e5f9bf5",
+ "instanceName": "vnf_of_replace_module",
+ "action": "None",
+ "legacyRegion": "some legacy region"
+ }
+ },
+ "instanceParams": [],
+ "validationCounter": 0,
+ "existingNames": {
+ "mcankinstancename": ""
+ },
+ "existingVNFCounterMap": {
+ "d326f424-2312-4dd6-b7fe-364fadbd1ef5": 1
+ },
+ "existingVnfGroupCounterMap": {},
+ "existingNetworksCounterMap": {},
+ "networks": {},
+ "vnfGroups": {},
+ "bulkSize": 1,
+ "instanceId": "e9993045-cc96-4f3f-bf9a-71b2a400a956",
+ "instanceName": "service_of_replace_module",
+ "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "subscriptionServiceType": "TYLER SILVIA",
+ "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
+ "productFamilyId": "bad955c3-29b2-4a27-932e-28e942cc6480",
+ "lcpCloudRegionId": "regionOne",
+ "tenantId": "0422ffb57ba042c0800a29dc85ca70f8",
+ "aicZoneId": "NFT1",
+ "projectName": "WATKINS",
+ "rollbackOnFailure": true,
+ "aicZoneName": "NFTJSSSS-NFT1",
+ "owningEntityName": "WayneHolland",
+ "tenantName": "tenant_name",
+ "modelInfo": {
+ "modelInvariantId": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b",
+ "modelVersionId": "bad955c3-29b2-4a27-932e-28e942cc6480",
+ "modelName": "Vf zolson5bpxmc02092017-Service",
+ "modelVersion": "1",
+ "uuid": "bad955c3-29b2-4a27-932e-28e942cc6480"
+ },
+ "isALaCarte": true,
+ "orchStatus": "Active",
+ "modelInavariantId": "b16a9398-ffa3-4041-b78c-2956b8ad9c7b",
+ "testApi": "GR_API"
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request.json
index 92f837f..1bce760 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request.json
@@ -12,7 +12,7 @@
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
"tenantId": "88a6ca3ee0394ade9403f075db23167e",
- "cloudOwner" : "att-aic"
+ "cloudOwner" : "irma-aic"
},
"requestInfo": {
"instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion",
@@ -63,7 +63,8 @@
"vre_a_volume_size_0" : "100",
"vmx_int_net_len" : "24",
"availability_zone_0": "mtpocdv-kvm-az01"
- }]
+ }],
+ "testApi" : "VNF_API"
}
}
}
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_instance_name.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_instance_name.json
index 82df5b9..1c0d2b9 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_instance_name.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_instance_name.json
@@ -12,7 +12,7 @@
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
"tenantId": "88a6ca3ee0394ade9403f075db23167e",
- "cloudOwner" : "att-aic"
+ "cloudOwner" : "irma-aic"
},
"requestInfo": {
"source": "VID",
@@ -53,7 +53,8 @@
"vre_a_volume_size_0" : "100",
"vmx_int_net_len" : "24",
"availability_zone_0": "mtpocdv-kvm-az01"
- }]
+ }],
+ "testApi" : "VNF_API"
}
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_volume_group.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_volume_group.json
index cfa4c26..3581a47 100644
--- a/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_volume_group.json
+++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule_instantiation_request_without_volume_group.json
@@ -12,7 +12,7 @@
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
"tenantId": "88a6ca3ee0394ade9403f075db23167e",
- "cloudOwner" : "att-aic"
+ "cloudOwner" : "irma-aic"
},
"requestInfo": {
"instanceName": "vmxnjr001_AVPN_base_vRE_BV_expansion",
@@ -54,7 +54,8 @@
"vre_a_volume_size_0" : "100",
"vmx_int_net_len" : "24",
"availability_zone_0": "mtpocdv-kvm-az01"
- }]
+ }],
+ "testApi" : "VNF_API"
}
}
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/vnf/bulk_vnf_request.json b/vid-app-common/src/test/resources/payload_jsons/vnf/bulk_vnf_request.json
new file mode 100644
index 0000000..1ae0406
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/vnf/bulk_vnf_request.json
@@ -0,0 +1,49 @@
+ {
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "11111111-f63c-463e-ba94-286933b895f9",
+ "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8",
+ "modelName": "2016-73_MOW-AVPN-vPE-BV-L",
+ "modelVersion": "10.0",
+ "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0",
+ "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e",
+ "cloudOwner" : "irma-aic"
+ },
+ "requestInfo": {
+ "instanceName": "vmxnjr001",
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "pa0916"
+ },
+ "platform": {
+ "platformName": "platformName"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "lineOfBusinessName"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "aa3514e3-5a33-55df-13ab-12abad84e7aa",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "sriov",
+ "modelVersion": "1.0"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "userParams": [],
+ "testApi" : "VNF_API"
+ }
+ }
+ }
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/vnf/bulk_vnf_request_without_cloud_owner.json b/vid-app-common/src/test/resources/payload_jsons/vnf/bulk_vnf_request_without_cloud_owner.json
new file mode 100644
index 0000000..1916964
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/vnf/bulk_vnf_request_without_cloud_owner.json
@@ -0,0 +1,48 @@
+ {
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "11111111-f63c-463e-ba94-286933b895f9",
+ "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8",
+ "modelName": "2016-73_MOW-AVPN-vPE-BV-L",
+ "modelVersion": "10.0",
+ "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0",
+ "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e"
+ },
+ "requestInfo": {
+ "instanceName": "vmxnjr001",
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "pa0916"
+ },
+ "platform": {
+ "platformName": "platformName"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "lineOfBusinessName"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "aa3514e3-5a33-55df-13ab-12abad84e7aa",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "sriov",
+ "modelVersion": "1.0"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "userParams": [],
+ "testApi" : "VNF_API"
+ }
+ }
+ }
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/vnf/bulk_vnf_request_without_instance_name.json b/vid-app-common/src/test/resources/payload_jsons/vnf/bulk_vnf_request_without_instance_name.json
new file mode 100644
index 0000000..3b59e6d
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/vnf/bulk_vnf_request_without_instance_name.json
@@ -0,0 +1,48 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelType": "vnf",
+ "modelInvariantId": "11111111-f63c-463e-ba94-286933b895f9",
+ "modelVersionId": "7f40c192-f63c-463e-ba94-286933b895f8",
+ "modelName": "2016-73_MOW-AVPN-vPE-BV-L",
+ "modelVersion": "10.0",
+ "modelCustomizationName": "2016-73_MOW-AVPN-vPE-BV-L 0",
+ "modelCustomizationId": "ab153b6e-c364-44c0-bef6-1f2982117f04"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "mdt1",
+ "tenantId": "88a6ca3ee0394ade9403f075db23167e",
+ "cloudOwner": "irma-aic"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": true,
+ "requestorId": "pa0916"
+ },
+ "platform": {
+ "platformName": "platformName"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "lineOfBusinessName"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "aa3514e3-5a33-55df-13ab-12abad84e7aa",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "sriov",
+ "modelVersion": "1.0"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "userParams": [],
+ "testApi" : "VNF_API"
+ }
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/vnf/vnf_without_lob_expected.json b/vid-app-common/src/test/resources/payload_jsons/vnf/vnf_without_lob_expected.json
new file mode 100644
index 0000000..11c5dcb
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/vnf/vnf_without_lob_expected.json
@@ -0,0 +1,46 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelCustomizationName": "xbi test VID noFC HEAT 0",
+ "modelCustomizationId": "e9745411-1f7d-47e3-9857-47363cb9ff92",
+ "modelInvariantId": "77d3a011-affb-4166-89b2-c4be7bc4ff23",
+ "modelVersionId": "9bb0edd9-3631-455b-bdfd-979b2ab53d07",
+ "modelName": "xbi test VID noFC HEAT",
+ "modelType": "vnf",
+ "modelVersion": "1.0"
+ },
+ "cloudConfiguration": {
+ "lcpCloudRegionId": "olson52b",
+ "tenantId": "bbf14e449c954feea272e926a8c2b244",
+ "cloudOwner" : "irma-aic"
+ },
+ "requestInfo": {
+ "instanceName": "zolson52bfrwl01",
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "pa0916"
+ },
+ "platform": {
+ "platformName": "NETWORK-CLOUD"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "aa3514e3-5a33-55df-13ab-12abad84e7aa",
+ "modelInfo": {
+ "modelType": "service",
+ "modelInvariantId": "ff3514e3-5a33-55df-13ab-12abad84e7ff",
+ "modelVersionId": "fe6985cd-ea33-3346-ac12-ab121484a3fe",
+ "modelName": "sriov",
+ "modelVersion": "1.0"
+ }
+ }
+ }
+ ],
+ "requestParameters": {
+ "userParams": [],
+ "testApi": "VNF_API"
+ }
+ }
+}
diff --git a/vid-app-common/src/test/resources/payload_jsons/vnf/vnf_without_lob_user_input.json b/vid-app-common/src/test/resources/payload_jsons/vnf/vnf_without_lob_user_input.json
new file mode 100644
index 0000000..60be0d1
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/vnf/vnf_without_lob_user_input.json
@@ -0,0 +1,24 @@
+{
+ "modelInfo": {
+ "modelCustomizationName": "xbi test VID noFC HEAT 0",
+ "modelCustomizationId": "e9745411-1f7d-47e3-9857-47363cb9ff92",
+ "modelInvariantId": "77d3a011-affb-4166-89b2-c4be7bc4ff23",
+ "modelVersionId": "9bb0edd9-3631-455b-bdfd-979b2ab53d07",
+ "modelName": "xbi test VID noFC HEAT",
+ "modelType": "vnf",
+ "modelVersion": "1.0"
+ },
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "instanceName": "zolson52bfrwl01",
+ "action": "Create",
+ "platformName": "NETWORK-CLOUD",
+ "lcpCloudRegionId": "olson52b",
+ "tenantId": "bbf14e449c954feea272e926a8c2b244",
+ "instanceParams": [{}],
+ "rollbackOnFailure": true,
+ "instanceId": null,
+ "vfModules": {},
+ "trackById": "449206d5-54a6-441f-b5c2-beacb2f2e1cc",
+ "isFailed": false,
+ "lineOfBusiness": null
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/vnfDelete1Create1Request.json b/vid-app-common/src/test/resources/payload_jsons/vnfDelete1Create1Request.json
new file mode 100644
index 0000000..5cf7973
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/vnfDelete1Create1Request.json
@@ -0,0 +1,240 @@
+{
+ "action": "None",
+ "isDirty": true,
+ "vnfs": {
+ "2017-388_PASQUALE-vPE 0": {
+ "vfModules": {},
+ "uuid": "afacccf6-397d-45d6-b5ae-94c39734b168",
+ "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "lcpCloudRegionId": "AAIAIC25",
+ "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
+ "lineOfBusiness": "ONAP",
+ "platformName": "platform",
+ "modelInfo": {
+ "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
+ "modelVersionId": "afacccf6-397d-45d6-b5ae-94c39734b168",
+ "modelName": "2017-388_PASQUALE-vPE",
+ "modelVersion": "4.0",
+ "modelCustomizationId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
+ "modelCustomizationName": "2017-388_PASQUALE-vPE 0",
+ "uuid": "afacccf6-397d-45d6-b5ae-94c39734b168"
+ },
+ "instanceName": "2017388_PASQUALEvPEmCaNkinstanceName",
+ "action": "None",
+ "legacyRegion": "some legacy region"
+ },
+ "2017-488_PASQUALE-vPE 0": {
+ "vfModules": {},
+ "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
+ "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "lcpCloudRegionId": "AAIAIC25",
+ "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
+ "lineOfBusiness": "ONAP",
+ "platformName": "platform",
+ "modelInfo": {
+ "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
+ "modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
+ "modelName": "2017-488_PASQUALE-vPE",
+ "modelVersion": "5.0",
+ "modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
+ "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
+ "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09"
+ },
+ "orchStatus": "Created",
+ "inMaint": false,
+ "instanceId": "VNF_INSTANCE_ID",
+ "instanceName": "2017488_PASQUALEvPEVNFinstancename",
+ "action": "None_Delete",
+ "legacyRegion": "some legacy region"
+ },
+ "2017-488_PASQUALE-vPE 0:0001": {
+ "vfModules": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot": {
+ "instanceName": "VFinstancenameZERO_001",
+ "action": "None",
+ "provStatus": "Prov Status",
+ "inMaint": true,
+ "modelInfo": {
+ "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
+ "modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
+ "modelName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
+ "modelVersion": "5",
+ "modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
+ "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
+ },
+ "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
+ }
+ },
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc": {
+ "instanceName": "VFinstancename_001",
+ "action": "None",
+ "volumeGroupName": "VFinstancename_vol_abc_001",
+ "modelInfo": {
+ "modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
+ "modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5",
+ "modelName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
+ "modelVersion": "6",
+ "modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
+ "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
+ },
+ "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
+ }
+ }
+ },
+ "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
+ "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "lcpCloudRegionId": "AAIAIC25",
+ "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
+ "lineOfBusiness": "ONAP",
+ "platformName": "platform",
+ "modelInfo": {
+ "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
+ "modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
+ "modelName": "2017-488_PASQUALE-vPE",
+ "modelVersion": "5.0",
+ "modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
+ "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
+ "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09"
+ },
+ "instanceName": "2017488_PASQUALEvPEVNFinstancename_001",
+ "action": "None",
+ "legacyRegion": "some legacy region"
+ },
+ "2017-488_PASQUALE-vPE 0:0002": {
+ "vfModules": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot": {
+ "instanceName": "VFinstancenameZERO_002",
+ "action": "None",
+ "modelInfo": {
+ "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
+ "modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
+ "modelName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
+ "modelVersion": "5",
+ "modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
+ "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
+ },
+ "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
+ }
+ },
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc": {
+ "instanceName": "VFinstancename_002",
+ "action": "None",
+ "volumeGroupName": "VFinstancename_vol_abc_002",
+ "modelInfo": {
+ "modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
+ "modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5",
+ "modelName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
+ "modelVersion": "6",
+ "modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
+ "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
+ },
+ "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
+ }
+ }
+ },
+ "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
+ "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "lcpCloudRegionId": "AAIAIC25",
+ "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
+ "lineOfBusiness": "ONAP",
+ "platformName": "platform",
+ "modelInfo": {
+ "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
+ "modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
+ "modelName": "2017-488_PASQUALE-vPE",
+ "modelVersion": "5.0",
+ "modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
+ "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
+ "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09"
+ },
+ "instanceName": "2017488_PASQUALEvPEVNFinstancename_002",
+ "action": "None",
+ "legacyRegion": "some legacy region"
+ },
+ "2017-388_PASQUALE-vPE 0_1": {
+ "action": "Create",
+ "inMaint": false,
+ "rollbackOnFailure": "true",
+ "originalName": "2017-388_PASQUALE-vPE 0",
+ "isMissingData": false,
+ "trackById": "wk10c4hh1oj",
+ "vfModules": {},
+ "vnfStoreKey": "2017-388_PASQUALE-vPE 0_1",
+ "instanceName": "2017388_PASQUALEvPEmCaNkinstanceName",
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "lcpCloudRegionId": "hvf6",
+ "tenantId": "229bcdc6eaeb4ca59d55221141d01f8e",
+ "platformName": "xxx1",
+ "lineOfBusiness": "zzz1",
+ "instanceParams": [
+ {
+ "vnf_config_template_version": "17.2",
+ "bandwidth_units": "Gbps",
+ "bandwidth": "10",
+ "AIC_CLLI": "ATLMY8GA",
+ "ASN": "AV_vPE",
+ "vnf_instance_name": "mtnj309me6"
+ }
+ ],
+ "modelInfo": {
+ "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
+ "modelVersionId": "afacccf6-397d-45d6-b5ae-94c39734b168",
+ "modelName": "2017-388_PASQUALE-vPE",
+ "modelVersion": "4.0",
+ "modelCustomizationId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
+ "modelCustomizationName": "2017-388_PASQUALE-vPE 0",
+ "uuid": "afacccf6-397d-45d6-b5ae-94c39734b168",
+ "modelUniqueId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c"
+ },
+ "uuid": "afacccf6-397d-45d6-b5ae-94c39734b168"
+ }
+ },
+ "instanceParams": [],
+ "validationCounter": 0,
+ "existingNames": {
+ "mcankinstancename": ""
+ },
+ "existingVNFCounterMap": {
+ "afacccf6-397d-45d6-b5ae-94c39734b168": 1,
+ "69e09f68-8b63-4cc9-b9ff-860960b5db09": 3,
+ "b3c76f73-eeb5-4fb6-9d31-72a889f1811c": 1
+ },
+ "existingVnfGroupCounterMap": {},
+ "existingNetworksCounterMap": {},
+ "networks": {},
+ "vnfGroups": {},
+ "bulkSize": 1,
+ "instanceId": "f8791436-8d55-4fde-b4d5-72dd2cf13cfb",
+ "instanceName": "mCaNkinstancename",
+ "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "subscriptionServiceType": "TYLER SILVIA",
+ "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
+ "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "lcpCloudRegionId": "hvf6",
+ "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054",
+ "aicZoneId": "NFT1",
+ "projectName": "WATKINS",
+ "rollbackOnFailure": true,
+ "aicZoneName": "NFTJSSSS-NFT1",
+ "owningEntityName": "WayneHolland",
+ "tenantName": "AIN Web Tool-15-D-testalexandria",
+ "modelInfo": {
+ "modelInvariantId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
+ "modelVersionId": "6b528779-44a3-4472-bdff-9cd15ec93450",
+ "modelName": "action-data",
+ "modelVersion": "1.0",
+ "uuid": "6b528779-44a3-4472-bdff-9cd15ec93450"
+ },
+ "isALaCarte": true,
+ "orchStatus": "Active",
+ "modelInavariantId": "6b528779-44a3-4472-bdff-9cd15ec93450",
+ "testApi": "VNF_API"
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/volumegroup_instantiation_request.json b/vid-app-common/src/test/resources/payload_jsons/volumegroup_instantiation_request.json
index 02d2d1e..8d64ebe 100644
--- a/vid-app-common/src/test/resources/payload_jsons/volumegroup_instantiation_request.json
+++ b/vid-app-common/src/test/resources/payload_jsons/volumegroup_instantiation_request.json
@@ -12,7 +12,7 @@
"cloudConfiguration": {
"lcpCloudRegionId": "mdt1",
"tenantId": "88a6ca3ee0394ade9403f075db23167e",
- "cloudOwner" : "att-aic"
+ "cloudOwner" : "irma-aic"
},
"requestInfo": {
"instanceName": "myVgName",
@@ -50,7 +50,8 @@
],
"requestParameters" : {
"userParams" : [ ],
- "usePreload" : true
+ "usePreload" : true,
+ "testApi" : "VNF_API"
}
}
}
diff --git a/vid-app-common/src/test/resources/payload_jsons/vrfEntry/service_with_vrf_entry_fe_input.json b/vid-app-common/src/test/resources/payload_jsons/vrfEntry/service_with_vrf_entry_fe_input.json
new file mode 100644
index 0000000..4f20cf1
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/vrfEntry/service_with_vrf_entry_fe_input.json
@@ -0,0 +1,81 @@
+{
+ "action": "Create",
+ "isDirty": false,
+ "vnfs": {},
+ "vrfs": {
+ "vrf-1": {
+ "networks": {
+ "Network-1": {
+ "instanceName": "myBestNetwork",
+ "instanceId": "884b373f-41c0-4a96-9785-7f075cb4ae9d",
+ "modelInfo": {
+ "modelType": "network"
+ }
+ }
+ },
+ "vpns": {
+ "vpn-1": {
+ "instanceName": "justFakeVPN",
+ "instanceId": "7e971d5c-6ddf-4f02-be8a-95dcbc7daf83",
+ "modelInfo": {
+ "modelType": "vpnBinding"
+ }
+ }
+ }
+ }
+ },
+ "instanceParams": [
+ {}
+ ],
+ "validationCounter": 0,
+ "existingNames": {
+ "dfd": ""
+ },
+ "existingVNFCounterMap": {},
+ "existingVRFCounterMap": {},
+ "existingVnfGroupCounterMap": {},
+ "existingNetworksCounterMap": {},
+ "optionalGroupMembersMap": {},
+ "networks": {},
+ "vnfGroups": {},
+ "bulkSize": 1,
+ "instanceName": "dfd",
+ "productFamilyId": "ddf9cc0f-6331-4d35-bed0-a37f2d5e9cb3",
+ "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "subscriberName": "SILVIA ROBBINS",
+ "subscriptionServiceType": "TYLER SILVIA",
+ "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
+ "lcpCloudRegionId": "lcpCloudRegionId",
+ "tenantName": "tenantName",
+ "tenantId": "4b273bc5-0ae6-4088-aa5d-5a862d84cab2",
+ "projectName": "WATKINS",
+ "rollbackOnFailure": "true",
+ "aicZoneName": null,
+ "owningEntityName": "WayneHolland",
+ "testApi": "VNF_API",
+ "modelInfo": {
+ "modelInvariantId": "dfc2c44c-2429-44ca-ae26-1e6dc1f207fb",
+ "modelVersionId": "f028b2e2-7080-4b13-91b2-94944d4c42d8",
+ "modelName": "infraVPN",
+ "modelVersion": "1.0",
+ "uuid": "f028b2e2-7080-4b13-91b2-94944d4c42d8",
+ "modelUniqueId": "f028b2e2-7080-4b13-91b2-94944d4c42d8"
+ },
+ "isALaCarte": true,
+ "name": "infraVPN",
+ "version": "1.0",
+ "description": "ddd",
+ "category": "Network Service",
+ "uuid": "f028b2e2-7080-4b13-91b2-94944d4c42d8",
+ "invariantUuid": "dfc2c44c-2429-44ca-ae26-1e6dc1f207fb",
+ "serviceType": "BONDING",
+ "serviceRole": "INFRASTRUCTURE-VPN",
+ "vidNotions": {
+ "instantiationType": "Macro",
+ "instantiationUI": "infrastructureVpn",
+ "modelCategory": "INFRASTRUCTURE_VPN",
+ "viewEditUI": "legacy"
+ },
+ "isEcompGeneratedNaming": true,
+ "isMultiStepDesign": false
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/payload_jsons/vrfEntry/service_with_vrf_instantiation_request.json b/vid-app-common/src/test/resources/payload_jsons/vrfEntry/service_with_vrf_instantiation_request.json
new file mode 100644
index 0000000..2e64554
--- /dev/null
+++ b/vid-app-common/src/test/resources/payload_jsons/vrfEntry/service_with_vrf_instantiation_request.json
@@ -0,0 +1,59 @@
+{
+ "requestDetails": {
+ "modelInfo": {
+ "modelInvariantId": "dfc2c44c-2429-44ca-ae26-1e6dc1f207fb",
+ "modelVersionId": "f028b2e2-7080-4b13-91b2-94944d4c42d8",
+ "modelName": "infraVPN",
+ "modelVersion": "1.0",
+ "modelType": "service"
+ },
+ "cloudConfiguration": {
+ "cloudOwner": "irma-aic",
+ "lcpCloudRegionId": "lcpCloudRegionId",
+ "tenantId": "4b273bc5-0ae6-4088-aa5d-5a862d84cab2"
+ },
+ "owningEntity": {
+ "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
+ "owningEntityName": "WayneHolland"
+ },
+ "project": {
+ "projectName": "WATKINS"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89",
+ "subscriberName": "SILVIA ROBBINS"
+ },
+ "requestInfo": {
+ "instanceName": "dfd",
+ "productFamilyId": "ddf9cc0f-6331-4d35-bed0-a37f2d5e9cb3",
+ "source": "VID",
+ "suppressRollback": false,
+ "requestorId": "az2016"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "TYLER SILVIA",
+ "aLaCarte": false,
+ "userParams": []
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "7e971d5c-6ddf-4f02-be8a-95dcbc7daf83",
+ "instanceName": "justFakeVPN",
+ "modelInfo": {
+ "modelType": "vpnBinding"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "884b373f-41c0-4a96-9785-7f075cb4ae9d",
+ "instanceName": "myBestNetwork",
+ "modelInfo": {
+ "modelType": "network"
+ }
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/policy-configuration-by-policy-false.JSON b/vid-app-common/src/test/resources/policy-configuration-by-policy-false.JSON
index 4508599..6e07326 100644
--- a/vid-app-common/src/test/resources/policy-configuration-by-policy-false.JSON
+++ b/vid-app-common/src/test/resources/policy-configuration-by-policy-false.JSON
@@ -34,8 +34,8 @@
"type": "Configuration",
"modelCustomizationName": "Port Mirroring Configuration By Policy 1",
"sourceNodes": [
- "vmmeservice2_proxy 2",
- "vmmeservice2_proxy 3"
+ "vflorenceservice2_proxy 2",
+ "vflorenceservice2_proxy 3"
],
"collectorNodes": [
"pprobeservice_proxy 5"
@@ -61,9 +61,9 @@
"type": "Configuration",
"modelCustomizationName": "Port Mirroring Configuration By Policy 0",
"sourceNodes": [
- "vmmeservice2_proxy 2",
- "vmmeservice_proxy 1",
- "vmmeservice_proxy 0"
+ "vflorenceservice2_proxy 2",
+ "vflorenceservice_proxy 1",
+ "vflorenceservice_proxy 0"
],
"collectorNodes": [
],
@@ -71,11 +71,11 @@
}
},
"serviceProxies": {
- "vmmeservice_proxy 0": {
+ "vflorenceservice_proxy 0": {
"uuid": "a32fee17-5b59-4c34-ba6f-6dd2f1c61fee",
"invariantUuid": "2933b574-d28d-45ea-bf22-4df2907e4a10",
- "description": "A Proxy for Service vmmeService",
- "name": "vmmeService Service Proxy",
+ "description": "A Proxy for Service vflorenceService",
+ "name": "vflorenceService Service Proxy",
"version": "1.0",
"customizationUuid": "d7cfe338-eeda-4217-ba13-f24b0811fb17",
"inputs": {},
@@ -84,13 +84,13 @@
"type": "Service Proxy",
"sourceModelUuid": "c3e6c9bd-b24d-458e-aa99-e0cadf70c5e5",
"sourceModelInvariant": "dd8a805d-3946-4f11-9831-e26cd6aec9a3",
- "sourceModelName": "vmmeService"
+ "sourceModelName": "vflorenceService"
},
- "vmmeservice_proxy 1": {
+ "vflorenceservice_proxy 1": {
"uuid": "a32fee17-5b59-4c34-ba6f-6dd2f1c61fee",
"invariantUuid": "2933b574-d28d-45ea-bf22-4df2907e4a10",
- "description": "A Proxy for Service vmmeService",
- "name": "vmmeService Service Proxy",
+ "description": "A Proxy for Service vflorenceService",
+ "name": "vflorenceService Service Proxy",
"version": "1.0",
"customizationUuid": "7a69f133-564c-4eb6-b93e-0a8281967efb",
"inputs": {},
@@ -99,13 +99,13 @@
"type": "Service Proxy",
"sourceModelUuid": "c3e6c9bd-b24d-458e-aa99-e0cadf70c5e5",
"sourceModelInvariant": "dd8a805d-3946-4f11-9831-e26cd6aec9a3",
- "sourceModelName": "vmmeService"
+ "sourceModelName": "vflorenceService"
},
- "vmmeservice2_proxy 3": {
+ "vflorenceservice2_proxy 3": {
"uuid": "a32fee17-5b59-4c34-ba6f-6dd2f1c61fee",
"invariantUuid": "2933b574-d28d-45ea-bf22-4df2907e4a10",
- "description": "A Proxy for Service vmmeService2",
- "name": "vmmeService2 Service Proxy",
+ "description": "A Proxy for Service vflorenceService2",
+ "name": "vflorenceService2 Service Proxy",
"version": "1.0",
"customizationUuid": "9d81c21f-e29c-44f6-b5f6-caa974ee078a",
"inputs": {},
@@ -114,7 +114,7 @@
"type": "Service Proxy",
"sourceModelUuid": "2a2ea15f-07c6-4b89-bfca-e8aba39a34d6",
"sourceModelInvariant": "a7eac2b3-8444-40ee-92e3-b3359b32445c",
- "sourceModelName": "vmmeService2"
+ "sourceModelName": "vflorenceService2"
},
"pprobeservice_proxy 4": {
"uuid": "a32fee17-5b59-4c34-ba6f-6dd2f1c61fee",
@@ -146,11 +146,11 @@
"sourceModelInvariant": "83b458fd-5dd3-419b-a9e3-7335814a0911",
"sourceModelName": "pProbeService"
},
- "vmmeservice2_proxy 2": {
+ "vflorenceservice2_proxy 2": {
"uuid": "a32fee17-5b59-4c34-ba6f-6dd2f1c61fee",
"invariantUuid": "2933b574-d28d-45ea-bf22-4df2907e4a10",
- "description": "A Proxy for Service vmmeService2",
- "name": "vmmeService2 Service Proxy",
+ "description": "A Proxy for Service vflorenceService2",
+ "name": "vflorenceService2 Service Proxy",
"version": "1.0",
"customizationUuid": "060be63d-5f9c-4fd0-8ef7-830d5e8eca17",
"inputs": {},
@@ -159,7 +159,7 @@
"type": "Service Proxy",
"sourceModelUuid": "2a2ea15f-07c6-4b89-bfca-e8aba39a34d6",
"sourceModelInvariant": "a7eac2b3-8444-40ee-92e3-b3359b32445c",
- "sourceModelName": "vmmeService2"
+ "sourceModelName": "vflorenceService2"
}
},
"vfModules": {},
diff --git a/vid-app-common/src/test/resources/policy-configuration-csar.JSON b/vid-app-common/src/test/resources/policy-configuration-csar.JSON
index 41f5f5c..d2614cb 100644
--- a/vid-app-common/src/test/resources/policy-configuration-csar.JSON
+++ b/vid-app-common/src/test/resources/policy-configuration-csar.JSON
@@ -34,9 +34,9 @@
"type": "Configuration",
"modelCustomizationName": "Port Mirroring Configuration By Policy 1",
"sourceNodes": [
- "vmmeservice2_proxy 2",
- "vmmeservice2_proxy 3",
- "vmmeservice_proxy 1"
+ "vflorenceservice2_proxy 2",
+ "vflorenceservice2_proxy 3",
+ "vflorenceservice_proxy 1"
],
"collectorNodes": [
"pprobeservice_proxy 5"
@@ -62,9 +62,9 @@
"type": "Configuration",
"modelCustomizationName": "Port Mirroring Configuration By Policy 0",
"sourceNodes": [
- "vmmeservice2_proxy 2",
- "vmmeservice_proxy 1",
- "vmmeservice_proxy 0"
+ "vflorenceservice2_proxy 2",
+ "vflorenceservice_proxy 1",
+ "vflorenceservice_proxy 0"
],
"collectorNodes": [
"pprobeservice_proxy 4"
@@ -73,11 +73,11 @@
}
},
"serviceProxies": {
- "vmmeservice_proxy 0": {
+ "vflorenceservice_proxy 0": {
"uuid": "a32fee17-5b59-4c34-ba6f-6dd2f1c61fee",
"invariantUuid": "2933b574-d28d-45ea-bf22-4df2907e4a10",
- "description": "A Proxy for Service vmmeService",
- "name": "vmmeService Service Proxy",
+ "description": "A Proxy for Service vflorenceService",
+ "name": "vflorenceService Service Proxy",
"version": "1.0",
"customizationUuid": "d7cfe338-eeda-4217-ba13-f24b0811fb17",
"inputs": {},
@@ -88,13 +88,13 @@
"type": "Service Proxy",
"sourceModelUuid": "c3e6c9bd-b24d-458e-aa99-e0cadf70c5e5",
"sourceModelInvariant": "dd8a805d-3946-4f11-9831-e26cd6aec9a3",
- "sourceModelName": "vmmeService"
+ "sourceModelName": "vflorenceService"
},
- "vmmeservice_proxy 1": {
+ "vflorenceservice_proxy 1": {
"uuid": "a32fee17-5b59-4c34-ba6f-6dd2f1c61fee",
"invariantUuid": "2933b574-d28d-45ea-bf22-4df2907e4a10",
- "description": "A Proxy for Service vmmeService",
- "name": "vmmeService Service Proxy",
+ "description": "A Proxy for Service vflorenceService",
+ "name": "vflorenceService Service Proxy",
"version": "1.0",
"customizationUuid": "7a69f133-564c-4eb6-b93e-0a8281967efb",
"inputs": {},
@@ -105,13 +105,13 @@
"type": "Service Proxy",
"sourceModelUuid": "c3e6c9bd-b24d-458e-aa99-e0cadf70c5e5",
"sourceModelInvariant": "dd8a805d-3946-4f11-9831-e26cd6aec9a3",
- "sourceModelName": "vmmeService"
+ "sourceModelName": "vflorenceService"
},
- "vmmeservice2_proxy 3": {
+ "vflorenceservice2_proxy 3": {
"uuid": "a32fee17-5b59-4c34-ba6f-6dd2f1c61fee",
"invariantUuid": "2933b574-d28d-45ea-bf22-4df2907e4a10",
- "description": "A Proxy for Service vmmeService2",
- "name": "vmmeService2 Service Proxy",
+ "description": "A Proxy for Service vflorenceService2",
+ "name": "vflorenceService2 Service Proxy",
"version": "1.0",
"customizationUuid": "9d81c21f-e29c-44f6-b5f6-caa974ee078a",
"inputs": {},
@@ -122,7 +122,7 @@
"type": "Service Proxy",
"sourceModelUuid": "2a2ea15f-07c6-4b89-bfca-e8aba39a34d6",
"sourceModelInvariant": "a7eac2b3-8444-40ee-92e3-b3359b32445c",
- "sourceModelName": "vmmeService2"
+ "sourceModelName": "vflorenceService2"
},
"pprobeservice_proxy 4": {
"uuid": "a32fee17-5b59-4c34-ba6f-6dd2f1c61fee",
@@ -158,11 +158,11 @@
"sourceModelInvariant": "83b458fd-5dd3-419b-a9e3-7335814a0911",
"sourceModelName": "pProbeService"
},
- "vmmeservice2_proxy 2": {
+ "vflorenceservice2_proxy 2": {
"uuid": "a32fee17-5b59-4c34-ba6f-6dd2f1c61fee",
"invariantUuid": "2933b574-d28d-45ea-bf22-4df2907e4a10",
- "description": "A Proxy for Service vmmeService2",
- "name": "vmmeService2 Service Proxy",
+ "description": "A Proxy for Service vflorenceService2",
+ "name": "vflorenceService2 Service Proxy",
"version": "1.0",
"customizationUuid": "060be63d-5f9c-4fd0-8ef7-830d5e8eca17",
"inputs": {},
@@ -173,11 +173,14 @@
"type": "Service Proxy",
"sourceModelUuid": "2a2ea15f-07c6-4b89-bfca-e8aba39a34d6",
"sourceModelInvariant": "a7eac2b3-8444-40ee-92e3-b3359b32445c",
- "sourceModelName": "vmmeService2"
+ "sourceModelName": "vflorenceService2"
}
},
"vfModules": {},
"volumeGroups": {},
"pnfs": {},
- "vnfGroups": {}
+ "vnfGroups": {},
+ "vrfs": {
+
+ }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/responses/aai/getCloudRegionAndTenantByVnfId.json b/vid-app-common/src/test/resources/responses/aai/getCloudRegionAndTenantByVnfId.json
index 690be60..bc3ab0a 100644
--- a/vid-app-common/src/test/resources/responses/aai/getCloudRegionAndTenantByVnfId.json
+++ b/vid-app-common/src/test/resources/responses/aai/getCloudRegionAndTenantByVnfId.json
@@ -34,7 +34,7 @@
{
"id": "264798392",
"node-type": "vserver",
- "url": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23b/tenants/tenant/3e9a20a3e89e45f884e09df0cc2d2d2a/vservers/vserver/088c2bf0-80e2-4bdf-93ae-b2469fbeba84",
+ "url": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/mtn23b/tenants/tenant/3e9a20a3e89e45f884e09df0cc2d2d2a/vservers/vserver/088c2bf0-80e2-4bdf-93ae-b2469fbeba84",
"properties": {
"vserver-id": "088c2bf0-80e2-4bdf-93ae-b2469fbeba84",
"vserver-name": "zrdm3mogx01oam001",
@@ -49,7 +49,7 @@
"id": "211808464",
"relationship-label": "tosca.relationships.AttachesTo",
"node-type": "volume",
- "url": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23b/tenants/tenant/3e9a20a3e89e45f884e09df0cc2d2d2a/vservers/vserver/088c2bf0-80e2-4bdf-93ae-b2469fbeba84/volumes/volume/28e1246e-2aeb-4a59-bb51-f20fb8e93c42"
+ "url": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/mtn23b/tenants/tenant/3e9a20a3e89e45f884e09df0cc2d2d2a/vservers/vserver/088c2bf0-80e2-4bdf-93ae-b2469fbeba84/volumes/volume/28e1246e-2aeb-4a59-bb51-f20fb8e93c42"
}
]
},
@@ -75,7 +75,7 @@
{
"id": "8757432",
"node-type": "tenant",
- "url": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23b/tenants/tenant/3e9a20a3e89e45f884e09df0cc2d2d2a",
+ "url": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/mtn23b/tenants/tenant/3e9a20a3e89e45f884e09df0cc2d2d2a",
"properties": {
"tenant-id": "3e9a20a3e89e45f884e09df0cc2d2d2a",
"tenant-name": "APPC-24595-T-IST-02C",
@@ -93,9 +93,9 @@
{
"id": "302227536",
"node-type": "cloud-region",
- "url": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23b",
+ "url": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/mtn23b",
"properties": {
- "cloud-owner": "att-aic",
+ "cloud-owner": "irma-aic" ,
"cloud-region-id": "mtn23b",
"cloud-type": "openstack",
"owner-defined-type": "lcp",
@@ -111,7 +111,7 @@
"id": "2744328",
"relationship-label": "org.onap.relationships.inventory.BelongsTo",
"node-type": "tenant",
- "url": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/att-aic/mtn23b/tenants/tenant/5452d6bd0cb34e99a3553d349456c642"
+ "url": "/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/irma-aic/mtn23b/tenants/tenant/5452d6bd0cb34e99a3553d349456c642"
}
]
}
diff --git a/vid-app-common/src/test/resources/responses/mso/multipleOrchestrationRequestsServiceInstance.json b/vid-app-common/src/test/resources/responses/mso/multipleOrchestrationRequestsServiceInstance.json
new file mode 100644
index 0000000..9708522
--- /dev/null
+++ b/vid-app-common/src/test/resources/responses/mso/multipleOrchestrationRequestsServiceInstance.json
@@ -0,0 +1,300 @@
+{
+ "requestList": [
+ {
+ "request": {
+ "requestId": "2543cd7c-ed76-4e94-83be-0cf0cc55bf23",
+ "startTime": "Mon, 04 Mar 2019 20:47:45 GMT",
+ "finishTime": "Mon, 04 Mar 2019 20:48:46 GMT",
+ "requestScope": "vnf",
+ "requestType": "createInstance",
+ "requestDetails": {
+ "modelInfo": {
+ "modelCustomizationName": "OAM_FRWL_5G_NC 0",
+ "modelInvariantId": "d5f2cc03-fad3-4a5a-bf36-6328771b3915",
+ "modelType": "vnf",
+ "modelName": "OAM_FRWL_5G_NC",
+ "modelVersion": "7.0",
+ "modelCustomizationUuid": "006ad5a0-b8c4-43f3-aa93-0fa379ea613d",
+ "modelVersionId": "f248be17-b66d-4ea0-bb24-51de6f62c240",
+ "modelCustomizationId": "006ad5a0-b8c4-43f3-aa93-0fa379ea613d",
+ "modelUuid": "f248be17-b66d-4ea0-bb24-51de6f62c240",
+ "modelInvariantUuid": "d5f2cc03-fad3-4a5a-bf36-6328771b3915",
+ "modelInstanceName": "OAM_FRWL_5G_NC 0"
+ },
+ "requestInfo": {
+ "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb",
+ "source": "VID",
+ "instanceName": "zauk51bfrwl07",
+ "suppressRollback": false,
+ "requestorId": "pj8646"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "d40c8a82-cc04-45e5-a0f6-0c9394c8f8d2",
+ "modelInfo": {
+ "modelInvariantId": "77ac5b6f-e31a-4477-b2c9-8a49ea58aee2",
+ "modelType": "service",
+ "modelName": "OAM_FRWL_5G_NC_SVC",
+ "modelVersion": "6.0",
+ "modelVersionId": "75a90831-a34f-4b81-8245-4f8b110f93fa",
+ "modelUuid": "75a90831-a34f-4b81-8245-4f8b110f93fa",
+ "modelInvariantUuid": "77ac5b6f-e31a-4477-b2c9-8a49ea58aee2"
+ }
+ }
+ }
+ ],
+ "cloudConfiguration": {
+ "tenantId": "e2a6af59d1cb43b2874e943bbbf8470a",
+ "cloudOwner": "att-nc",
+ "lcpCloudRegionId": "auk51b"
+ },
+ "requestParameters": {
+ "testApi": "GR_API"
+ },
+ "platform": {
+ "platformName": "NETWORK-CLOUD"
+ },
+ "lineOfBusiness": {
+ "lineOfBusinessName": "EMANUEL-CONSUMER"
+ }
+ },
+ "instanceReferences": {
+ "serviceInstanceId": "d40c8a82-cc04-45e5-a0f6-0c9394c8f8d2",
+ "vnfInstanceId": "05bedd02-b933-40f1-ad20-bab3197489a9",
+ "vnfInstanceName": "zauk51bfrwl07",
+ "requestorId": "pj8646"
+ },
+ "requestStatus": {
+ "requestState": "COMPLETE",
+ "statusMessage": "STATUS: ALaCarte-Vnf-createInstance request was executed correctly. FLOW STATUS: Successfully completed all Building Blocks",
+ "percentProgress": 100,
+ "timestamp": "Mon, 04 Mar 2019 20:48:46 GMT"
+ }
+ }
+ },
+ {
+ "request": {
+ "requestId": "fab854bf-e53c-415e-b3cc-b6fcce8414b2",
+ "startTime": "Mon, 04 Mar 2019 20:47:15 GMT",
+ "finishTime": "Mon, 04 Mar 2019 20:47:38 GMT",
+ "requestScope": "service",
+ "requestType": "createInstance",
+ "requestDetails": {
+ "modelInfo": {
+ "modelInvariantId": "77ac5b6f-e31a-4477-b2c9-8a49ea58aee2",
+ "modelType": "service",
+ "modelName": "OAM_FRWL_5G_NC_SVC",
+ "modelVersion": "6.0",
+ "modelVersionId": "75a90831-a34f-4b81-8245-4f8b110f93fa",
+ "modelUuid": "75a90831-a34f-4b81-8245-4f8b110f93fa",
+ "modelInvariantUuid": "77ac5b6f-e31a-4477-b2c9-8a49ea58aee2"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "instanceName": "zauk51bfrwl07_vnf_service",
+ "suppressRollback": false,
+ "requestorId": "pj8646"
+ },
+ "subscriberInfo": {
+ "globalSubscriberId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
+ },
+ "requestParameters": {
+ "subscriptionServiceType": "Emanuel",
+ "aLaCarte": true,
+ "testApi": "GR_API"
+ },
+ "project": {
+ "projectName": "Kennedy"
+ },
+ "owningEntity": {
+ "owningEntityId": "e4257a94-21cc-40c5-adc9-e6f4ff868e31",
+ "owningEntityName": "EMANUEL-CORE"
+ }
+ },
+ "instanceReferences": {
+ "serviceInstanceId": "d40c8a82-cc04-45e5-a0f6-0c9394c8f8d2",
+ "serviceInstanceName": "zauk51bfrwl07_vnf_service",
+ "requestorId": "pj8646"
+ },
+ "requestStatus": {
+ "requestState": "COMPLETE",
+ "statusMessage": "STATUS: ALaCarte-Service-createInstance request was executed correctly. FLOW STATUS: Successfully completed all Building Blocks",
+ "percentProgress": 100,
+ "timestamp": "Mon, 04 Mar 2019 20:47:38 GMT"
+ }
+ }
+ },
+ {
+ "request": {
+ "requestId": "3eb7b323-b486-402e-931a-2ad296e6406b",
+ "startTime": "Mon, 04 Mar 2019 20:48:52 GMT",
+ "finishTime": "Mon, 04 Mar 2019 20:50:40 GMT",
+ "requestScope": "vfModule",
+ "requestType": "createInstance",
+ "requestDetails": {
+ "modelInfo": {
+ "modelCustomizationName": "OamFrwl5gNc..base_oam..module-0",
+ "modelInvariantId": "00b03b3e-454f-438c-87ca-5860f98e8dbc",
+ "modelType": "vfModule",
+ "modelName": "OamFrwl5gNc..base_oam..module-0",
+ "modelVersion": "3",
+ "modelCustomizationUuid": "53aef95c-92b5-48d7-912a-1f89d0eb6355",
+ "modelVersionId": "3fb037f3-d629-490f-af49-2bbb97a946be",
+ "modelCustomizationId": "53aef95c-92b5-48d7-912a-1f89d0eb6355",
+ "modelUuid": "3fb037f3-d629-490f-af49-2bbb97a946be",
+ "modelInvariantUuid": "00b03b3e-454f-438c-87ca-5860f98e8dbc",
+ "modelInstanceName": "OamFrwl5gNc..base_oam..module-0"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "instanceName": "zauk51bfrwl07_base_1",
+ "suppressRollback": false,
+ "requestorId": "pj8646"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "d40c8a82-cc04-45e5-a0f6-0c9394c8f8d2",
+ "modelInfo": {
+ "modelInvariantId": "77ac5b6f-e31a-4477-b2c9-8a49ea58aee2",
+ "modelType": "service",
+ "modelName": "OAM_FRWL_5G_NC_SVC",
+ "modelVersion": "6.0",
+ "modelVersionId": "75a90831-a34f-4b81-8245-4f8b110f93fa",
+ "modelUuid": "75a90831-a34f-4b81-8245-4f8b110f93fa",
+ "modelInvariantUuid": "77ac5b6f-e31a-4477-b2c9-8a49ea58aee2"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "05bedd02-b933-40f1-ad20-bab3197489a9",
+ "modelInfo": {
+ "modelCustomizationName": "OAM_FRWL_5G_NC 0",
+ "modelInvariantId": "d5f2cc03-fad3-4a5a-bf36-6328771b3915",
+ "modelType": "vnf",
+ "modelName": "OAM_FRWL_5G_NC",
+ "modelVersion": "7.0",
+ "modelCustomizationUuid": "006ad5a0-b8c4-43f3-aa93-0fa379ea613d",
+ "modelVersionId": "f248be17-b66d-4ea0-bb24-51de6f62c240",
+ "modelCustomizationId": "006ad5a0-b8c4-43f3-aa93-0fa379ea613d",
+ "modelUuid": "f248be17-b66d-4ea0-bb24-51de6f62c240",
+ "modelInvariantUuid": "d5f2cc03-fad3-4a5a-bf36-6328771b3915",
+ "modelInstanceName": "OAM_FRWL_5G_NC 0"
+ }
+ }
+ }
+ ],
+ "cloudConfiguration": {
+ "tenantId": "e2a6af59d1cb43b2874e943bbbf8470a",
+ "cloudOwner": "att-nc",
+ "lcpCloudRegionId": "auk51b"
+ },
+ "requestParameters": {
+ "usePreload": false,
+ "testApi": "GR_API"
+ }
+ },
+ "instanceReferences": {
+ "serviceInstanceId": "d40c8a82-cc04-45e5-a0f6-0c9394c8f8d2",
+ "vnfInstanceId": "05bedd02-b933-40f1-ad20-bab3197489a9",
+ "vfModuleInstanceId": "9276805f-07ba-43c0-a5f1-f327c1d72606",
+ "vfModuleInstanceName": "zauk51bfrwl07_base_1",
+ "requestorId": "pj8646"
+ },
+ "requestStatus": {
+ "requestState": "COMPLETE",
+ "statusMessage": "STATUS: ALaCarte-VfModule-createInstance request was executed correctly. FLOW STATUS: Successfully completed all Building Blocks",
+ "percentProgress": 100,
+ "timestamp": "Mon, 04 Mar 2019 20:50:40 GMT"
+ }
+ }
+ },
+ {
+ "request": {
+ "requestId": "74f5a2dc-1e80-4553-8fac-d30675e510be",
+ "startTime": "Mon, 04 Mar 2019 20:50:47 GMT",
+ "requestScope": "vfModule",
+ "requestType": "createInstance",
+ "requestDetails": {
+ "modelInfo": {
+ "modelCustomizationName": "OamFrwl5gNc..module_oam..module-1",
+ "modelInvariantId": "972a22a1-8cbf-45ce-8ff2-f0f33694695d",
+ "modelType": "vfModule",
+ "modelName": "OamFrwl5gNc..module_oam..module-1",
+ "modelVersion": "3",
+ "modelCustomizationUuid": "cf88008e-c4b6-48b8-99a9-44d850f3d8db",
+ "modelVersionId": "cea74dcd-1174-4f65-adff-87a355849275",
+ "modelCustomizationId": "cf88008e-c4b6-48b8-99a9-44d850f3d8db",
+ "modelUuid": "cea74dcd-1174-4f65-adff-87a355849275",
+ "modelInvariantUuid": "972a22a1-8cbf-45ce-8ff2-f0f33694695d",
+ "modelInstanceName": "OamFrwl5gNc..module_oam..module-1"
+ },
+ "requestInfo": {
+ "source": "VID",
+ "instanceName": "zauk51bfrwl07_mod_1",
+ "suppressRollback": false,
+ "requestorId": "pj8646"
+ },
+ "relatedInstanceList": [
+ {
+ "relatedInstance": {
+ "instanceId": "d40c8a82-cc04-45e5-a0f6-0c9394c8f8d2",
+ "modelInfo": {
+ "modelInvariantId": "77ac5b6f-e31a-4477-b2c9-8a49ea58aee2",
+ "modelType": "service",
+ "modelName": "OAM_FRWL_5G_NC_SVC",
+ "modelVersion": "6.0",
+ "modelVersionId": "75a90831-a34f-4b81-8245-4f8b110f93fa",
+ "modelUuid": "75a90831-a34f-4b81-8245-4f8b110f93fa",
+ "modelInvariantUuid": "77ac5b6f-e31a-4477-b2c9-8a49ea58aee2"
+ }
+ }
+ },
+ {
+ "relatedInstance": {
+ "instanceId": "05bedd02-b933-40f1-ad20-bab3197489a9",
+ "modelInfo": {
+ "modelCustomizationName": "OAM_FRWL_5G_NC 0",
+ "modelInvariantId": "d5f2cc03-fad3-4a5a-bf36-6328771b3915",
+ "modelType": "vnf",
+ "modelName": "OAM_FRWL_5G_NC",
+ "modelVersion": "7.0",
+ "modelCustomizationUuid": "006ad5a0-b8c4-43f3-aa93-0fa379ea613d",
+ "modelVersionId": "f248be17-b66d-4ea0-bb24-51de6f62c240",
+ "modelCustomizationId": "006ad5a0-b8c4-43f3-aa93-0fa379ea613d",
+ "modelUuid": "f248be17-b66d-4ea0-bb24-51de6f62c240",
+ "modelInvariantUuid": "d5f2cc03-fad3-4a5a-bf36-6328771b3915",
+ "modelInstanceName": "OAM_FRWL_5G_NC 0"
+ }
+ }
+ }
+ ],
+ "cloudConfiguration": {
+ "tenantId": "e2a6af59d1cb43b2874e943bbbf8470a",
+ "cloudOwner": "att-nc",
+ "lcpCloudRegionId": "auk51b"
+ },
+ "requestParameters": {
+ "usePreload": true,
+ "testApi": "GR_API"
+ }
+ },
+ "instanceReferences": {
+ "serviceInstanceId": "d40c8a82-cc04-45e5-a0f6-0c9394c8f8d2",
+ "vnfInstanceId": "05bedd02-b933-40f1-ad20-bab3197489a9",
+ "vfModuleInstanceId": "73a01fe6-d9f9-4022-82f4-082c6d8cf520",
+ "vfModuleInstanceName": "zauk51bfrwl07_mod_1",
+ "requestorId": "pj8646"
+ },
+ "requestStatus": {
+ "requestState": "FAILED",
+ "statusMessage": "STATUS: Error from SDNC: No active l3-network found in AAI with network_name GRP-27529-T-IST-07A_N_oam_protected_net_1 FLOW STATUS: All Rollback flows have completed successfully ROLLBACK STATUS: Rollback has been completed successfully.",
+ "percentProgress": 100,
+ "timestamp": "Mon, 04 Mar 2019 20:51:14 GMT"
+ }
+ }
+ }
+ ]
+}
diff --git a/vid-app-common/src/test/resources/responses/mso/orchestrationRequestsVnf.json b/vid-app-common/src/test/resources/responses/mso/orchestrationRequestsVnf.json
index f833104..e31f0e0 100644
--- a/vid-app-common/src/test/resources/responses/mso/orchestrationRequestsVnf.json
+++ b/vid-app-common/src/test/resources/responses/mso/orchestrationRequestsVnf.json
@@ -42,7 +42,7 @@
],
"cloudConfiguration": {
"tenantId": "19dfa99ba1cc4948bb868eba9e0de7ab",
- "cloudOwner": "att-aic",
+ "cloudOwner": "irma-aic" ,
"lcpCloudRegionId": "test1"
},
"requestParameters": {
diff --git a/vid-app-common/src/test/resources/sdcservices.json b/vid-app-common/src/test/resources/sdcservices.json
new file mode 100644
index 0000000..1ba13c9
--- /dev/null
+++ b/vid-app-common/src/test/resources/sdcservices.json
@@ -0,0 +1,284 @@
+{
+ "services": [
+ {
+ "uuid": "6bce7302-70bd-4057-b48e-8d5b99e686ca",
+ "invariantUUID": "9aa04749-c02c-432d-a90c-18caa361c833",
+ "name": "vDOROTHEA_srv",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-VdorotheaSrv-csar.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "76f27dfe-33e5-472f-8e0b-acf524adc4f0",
+ "invariantUUID": "c3618e16-bb5b-433a-a6e0-565ca79d8b65",
+ "name": "4-27_vFLORENCE_Service",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-MsoExampleService-csar.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "f4d84bb4-a416-4b4e-997e-0059973630b9",
+ "invariantUUID": "598e3f9e-3244-4d8f-a8e0-0e5d7a29eda9",
+ "name": "PASQUALE vMX vPE_BV Service 488",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-vf-with-annotations.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "48a52540-8772-4368-9cdb-1f124ea5c931",
+ "invariantUUID": "f430728a-4530-42be-a577-1206b9484cef",
+ "name": "4-27_vFLORENCE_Service",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-vf-csar.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "cb49608f-5a24-4789-b0f7-2595473cb997",
+ "invariantUUID": "0311f998-9268-4fd6-bbba-afff15087b72",
+ "name": "4-27_vFLORENCE_Service",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-vl-csar.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "3f6bd9e9-0942-49d3-84e8-6cdccd6de339",
+ "invariantUUID": "5461e83e-0b2a-465d-ab45-9d731894afd9",
+ "name": "vLoadBalancerMS",
+ "version": "1.0",
+ "toscaModelURL": "./csars/vLoadBalancerMS-with-policy.TOSCA.zip",
+ "category": "Network L4+",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "demo",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "90fe6842-aa76-4b68-8329-5c86ff564407",
+ "invariantUUID": "0311f998-9268-4fd6-bbba-afff15087b72",
+ "name": "4-27_vFLORENCE_Service",
+ "version": "1.0",
+ "toscaModelURL": "./csars/1712_PASQUALE.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "73e1322a-8a9a-49dc-9558-b0c5c5770e4a",
+ "invariantUUID": "f430728a-4530-42be-a577-1206b9484cef",
+ "name": "4-27_vFLORENCE_Service",
+ "version": "1.0",
+ "toscaModelURL": "./csars/pnf.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "240376de-870e-48df-915a-31f140eedd2c",
+ "invariantUUID": "709d1be4-9a3f-4a29-8c4d-a20465e808a3",
+ "name": "Demo Service",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-DemoService1-csar.csar",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "32671332-a7ee-4df6-9609-db50ce5eaee7",
+ "invariantUUID": "598e3f9e-3244-4d8f-a8e0-0e5d7a29eda9",
+ "name": "PASQUALE vMX vPE_BV Service 488",
+ "version": "1.0",
+ "toscaModelURL": "./csars/pasquale.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "55a48870-d99e-41a8-a3b4-a8d748333139",
+ "invariantUUID": "3d89efc0-19ca-4df7-9818-028e1fc6f708",
+ "name": "AMP PH SVC",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-AmpPhSvc-csar.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd",
+ "invariantUUID": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
+ "name": "action-data",
+ "version": "1.0",
+ "toscaModelURL": "./csars/2f80c596.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "ee6d61be-4841-4f98-8f23-5de9da846ca7",
+ "invariantUUID": "b7d923c9-6175-41f1-91ba-4565c4953408",
+ "name": "Multiple pProbes",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-Servicecontainermultiplepprobes-csar.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "ee6d61be-4841-4f98-8f23-5de9da845544",
+ "invariantUUID": "b7d923c9-6175-41f1-91ba-4565c4955555",
+ "name": "ServiceContainerMultiplepProbes2",
+ "version": "2.0",
+ "toscaModelURL": "./csars/service-ServicecontainerContainsPprobe.zip",
+ "category": "Network L1-3",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "12344bb4-a416-4b4e-997e-0059973630b9",
+ "invariantUUID": "598e3f9e-3244-4d8f-a8e0-0e5d7a29eda9",
+ "name": "Fabric Configuration",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-fabric-configuration.zip",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "1837481c-fa7d-4362-8ce1-d05fafc87bd1",
+ "invariantUUID": "93518289-3049-450f-a22d-86108c250265",
+ "name": "jenny vTSBC vlan SVC",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-JennyVtsbcVlanSvc-csar.zip",
+ "category": "Network L1-3",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "2a53419b-3f85-4ad5-a9c9-d79905500a27",
+ "invariantUUID": "16972715-9d79-4fb0-9463-0253d45e1d48",
+ "name": "MNS VNN1B exn svc",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-MnsVnn1bExnSvc-csar.csar",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "e32a5014-357f-4be4-b3f9-fecb0010811e",
+ "invariantUUID": "4e099102-fccb-4ee3-b51b-ebb51259dc50",
+ "name": "MNS VNN1B dmz svc",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-MnsVnn1bDmzSvc-csar.csar",
+ "category": "Emanuel",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "4117a0b6-e234-467d-b5b9-fe2f68c8b0fc",
+ "invariantUUID": "7ee41ce4-4827-44b0-a48e-2707a59905d2",
+ "name": "Grouping Service for Test",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-vnf-grouping-csar.zip",
+ "category": "Network L4+",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ },
+ {
+ "uuid": "f028b2e2-7080-4b13-91b2-94944d4c42d8",
+ "invariantUUID": "dfc2c44c-2429-44ca-ae26-1e6dc1f207fb",
+ "name": "infraVPN",
+ "version": "1.0",
+ "toscaModelURL": "./csars/service-Infravpn-csar.zip",
+ "category": "Network Service",
+ "lifecycleState": "CERTIFIED",
+ "lastUpdaterUserId": "rg276b",
+ "lastUpdaterFullName": null,
+ "distributionStatus": "DISTRIBUTED",
+ "artifacts": null,
+ "resources": null
+ }
+ ]
+}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/vLoadBalancerMS-with-policy.TOSCA.json b/vid-app-common/src/test/resources/vLoadBalancerMS-with-policy.TOSCA.json
index 8e29ff1..d066c2a 100644
--- a/vid-app-common/src/test/resources/vLoadBalancerMS-with-policy.TOSCA.json
+++ b/vid-app-common/src/test/resources/vLoadBalancerMS-with-policy.TOSCA.json
@@ -167,7 +167,7 @@
}
},
"networks": {},
- "collectionResource": {},
+ "collectionResources": {},
"configurations": {},
"fabricConfigurations": {},
"serviceProxies": {},
diff --git a/vid-app-common/src/test/resources/vf-csar.JSON b/vid-app-common/src/test/resources/vf-csar.JSON
index c1b71b3..591f068 100644
--- a/vid-app-common/src/test/resources/vf-csar.JSON
+++ b/vid-app-common/src/test/resources/vf-csar.JSON
@@ -3,7 +3,7 @@
},
"service": {
- "category": "Mobility",
+ "category": "Emanuel",
"description": "Bla bla",
"serviceRole": null,
"serviceType": null,
@@ -96,10 +96,10 @@
"properties": {
"availability_zone_max_count": "get_input:greatdefect0_availability_zone_max_count",
"itc_flavor_name": "nv.c8r24d160",
- "itc_image_name": "NIMBUS_IXLA-ITC_8.20_EA_KVM_210117.qcow2",
+ "itc_image_name": "KENNEDY_IXLA-ITC_8.20_EA_KVM_210117.qcow2",
"itc_name_0": "get_input:greatdefect0_itc_name_0",
"itm_flavor_name": "nv.c2r4d50",
- "itm_image_name": "NIMBUS_IXLA-ITM_8.20.EA_KVM.qcow2",
+ "itm_image_name": "KENNEDY_IXLA-ITM_8.20.EA_KVM.qcow2",
"vf_module_id": "get_input:greatdefect0_vf_module_id",
"ecomp_generated_naming": "false"
},
@@ -178,5 +178,8 @@
"pnfs": {
},
- "vnfGroups": {}
+ "vnfGroups": {},
+ "vrfs": {
+
+ }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/vf-with-annotation-csar.json b/vid-app-common/src/test/resources/vf-with-annotation-csar.json
index db68313..17cb652 100644
--- a/vid-app-common/src/test/resources/vf-with-annotation-csar.json
+++ b/vid-app-common/src/test/resources/vf-with-annotation-csar.json
@@ -2,17 +2,17 @@
"service": {
"uuid": "f4d84bb4-a416-4b4e-997e-0059973630b9",
"invariantUuid": "598e3f9e-3244-4d8f-a8e0-0e5d7a29eda9",
- "name": "ADIOD vMX vPE_BV Service 488",
+ "name": "PASQUALE vMX vPE_BV Service 488",
"version": "1.0",
"toscaModelURL": null,
"category": "Network L1-3",
"serviceType": "",
"serviceRole": "",
- "description": "ADIOD vMX vPE based on Juniper 17.2 release. Updated with updated VF for v8.0 of VLM",
+ "description": "PASQUALE vMX vPE based on Juniper 17.2 release. Updated with updated VF for v8.0 of VLM",
"serviceEcompNaming": "true",
"instantiationType": "Macro",
"inputs": {
- "2017488_adiodvpe0_ASN": {
+ "2017488_pasqualevpe0_ASN": {
"type": "string",
"description": "AV/PE",
"entry_schema": null,
@@ -26,11 +26,11 @@
}
},
"vnfs": {
- "2017-488_ADIOD-vPE 0": {
+ "2017-488_PASQUALE-vPE 0": {
"uuid": "ea81d6f7-0861-44a7-b7d5-d173b562c350",
"invariantUuid": "5be7e99e-8eb2-4d97-be63-8081ff3cd10e",
- "description": "Name ADIOD vPE Description The provider edge function for the ADIOD service supported by the Junipers VMX product Category Router Vendor Juniper Vendor Release Code 17.2 Owners Mary Fragale. Updated 9-25 to use v8.0 of the Juniper Valid 2 VLM",
- "name": "2017-488_ADIOD-vPE",
+ "description": "Name PASQUALE vPE Description The provider edge function for the PASQUALE service supported by the Junipers VMX product Category Router Vendor Juniper Vendor Release Code 17.2 Owners Mary Fragale. Updated 9-25 to use v8.0 of the Juniper Valid 2 VLM",
+ "name": "2017-488_PASQUALE-vPE",
"version": "9.0",
"customizationUuid": "41516cc6-5098-4b40-a619-f8d5f55fc4d8",
"inputs": {
@@ -41,21 +41,21 @@
},
"properties": {
"vmxvre_retype": "RE-VMX",
- "vnf_config_template_version": "get_input:2017488_adiodvpe0_vnf_config_template_version",
+ "vnf_config_template_version": "get_input:2017488_pasqualevpe0_vnf_config_template_version",
"sriov44_net_id": "48d399b3-11ee-48a8-94d2-f0ea94d6be8d",
"int_ctl_net_id": "2f323477-6936-4d01-ac53-d849430281d9",
"vmxvpfe_sriov41_0_port_mac": "00:11:22:EF:AC:DF",
"int_ctl_net_name": "VMX-INTXI",
- "vmx_int_ctl_prefix": "128.0.0.0",
+ "vmx_int_ctl_prefix": "10.0.0.10",
"sriov43_net_id": "da349ca1-6de9-4548-be88-2d88e99bfef5",
"sriov42_net_id": "760669ba-013d-4d9b-b0e7-4151fe2e6279",
"sriov41_net_id": "25ad52d5-c165-40f8-b3b0-ddfc2373280a",
"nf_type": "ROUTER",
- "vmxvpfe_int_ctl_ip_1": "128.0.0.16",
+ "vmxvpfe_int_ctl_ip_1": "10.0.0.10",
"is_AVPN_service": "false",
"vmx_RSG_name": "vREXI-affinity",
"vmx_int_ctl_forwarding": "l2",
- "vmxvre_oam_ip_0": "10.40.123.5",
+ "vmxvre_oam_ip_0": "10.0.0.10",
"vmxvpfe_sriov44_0_port_mac": "00:11:22:EF:AC:DF",
"vmxvpfe_sriov41_0_port_vlanstrip": "false",
"vmxvpfe_sriov42_0_port_vlanfilter": "4001",
@@ -83,10 +83,10 @@
"vmxvpfe_sriov42_0_port_unknownmulticastallow": "true",
"vmxvpfe_sriov44_0_port_vlanstrip": "false",
"vf_module_id": "123",
- "nf_function": "ADIOD vPE",
+ "nf_function": "PASQUALE vPE",
"vmxvpfe_sriov43_0_port_unknownmulticastallow": "true",
- "vmxvre_int_ctl_ip_0": "128.0.0.1",
- "AIC_CLLI": "get_input:2017488_adiodvpe0_AIC_CLLI",
+ "vmxvre_int_ctl_ip_0": "10.0.0.10",
+ "AIC_CLLI": "get_input:2017488_pasqualevpe0_AIC_CLLI",
"vnf_name": "mtnj309me6vre",
"vmxvpfe_sriov41_0_port_unknownunicastallow": "true",
"vmxvre_volume_type_1": "HITACHI",
@@ -94,24 +94,24 @@
"vmxvre_volume_type_0": "HITACHI",
"vmxvpfe_volume_type_0": "HITACHI",
"vmxvpfe_sriov43_0_port_broadcastallow": "true",
- "bandwidth_units": "get_input:2017488_adiodvpe0_bandwidth_units",
+ "bandwidth_units": "get_input:2017488_pasqualevpe0_bandwidth_units",
"vnf_id": "123",
"vmxvre_oam_prefix": "24",
- "availability_zone_0": "get_input:2017488_adiodvpe0_availability_zone_0",
- "ASN": "get_input:2017488_adiodvpe0_ASN",
+ "availability_zone_0": "get_input:2017488_pasqualevpe0_availability_zone_0",
+ "ASN": "get_input:2017488_pasqualevpe0_ASN",
"vmxvre_chassis_i2cid": "161",
"vmxvpfe_name_0": "vPFEXI",
- "bandwidth": "get_input:2017488_adiodvpe0_bandwidth",
+ "bandwidth": "get_input:2017488_pasqualevpe0_bandwidth",
"availability_zone_max_count": "1",
"vmxvre_volume_size_0": "45.0",
"vmxvre_volume_size_1": "50.0",
"vmxvpfe_sriov42_0_port_broadcastallow": "true",
- "vmxvre_oam_gateway": "10.40.123.1",
+ "vmxvre_oam_gateway": "10.0.0.10",
"vmxvre_volume_name_1": "vREXI_FAVolume",
"vmxvre_ore_present": "0",
"vmxvre_volume_name_0": "vREXI_FBVolume",
"vmxvre_type": "0",
- "vnf_instance_name": "get_input:2017488_adiodvpe0_vnf_instance_name",
+ "vnf_instance_name": "get_input:2017488_pasqualevpe0_vnf_instance_name",
"vmxvpfe_sriov41_0_port_unknownmulticastallow": "true",
"oam_net_id": "b95eeb1d-d55d-4827-abb4-8ebb94941429",
"vmx_int_ctl_len": "24",
@@ -126,32 +126,32 @@
"ecomp_generated_naming": "true"
},
"type": "VF",
- "modelCustomizationName": "2017-488_ADIOD-vPE 0",
+ "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
"vfModules": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
"uuid": "a5d8df05-11cb-4351-96e0-b6d4168ea4df",
"invariantUuid": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"customizationUuid": "f3d97417-0c8d-424e-8ff7-b2eb4fbcecc3",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "name": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"version": "8",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"baseModule" : false
},
"inputs": {
"bandwidth_units": {
- "fromInputName": "2017488_adiodvpe0_bandwidth_units",
+ "fromInputName": "2017488_pasqualevpe0_bandwidth_units",
"type": "string",
"description": "Units of bandwidth",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "bandwidth_units"
},
"constraints": null,
@@ -159,13 +159,13 @@
"default": "Gbps"
},
"bandwidth": {
- "fromInputName": "2017488_adiodvpe0_bandwidth",
+ "fromInputName": "2017488_pasqualevpe0_bandwidth",
"type": "string",
"description": "Requested VPE bandwidth",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "bandwidth"
},
"constraints": null,
@@ -173,13 +173,13 @@
"default": "10"
},
"vnf_instance_name": {
- "fromInputName": "2017488_adiodvpe0_vnf_instance_name",
+ "fromInputName": "2017488_pasqualevpe0_vnf_instance_name",
"type": "string",
"description": "The hostname assigned to the vpe.",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "vnf_instance_name"
},
"constraints": null,
@@ -187,13 +187,13 @@
"default": "mtnj309me6"
},
"vnf_config_template_version": {
- "fromInputName": "2017488_adiodvpe0_vnf_config_template_version",
+ "fromInputName": "2017488_pasqualevpe0_vnf_config_template_version",
"type": "string",
"description": "VPE Software Version",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "vnf_config_template_version"
},
"constraints": null,
@@ -201,13 +201,13 @@
"default": "17.2"
},
"AIC_CLLI": {
- "fromInputName": "2017488_adiodvpe0_AIC_CLLI",
+ "fromInputName": "2017488_pasqualevpe0_AIC_CLLI",
"type": "string",
"description": "AIC Site CLLI",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "AIC_CLLI"
},
"constraints": null,
@@ -217,19 +217,19 @@
},
"volumeGroupAllowed": true
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
"uuid": "040e591e-5d30-4e0d-850f-7266e5a8e013",
"invariantUuid": "b34833bb-6aa9-4ad6-a831-70b06367a091",
"customizationUuid": "5c5f91f9-5e31-4120-b892-5536587ec258",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "name": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"version": "6",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"properties": {
"minCountInstances": 1,
"maxCountInstances": 1,
"initialCount": 1,
- "vfModuleLabel": "ADIOD_base_vPE_BV",
+ "vfModuleLabel": "PASQUALE_base_vPE_BV",
"baseModule" : true
},
"inputs": {
@@ -237,30 +237,30 @@
},
"volumeGroupAllowed": false
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vPFE_BV..module-2": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2": {
"uuid": "b3e8b26e-cff0-49fc-a4e6-f3e16c8440fe",
"invariantUuid": "eff8cc59-53a1-4101-aed7-8cf24ecf8339",
"customizationUuid": "6e410843-257c-46d9-ba8a-8d94e1362452",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "name": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"version": "8",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vPFE_BV",
+ "vfModuleLabel": "PASQUALE_vPFE_BV",
"baseModule" : false
},
"inputs": {
"availability_zone_0": {
- "fromInputName": "2017488_adiodvpe0_availability_zone_0",
+ "fromInputName": "2017488_pasqualevpe0_availability_zone_0",
"type": "string",
"description": "The Availability Zone to launch the instance.",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vPFE_BV",
+ "vfModuleLabel": "PASQUALE_vPFE_BV",
"paramName": "availability_zone_0"
},
"constraints": null,
@@ -272,29 +272,29 @@
}
},
"volumeGroups": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
"uuid": "a5d8df05-11cb-4351-96e0-b6d4168ea4df",
"invariantUuid": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"customizationUuid": "f3d97417-0c8d-424e-8ff7-b2eb4fbcecc3",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "name": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"version": "8",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vRE_BV"
+ "vfModuleLabel": "PASQUALE_vRE_BV"
},
"inputs": {
"bandwidth_units": {
- "fromInputName": "2017488_adiodvpe0_bandwidth_units",
+ "fromInputName": "2017488_pasqualevpe0_bandwidth_units",
"type": "string",
"description": "Units of bandwidth",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "bandwidth_units"
},
"constraints": null,
@@ -302,13 +302,13 @@
"default": "Gbps"
},
"bandwidth": {
- "fromInputName": "2017488_adiodvpe0_bandwidth",
+ "fromInputName": "2017488_pasqualevpe0_bandwidth",
"type": "string",
"description": "Requested VPE bandwidth",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "bandwidth"
},
"constraints": null,
@@ -316,13 +316,13 @@
"default": "10"
},
"vnf_instance_name": {
- "fromInputName": "2017488_adiodvpe0_vnf_instance_name",
+ "fromInputName": "2017488_pasqualevpe0_vnf_instance_name",
"type": "string",
"description": "The hostname assigned to the vpe.",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "vnf_instance_name"
},
"constraints": null,
@@ -330,13 +330,13 @@
"default": "mtnj309me6"
},
"vnf_config_template_version": {
- "fromInputName": "2017488_adiodvpe0_vnf_config_template_version",
+ "fromInputName": "2017488_pasqualevpe0_vnf_config_template_version",
"type": "string",
"description": "VPE Software Version",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "vnf_config_template_version"
},
"constraints": null,
@@ -344,13 +344,13 @@
"default": "17.2"
},
"AIC_CLLI": {
- "fromInputName": "2017488_adiodvpe0_AIC_CLLI",
+ "fromInputName": "2017488_pasqualevpe0_AIC_CLLI",
"type": "string",
"description": "AIC Site CLLI",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "AIC_CLLI"
},
"constraints": null,
@@ -359,29 +359,29 @@
}
}
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vPFE_BV..module-2": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2": {
"uuid": "b3e8b26e-cff0-49fc-a4e6-f3e16c8440fe",
"invariantUuid": "eff8cc59-53a1-4101-aed7-8cf24ecf8339",
"customizationUuid": "6e410843-257c-46d9-ba8a-8d94e1362452",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "name": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"version": "8",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vPFE_BV"
+ "vfModuleLabel": "PASQUALE_vPFE_BV"
},
"inputs": {
"availability_zone_0": {
- "fromInputName": "2017488_adiodvpe0_availability_zone_0",
+ "fromInputName": "2017488_pasqualevpe0_availability_zone_0",
"type": "string",
"description": "The Availability Zone to launch the instance.",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vPFE_BV",
+ "vfModuleLabel": "PASQUALE_vPFE_BV",
"paramName": "availability_zone_0"
},
"constraints": null,
@@ -396,7 +396,7 @@
"networks": {
},
- "collectionResource": {
+ "collectionResources": {
},
"configurations": {
@@ -406,30 +406,30 @@
},
"vfModules": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
"uuid": "a5d8df05-11cb-4351-96e0-b6d4168ea4df",
"invariantUuid": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"customizationUuid": "f3d97417-0c8d-424e-8ff7-b2eb4fbcecc3",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "name": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"version": "8",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"baseModule" : false
},
"inputs": {
"bandwidth_units": {
- "fromInputName": "2017488_adiodvpe0_bandwidth_units",
+ "fromInputName": "2017488_pasqualevpe0_bandwidth_units",
"type": "string",
"description": "Units of bandwidth",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "bandwidth_units"
},
"constraints": null,
@@ -437,13 +437,13 @@
"default": "Gbps"
},
"bandwidth": {
- "fromInputName": "2017488_adiodvpe0_bandwidth",
+ "fromInputName": "2017488_pasqualevpe0_bandwidth",
"type": "string",
"description": "Requested VPE bandwidth",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "bandwidth"
},
"constraints": null,
@@ -451,13 +451,13 @@
"default": "10"
},
"vnf_instance_name": {
- "fromInputName": "2017488_adiodvpe0_vnf_instance_name",
+ "fromInputName": "2017488_pasqualevpe0_vnf_instance_name",
"type": "string",
"description": "The hostname assigned to the vpe.",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "vnf_instance_name"
},
"constraints": null,
@@ -465,13 +465,13 @@
"default": "mtnj309me6"
},
"vnf_config_template_version": {
- "fromInputName": "2017488_adiodvpe0_vnf_config_template_version",
+ "fromInputName": "2017488_pasqualevpe0_vnf_config_template_version",
"type": "string",
"description": "VPE Software Version",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "vnf_config_template_version"
},
"constraints": null,
@@ -479,13 +479,13 @@
"default": "17.2"
},
"AIC_CLLI": {
- "fromInputName": "2017488_adiodvpe0_AIC_CLLI",
+ "fromInputName": "2017488_pasqualevpe0_AIC_CLLI",
"type": "string",
"description": "AIC Site CLLI",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "AIC_CLLI"
},
"constraints": null,
@@ -495,19 +495,19 @@
},
"volumeGroupAllowed": true
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
"uuid": "040e591e-5d30-4e0d-850f-7266e5a8e013",
"invariantUuid": "b34833bb-6aa9-4ad6-a831-70b06367a091",
"customizationUuid": "5c5f91f9-5e31-4120-b892-5536587ec258",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "name": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"version": "6",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"properties": {
"minCountInstances": 1,
"maxCountInstances": 1,
"initialCount": 1,
- "vfModuleLabel": "ADIOD_base_vPE_BV",
+ "vfModuleLabel": "PASQUALE_base_vPE_BV",
"baseModule" : true
},
"inputs": {
@@ -515,30 +515,30 @@
},
"volumeGroupAllowed": false
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vPFE_BV..module-2": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2": {
"uuid": "b3e8b26e-cff0-49fc-a4e6-f3e16c8440fe",
"invariantUuid": "eff8cc59-53a1-4101-aed7-8cf24ecf8339",
"customizationUuid": "6e410843-257c-46d9-ba8a-8d94e1362452",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "name": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"version": "8",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vPFE_BV",
+ "vfModuleLabel": "PASQUALE_vPFE_BV",
"baseModule" : false
},
"inputs": {
"availability_zone_0": {
- "fromInputName": "2017488_adiodvpe0_availability_zone_0",
+ "fromInputName": "2017488_pasqualevpe0_availability_zone_0",
"type": "string",
"description": "The Availability Zone to launch the instance.",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vPFE_BV",
+ "vfModuleLabel": "PASQUALE_vPFE_BV",
"paramName": "availability_zone_0"
},
"constraints": null,
@@ -550,30 +550,30 @@
}
},
"volumeGroups": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
"uuid": "a5d8df05-11cb-4351-96e0-b6d4168ea4df",
"invariantUuid": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"customizationUuid": "f3d97417-0c8d-424e-8ff7-b2eb4fbcecc3",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "name": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"version": "8",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"baseModule" : false
},
"inputs": {
"bandwidth_units": {
- "fromInputName": "2017488_adiodvpe0_bandwidth_units",
+ "fromInputName": "2017488_pasqualevpe0_bandwidth_units",
"type": "string",
"description": "Units of bandwidth",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "bandwidth_units"
},
"constraints": null,
@@ -581,13 +581,13 @@
"default": "Gbps"
},
"bandwidth": {
- "fromInputName": "2017488_adiodvpe0_bandwidth",
+ "fromInputName": "2017488_pasqualevpe0_bandwidth",
"type": "string",
"description": "Requested VPE bandwidth",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "bandwidth"
},
"constraints": null,
@@ -595,13 +595,13 @@
"default": "10"
},
"vnf_instance_name": {
- "fromInputName": "2017488_adiodvpe0_vnf_instance_name",
+ "fromInputName": "2017488_pasqualevpe0_vnf_instance_name",
"type": "string",
"description": "The hostname assigned to the vpe.",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "vnf_instance_name"
},
"constraints": null,
@@ -609,13 +609,13 @@
"default": "mtnj309me6"
},
"vnf_config_template_version": {
- "fromInputName": "2017488_adiodvpe0_vnf_config_template_version",
+ "fromInputName": "2017488_pasqualevpe0_vnf_config_template_version",
"type": "string",
"description": "VPE Software Version",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "vnf_config_template_version"
},
"constraints": null,
@@ -623,13 +623,13 @@
"default": "17.2"
},
"AIC_CLLI": {
- "fromInputName": "2017488_adiodvpe0_AIC_CLLI",
+ "fromInputName": "2017488_pasqualevpe0_AIC_CLLI",
"type": "string",
"description": "AIC Site CLLI",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vRE_BV",
+ "vfModuleLabel": "PASQUALE_vRE_BV",
"paramName": "AIC_CLLI"
},
"constraints": null,
@@ -638,30 +638,30 @@
}
}
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vPFE_BV..module-2": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2": {
"uuid": "b3e8b26e-cff0-49fc-a4e6-f3e16c8440fe",
"invariantUuid": "eff8cc59-53a1-4101-aed7-8cf24ecf8339",
"customizationUuid": "6e410843-257c-46d9-ba8a-8d94e1362452",
"description": null,
- "name": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "name": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"version": "8",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vPFE_BV..module-2",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2",
"properties": {
"minCountInstances": 0,
"maxCountInstances": null,
"initialCount": 0,
- "vfModuleLabel": "ADIOD_vPFE_BV",
+ "vfModuleLabel": "PASQUALE_vPFE_BV",
"baseModule" : false
},
"inputs": {
"availability_zone_0": {
- "fromInputName": "2017488_adiodvpe0_availability_zone_0",
+ "fromInputName": "2017488_pasqualevpe0_availability_zone_0",
"type": "string",
"description": "The Availability Zone to launch the instance.",
"entry_schema": null,
"inputProperties": {
"sourceType": "HEAT",
- "vfModuleLabel": "ADIOD_vPFE_BV",
+ "vfModuleLabel": "PASQUALE_vPFE_BV",
"paramName": "availability_zone_0"
},
"constraints": null,
@@ -674,5 +674,8 @@
"pnfs": {
},
- "vnfGroups": {}
+ "vnfGroups": {},
+ "vrfs": {
+
+ }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/vf-with-vfcInstanceGroups.json b/vid-app-common/src/test/resources/vf-with-vfcInstanceGroups.json
index 3b7e2e8..34e2d45 100644
--- a/vid-app-common/src/test/resources/vf-with-vfcInstanceGroups.json
+++ b/vid-app-common/src/test/resources/vf-with-vfcInstanceGroups.json
@@ -2,13 +2,13 @@
"service": {
"uuid": "6bce7302-70bd-4057-b48e-8d5b99e686ca",
"invariantUuid": "9aa04749-c02c-432d-a90c-18caa361c833",
- "name": "vDBE_srv",
+ "name": "vDOROTHEA_srv",
"version": "1.0",
"toscaModelURL": null,
"category": "Network L4+",
"serviceType": "",
"serviceRole": "",
- "description": "vDBE_srv",
+ "description": "vDOROTHEA_srv",
"serviceEcompNaming": "true",
"instantiationType": "A-La-Carte",
"inputs": {
@@ -16,11 +16,11 @@
}
},
"vnfs": {
- "vDBE 0": {
+ "vDOROTHEA 0": {
"uuid": "61535073-2e50-4141-9000-f66fea69b433",
"invariantUuid": "fcdf49ce-6f0b-4ca2-b676-a484e650e734",
- "description": "vDBE",
- "name": "vDBE",
+ "description": "vDOROTHEA",
+ "name": "vDOROTHEA",
"version": "0.2",
"customizationUuid": "882e5dcb-ba9f-4766-8cde-e326638107db",
"inputs": {
@@ -40,16 +40,16 @@
"untr_network_collection_function": "untraaa"
},
"type": "VF",
- "modelCustomizationName": "vDBE 0",
+ "modelCustomizationName": "vDOROTHEA 0",
"vfModules": {
- "vdbe0..Vdbe..main..module-0": {
+ "vdorothea0..Vdorothea..main..module-0": {
"uuid": "25a4d009-2f5a-44b4-b02a-62c584c15912",
"invariantUuid": "614afb1a-3e7e-44e9-90ab-424d0070c781",
"customizationUuid": "3443b341-7b0b-498c-a84a-a7ee736cba7e",
"description": null,
- "name": "Vdbe..main..module-0",
+ "name": "Vdorothea..main..module-0",
"version": "1",
- "modelCustomizationName": "Vdbe..main..module-0",
+ "modelCustomizationName": "Vdorothea..main..module-0",
"properties": {
"minCountInstances": 1,
"maxCountInstances": 1,
@@ -97,7 +97,7 @@
"networks": {
},
- "collectionResource": {
+ "collectionResources": {
},
"configurations": {
@@ -107,14 +107,14 @@
},
"vfModules": {
- "vdbe0..Vdbe..main..module-0": {
+ "vdorothea0..Vdorothea..main..module-0": {
"uuid": "25a4d009-2f5a-44b4-b02a-62c584c15912",
"invariantUuid": "614afb1a-3e7e-44e9-90ab-424d0070c781",
"customizationUuid": "3443b341-7b0b-498c-a84a-a7ee736cba7e",
"description": null,
- "name": "Vdbe..main..module-0",
+ "name": "Vdorothea..main..module-0",
"version": "1",
- "modelCustomizationName": "Vdbe..main..module-0",
+ "modelCustomizationName": "Vdorothea..main..module-0",
"properties": {
"minCountInstances": 1,
"maxCountInstances": 1,
@@ -134,5 +134,8 @@
"pnfs": {
},
- "vnfGroups": {}
+ "vnfGroups": {},
+ "vrfs": {
+
+ }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/vl-csar.JSON b/vid-app-common/src/test/resources/vl-csar.JSON
index 3de6ee4..cdf2125 100644
--- a/vid-app-common/src/test/resources/vl-csar.JSON
+++ b/vid-app-common/src/test/resources/vl-csar.JSON
@@ -75,7 +75,7 @@
"modelCustomizationName": "ExtVL 0"
}
},
- "collectionResource": {
+ "collectionResources": {
},
"configurations": {
@@ -93,5 +93,8 @@
"pnfs": {
},
- "vnfGroups": {}
+ "vnfGroups": {},
+ "vrfs": {
+
+ }
}
\ No newline at end of file
diff --git a/vid-app-common/src/test/resources/vnf-grouping-csar.json b/vid-app-common/src/test/resources/vnf-grouping-csar.json
index 4c6f1d9..ebf2204 100644
--- a/vid-app-common/src/test/resources/vnf-grouping-csar.json
+++ b/vid-app-common/src/test/resources/vnf-grouping-csar.json
@@ -18,18 +18,18 @@
},
"networks": {
},
- "collectionResource": {
+ "collectionResources": {
},
"configurations": {
},
"fabricConfigurations": {
},
"serviceProxies": {
- "vdbe_svc_vprs_proxy 0": {
+ "vdorothea_svc_vprs_proxy 0": {
"uuid": "65fadfa8-a0d9-443f-95ad-836cd044e26c",
"invariantUuid": "f4baae0c-b3a5-4ca1-a777-afbffe7010bc",
- "description": "A Proxy for Service vDBE_Svc_vPRS",
- "name": "vDBE_Svc_vPRS Service Proxy",
+ "description": "A Proxy for Service vDOROTHEA_Svc_vPRS",
+ "name": "vDOROTHEA_Svc_vPRS Service Proxy",
"version": "1.0",
"customizationUuid": "bdb63d23-e132-4ce7-af2c-a493b4cafac9",
"inputs": {
@@ -42,7 +42,7 @@
"type": "Service Proxy",
"sourceModelUuid": "da7827a2-366d-4be6-8c68-a69153c61274",
"sourceModelInvariant": "24632e6b-584b-4f45-80d4-fefd75fd9f14",
- "sourceModelName": "vDBE_Svc_vPRS"
+ "sourceModelName": "vDOROTHEA_Svc_vPRS"
},
"tsbc0001vm001_svc_proxy 0": {
"uuid": "65fadfa8-a0d9-443f-95ad-836cd044e26c",
@@ -87,11 +87,11 @@
"ecomp_generated_naming": "true"
},
"members": {
- "vdbe_svc_vprs_proxy 0": {
+ "vdorothea_svc_vprs_proxy 0": {
"uuid": "65fadfa8-a0d9-443f-95ad-836cd044e26c",
"invariantUuid": "f4baae0c-b3a5-4ca1-a777-afbffe7010bc",
- "description": "A Proxy for Service vDBE_Svc_vPRS",
- "name": "vDBE_Svc_vPRS Service Proxy",
+ "description": "A Proxy for Service vDOROTHEA_Svc_vPRS",
+ "name": "vDOROTHEA_Svc_vPRS Service Proxy",
"version": "1.0",
"customizationUuid": "bdb63d23-e132-4ce7-af2c-a493b4cafac9",
"inputs": {},
@@ -102,7 +102,7 @@
"type": "Service Proxy",
"sourceModelUuid": "da7827a2-366d-4be6-8c68-a69153c61274",
"sourceModelInvariant": "24632e6b-584b-4f45-80d4-fefd75fd9f14",
- "sourceModelName": "vDBE_Svc_vPRS"
+ "sourceModelName": "vDOROTHEA_Svc_vPRS"
}
}
},
@@ -119,7 +119,8 @@
"function": "SIGNALING",
"description": "DDD1",
"type": "LOAD-GROUP",
- "ecomp_generated_naming": "true"
+ "ecomp_generated_naming": "true",
+ "quantity": 3
},
"members": {
"tsbc0001vm001_svc_proxy 0": {
@@ -141,5 +142,8 @@
}
}
}
+ },
+ "vrfs": {
+
}
}
\ No newline at end of file