aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2020-01-21 14:05:47 +0000
committerGerrit Code Review <gerrit@onap.org>2020-01-21 14:05:47 +0000
commitd84677a58ba4ea589a14852b32ee47e15bb0164e (patch)
tree9555414ba71566072e3b2a5c1c2d62c8b09e88a5 /bpmn
parentb6fc1fc1f2e4242a83a52581b7d6d05c7a7cd201 (diff)
parentf09158e1f7928f656a9da07b9388129f73099a8d (diff)
Merge "updated bbinput setup to handle new and old"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ServiceModel.java32
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java60
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java123
3 files changed, 173 insertions, 42 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ServiceModel.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ServiceModel.java
new file mode 100644
index 0000000000..51bc4d7064
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/entities/ServiceModel.java
@@ -0,0 +1,32 @@
+package org.onap.so.bpmn.servicedecomposition.entities;
+
+import org.onap.so.db.catalog.beans.Service;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonRootName;
+
+@JsonRootName("serviceModel")
+public class ServiceModel {
+
+ @JsonProperty("currentService")
+ private Service currentService;
+ @JsonProperty("newService")
+ private Service newService;
+
+
+ public Service getCurrentService() {
+ return currentService;
+ }
+
+ public void setCurrentService(Service currentService) {
+ this.currentService = currentService;
+ }
+
+ public Service getNewService() {
+ return newService;
+ }
+
+ public void setNewService(Service newService) {
+ this.newService = newService;
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
index 6afceac78f..ac66fb1a41 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java
@@ -46,6 +46,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.entities.ServiceModel;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
@@ -242,7 +243,9 @@ public class BBInputSetup implements JavaDelegate {
String bbName = executeBB.getBuildingBlock().getBpmnFlowName();
String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
+ ServiceModel serviceModel = new ServiceModel();
Service service = null;
+ Service newService = null;
boolean isReplace = false;
if (serviceInstanceId != null) {
aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
@@ -254,20 +257,27 @@ public class BBInputSetup implements JavaDelegate {
for (RelatedInstanceList relatedInstList : relatedInstanceList) {
RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
if (relatedInstance.getModelInfo().getModelType().equals(ModelType.service)) {
- service = bbInputSetupUtils.getCatalogServiceByModelUUID(
+ newService = bbInputSetupUtils.getCatalogServiceByModelUUID(
relatedInstance.getModelInfo().getModelVersionId());
isReplace = true;
}
}
}
- } else {
- service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
}
+
+ service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+
+ serviceModel.setNewService(newService);
+ serviceModel.setCurrentService(service);
+
if (service == null) {
String message = String.format(
"Related service instance model not found in MSO CatalogDB: model-version-id=%s",
aaiServiceInstance.getModelVersionId());
throw new ServiceModelNotFoundException(message);
+ } else if (newService == null && isReplace) {
+ String message = "Related service instance model in Request not found in MSO CatalogDB";
+ throw new ServiceModelNotFoundException(message);
}
} else {
String message = String.format("Related service instance from AAI not found: service-instance-id=%s",
@@ -277,10 +287,16 @@ public class BBInputSetup implements JavaDelegate {
}
ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
- serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
+ if (isReplace) {
+ serviceInstance.setModelInfoServiceInstance(
+ this.mapperLayer.mapCatalogServiceIntoServiceInstance(serviceModel.getNewService()));
+ } else {
+ serviceInstance.setModelInfoServiceInstance(
+ this.mapperLayer.mapCatalogServiceIntoServiceInstance(serviceModel.getCurrentService()));
+ }
this.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap,
resourceId, vnfType, executeBB.getBuildingBlock().getKey(), executeBB.getConfigurationResourceKeys(),
- isReplace);
+ isReplace, serviceModel);
return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
}
@@ -342,8 +358,8 @@ public class BBInputSetup implements JavaDelegate {
protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName,
ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType,
- String configurationKey, ConfigurationResourceKeys configurationResourceKeys, boolean isReplace)
- throws Exception {
+ String configurationKey, ConfigurationResourceKeys configurationResourceKeys, boolean isReplace,
+ ServiceModel serviceModel) throws Exception {
ModelInfo modelInfo = requestDetails.getModelInfo();
String instanceName = requestDetails.getRequestInfo().getInstanceName();
String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId();
@@ -381,7 +397,8 @@ public class BBInputSetup implements JavaDelegate {
} else {
lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId);
this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration(), isReplace);
+ relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration(), isReplace,
+ serviceModel);
}
} else if (modelType.equals(ModelType.instanceGroup)) {
lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, resourceId);
@@ -511,7 +528,7 @@ public class BBInputSetup implements JavaDelegate {
protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName,
ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
RelatedInstanceList[] relatedInstanceList, String instanceName, List<Map<String, String>> instanceParams,
- CloudConfiguration cloudConfiguration, boolean isReplace) throws Exception {
+ CloudConfiguration cloudConfiguration, boolean isReplace, ServiceModel serviceModel) throws Exception {
String replaceVnfModelCustomizationUUID = null;
String vnfModelCustomizationUUID = null;
if (relatedInstanceList != null) {
@@ -536,8 +553,13 @@ public class BBInputSetup implements JavaDelegate {
vnfModelCustomizationUUID =
this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
ModelInfo vnfModelInfo = new ModelInfo();
- vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
- this.mapCatalogVnf(tempVnf, vnfModelInfo, service);
+ if (isReplace) {
+ vnfModelInfo.setModelCustomizationUuid(replaceVnfModelCustomizationUUID);
+ this.mapCatalogVnf(tempVnf, vnfModelInfo, serviceModel.getNewService());
+ } else {
+ vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
+ this.mapCatalogVnf(tempVnf, vnfModelInfo, serviceModel.getCurrentService());
+ }
Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(tempVnf, modelInfo,
cloudConfiguration.getCloudOwner(), cloudConfiguration.getLcpCloudRegionId(), lookupKeyMap);
if (volumeGroupIdOp.isPresent()) {
@@ -559,18 +581,22 @@ public class BBInputSetup implements JavaDelegate {
modelInfoVfModule.setModelCustomizationId(vfModuleCustId);
if (isReplace && lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null
&& vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) {
- mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, replaceVnfModelCustomizationUUID);
+ mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, serviceModel.getNewService(),
+ replaceVnfModelCustomizationUUID);
} else {
- mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, service, vnfModelCustomizationUUID);
+ mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, serviceModel.getCurrentService(),
+ vnfModelCustomizationUUID);
}
}
if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) {
vfModule = createVfModule(lookupKeyMap, resourceId, instanceName, instanceParams);
vnf.getVfModules().add(vfModule);
if (isReplace) {
- mapCatalogVfModule(vfModule, modelInfo, service, replaceVnfModelCustomizationUUID);
+ mapCatalogVfModule(vfModule, modelInfo, serviceModel.getNewService(),
+ replaceVnfModelCustomizationUUID);
} else {
- mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID);
+ mapCatalogVfModule(vfModule, modelInfo, serviceModel.getCurrentService(),
+ vnfModelCustomizationUUID);
}
}
} else {
@@ -1476,8 +1502,10 @@ public class BBInputSetup implements JavaDelegate {
CloudConfiguration cloudConfig = new CloudConfiguration();
cloudConfig.setLcpCloudRegionId(cloudRegion.getLcpCloudRegionId());
cloudConfig.setCloudOwner(cloudRegion.getCloudOwner());
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, vfModuleId, null,
- vfModules.getInstanceName(), vfModules.getInstanceParams(), cloudConfig, false);
+ vfModules.getInstanceName(), vfModules.getInstanceParams(), cloudConfig, false, serviceModel);
}
} else if (bbName.contains(NETWORK)) {
networks = findNetworksByKey(key, resources);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
index 517bdfffb8..e0ee918ead 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java
@@ -79,6 +79,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.entities.ServiceModel;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.generalobjects.OrchestrationContext;
import org.onap.so.bpmn.servicedecomposition.generalobjects.RequestContext;
@@ -445,6 +446,8 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
String requestAction = "createInstance";
Service service = Mockito.mock(Service.class);
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class);
String resourceId = "123";
String vnfType = "vnfType";
@@ -456,8 +459,9 @@ public class BBInputSetupTest {
.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId");
- doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName",
- serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false);
+ doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(eq(requestDetails), eq(service),
+ eq("bbName"), eq(serviceInstance), eq(lookupKeyMap), eq(resourceId), eq(vnfType), eq(null), eq(null),
+ eq(false), isA(ServiceModel.class));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
executeBB, requestAction, null);
@@ -469,6 +473,51 @@ public class BBInputSetupTest {
}
@Test
+ public void testGetGBBALaCarteNonServiceIsReplace() throws Exception {
+ GeneralBuildingBlock expected = mapper.readValue(new File(RESOURCE_PATH + "GeneralBuildingBlockExpected.json"),
+ GeneralBuildingBlock.class);
+ ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
+ ExecuteBuildingBlock.class);
+ RequestDetails requestDetails = mapper.readValue(
+ new File(RESOURCE_PATH + "RequestDetailsInput_withRelatedInstanceList.json"), RequestDetails.class);
+ Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
+ String requestAction = "replaceInstance";
+ Service service = Mockito.mock(Service.class);
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
+ ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class);
+ String resourceId = "123";
+ String vnfType = "vnfType";
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
+ aaiServiceInstance.setModelVersionId("modelVersionId");
+ org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = Mockito.mock(org.onap.aai.domain.yang.CloudRegion.class);
+ lookupKeyMap.put(ResourceKey.SERVICE_INSTANCE_ID, "instanceId");
+ doReturn(service).when(SPY_bbInputSetupUtils)
+ .getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+ doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID("modelUUID");
+ doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId");
+
+ doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(eq(requestDetails), eq(service),
+ eq("bbName"), eq(serviceInstance), eq(lookupKeyMap), eq(resourceId), eq(vnfType), eq(null), eq(null),
+ eq(true), isA(ServiceModel.class));
+ doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
+ doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
+ executeBB, requestAction, null);
+
+ GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap,
+ requestAction, resourceId, vnfType);
+
+ verify(SPY_bbInputSetup, times(1)).populateObjectsOnAssignAndCreateFlows(eq(requestDetails), eq(service),
+ eq("bbName"), eq(serviceInstance), eq(lookupKeyMap), eq(resourceId), eq(vnfType), eq(null), eq(null),
+ eq(true), isA(ServiceModel.class));
+
+ verify(SPY_bbInputSetupUtils, times(1)).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+ verify(SPY_bbInputSetupUtils, times(1)).getCatalogServiceByModelUUID("modelUUID");
+
+ assertThat(actual, sameBeanAs(expected));
+ }
+
+ @Test
public void testGetGBBALaCarteNonServiceWithoutServiceModelInfo() throws Exception {
ExecuteBuildingBlock executeBB = mapper.readValue(new File(RESOURCE_PATH + "ExecuteBuildingBlockSimple.json"),
ExecuteBuildingBlock.class);
@@ -527,6 +576,8 @@ public class BBInputSetupTest {
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
String requestAction = "createInstance";
Service service = Mockito.mock(Service.class);
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
String resourceId = "123";
ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class);
org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
@@ -538,8 +589,9 @@ public class BBInputSetupTest {
.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId");
- doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName",
- serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false);
+ doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(eq(requestDetails), eq(service),
+ eq("bbName"), eq(serviceInstance), eq(lookupKeyMap), eq(resourceId), eq(vnfType), eq(null), eq(null),
+ eq(false), isA(ServiceModel.class));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
@@ -818,6 +870,8 @@ public class BBInputSetupTest {
String productFamilyId = "productFamilyId";
String applicationId = "applicationId";
Service service = Mockito.mock(Service.class);
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
ServiceInstance serviceInstance = Mockito.mock(ServiceInstance.class);
RequestDetails requestDetails = Mockito.mock(RequestDetails.class);
ModelInfo modelInfo = Mockito.mock(ModelInfo.class);
@@ -844,7 +898,7 @@ public class BBInputSetupTest {
doReturn(ModelType.network).when(modelInfo).getModelType();
SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType, null, null, false);
+ lookupKeyMap, resourceId, vnfType, null, null, false, serviceModel);
verify(SPY_bbInputSetup, times(1)).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance,
lookupKeyMap, resourceId, null);
assertEquals("NetworkId populated", true,
@@ -858,7 +912,7 @@ public class BBInputSetupTest {
productFamilyId, applicationId, false);
SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType, null, null, false);
+ lookupKeyMap, resourceId, vnfType, null, null, false, serviceModel);
verify(SPY_bbInputSetup, times(1)).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness,
service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null,
productFamilyId, applicationId, false);
@@ -870,7 +924,7 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance,
lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType, null, null, false);
+ lookupKeyMap, resourceId, vnfType, null, null, false, serviceModel);
verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbName, serviceInstance,
lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
assertEquals("VolumeGroupId populated", true,
@@ -879,11 +933,11 @@ public class BBInputSetupTest {
doReturn(ModelType.vfModule).when(modelInfo).getModelType();
resourceId = "vfModuleId";
doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false);
+ resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false, serviceModel);
SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType, null, null, false);
+ lookupKeyMap, resourceId, vnfType, null, null, false, serviceModel);
verify(SPY_bbInputSetup, times(1)).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false);
+ resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false, serviceModel);
assertEquals("VfModuleId populated", true,
lookupKeyMap.get(ResourceKey.VF_MODULE_ID).equalsIgnoreCase(resourceId));
@@ -893,7 +947,7 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbNameAssignVolume, serviceInstance,
lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbNameAssignVolume,
- serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false);
+ serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false, serviceModel);
verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbNameAssignVolume, serviceInstance,
lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
assertEquals("VolumeGroupId populated", true,
@@ -2023,7 +2077,7 @@ public class BBInputSetupTest {
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(1)).populateVfModule(isA(ModelInfo.class), isA(Service.class), any(String.class),
isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), any(),
- isA(CloudConfiguration.class), Mockito.anyBoolean());
+ isA(CloudConfiguration.class), Mockito.anyBoolean(), isA(ServiceModel.class));
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString());
@@ -2306,7 +2360,7 @@ public class BBInputSetupTest {
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(1)).populateVfModule(isA(ModelInfo.class), isA(Service.class), any(String.class),
isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), any(),
- isA(CloudConfiguration.class), Mockito.anyBoolean());
+ isA(CloudConfiguration.class), Mockito.anyBoolean(), isA(ServiceModel.class));
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString());
@@ -2371,7 +2425,7 @@ public class BBInputSetupTest {
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(1)).populateVfModule(isA(ModelInfo.class), isA(Service.class), any(String.class),
isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), any(),
- isA(CloudConfiguration.class), Mockito.anyBoolean());
+ isA(CloudConfiguration.class), Mockito.anyBoolean(), isA(ServiceModel.class));
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString());
@@ -2945,6 +2999,8 @@ public class BBInputSetupTest {
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationId(vfModuleCustomizationId);
Service service = new Service();
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(service);
String bbName = AssignFlows.VF_MODULE.toString();
ServiceInstance serviceInstance = new ServiceInstance();
GenericVnf vnf = new GenericVnf();
@@ -2984,7 +3040,7 @@ public class BBInputSetupTest {
isA(Service.class), isA(String.class));
SPY_bbInputSetup.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- relatedInstanceList, instanceName, instanceParams, cloudConfiguration, false);
+ relatedInstanceList, instanceName, instanceParams, cloudConfiguration, false, serviceModel);
verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
isA(Service.class), isA(String.class));
@@ -3002,7 +3058,13 @@ public class BBInputSetupTest {
String vfModuleCustomizationId = "vfModuleCustomizationId";
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationId(vfModuleCustomizationId);
- Service service = new Service();
+ Service currentService = new Service();
+ currentService.setModelUUID("currentUUID");
+ Service newService = new Service();
+ newService.setModelUUID("newUUID");
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(currentService);
+ serviceModel.setNewService(newService);
String bbName = "ActivateVfModuleBB";
ServiceInstance serviceInstance = new ServiceInstance();
GenericVnf vnf = new GenericVnf();
@@ -3053,13 +3115,13 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
isA(Service.class), isA(String.class));
- SPY_bbInputSetup.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- relatedInstanceList, instanceName, instanceParams, cloudConfiguration, true);
+ SPY_bbInputSetup.populateVfModule(modelInfo, newService, bbName, serviceInstance, lookupKeyMap, resourceId,
+ relatedInstanceList, instanceName, instanceParams, cloudConfiguration, true, serviceModel);
verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
- isA(Service.class), eq("vnfModelCustId"));
- verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
- isA(Service.class), eq("vnfCustomizationId"));
+ eq(currentService), eq("vnfModelCustId"));
+ verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), eq(newService),
+ eq("vnfCustomizationId"));
assertEquals("Lookup Key Map populated with VfModule Id", "vfModuleId1",
lookupKeyMap.get(ResourceKey.VF_MODULE_ID));
assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId,
@@ -3074,7 +3136,13 @@ public class BBInputSetupTest {
String vfModuleCustomizationId = "vfModuleCustomizationId";
ModelInfo modelInfo = new ModelInfo();
modelInfo.setModelCustomizationId(vfModuleCustomizationId);
- Service service = new Service();
+ Service currentService = new Service();
+ Service newService = new Service();
+ ServiceModel serviceModel = new ServiceModel();
+ serviceModel.setCurrentService(currentService);
+ currentService.setModelUUID("currentUUID");
+ serviceModel.setNewService(newService);
+ currentService.setModelUUID("newUUID");
String bbName = AssignFlows.VF_MODULE.toString();
ServiceInstance serviceInstance = new ServiceInstance();
GenericVnf vnf = new GenericVnf();
@@ -3091,6 +3159,7 @@ public class BBInputSetupTest {
vnf.getVfModules().add(vfModule2);
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, vnfId);
+ lookupKeyMap.put(ResourceKey.VF_MODULE_ID, vfModuleId);
String resourceId = vfModuleId;
RelatedInstanceList[] relatedInstanceList = new RelatedInstanceList[1];
RelatedInstanceList relatedInstanceListObj = new RelatedInstanceList();
@@ -3124,11 +3193,13 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
isA(Service.class), isA(String.class));
- SPY_bbInputSetup.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- relatedInstanceList, instanceName, instanceParams, cloudConfiguration, true);
+ SPY_bbInputSetup.populateVfModule(modelInfo, newService, bbName, serviceInstance, lookupKeyMap, resourceId,
+ relatedInstanceList, instanceName, instanceParams, cloudConfiguration, true, serviceModel);
- verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
- isA(Service.class), isA(String.class));
+ verify(SPY_bbInputSetup, times(2)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
+ eq(serviceModel.getCurrentService()), isA(String.class));
+ verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
+ eq(serviceModel.getNewService()), isA(String.class));
assertEquals("Lookup Key Map populated with VfModule Id", vfModuleId,
lookupKeyMap.get(ResourceKey.VF_MODULE_ID));
assertEquals("Lookup Key Map populated with VolumeGroup Id", volumeGroupId,