diff options
author | Plummer, Brittany <brittany.plummer@att.com> | 2019-10-09 09:10:30 -0400 |
---|---|---|
committer | Benjamin, Max (mb388a) <mb388a@att.com> | 2019-10-09 09:10:30 -0400 |
commit | 4d580903d566c1c9b43b4a6356a63b0daecfd876 (patch) | |
tree | 47c607ab682b319102603cc675b65855ff6ce6e0 | |
parent | e39c2cbf62f993dbe7843b3eb360c485ef445554 (diff) |
feature request to mso to save name on deletes
Updated to fix instanceName getting cleared
Updated to pass requestId string instead of executebb
Updated tests to fix compliation issues
Moved log line to right before actual update
Updated documentation for invoke delete service instance flow no
instance name
Issue-ID: SO-2426
Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com>
Change-Id: I049120e60e8fe69147375d628fad0cbefd0d9afe
2 files changed, 202 insertions, 140 deletions
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 433aa0c11a..763f163a2b 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 @@ -83,6 +83,7 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; @@ -128,6 +129,9 @@ public class BBInputSetup implements JavaDelegate { @Autowired private ExceptionBuilder exceptionUtil; + @Autowired + private RequestsDbClient requestsDbClient; + private ObjectMapper mapper = new ObjectMapper(); public BBInputSetupUtils getBbInputSetupUtils() { @@ -259,8 +263,8 @@ public class BBInputSetup implements JavaDelegate { if (aaiServiceInstance != null && service != null) { ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance); serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); - this.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap, - resourceId, vnfType, executeBB.getBuildingBlock().getKey(), + this.populateObjectsOnAssignAndCreateFlows(executeBB.getRequestId(), requestDetails, service, bbName, + serviceInstance, lookupKeyMap, resourceId, vnfType, executeBB.getBuildingBlock().getKey(), executeBB.getConfigurationResourceKeys()); return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); @@ -284,6 +288,9 @@ public class BBInputSetup implements JavaDelegate { org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId); GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf); genericVnfs.add(genericVnf); + if (genericVnf != null) { + updateInstanceName(executeBB.getRequestId(), ModelType.vnf, genericVnf.getVnfName()); + } } String instanceGroupId = lookupKeyMap.get(ResourceKey.INSTANCE_GROUP_ID); @@ -292,6 +299,7 @@ public class BBInputSetup implements JavaDelegate { bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId); InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstancegroup); instanceGroup.setOrchestrationStatus(OrchestrationStatus.INVENTORIED); + updateInstanceName(executeBB.getRequestId(), ModelType.instanceGroup, instanceGroup.getInstanceGroupName()); if (serviceInstanceId == null) { Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstanceOpt = @@ -326,9 +334,10 @@ public class BBInputSetup implements JavaDelegate { customer); } - protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName, - ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType, - String configurationKey, ConfigurationResourceKeys configurationResourceKeys) throws Exception { + protected void populateObjectsOnAssignAndCreateFlows(String requestId, RequestDetails requestDetails, + Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, + String resourceId, String vnfType, String configurationKey, + ConfigurationResourceKeys configurationResourceKeys) throws Exception { ModelInfo modelInfo = requestDetails.getModelInfo(); String instanceName = requestDetails.getRequestInfo().getInstanceName(); String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId(); @@ -340,26 +349,26 @@ public class BBInputSetup implements JavaDelegate { if (modelType.equals(ModelType.network)) { lookupKeyMap.put(ResourceKey.NETWORK_ID, resourceId); - this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - null); + this.populateL3Network(requestId, instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, null); } else if (modelType.equals(ModelType.vnf)) { lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, resourceId); - this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance, - lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId); + this.populateGenericVnf(requestId, modelInfo, instanceName, platform, lineOfBusiness, service, bbName, + serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId); } else if (modelType.equals(ModelType.volumeGroup)) { lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, resourceId); - this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + this.populateVolumeGroup(requestId, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); } else if (modelType.equals(ModelType.vfModule)) { if (bbName.contains("Configuration")) { String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); ModelInfo configurationModelInfo = new ModelInfo(); configurationModelInfo.setModelCustomizationUuid(configurationKey); - populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, + populateConfiguration(requestId, configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, configurationId, instanceName, configurationResourceKeys, requestDetails); } else { lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId); - this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, + this.populateVfModule(requestId, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration()); } } else if (modelType.equals(ModelType.instanceGroup)) { @@ -384,7 +393,7 @@ public class BBInputSetup implements JavaDelegate { // Dependent on MSO-5821 653458 US - MSO - Enhance Catalog DB Schema & Adapter to support VNF Groups } - protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName, + protected void populateConfiguration(String requestId, ModelInfo modelInfo, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String instanceName, ConfigurationResourceKeys configurationResourceKeys, RequestDetails requestDetails) { Configuration configuration = null; @@ -408,11 +417,13 @@ public class BBInputSetup implements JavaDelegate { Vnfc vnfc = getVnfcToConfiguration(configurationResourceKeys.getVnfcName()); configuration.setVnfc(vnfc); this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys); + updateInstanceName(requestId, ModelType.configuration, configuration.getConfigurationName()); } else if (configuration != null && bbName.contains("Vrf")) { configuration.setModelInfoConfiguration(mapperLayer.mapCatalogConfigurationToConfiguration( findConfigurationResourceCustomization(modelInfo, service), null)); configuration.setConfigurationType(configuration.getModelInfoConfiguration().getConfigurationType()); configuration.setConfigurationSubType(configuration.getModelInfoConfiguration().getConfigurationRole()); + updateInstanceName(requestId, ModelType.configuration, configuration.getConfigurationName()); } } @@ -487,7 +498,7 @@ public class BBInputSetup implements JavaDelegate { vfModuleCustomizationUUID, cvnfcCustomizationUUID); } - protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName, + protected void populateVfModule(String requestId, 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) throws Exception { @@ -538,6 +549,9 @@ public class BBInputSetup implements JavaDelegate { vnf.getVfModules().add(vfModule); mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID); } + if (vfModule != null) { + updateInstanceName(requestId, ModelType.vfModule, vfModule.getVfModuleName()); + } } else { logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); throw new Exception("Could not find relevant information for related VNF"); @@ -601,7 +615,7 @@ public class BBInputSetup implements JavaDelegate { return vfModule; } - protected void populateVolumeGroup(ModelInfo modelInfo, Service service, String bbName, + protected void populateVolumeGroup(String requestId, ModelInfo modelInfo, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, RelatedInstanceList[] relatedInstanceList, String instanceName, String vnfType, List<Map<String, String>> instanceParams) throws Exception { @@ -647,6 +661,7 @@ public class BBInputSetup implements JavaDelegate { } if (volumeGroup != null) { mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID); + updateInstanceName(requestId, ModelType.volumeGroup, volumeGroup.getVolumeGroupName()); } } else { logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID)); @@ -700,7 +715,7 @@ public class BBInputSetup implements JavaDelegate { return null; } - protected void populateGenericVnf(ModelInfo modelInfo, String instanceName, + protected void populateGenericVnf(String requestId, ModelInfo modelInfo, String instanceName, org.onap.so.serviceinstancebeans.Platform platform, org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness, Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, @@ -745,6 +760,7 @@ public class BBInputSetup implements JavaDelegate { && !instanceGroupInList(vnf, instanceGroupId)) { mapNetworkCollectionInstanceGroup(vnf, instanceGroupId); } + updateInstanceName(requestId, ModelType.vnf, vnf.getVnfName()); } } @@ -828,8 +844,8 @@ public class BBInputSetup implements JavaDelegate { return vnfResourceCustomization; } - protected void populateL3Network(String instanceName, ModelInfo modelInfo, Service service, String bbName, - ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, + protected void populateL3Network(String requestId, String instanceName, ModelInfo modelInfo, Service service, + String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, List<Map<String, String>> instanceParams) { L3Network network = null; for (L3Network networkTemp : serviceInstance.getNetworks()) { @@ -846,6 +862,7 @@ public class BBInputSetup implements JavaDelegate { } if (network != null) { mapCatalogNetwork(network, modelInfo, service); + updateInstanceName(requestId, ModelType.network, network.getNetworkName()); } } @@ -905,6 +922,7 @@ public class BBInputSetup implements JavaDelegate { ServiceInstance serviceInstance = this.getALaCarteServiceInstance(service, requestDetails, customer, project, owningEntity, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()), executeBB.getBuildingBlock().getBpmnFlowName()); + updateInstanceName(executeBB.getRequestId(), ModelType.service, serviceInstance.getServiceInstanceName()); return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, customer); } else { @@ -1113,8 +1131,8 @@ public class BBInputSetup implements JavaDelegate { NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service); if (networkCust != null) { networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID()); - this.populateL3Network(null, networkModelInfo, service, bbName, serviceInstance, lookupKeyMap, - networkId, null); + this.populateL3Network(executeBB.getRequestId(), null, networkModelInfo, service, bbName, + serviceInstance, lookupKeyMap, networkId, null); } else { logger.debug("Could not find a network customization with key: {}", key); } @@ -1134,8 +1152,9 @@ public class BBInputSetup implements JavaDelegate { String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); ModelInfo configurationModelInfo = new ModelInfo(); configurationModelInfo.setModelCustomizationUuid(key); - this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, - configurationId, null, executeBB.getConfigurationResourceKeys(), executeBB.getRequestDetails()); + this.populateConfiguration(executeBB.getRequestId(), configurationModelInfo, service, bbName, + serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys(), + executeBB.getRequestDetails()); } if (executeBB.getWorkflowResourceIds() != null) { this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance, @@ -1242,6 +1261,7 @@ public class BBInputSetup implements JavaDelegate { if (aaiServiceInstance != null && service != null) { ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance); serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service)); + updateInstanceName(executeBB.getRequestId(), ModelType.service, serviceInstance.getServiceInstanceName()); gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); } else { logger.debug("Related Service Instance from AAI: {}", aaiServiceInstance); @@ -1383,9 +1403,9 @@ public class BBInputSetup implements JavaDelegate { this.bbInputSetupUtils.updateInfraActiveRequestVnfId(request, vnfId); } String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId(); - this.populateGenericVnf(vnfs.getModelInfo(), vnfs.getInstanceName(), vnfs.getPlatform(), - vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType, - vnfs.getInstanceParams(), productFamilyId); + this.populateGenericVnf(executeBB.getRequestId(), vnfs.getModelInfo(), vnfs.getInstanceName(), + vnfs.getPlatform(), vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, + vnfId, vnfType, vnfs.getInstanceParams(), productFamilyId); } else if (bbName.contains(VF_MODULE) || bbName.contains(VOLUME_GROUP)) { Pair<Vnfs, VfModules> vnfsAndVfModules = getVfModulesAndItsVnfsByKey(key, resources); if (vnfsAndVfModules != null) { @@ -1399,22 +1419,24 @@ public class BBInputSetup implements JavaDelegate { ModelInfo modelInfo = vfModules.getModelInfo(); if (bbName.contains(VOLUME_GROUP)) { String volumeGroupId = lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID); - this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, volumeGroupId, null, - vfModules.getVolumeGroupInstanceName(), vnfType, vfModules.getInstanceParams()); + this.populateVolumeGroup(executeBB.getRequestId(), modelInfo, service, bbName, serviceInstance, + lookupKeyMap, volumeGroupId, null, vfModules.getVolumeGroupInstanceName(), vnfType, + vfModules.getInstanceParams()); } else { String vfModuleId = lookupKeyMap.get(ResourceKey.VF_MODULE_ID); CloudConfiguration cloudConfig = new CloudConfiguration(); cloudConfig.setLcpCloudRegionId(cloudRegion.getLcpCloudRegionId()); cloudConfig.setCloudOwner(cloudRegion.getCloudOwner()); - this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, vfModuleId, null, - vfModules.getInstanceName(), vfModules.getInstanceParams(), cloudConfig); + this.populateVfModule(executeBB.getRequestId(), modelInfo, service, bbName, serviceInstance, + lookupKeyMap, vfModuleId, null, vfModules.getInstanceName(), vfModules.getInstanceParams(), + cloudConfig); } } else if (bbName.contains(NETWORK)) { networks = findNetworksByKey(key, resources); String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID); if (networks != null) { - this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName, - serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams()); + this.populateL3Network(executeBB.getRequestId(), networks.getInstanceName(), networks.getModelInfo(), + service, bbName, serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams()); } } else if (bbName.contains("Configuration")) { String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID); @@ -1423,8 +1445,9 @@ public class BBInputSetup implements JavaDelegate { ConfigurationResourceCustomization configurationCust = findConfigurationResourceCustomization(configurationModelInfo, service); if (configurationCust != null) { - this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap, - configurationId, null, executeBB.getConfigurationResourceKeys(), executeBB.getRequestDetails()); + this.populateConfiguration(executeBB.getRequestId(), configurationModelInfo, service, bbName, + serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys(), + executeBB.getRequestDetails()); } else { logger.debug("Could not find a configuration customization with key: {}", key); } @@ -1936,5 +1959,24 @@ public class BBInputSetup implements JavaDelegate { return customer; } + protected void updateInstanceName(String requestId, ModelType resourceType, String instanceName) { + try { + if (instanceName != null) { + InfraActiveRequests request = requestsDbClient.getInfraActiveRequestbyRequestId(requestId); + if (resourceType.getName(request) == null) { + logger.info("Updating instanceName to: {} in requestDb for requestId: {}", instanceName, requestId); + resourceType.setName(request, instanceName); + requestsDbClient.updateInfraActiveRequests(request); + } + } else { + logger.info("Failed to update instanceName in RequestDb because it was null for requestId: {}", + requestId); + } + } catch (Exception ex) { + logger.error("Unable to update Request db with instanceName for requestId: {} due to error: {}", requestId, + ex.getMessage()); + } + } + } 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 7c136cdee9..335d5b9d70 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 @@ -34,6 +34,7 @@ import static org.mockito.Mockito.doNothing; import static org.mockito.Mockito.doReturn; import static org.mockito.Mockito.times; import static org.mockito.Mockito.verify; +import static org.mockito.Mockito.when; import java.io.File; import java.io.IOException; import java.util.ArrayList; @@ -48,6 +49,7 @@ import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.mockito.ArgumentMatchers; +import org.mockito.InjectMocks; import org.mockito.Mock; import org.mockito.Mockito; import org.mockito.Spy; @@ -107,6 +109,7 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization; import org.onap.so.db.catalog.beans.VnfResourceCustomization; import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization; import org.onap.so.db.request.beans.InfraActiveRequests; +import org.onap.so.db.request.client.RequestsDbClient; import org.onap.so.serviceinstancebeans.CloudConfiguration; import org.onap.so.serviceinstancebeans.ModelInfo; import org.onap.so.serviceinstancebeans.ModelType; @@ -128,8 +131,10 @@ public class BBInputSetupTest { protected ObjectMapper mapper = new ObjectMapper(); private static final String CLOUD_OWNER = "CloudOwner"; + private static final String REQUEST_ID = "b20bbd26-af25-4a50-a9fe-222a3c0f9771"; @Spy + @InjectMocks private BBInputSetup SPY_bbInputSetup = new BBInputSetup(); @Mock @@ -141,6 +146,9 @@ public class BBInputSetupTest { @Spy private BBInputSetupMapperLayer bbInputSetupMapperLayer; + @Mock + private RequestsDbClient requestsDbClient; + @Before public void setup() { SPY_bbInputSetup.setBbInputSetupUtils(SPY_bbInputSetupUtils); @@ -441,8 +449,8 @@ 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); + doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(executeBB.getRequestId(), + requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null); @@ -492,8 +500,8 @@ 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); + doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(executeBB.getRequestId(), + requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance); doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, @@ -783,8 +791,8 @@ public class BBInputSetupTest { Mockito.mock(org.onap.so.serviceinstancebeans.LineOfBusiness.class); Map<ResourceKey, String> lookupKeyMap = new HashMap<>(); - doNothing().when(SPY_bbInputSetup).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, - lookupKeyMap, resourceId, null); + doNothing().when(SPY_bbInputSetup).populateL3Network(REQUEST_ID, instanceName, modelInfo, service, bbName, + serviceInstance, lookupKeyMap, resourceId, null); doReturn(modelInfo).when(requestDetails).getModelInfo(); doReturn(productFamilyId).when(requestInfo).getProductFamilyId(); doReturn(requestInfo).when(requestDetails).getRequestInfo(); @@ -795,45 +803,45 @@ public class BBInputSetupTest { doReturn(cloudConfiguration).when(requestDetails).getCloudConfiguration(); doReturn(ModelType.network).when(modelInfo).getModelType(); - SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, - lookupKeyMap, resourceId, vnfType, null, null); - verify(SPY_bbInputSetup, times(1)).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, - lookupKeyMap, resourceId, null); + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName, + serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); + verify(SPY_bbInputSetup, times(1)).populateL3Network(REQUEST_ID, instanceName, modelInfo, service, bbName, + serviceInstance, lookupKeyMap, resourceId, null); assertEquals("NetworkId populated", true, lookupKeyMap.get(ResourceKey.NETWORK_ID).equalsIgnoreCase(resourceId)); doReturn(ModelType.vnf).when(modelInfo).getModelType(); resourceId = "vnfId"; - doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, - service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, - productFamilyId); - SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, - lookupKeyMap, resourceId, vnfType, null, null); - verify(SPY_bbInputSetup, times(1)).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, - service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, - productFamilyId); + doNothing().when(SPY_bbInputSetup).populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, + lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, + vnfType, null, productFamilyId); + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName, + serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, + lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, + vnfType, null, productFamilyId); assertEquals("VnfId populated", true, lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID).equalsIgnoreCase(resourceId)); doReturn(ModelType.volumeGroup).when(modelInfo).getModelType(); resourceId = "volumeGroupId"; - doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, + doNothing().when(SPY_bbInputSetup).populateVolumeGroup(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); - SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, - lookupKeyMap, resourceId, vnfType, null, null); - verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbName, serviceInstance, + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName, + serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null); assertEquals("VolumeGroupId populated", true, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID).equalsIgnoreCase(resourceId)); doReturn(ModelType.vfModule).when(modelInfo).getModelType(); resourceId = "vfModuleId"; - doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, - resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); - SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, - lookupKeyMap, resourceId, vnfType, null, null); - verify(SPY_bbInputSetup, times(1)).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, - resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); + doNothing().when(SPY_bbInputSetup).populateVfModule(REQUEST_ID, modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); + SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName, + serviceInstance, lookupKeyMap, resourceId, vnfType, null, null); + verify(SPY_bbInputSetup, times(1)).populateVfModule(REQUEST_ID, modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, cloudConfiguration); assertEquals("VfModuleId populated", true, lookupKeyMap.get(ResourceKey.VF_MODULE_ID).equalsIgnoreCase(resourceId)); } @@ -1114,12 +1122,12 @@ public class BBInputSetupTest { doReturn(aaiGenericVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId()); lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId"); - SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); + SPY_bbInputSetup.populateVolumeGroup(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vg, modelInfo, service, "vnfModelCustomizationUUID"); vnf.getVolumeGroups().clear(); - SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); + SPY_bbInputSetup.populateVolumeGroup(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null); verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vnf.getVolumeGroups().get(0), modelInfo, service, "vnfModelCustomizationUUID"); } @@ -1168,19 +1176,19 @@ public class BBInputSetupTest { doNothing().when(SPY_bbInputSetup).mapCatalogNetwork(network, modelInfo, service); - SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, - resourceId, null); + SPY_bbInputSetup.populateL3Network(REQUEST_ID, instanceName, modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, null); lookupKeyMap.put(ResourceKey.NETWORK_ID, null); - SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, - resourceId, null); + SPY_bbInputSetup.populateL3Network(REQUEST_ID, instanceName, modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, null); verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(network, modelInfo, service); instanceName = "networkName2"; L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null); - SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, - resourceId, null); + SPY_bbInputSetup.populateL3Network(REQUEST_ID, instanceName, modelInfo, service, bbName, serviceInstance, + lookupKeyMap, resourceId, null); verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network2, modelInfo, service); } @@ -1238,15 +1246,15 @@ public class BBInputSetupTest { doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName); - SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - instanceName, configResourceKeys, requestDetails); + SPY_bbInputSetup.populateConfiguration(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, instanceName, configResourceKeys, requestDetails); verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null); - SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - instanceName, configResourceKeys, requestDetails); + SPY_bbInputSetup.populateConfiguration(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, instanceName, configResourceKeys, requestDetails); verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); @@ -1257,8 +1265,8 @@ public class BBInputSetupTest { doReturn(configuration2).when(SPY_bbInputSetup).createConfiguration(lookupKeyMap, instanceName, resourceId); doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service, configResourceKeys); - SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - instanceName, configResourceKeys, requestDetails); + SPY_bbInputSetup.populateConfiguration(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, instanceName, configResourceKeys, requestDetails); verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service, configResourceKeys); } @@ -1323,8 +1331,8 @@ public class BBInputSetupTest { doReturn(null).when(SPY_bbInputSetup).findConfigurationResourceCustomization(modelInfo, service); doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName); - SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId, - instanceName, configResourceKeys, requestDetails); + SPY_bbInputSetup.populateConfiguration(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, instanceName, configResourceKeys, requestDetails); verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service, configResourceKeys); } @@ -1368,15 +1376,15 @@ public class BBInputSetupTest { new org.onap.so.db.catalog.beans.InstanceGroup(); doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any()); - SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, - requestDetails.getRequestInfo().getProductFamilyId()); + SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service, + bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, + null, requestDetails.getRequestInfo().getProductFamilyId()); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); - SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, - requestDetails.getRequestInfo().getProductFamilyId()); + SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service, + bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, + null, requestDetails.getRequestInfo().getProductFamilyId()); verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service); instanceName = "vnfName2"; @@ -1389,9 +1397,9 @@ public class BBInputSetupTest { lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId2"); - SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, - requestDetails.getRequestInfo().getProductFamilyId()); + SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service, + bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, + null, requestDetails.getRequestInfo().getProductFamilyId()); verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service); verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); verify(SPY_bbInputSetup, times(2)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); @@ -1465,15 +1473,15 @@ public class BBInputSetupTest { new org.onap.so.db.catalog.beans.InstanceGroup(); doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any()); - SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, - requestDetails.getRequestInfo().getProductFamilyId()); + SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service, + bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, + null, requestDetails.getRequestInfo().getProductFamilyId()); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); - SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, - requestDetails.getRequestInfo().getProductFamilyId()); + SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service, + bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, + null, requestDetails.getRequestInfo().getProductFamilyId()); verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service); instanceName = "vnfName2"; @@ -1485,9 +1493,9 @@ public class BBInputSetupTest { doReturn(vnf2AAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf2.getVnfId()); doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf2, modelInfo, service); doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); - SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, - serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null, - requestDetails.getRequestInfo().getProductFamilyId()); + SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service, + bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, + null, requestDetails.getRequestInfo().getProductFamilyId()); verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(vnf2, modelInfo, service); verify(SPY_bbInputSetup, times(2)).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}"); verify(SPY_bbInputSetup, times(1)).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service); @@ -1939,14 +1947,14 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), isA(ModelInfo.class), + verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), any(String.class), isA(ModelInfo.class), isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString()); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), - isA(org.onap.so.serviceinstancebeans.Platform.class), + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(any(String.class), isA(ModelInfo.class), + any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class), isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any(), any(String.class)); @@ -1955,17 +1963,17 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); 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)); + verify(SPY_bbInputSetup, times(1)).populateVfModule(any(String.class), isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), + any(), isA(CloudConfiguration.class)); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(), - ArgumentMatchers.isNull(), any(String.class), any()); + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), + ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), any(String.class), any()); Configuration configuration = new Configuration(); configuration.setConfigurationId("configurationId"); @@ -1975,16 +1983,16 @@ public class BBInputSetupTest { configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); doReturn(configurationCustList).when(service).getConfigurationCustomizations(); configurationCustList.add(configurationCust); - doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(), - isA(ConfigurationResourceKeys.class), isA(RequestDetails.class)); + doNothing().when(SPY_bbInputSetup).populateConfiguration(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), + ArgumentMatchers.isNull(), isA(ConfigurationResourceKeys.class), isA(RequestDetails.class)); executeBB.getBuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB"); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(), - isA(ConfigurationResourceKeys.class), isA(RequestDetails.class)); + verify(SPY_bbInputSetup, times(1)).populateConfiguration(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), + ArgumentMatchers.isNull(), isA(ConfigurationResourceKeys.class), isA(RequestDetails.class)); } @@ -2050,16 +2058,16 @@ public class BBInputSetupTest { ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization(); configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); configurationCustList.add(configurationCust); - doNothing().when(SPY_bbInputSetup).populateConfiguration(isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(), - isA(ConfigurationResourceKeys.class), isA(RequestDetails.class)); + doNothing().when(SPY_bbInputSetup).populateConfiguration(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), + ArgumentMatchers.isNull(), isA(ConfigurationResourceKeys.class), isA(RequestDetails.class)); executeBB.getBuildingBlock().setBpmnFlowName("AssignVrfConfigurationBB"); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9"); gBB = SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateConfiguration(isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(), - isA(ConfigurationResourceKeys.class), isA(RequestDetails.class)); + verify(SPY_bbInputSetup, times(1)).populateConfiguration(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), + ArgumentMatchers.isNull(), isA(ConfigurationResourceKeys.class), isA(RequestDetails.class)); assertEquals(gBB.getCustomer().getVpnBindings().get(0).getVpnId(), "vpnBindingId"); assertEquals(gBB.getServiceInstance().getNetworks().get(0).getNetworkId(), "localNetworkId"); assertEquals(gBB.getServiceInstance().getNetworks().get(0).getVpnBindings().get(0).getVpnId(), @@ -2223,14 +2231,14 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), isA(ModelInfo.class), + verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), any(String.class), isA(ModelInfo.class), isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), - isA(org.onap.so.serviceinstancebeans.Platform.class), + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(any(String.class), isA(ModelInfo.class), + any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class), isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), ArgumentMatchers.isNull(), any(String.class), ArgumentMatchers.isNull(), any(), any(String.class)); @@ -2239,17 +2247,17 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); 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)); + verify(SPY_bbInputSetup, times(1)).populateVfModule(any(String.class), isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), + any(), isA(CloudConfiguration.class)); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(), - ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), any()); + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), + ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), any()); } @Test @@ -2288,14 +2296,14 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), isA(ModelInfo.class), + verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), any(String.class), isA(ModelInfo.class), isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateGenericVnf(isA(ModelInfo.class), any(String.class), - isA(org.onap.so.serviceinstancebeans.Platform.class), + verify(SPY_bbInputSetup, times(1)).populateGenericVnf(any(String.class), isA(ModelInfo.class), + any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class), isA(org.onap.so.serviceinstancebeans.LineOfBusiness.class), isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(), any(String.class), any(String.class), any(), any(String.class)); @@ -2304,17 +2312,17 @@ public class BBInputSetupTest { executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString()); executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f"); 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)); + verify(SPY_bbInputSetup, times(1)).populateVfModule(any(String.class), isA(ModelInfo.class), isA(Service.class), + any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class), + any(), isA(CloudConfiguration.class)); lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString()); executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8"); SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType); - verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(), - ArgumentMatchers.isNull(), any(String.class), any()); + verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(any(String.class), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), + ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), any(String.class), any()); } @Test @@ -2392,8 +2400,8 @@ public class BBInputSetupTest { doReturn("ab153b6e-c364-44c0-bef6-1f2982117f04").when(networkCust).getModelCustomizationUUID(); networkCustList.add(networkCust); doReturn(networkCustList).when(service).getNetworkCustomizations(); - doNothing().when(SPY_bbInputSetup).populateL3Network(any(), isA(ModelInfo.class), isA(Service.class), - any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); + doNothing().when(SPY_bbInputSetup).populateL3Network(any(String.class), any(), isA(ModelInfo.class), + isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any()); executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString()); executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04"); @@ -2874,8 +2882,8 @@ 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); + SPY_bbInputSetup.populateVfModule(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap, + resourceId, relatedInstanceList, instanceName, instanceParams, cloudConfiguration); verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class), isA(Service.class), isA(String.class)); @@ -2903,5 +2911,17 @@ public class BBInputSetupTest { Assert.assertNotNull(vnfc); } + @Test + public void updateInstanceNameTest() { + InfraActiveRequests request = new InfraActiveRequests(); + request.setRequestId(REQUEST_ID); + + when(requestsDbClient.getInfraActiveRequestbyRequestId(REQUEST_ID)).thenReturn(request); + SPY_bbInputSetup.updateInstanceName(REQUEST_ID, ModelType.service, "instanceName"); + + verify(requestsDbClient).updateInfraActiveRequests(request); + assertEquals("instanceName", request.getServiceInstanceName()); + } + } |