diff options
16 files changed, 252 insertions, 61 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java index 1079fbe92..7617d7778 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/BaseResource.java @@ -20,20 +20,22 @@ package org.onap.vid.model.serviceInstantiation; +import static com.fasterxml.jackson.annotation.JsonInclude.Include.NON_NULL; + import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.collect.ImmutableMap; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; import org.apache.commons.lang3.StringUtils; import org.onap.vid.job.JobAdapter; import org.onap.vid.job.JobType; import org.onap.vid.model.Action; import org.onap.vid.mso.model.ModelInfo; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; - public abstract class BaseResource implements JobAdapter.AsyncJobRequest { protected String instanceId; @@ -60,6 +62,9 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { protected Integer position; + @JsonInclude(NON_NULL) + protected String originalName; //not used at backend, but stored for fronted + private static final Map<String, Action> actionStingToEnumMap = ImmutableMap.<String, Action>builder() .put("Delete", Action.Delete) @@ -85,7 +90,8 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { @JsonProperty("trackById") String trackById, @JsonProperty("isFailed") Boolean isFailed, @JsonProperty("statusMessage") String statusMessage, - @JsonProperty("position") Integer position) { + @JsonProperty("position") Integer position, + @JsonProperty("originalName") String originalName) { this.modelInfo = modelInfo; this.modelInfo.setModelType(getModelType()); this.rollbackOnFailure = rollbackOnFailure; @@ -99,6 +105,7 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { this.isFailed = isFailed!= null ? isFailed: false; this.statusMessage = statusMessage; this.position = position; + this.originalName = originalName; } private Action actionStringToEnum(String actionAsString) { @@ -177,6 +184,10 @@ public abstract class BaseResource implements JobAdapter.AsyncJobRequest { this.position = position; } + public String getOriginalName() { + return originalName; + } + @JsonIgnore public abstract Collection<? extends BaseResource> getChildren(); diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java index f23c2e73e..642e28b36 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroup.java @@ -21,13 +21,12 @@ package org.onap.vid.model.serviceInstantiation; import com.fasterxml.jackson.annotation.JsonProperty; -import org.onap.vid.job.JobAdapter; -import org.onap.vid.job.JobType; -import org.onap.vid.mso.model.ModelInfo; - import java.util.Collection; import java.util.Collections; import java.util.Map; +import org.onap.vid.job.JobAdapter; +import org.onap.vid.job.JobType; +import org.onap.vid.mso.model.ModelInfo; public class InstanceGroup extends BaseResource implements JobAdapter.AsyncJobRequest { @@ -42,10 +41,11 @@ public class InstanceGroup extends BaseResource implements JobAdapter.AsyncJobRe @JsonProperty("trackById") String trackById, @JsonProperty("isFailed") Boolean isFailed, @JsonProperty("statusMessage") String statusMessage, - @JsonProperty("position") Integer position) { + @JsonProperty("position") Integer position, + @JsonProperty("originalName") String originalName) { super(modelInfo, instanceName, action, null, null, null, null, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, - position); + position, originalName); this.vnfGroupMembers = vnfGroupMembers; } diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java index e9f34ccfb..758ee0694 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/InstanceGroupMember.java @@ -34,9 +34,10 @@ public class InstanceGroupMember extends BaseResource implements JobAdapter.Asyn @JsonProperty("trackById") String trackById, @JsonProperty("isFailed") Boolean isFailed, @JsonProperty("statusMessage") String statusMessage, - @JsonProperty("position") Integer position) { + @JsonProperty("position") Integer position, + @JsonProperty("originalName") String originalName) { super(new ModelInfo(), null, action, null, null, null, null, false, instanceId, trackById, isFailed, statusMessage, - position); + position, originalName); } @Override diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java index b9a0aeb85..cec61f6b7 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Network.java @@ -21,14 +21,13 @@ package org.onap.vid.model.serviceInstantiation; import com.fasterxml.jackson.annotation.JsonProperty; -import org.onap.vid.job.JobAdapter; -import org.onap.vid.job.JobType; -import org.onap.vid.mso.model.ModelInfo; - import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; +import org.onap.vid.job.JobAdapter; +import org.onap.vid.job.JobType; +import org.onap.vid.mso.model.ModelInfo; public class Network extends BaseResource implements JobAdapter.AsyncJobRequest { @@ -53,10 +52,11 @@ public class Network extends BaseResource implements JobAdapter.AsyncJobRequest @JsonProperty("trackById") String trackById, @JsonProperty("isFailed") Boolean isFailed, @JsonProperty("statusMessage") String statusMessage, - @JsonProperty("position") Integer position) { + @JsonProperty("position") Integer position, + @JsonProperty("originalName") String originalName) { super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, - position); + position, originalName); this.productFamilyId = productFamilyId; this.platformName = platformName; this.lineOfBusiness = lineOfBusiness; diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java index e7e5783c4..7c04a91dc 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiation.java @@ -104,9 +104,10 @@ public class ServiceInstantiation extends BaseResource implements JobAdapter.Asy @JsonProperty("trackById") String trackById, @JsonProperty("isFailed") Boolean isFailed, @JsonProperty("statusMessage") String statusMessage, - @JsonProperty("vidNotions") VidNotions vidNotions) { + @JsonProperty("vidNotions") VidNotions vidNotions, + @JsonProperty("originalName") String originalName) { super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, - null); + null, originalName); this.owningEntityId = owningEntityId; this.owningEntityName = owningEntityName; this.projectName = projectName; diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiationTemplate.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiationTemplate.java index 4872ce2c8..9499beb50 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiationTemplate.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/ServiceInstantiationTemplate.java @@ -52,7 +52,8 @@ public class ServiceInstantiationTemplate extends ServiceInstantiation implement baseService.isRollbackOnFailure(), baseService.isALaCarte(), baseService.getTestApi(), baseService.getInstanceId(), Objects.toString(baseService.getAction(), null), baseService.getTrackById(), baseService.getIsFailed(), baseService.getStatusMessage(), - baseService.getVidNotions() + baseService.getVidNotions(), + baseService.getOriginalName() ); this.existingVNFCounterMap = vnfCounterMap; diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java index d04e679e6..0b9a2a7b7 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/VfModule.java @@ -68,9 +68,10 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest @JsonProperty("statusMessage") String statusMessage, @Nullable @JsonProperty("retainAssignments") Boolean retainAssignments, @Nullable @JsonProperty("retainVolumeGroups") Boolean retainVolumeGroups, - @JsonProperty("position") Integer position) { + @JsonProperty("position") Integer position, + @JsonProperty("originalName") String originalName) { super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, - position); + position, originalName); this.volumeGroupInstanceName = volumeGroupInstanceName; this.usePreload = usePreload; this.supplementaryParams = supplementaryParams; @@ -135,6 +136,8 @@ public class VfModule extends BaseResource implements JobAdapter.AsyncJobRequest this.getStatusMessage(), this.isRetainAssignments(), this.isRetainVolumeGroups(), - this.getPosition()); + this.getPosition(), + this.getOriginalName() + ); } }
\ No newline at end of file diff --git a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java index fc71f279f..2ed219637 100644 --- a/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java +++ b/vid-app-common/src/main/java/org/onap/vid/model/serviceInstantiation/Vnf.java @@ -21,15 +21,18 @@ package org.onap.vid.model.serviceInstantiation; +import static java.util.stream.Collectors.toList; + import com.fasterxml.jackson.annotation.JsonProperty; +import java.util.Collection; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import java.util.Objects; import org.onap.vid.job.JobAdapter; import org.onap.vid.job.JobType; import org.onap.vid.mso.model.ModelInfo; -import java.util.*; - -import static java.util.stream.Collectors.toList; - /** * The Class VNF. */ @@ -59,10 +62,11 @@ public class Vnf extends BaseResource implements JobAdapter.AsyncJobRequest { @JsonProperty("trackById") String trackById, @JsonProperty("isFailed") Boolean isFailed, @JsonProperty("statusMessage") String statusMessage, - @JsonProperty("position") Integer position) { + @JsonProperty("position") Integer position, + @JsonProperty("originalName") String originalName) { super(modelInfo, instanceName, action, lcpCloudRegionId, legacyRegion, tenantId, instanceParams, rollbackOnFailure, instanceId, trackById, isFailed, statusMessage, - position); + position, originalName); this.productFamilyId = productFamilyId; this.platformName = platformName; this.lineOfBusiness = lineOfBusiness; 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 db856d757..b916347d2 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 @@ -279,7 +279,7 @@ public class ResourceCommandTest { convertToMap(networks), convertToMap(vnfGroups), null, - null, false, 1, false,false,null, null, null, null, null, null, null); + null, false, 1, false,false,null, null, null, null, null, null, null, null); } public static ServiceInstantiation createServiceWith2InstancesInEachLevel(Action action) { @@ -298,11 +298,11 @@ public class ResourceCommandTest { static InstanceGroup createGroup(List<InstanceGroupMember> groupMembers, Action action) { return new InstanceGroup(mock(ModelInfo.class), null, action.name(), false, null, convertToMap(groupMembers), null, null, null, - null); + null, null); } static InstanceGroupMember createMember(Action action) { - return new InstanceGroupMember(null, action.toString(), null, null, null, null); + return new InstanceGroupMember(null, action.toString(), null, null, null, null, null); } static Vnf createVnf(List<VfModule> vfModules, Action action) { @@ -310,22 +310,22 @@ public class ResourceCommandTest { 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, - 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, - 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, null, null, null); + false, false, null, null, null, null, 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, - null); + null, null); } } diff --git a/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java b/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java index b7ae76915..f0c96b839 100644 --- a/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/model/serviceInstantiation/InstantiationModelSerializationTest.java @@ -94,7 +94,8 @@ public class InstantiationModelSerializationTest { new VidNotions(InstantiationUI.ANY_ALACARTE_WHICH_NOT_EXCLUDED, ModelCategory.INFRASTRUCTURE_VPN, InstantiationUI.INFRASTRUCTURE_VPN, - InstantiationType.Macro) + InstantiationType.Macro), + "originalName" ); verifySerializationAndDeserialization(serviceInstantiation); @@ -119,7 +120,8 @@ public class InstantiationModelSerializationTest { "trackById", true, "statusMessage", - 5); + 5, + "originalName"); verifySerializationAndDeserialization(vnf); } @@ -151,7 +153,8 @@ public class InstantiationModelSerializationTest { "statusMessage", true, true, - 1); + 1, + "originalName"); verifySerializationAndDeserialization(vfModule); } @@ -164,7 +167,7 @@ public class InstantiationModelSerializationTest { VfModule vfModule = new VfModule(newModelInfo(), null, null, null, null, null, null, null, null, false, /* HERE ====> */ USE_PRELOAD, - null, null, null, null, null, null, null); + null, null, null, null, null, null, null, null); assertThat(vfModule, jsonPartEquals("sdncPreLoad", USE_PRELOAD)); assertThat(vfModule, jsonNodeAbsent("usePreload")); @@ -179,7 +182,7 @@ public class InstantiationModelSerializationTest { /* HERE ====> */ VOLUME_GROUP_INSTANCE_NAME, null, null, null, null, null, null, false, null, null, null, null, null, - null, null, null); + null, null, null, null); assertThat(vfModule, jsonPartEquals("volumeGroupName", VOLUME_GROUP_INSTANCE_NAME)); assertThat(vfModule, jsonNodeAbsent("volumeGroupInstanceName")); 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 e2fd38c4a..f61131770 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 @@ -237,7 +237,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests testApi, instanceId, action.name(), - UUID.randomUUID().toString(), null, null, null); + UUID.randomUUID().toString(), null, null, null, null); } private List<Map<String,String>> createInstanceParams() { @@ -266,12 +266,12 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), "mdt1", null, "88a6ca3ee0394ade9403f075db23167e", instanceParams, supplementaryParams, false, usePreload, null, UUID.randomUUID().toString(), null, null, - null, null, null); + null, null, null, "originalName"); } return new VfModule(vfModuleInfo, instanceName, volumeGroupInstanceName, Action.Create.name(), null, null, null, instanceParams, supplementaryParams, false, false, null, UUID.randomUUID().toString(), null, - null, null, null, null); + null, null, null, null, "originalName"); } protected ModelInfo createVfModuleModelInfo(String modelName, String modelVersion, String modelVersionId, String modelInvariantId, String modelCustomizationId, String modelCustomizationName) { @@ -281,7 +281,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests protected VfModule createVfModuleForReplace(ModelInfo vfModuleModelInfo, String instanceName, String lcpCloudRegionId, String tenantId, Boolean retainAssignments, Boolean retainVolumeGroups, List<UserParamNameAndValue> supplementaryParams) { return new VfModule( vfModuleModelInfo, instanceName, null, Action.Upgrade.name(), lcpCloudRegionId, null, tenantId, - null, supplementaryParams, true, null, null, UUID.randomUUID().toString(), null, null, retainAssignments, retainVolumeGroups, null); + null, supplementaryParams, true, null, null, UUID.randomUUID().toString(), null, null, retainAssignments, retainVolumeGroups, null, "originalName"); } protected ModelInfo createVnfModelInfo(boolean isAlacarte) { @@ -366,7 +366,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests 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, - UUID.randomUUID().toString(), null, null, null); + UUID.randomUUID().toString(), null, null, null, "originalName"); vnfs.put(vnf.getModelInfo().getModelName(), vnf); return vnfs; @@ -398,7 +398,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests "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) + new VidNotions(InstantiationUI.TRANSPORT_SERVICE, ModelCategory.Transport, InstantiationUI.TRANSPORT_SERVICE, InstantiationType.Macro), "originalName" ); return serviceInstantiation; } @@ -419,7 +419,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests 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, null)); + false, null, UUID.randomUUID().toString(), null, null, null, "originalName")); // 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)); } @@ -435,7 +435,7 @@ public class AsyncInstantiationBaseTest extends AbstractTestNGSpringContextTests modelInfo.setModelVersion("10.0"); return new InstanceGroup(modelInfo, (isUserProvidedNaming ? VNF_GROUP_NAME : null), action.name(), false, null, emptyMap(), UUID.randomUUID().toString(), null, null, - null); + null, "originalName"); } protected ModelInfo createServiceModelInfo() { 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 a1e4af2c4..284efce45 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 @@ -1056,7 +1056,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT 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, UUID.randomUUID().toString(), null, null, null); + null, null, null, false, null, null, UUID.randomUUID().toString(), null, null, null, "originalName"); assertThat(vnf.getLcpCloudRegionId(), equalTo(legacyCloudRegion)); } @@ -1065,7 +1065,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT 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, null, - false, 1,false, false, null, null, Action.Create.name(), UUID.randomUUID().toString(), null, null, null); + false, 1,false, false, null, null, Action.Create.name(), UUID.randomUUID().toString(), null, null, null, "originalName"); assertThat(service.getLcpCloudRegionId(), equalTo(legacyCloudRegion)); } @@ -1089,7 +1089,7 @@ public class AsyncInstantiationBusinessLogicTest extends AsyncInstantiationBaseT 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); + UUID.randomUUID().toString(), null, null, null, "originalName"); } @DataProvider diff --git a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java index 58a069ba2..71d38b3f8 100644 --- a/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java +++ b/vid-app-common/src/test/java/org/onap/vid/services/MsoRequestBuilderTest.java @@ -526,7 +526,7 @@ public class MsoRequestBuilderTest extends AsyncInstantiationBaseTest { "}"; Vnf vnfDetails = new Vnf(createVnfModelInfo(true), "productFamily", "instanceName", Action.Delete.name(), "platform", "AAIAIC25", null, "092eb9e8e4b7412e8787dd091bc58e86", null, null, false, "VNF_INSTANCE_ID", null, UUID.randomUUID().toString(), null, null, - null); + null, "originalName"); RequestDetailsWrapper<VnfInstantiationRequestDetails> result = msoRequestBuilder.generateDeleteVnfRequest(vnfDetails, "az2018"); MsoOperationalEnvironmentTest.assertThatExpectationIsLikeObject(expected, result); diff --git a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json index 01702b35f..d2e1d6d07 100644 --- a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json +++ b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json @@ -13,7 +13,7 @@ "existingNetworksCounterMap": { }, "existingVNFCounterMap": { - "024a417d-ca46-40bf-95ce-809c6a269011": 1 + "024a417d-ca46-40bf-95ce-809c6a269011": 2 }, "existingVnfGroupCounterMap": { }, @@ -75,6 +75,7 @@ "action": "Create", "instanceId": null, "instanceName": "hvf6arlba007", + "originalName": "vProbe_NC_VNF 0", "vnfStoreKey": "vProbe_NC_VNF 0", "instanceParams": [ { @@ -155,6 +156,85 @@ } } } + }, + "vProbe_NC_VNF 0_1": { + "modelInfo": { + "modelCustomizationName": "vProbe_NC_VNF 0", + "modelCustomizationId": "024a417d-ca46-40bf-95ce-809c6a269011", + "modelInvariantId": "a6a96924-b9c5-4c85-ae18-cbfca848095e", + "modelVersionId": "21ae311e-432f-4c54-b855-446d0b8ded72", + "modelName": "vProbe_NC_VNF", + "modelType": "vnf", + "modelVersion": "1.0" + }, + "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", + "instanceName": "hvf6arlba008", + "originalName": "vProbe_NC_VNF 0", + "vnfStoreKey": "vProbe_NC_VNF 0_1", + "action": "Create", + "platformName": "xxx1", + "lcpCloudRegionId": "hvf6", + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "instanceParams": [ + {} + ], + "rollbackOnFailure": true, + "instanceId": null, + "vfModules": { + "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0": { + "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg": { + "modelInfo": { + "modelCustomizationName": "VprobeNcVnf..FE_base_module..module-0", + "modelCustomizationId": "4d0818cf-eaa9-4a3f-89c2-639953089e14", + "modelInvariantId": "29b6fa3c-aeb3-4103-b3f7-6f98e097b005", + "modelVersionId": "c5b26cc1-a66f-4b69-aa23-6abc7c647c88", + "modelName": "VprobeNcVnf..FE_base_module..module-0", + "modelType": "vfModule", + "modelVersion": "1" + }, + "instanceName": "hvf6arlba007_lba_Base_02", + "action": "Create", + "lcpCloudRegionId": "hvf6", + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "instanceParams": [ + {} + ], + "rollbackOnFailure": true, + "trackById": "ea2879a6-10bc-4697-90d7-7bc3e71da0fd", + "isFailed": false + } + }, + "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1": { + "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi": { + "modelInfo": { + "modelCustomizationName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1", + "modelCustomizationId": "9b99d340-a80b-45ef-9ff1-993fa3e4c001", + "modelInvariantId": "1bcc4824-6c1a-4b51-af7c-076b7fc14d05", + "modelVersionId": "c09e4530-8fd8-418f-9483-2f57ce927b05", + "modelName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1", + "modelType": "vfModule", + "modelVersion": "1" + }, + "instanceName": "my_hvf6arlba007_lba_dj_02", + "action": "Create", + "lcpCloudRegionId": "hvf6", + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "instanceParams": [ + {} + ], + "rollbackOnFailure": true, + "trackById": "b134410e-3bc0-478e-883e-1b6bdf8a28df", + "isFailed": false, + "volumeGroupName": "my_special_hvf6arlba007_lba_dj_01_vol", + "sdncPreLoad": true + } + } + }, + "trackById": "1d2848a0-3573-4d29-b3dd-60bb263260ea", + "isFailed": false, + "statusMessage": null, + "position": null, + "lineOfBusiness": "zzz1" } }, "vrfs": { diff --git a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json index 5a327fdd7..296ad311c 100644 --- a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json +++ b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json @@ -25,7 +25,7 @@ "testApi": "GR_API", "trackById": "36601560-f8e3-4020-bdef-3e4709c51e84", "existingVNFCounterMap": { - "024a417d-ca46-40bf-95ce-809c6a269011": 1 + "024a417d-ca46-40bf-95ce-809c6a269011": 2 }, "existingVRFCounterMap": {}, "existingVnfGroupCounterMap": {}, @@ -45,6 +45,7 @@ }, "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", "instanceName": "hvf6arlba007", + "originalName": "vProbe_NC_VNF 0", "action": "Create", "platformName": "xxx1", "lcpCloudRegionId": "hvf6", @@ -109,6 +110,84 @@ "statusMessage": null, "position": null, "lineOfBusiness": "zzz1" + }, + "vProbe_NC_VNF 0_1": { + "modelInfo": { + "modelCustomizationName": "vProbe_NC_VNF 0", + "modelCustomizationId": "024a417d-ca46-40bf-95ce-809c6a269011", + "modelInvariantId": "a6a96924-b9c5-4c85-ae18-cbfca848095e", + "modelVersionId": "21ae311e-432f-4c54-b855-446d0b8ded72", + "modelName": "vProbe_NC_VNF", + "modelType": "vnf", + "modelVersion": "1.0" + }, + "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", + "instanceName": "hvf6arlba008", + "originalName": "vProbe_NC_VNF 0", + "action": "Create", + "platformName": "xxx1", + "lcpCloudRegionId": "hvf6", + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "instanceParams": [ + {} + ], + "rollbackOnFailure": true, + "instanceId": null, + "vfModules": { + "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0": { + "vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0ahubg": { + "modelInfo": { + "modelCustomizationName": "VprobeNcVnf..FE_base_module..module-0", + "modelCustomizationId": "4d0818cf-eaa9-4a3f-89c2-639953089e14", + "modelInvariantId": "29b6fa3c-aeb3-4103-b3f7-6f98e097b005", + "modelVersionId": "c5b26cc1-a66f-4b69-aa23-6abc7c647c88", + "modelName": "VprobeNcVnf..FE_base_module..module-0", + "modelType": "vfModule", + "modelVersion": "1" + }, + "instanceName": "hvf6arlba007_lba_Base_02", + "action": "Create", + "lcpCloudRegionId": "hvf6", + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "instanceParams": [ + {} + ], + "rollbackOnFailure": true, + "trackById": "ea2879a6-10bc-4697-90d7-7bc3e71da0fd", + "isFailed": false + } + }, + "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1": { + "vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1yprvi": { + "modelInfo": { + "modelCustomizationName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1", + "modelCustomizationId": "9b99d340-a80b-45ef-9ff1-993fa3e4c001", + "modelInvariantId": "1bcc4824-6c1a-4b51-af7c-076b7fc14d05", + "modelVersionId": "c09e4530-8fd8-418f-9483-2f57ce927b05", + "modelName": "VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1", + "modelType": "vfModule", + "modelVersion": "1" + }, + "instanceName": "my_hvf6arlba007_lba_dj_02", + "action": "Create", + "lcpCloudRegionId": "hvf6", + "tenantId": "4914ab0ab3a743e58f0eefdacc1dde77", + "instanceParams": [ + {} + ], + "rollbackOnFailure": true, + "trackById": "b134410e-3bc0-478e-883e-1b6bdf8a28df", + "isFailed": false, + "volumeGroupName": "my_special_hvf6arlba007_lba_dj_01_vol", + "sdncPreLoad": true + } + } + }, + "trackById": "1d2848a0-3573-4d29-b3dd-60bb263260ea", + "isFailed": false, + "statusMessage": null, + "position": null, + "lineOfBusiness": "zzz1" } }, "networks": {}, diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts index 40306fcfd..d1bee9c70 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts @@ -37,6 +37,7 @@ describe('Drawing Board: Instantiation Templates', function () { loadDrawingBoardWithRecreateMode(); removeVNFWithVFModules('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0'); + removeVNFWithVFModules('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0'); cy.getDrawingBoardDeployBtn().click(); cy.wait('@expectedPostAsyncInstantiation').then(xhr => { @@ -52,7 +53,7 @@ describe('Drawing Board: Instantiation Templates', function () { .fillVnfPopup() .getDrawingBoardDeployBtn().click() .wait('@expectedPostAsyncInstantiation').then(xhr => { - const vnfRequest = bodyOf(xhr).vnfs['vProbe_NC_VNF 0_1']; + const vnfRequest = bodyOf(xhr).vnfs['vProbe_NC_VNF 0_2']; expect(vnfRequest.action).equals("Create"); expect(vnfRequest.rollbackOnFailure).equals("true"); @@ -82,7 +83,7 @@ describe('Drawing Board: Instantiation Templates', function () { .getTagElementContainsText('button', 'Duplicate').click() .getDrawingBoardDeployBtn().click() .wait('@expectedPostAsyncInstantiation').then(xhr => { - expect(Object.keys(bodyOf(xhr).vnfs).length).equals(numberOfDuplicate + 1); + expect(Object.keys(bodyOf(xhr).vnfs).length).equals(numberOfDuplicate + 2); }); }); @@ -119,6 +120,7 @@ describe('Drawing Board: Instantiation Templates', function () { assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd([ {path: [...vnfPath, "vnfStoreKey"], value: "vProbe_NC_VNF 0"}, // side-effect + {path: [...vnfPath2, "vnfStoreKey"], value: "vProbe_NC_VNF 0_1"}, ]); }); @@ -145,7 +147,7 @@ describe('Drawing Board: Instantiation Templates', function () { let module1CustomizationId = `vprobe_nc_vnf0..${module1ModelId}`; // Click target VNF on right tree - cy.getElementByDataTestsId('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0').click(); + cy.getElementByDataTestsId('node-21ae311e-432f-4c54-b855-446d0b8ded72-vProbe_NC_VNF 0').first().click(); // Click [+] vfModule on left tree cy.drawingBoardPressAddButtonByElementName(`node-${module1CustomizationId}`) @@ -182,6 +184,7 @@ describe('Drawing Board: Instantiation Templates', function () { assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd([ {path: [...vnfPath, "vnfStoreKey"], value: "vProbe_NC_VNF 0"}, // side-effect + {path: [...vnfPath2, "vnfStoreKey"], value: "vProbe_NC_VNF 0_1"}, {path: ["existingNames", newVfModuleName], value: ""}, {path: ["existingNames", `${newVfModuleName}_vol`], value: ""}, {path: latestVfModule_1Path, value: latestVfModule_1ExpectedValue}, @@ -202,6 +205,7 @@ describe('Drawing Board: Instantiation Templates', function () { assertThatBodyFromDeployRequestEqualsToTemplateFromBackEnd([ {path: [...vnfPath, "vnfStoreKey"], value: "vProbe_NC_VNF 0"}, // side-effect + {path: [...vnfPath2, "vnfStoreKey"], value: "vProbe_NC_VNF 0_1"}, {path: [...removed_vfModule_Path], value: undefined}, ]); }); @@ -333,6 +337,10 @@ const vnfPath = [ "vnfs", "vProbe_NC_VNF 0" ]; +const vnfPath2 = [ + "vnfs", "vProbe_NC_VNF 0_1" +]; + function loadDrawingBoardWithRecreateMode() { loadDrawingBoardWithRecreateModeInternal( '../../' + templateWithVnfSetup.instanceTemplateFile, |