aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOCommonBPMN')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java439
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java503
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupExistingServiceTest.java25
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java66
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java327
5 files changed, 932 insertions, 428 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 a065bbff1c..a4793476e4 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
@@ -294,11 +294,14 @@ public class BBInputSetup implements JavaDelegate {
serviceInstance.setModelInfoServiceInstance(
this.mapperLayer.mapCatalogServiceIntoServiceInstance(serviceModel.getCurrentService()));
}
- this.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, vnfType, executeBB.getBuildingBlock().getKey(), executeBB.getConfigurationResourceKeys(),
- isReplace, serviceModel);
- return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
-
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(executeBB.getRequestId())
+ .setRequestDetails(requestDetails).setService(service).setBbName(bbName)
+ .setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).setResourceId(resourceId)
+ .setVnfType(vnfType).setKey(executeBB.getBuildingBlock().getKey())
+ .setConfigurationResourceKeys(executeBB.getConfigurationResourceKeys()).setExecuteBB(executeBB)
+ .setRequestAction(requestAction).setIsReplace(isReplace).setServiceModel(serviceModel).build();
+ this.populateObjectsOnAssignAndCreateFlows(parameter);
+ return this.populateGBBWithSIAndAdditionalInfo(parameter);
}
protected GeneralBuildingBlock getGBBCM(ExecuteBuildingBlock executeBB, RequestDetails requestDetails,
@@ -315,7 +318,6 @@ public class BBInputSetup implements JavaDelegate {
GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf);
genericVnfs.add(genericVnf);
}
-
String instanceGroupId = lookupKeyMap.get(ResourceKey.INSTANCE_GROUP_ID);
if (instanceGroupId != null && !instanceGroupId.isEmpty()) {
org.onap.aai.domain.yang.InstanceGroup aaiInstancegroup =
@@ -352,69 +354,62 @@ public class BBInputSetup implements JavaDelegate {
serviceInstance.getInstanceGroups().add(instanceGroup);
customer.setServiceSubscription(new ServiceSubscription());
}
- return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction,
- customer);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestDetails(requestDetails)
+ .setServiceInstance(serviceInstance).setExecuteBB(executeBB).setRequestAction(requestAction)
+ .setCustomer(customer).build();
+ return this.populateGBBWithSIAndAdditionalInfo(parameter);
}
- 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,
- ServiceModel serviceModel) throws Exception {
- ModelInfo modelInfo = requestDetails.getModelInfo();
- String instanceName = requestDetails.getRequestInfo().getInstanceName();
- String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId();
- ModelType modelType = modelInfo.getModelType();
- RelatedInstanceList[] relatedInstanceList = requestDetails.getRelatedInstanceList();
+ protected void populateObjectsOnAssignAndCreateFlows(BBInputSetupParameter parameter) throws Exception {
+ parameter.setModelInfo(parameter.getRequestDetails().getModelInfo());
+ parameter.setInstanceName(parameter.getRequestDetails().getRequestInfo().getInstanceName());
+ parameter.setProductFamilyId(parameter.getRequestDetails().getRequestInfo().getProductFamilyId());
+ ModelType modelType = parameter.getModelInfo().getModelType();
+ parameter.setRelatedInstanceList(parameter.getRequestDetails().getRelatedInstanceList());
- org.onap.so.serviceinstancebeans.Platform platform = requestDetails.getPlatform();
- org.onap.so.serviceinstancebeans.LineOfBusiness lineOfBusiness = requestDetails.getLineOfBusiness();
+ parameter.setPlatform(parameter.getRequestDetails().getPlatform());
+ parameter.setLineOfBusiness(parameter.getRequestDetails().getLineOfBusiness());
String applicationId = "";
- if (requestDetails.getRequestInfo().getApplicationId() != null) {
- applicationId = requestDetails.getRequestInfo().getApplicationId();
+ if (parameter.getRequestDetails().getRequestInfo().getApplicationId() != null) {
+ applicationId = parameter.getRequestDetails().getRequestInfo().getApplicationId();
+ parameter.setApplicationId(applicationId);
}
if (modelType.equals(ModelType.network)) {
- lookupKeyMap.put(ResourceKey.NETWORK_ID, resourceId);
- this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- null);
+ parameter.getLookupKeyMap().put(ResourceKey.NETWORK_ID, parameter.getResourceId());
+ this.populateL3Network(parameter);
} 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, applicationId,
- isReplace);
+ parameter.getLookupKeyMap().put(ResourceKey.GENERIC_VNF_ID, parameter.getResourceId());
+ this.populateGenericVnf(parameter);
} else if (modelType.equals(ModelType.volumeGroup) || (modelType.equals(ModelType.vfModule)
- && (bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString()) || bbName.startsWith(CREATEVOLUME)))) {
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, resourceId);
- this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- relatedInstanceList, instanceName, vnfType, null);
+ && (parameter.getBbName().equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())
+ || parameter.getBbName().startsWith(CREATEVOLUME)))) {
+ parameter.getLookupKeyMap().put(ResourceKey.VOLUME_GROUP_ID, parameter.getResourceId());
+ this.populateVolumeGroup(parameter);
} 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,
- configurationId, instanceName, configurationResourceKeys, requestDetails);
+ if (parameter.getBbName().contains("Configuration")) {
+ parameter.setResourceId(parameter.getLookupKeyMap().get(ResourceKey.CONFIGURATION_ID));
+ parameter.getModelInfo().setModelCustomizationUuid(parameter.getConfigurationKey());
+ populateConfiguration(parameter);
} else {
- lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId);
- this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
- relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration(), isReplace,
- serviceModel);
+ parameter.getLookupKeyMap().put(ResourceKey.VF_MODULE_ID, parameter.getResourceId());
+ parameter.setCloudConfiguration(parameter.getRequestDetails().getCloudConfiguration());
+ this.populateVfModule(parameter);
}
} else if (modelType.equals(ModelType.instanceGroup)) {
- lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, resourceId);
- this.populateInstanceGroup(modelInfo, service, serviceInstance, resourceId, instanceName);
+ parameter.getLookupKeyMap().put(ResourceKey.INSTANCE_GROUP_ID, parameter.getResourceId());
+ this.populateInstanceGroup(parameter);
} else {
return;
}
}
- protected void populateInstanceGroup(ModelInfo modelInfo, Service service, ServiceInstance serviceInstance,
- String instanceGroupId, String instanceName) {
+ protected void populateInstanceGroup(BBInputSetupParameter parameter) {
InstanceGroup instanceGroup = new InstanceGroup();
- instanceGroup.setId(instanceGroupId);
- instanceGroup.setInstanceGroupName(instanceName);
- mapCatalogInstanceGroup(instanceGroup, modelInfo, service);
- serviceInstance.getInstanceGroups().add(instanceGroup);
+ instanceGroup.setId(parameter.getInstanceGroupId());
+ instanceGroup.setInstanceGroupName(parameter.getInstanceName());
+ mapCatalogInstanceGroup(instanceGroup, parameter.getModelInfo(), parameter.getService());
+ parameter.getServiceInstance().getInstanceGroups().add(instanceGroup);
}
protected void mapCatalogInstanceGroup(InstanceGroup instanceGroup, ModelInfo modelInfo, Service service) {
@@ -422,33 +417,35 @@ 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,
- ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
- String instanceName, ConfigurationResourceKeys configurationResourceKeys, RequestDetails requestDetails) {
+ protected void populateConfiguration(BBInputSetupParameter parameter) {
Configuration configuration = null;
- for (Configuration configurationTemp : serviceInstance.getConfigurations()) {
- if (lookupKeyMap.get(ResourceKey.CONFIGURATION_ID) != null && configurationTemp.getConfigurationId()
- .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID))) {
+ for (Configuration configurationTemp : parameter.getServiceInstance().getConfigurations()) {
+ if (parameter.getLookupKeyMap().get(ResourceKey.CONFIGURATION_ID) != null
+ && configurationTemp.getConfigurationId()
+ .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.CONFIGURATION_ID))) {
configuration = configurationTemp;
org.onap.aai.domain.yang.Configuration aaiConfiguration =
bbInputSetupUtils.getAAIConfiguration(configuration.getConfigurationId());
if (aaiConfiguration != null) {
- modelInfo.setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId());
+ parameter.getModelInfo().setModelCustomizationUuid(aaiConfiguration.getModelCustomizationId());
}
}
}
- if (configuration == null && (bbName.equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())
- || bbName.equalsIgnoreCase(AssignFlows.VRF_CONFIGURATION.toString()))) {
- configuration = this.createConfiguration(lookupKeyMap, instanceName, resourceId);
- serviceInstance.getConfigurations().add(configuration);
+ if (configuration == null
+ && (parameter.getBbName().equalsIgnoreCase(AssignFlows.FABRIC_CONFIGURATION.toString())
+ || parameter.getBbName().equalsIgnoreCase(AssignFlows.VRF_CONFIGURATION.toString()))) {
+ configuration = this.createConfiguration(parameter.getLookupKeyMap(), parameter.getInstanceName(),
+ parameter.getResourceId());
+ parameter.getServiceInstance().getConfigurations().add(configuration);
}
- if (configuration != null && bbName.contains("Fabric")) {
- Vnfc vnfc = getVnfcToConfiguration(configurationResourceKeys.getVnfcName());
+ if (configuration != null && parameter.getBbName().contains("Fabric")) {
+ Vnfc vnfc = getVnfcToConfiguration(parameter.getConfigurationResourceKeys().getVnfcName());
configuration.setVnfc(vnfc);
- this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys);
- } else if (configuration != null && bbName.contains("Vrf")) {
+ this.mapCatalogConfiguration(configuration, parameter.getModelInfo(), parameter.getService(),
+ parameter.getConfigurationResourceKeys());
+ } else if (configuration != null && parameter.getBbName().contains("Vrf")) {
configuration.setModelInfoConfiguration(mapperLayer.mapCatalogConfigurationToConfiguration(
- findConfigurationResourceCustomization(modelInfo, service), null));
+ findConfigurationResourceCustomization(parameter.getModelInfo(), parameter.getService()), null));
configuration.setConfigurationType(configuration.getModelInfoConfiguration().getConfigurationType());
configuration.setConfigurationSubType(configuration.getModelInfoConfiguration().getConfigurationRole());
}
@@ -525,45 +522,43 @@ public class BBInputSetup implements JavaDelegate {
vfModuleCustomizationUUID, cvnfcCustomizationUUID);
}
- 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, ServiceModel serviceModel) throws Exception {
- String replaceVnfModelCustomizationUUID = null;
+ protected void populateVfModule(BBInputSetupParameter parameter) throws Exception {
String vnfModelCustomizationUUID = null;
- if (relatedInstanceList != null) {
- for (RelatedInstanceList relatedInstList : relatedInstanceList) {
+ String replaceVnfModelCustomizationUUID = null;
+ if (parameter.getRelatedInstanceList() != null) {
+ for (RelatedInstanceList relatedInstList : parameter.getRelatedInstanceList()) {
RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
- if (isReplace) {
+ if (parameter.getIsReplace()) {
replaceVnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
} else {
vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
}
}
if (relatedInstance.getModelInfo().getModelType().equals(ModelType.volumeGroup)) {
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, relatedInstance.getInstanceId());
+ parameter.getLookupKeyMap().put(ResourceKey.VOLUME_GROUP_ID, relatedInstance.getInstanceId());
}
}
}
GenericVnf vnf = null;
- for (GenericVnf tempVnf : serviceInstance.getVnfs()) {
- if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
+ for (GenericVnf tempVnf : parameter.getServiceInstance().getVnfs()) {
+ if (tempVnf.getVnfId().equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.GENERIC_VNF_ID))) {
vnf = tempVnf;
vnfModelCustomizationUUID =
this.bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
ModelInfo vnfModelInfo = new ModelInfo();
- if (isReplace) {
+ if (parameter.getIsReplace()) {
vnfModelInfo.setModelCustomizationUuid(replaceVnfModelCustomizationUUID);
- this.mapCatalogVnf(tempVnf, vnfModelInfo, serviceModel.getNewService());
+ this.mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getServiceModel().getNewService());
} else {
vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
- this.mapCatalogVnf(tempVnf, vnfModelInfo, serviceModel.getCurrentService());
+ this.mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getServiceModel().getCurrentService());
}
- Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(tempVnf, modelInfo,
- cloudConfiguration.getCloudOwner(), cloudConfiguration.getLcpCloudRegionId(), lookupKeyMap);
+ Optional<String> volumeGroupIdOp = getVolumeGroupIdRelatedToVfModule(tempVnf, parameter.getModelInfo(),
+ parameter.getCloudConfiguration().getCloudOwner(),
+ parameter.getCloudConfiguration().getLcpCloudRegionId(), parameter.getLookupKeyMap());
if (volumeGroupIdOp.isPresent()) {
- lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get());
+ parameter.getLookupKeyMap().put(ResourceKey.VOLUME_GROUP_ID, volumeGroupIdOp.get());
}
break;
}
@@ -571,36 +566,39 @@ public class BBInputSetup implements JavaDelegate {
if (vnf != null) {
VfModule vfModule = null;
for (VfModule vfModuleTemp : vnf.getVfModules()) {
- if (lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null
- && vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) {
+ if (parameter.getLookupKeyMap().get(ResourceKey.VF_MODULE_ID) != null && vfModuleTemp.getVfModuleId()
+ .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.VF_MODULE_ID))) {
vfModule = vfModuleTemp;
}
String vfModuleCustId = bbInputSetupUtils.getAAIVfModule(vnf.getVnfId(), vfModuleTemp.getVfModuleId())
.getModelCustomizationId();
ModelInfo modelInfoVfModule = new ModelInfo();
modelInfoVfModule.setModelCustomizationId(vfModuleCustId);
- if (isReplace && lookupKeyMap.get(ResourceKey.VF_MODULE_ID) != null
- && vfModuleTemp.getVfModuleId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VF_MODULE_ID))) {
- mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, serviceModel.getNewService(),
+ if (parameter.getIsReplace() && parameter.getLookupKeyMap().get(ResourceKey.VF_MODULE_ID) != null
+ && vfModuleTemp.getVfModuleId()
+ .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.VF_MODULE_ID))) {
+ mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, parameter.getServiceModel().getNewService(),
replaceVnfModelCustomizationUUID);
} else {
- mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, serviceModel.getCurrentService(),
+ mapCatalogVfModule(vfModuleTemp, modelInfoVfModule, parameter.getServiceModel().getCurrentService(),
vnfModelCustomizationUUID);
}
}
- if (vfModule == null && bbName.equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) {
- vfModule = createVfModule(lookupKeyMap, resourceId, instanceName, instanceParams);
+ if (vfModule == null && parameter.getBbName().equalsIgnoreCase(AssignFlows.VF_MODULE.toString())) {
+ vfModule = createVfModule(parameter.getLookupKeyMap(), parameter.getResourceId(),
+ parameter.getInstanceName(), parameter.getInstanceParams());
vnf.getVfModules().add(vfModule);
- if (isReplace) {
- mapCatalogVfModule(vfModule, modelInfo, serviceModel.getNewService(),
+ if (parameter.getIsReplace()) {
+ mapCatalogVfModule(vfModule, parameter.getModelInfo(), parameter.getServiceModel().getNewService(),
replaceVnfModelCustomizationUUID);
} else {
- mapCatalogVfModule(vfModule, modelInfo, serviceModel.getCurrentService(),
- vnfModelCustomizationUUID);
+ mapCatalogVfModule(vfModule, parameter.getModelInfo(),
+ parameter.getServiceModel().getCurrentService(), vnfModelCustomizationUUID);
}
}
} else {
- logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID));
+ logger.debug("Related VNF instance Id not found: {}",
+ parameter.getLookupKeyMap().get(ResourceKey.GENERIC_VNF_ID));
throw new Exception("Could not find relevant information for related VNF");
}
}
@@ -663,19 +661,17 @@ public class BBInputSetup implements JavaDelegate {
return vfModule;
}
- protected void populateVolumeGroup(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 {
+ protected void populateVolumeGroup(BBInputSetupParameter parameter) throws Exception {
VolumeGroup volumeGroup = null;
GenericVnf vnf = null;
String vnfModelCustomizationUUID = null;
- String generatedVnfType = vnfType;
+ String generatedVnfType = parameter.getVnfType();
if (generatedVnfType == null || generatedVnfType.isEmpty()) {
- generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName();
+ generatedVnfType =
+ parameter.getService().getModelName() + "/" + parameter.getModelInfo().getModelCustomizationName();
}
- if (relatedInstanceList != null) {
- for (RelatedInstanceList relatedInstList : relatedInstanceList) {
+ if (parameter.getRelatedInstanceList() != null) {
+ for (RelatedInstanceList relatedInstList : parameter.getRelatedInstanceList()) {
RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf)) {
vnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationUuid();
@@ -683,35 +679,38 @@ public class BBInputSetup implements JavaDelegate {
}
}
}
- for (GenericVnf tempVnf : serviceInstance.getVnfs()) {
- if (tempVnf.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
+ for (GenericVnf tempVnf : parameter.getServiceInstance().getVnfs()) {
+ if (tempVnf.getVnfId().equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.GENERIC_VNF_ID))) {
vnf = tempVnf;
vnfModelCustomizationUUID =
bbInputSetupUtils.getAAIGenericVnf(vnf.getVnfId()).getModelCustomizationId();
ModelInfo vnfModelInfo = new ModelInfo();
vnfModelInfo.setModelCustomizationUuid(vnfModelCustomizationUUID);
- mapCatalogVnf(tempVnf, vnfModelInfo, service);
+ mapCatalogVnf(tempVnf, vnfModelInfo, parameter.getService());
break;
}
}
if (vnf != null && vnfModelCustomizationUUID != null) {
for (VolumeGroup volumeGroupTemp : vnf.getVolumeGroups()) {
- if (lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID) != null && volumeGroupTemp.getVolumeGroupId()
- .equalsIgnoreCase(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID))) {
+ if (parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID) != null
+ && volumeGroupTemp.getVolumeGroupId()
+ .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.VOLUME_GROUP_ID))) {
volumeGroup = volumeGroupTemp;
break;
}
}
- if (volumeGroup == null && bbName.equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) {
- volumeGroup =
- createVolumeGroup(lookupKeyMap, resourceId, instanceName, generatedVnfType, instanceParams);
+ if (volumeGroup == null && parameter.getBbName().equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString())) {
+ volumeGroup = createVolumeGroup(parameter.getLookupKeyMap(), parameter.getResourceId(),
+ parameter.getInstanceName(), generatedVnfType, parameter.getInstanceParams());
vnf.getVolumeGroups().add(volumeGroup);
}
if (volumeGroup != null) {
- mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID);
+ mapCatalogVolumeGroup(volumeGroup, parameter.getModelInfo(), parameter.getService(),
+ vnfModelCustomizationUUID);
}
} else {
- logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID));
+ logger.debug("Related VNF instance Id not found: {}",
+ parameter.getLookupKeyMap().get(ResourceKey.GENERIC_VNF_ID));
throw new Exception("Could not find relevant information for related VNF");
}
}
@@ -762,55 +761,52 @@ public class BBInputSetup implements JavaDelegate {
return null;
}
- protected void populateGenericVnf(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,
- RelatedInstanceList[] relatedInstanceList, String resourceId, String vnfType,
- List<Map<String, String>> instanceParams, String productFamilyId, String applicationId, boolean isReplace) {
+ protected void populateGenericVnf(BBInputSetupParameter parameter) {
GenericVnf vnf = null;
ModelInfo instanceGroupModelInfo = null;
String instanceGroupId = null;
- String generatedVnfType = vnfType;
+ String generatedVnfType = parameter.getVnfType();
String replaceVnfModelCustomizationUUID = null;
if (generatedVnfType == null || generatedVnfType.isEmpty()) {
- generatedVnfType = service.getModelName() + "/" + modelInfo.getModelCustomizationName();
+ generatedVnfType =
+ parameter.getService().getModelName() + "/" + parameter.getModelInfo().getModelCustomizationName();
}
- if (relatedInstanceList != null) {
- for (RelatedInstanceList relatedInstList : relatedInstanceList) {
+ if (parameter.getRelatedInstanceList() != null) {
+ for (RelatedInstanceList relatedInstList : parameter.getRelatedInstanceList()) {
RelatedInstance relatedInstance = relatedInstList.getRelatedInstance();
if (relatedInstance.getModelInfo().getModelType().equals(ModelType.networkInstanceGroup)) {
instanceGroupModelInfo = relatedInstance.getModelInfo();
instanceGroupId = relatedInstance.getInstanceId();
}
- if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf) && isReplace) {
+ if (relatedInstance.getModelInfo().getModelType().equals(ModelType.vnf) && parameter.getIsReplace()) {
replaceVnfModelCustomizationUUID = relatedInstance.getModelInfo().getModelCustomizationId();
}
}
}
- for (GenericVnf vnfTemp : serviceInstance.getVnfs()) {
- if (lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID) != null
- && vnfTemp.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
+ for (GenericVnf vnfTemp : parameter.getServiceInstance().getVnfs()) {
+ if (parameter.getLookupKeyMap().get(ResourceKey.GENERIC_VNF_ID) != null && vnfTemp.getVnfId()
+ .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.GENERIC_VNF_ID))) {
String vnfModelCustId =
bbInputSetupUtils.getAAIGenericVnf(vnfTemp.getVnfId()).getModelCustomizationId();
- if (isReplace && replaceVnfModelCustomizationUUID != null
- && vnfTemp.getVnfId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID))) {
- modelInfo.setModelCustomizationUuid(replaceVnfModelCustomizationUUID);
+ if (parameter.getIsReplace() && replaceVnfModelCustomizationUUID != null && vnfTemp.getVnfId()
+ .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.GENERIC_VNF_ID))) {
+ parameter.getModelInfo().setModelCustomizationUuid(replaceVnfModelCustomizationUUID);
} else {
- modelInfo.setModelCustomizationUuid(vnfModelCustId);
+ parameter.getModelInfo().setModelCustomizationUuid(vnfModelCustId);
}
vnf = vnfTemp;
break;
}
}
- if (vnf == null && bbName.equalsIgnoreCase(AssignFlows.VNF.toString())) {
- vnf = createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness, resourceId, generatedVnfType,
- instanceParams, productFamilyId, applicationId);
- serviceInstance.getVnfs().add(vnf);
- mapVnfcCollectionInstanceGroup(vnf, modelInfo, service);
+ if (vnf == null && parameter.getBbName().equalsIgnoreCase(AssignFlows.VNF.toString())) {
+ vnf = createGenericVnf(parameter.getLookupKeyMap(), parameter.getInstanceName(), parameter.getPlatform(),
+ parameter.getLineOfBusiness(), parameter.getResourceId(), generatedVnfType,
+ parameter.getInstanceParams(), parameter.getProductFamilyId(), parameter.getApplicationId());
+ parameter.getServiceInstance().getVnfs().add(vnf);
+ mapVnfcCollectionInstanceGroup(vnf, parameter.getModelInfo(), parameter.getService());
}
if (vnf != null) {
- mapCatalogVnf(vnf, modelInfo, service);
+ mapCatalogVnf(vnf, parameter.getModelInfo(), parameter.getService());
if (instanceGroupId != null && instanceGroupModelInfo != null
&& instanceGroupModelInfo.getModelType().equals(ModelType.networkInstanceGroup)
&& !instanceGroupInList(vnf, instanceGroupId)) {
@@ -907,24 +903,23 @@ 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,
- List<Map<String, String>> instanceParams) {
+ protected void populateL3Network(BBInputSetupParameter parameter) {
L3Network network = null;
- for (L3Network networkTemp : serviceInstance.getNetworks()) {
- if (lookupKeyMap.get(ResourceKey.NETWORK_ID) != null
- && networkTemp.getNetworkId().equalsIgnoreCase(lookupKeyMap.get(ResourceKey.NETWORK_ID))) {
+ for (L3Network networkTemp : parameter.getServiceInstance().getNetworks()) {
+ if (parameter.getLookupKeyMap().get(ResourceKey.NETWORK_ID) != null && networkTemp.getNetworkId()
+ .equalsIgnoreCase(parameter.getLookupKeyMap().get(ResourceKey.NETWORK_ID))) {
network = networkTemp;
break;
}
}
- if (network == null && (bbName.equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString())
- || bbName.equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) {
- network = createNetwork(lookupKeyMap, instanceName, resourceId, instanceParams);
- serviceInstance.getNetworks().add(network);
+ if (network == null && (parameter.getBbName().equalsIgnoreCase(AssignFlows.NETWORK_A_LA_CARTE.toString())
+ || parameter.getBbName().equalsIgnoreCase(AssignFlows.NETWORK_MACRO.toString()))) {
+ network = createNetwork(parameter.getLookupKeyMap(), parameter.getInstanceName(), parameter.getResourceId(),
+ parameter.getInstanceParams());
+ parameter.getServiceInstance().getNetworks().add(network);
}
if (network != null) {
- mapCatalogNetwork(network, modelInfo, service);
+ mapCatalogNetwork(network, parameter.getModelInfo(), parameter.getService());
}
}
@@ -984,8 +979,10 @@ public class BBInputSetup implements JavaDelegate {
ServiceInstance serviceInstance = this.getALaCarteServiceInstance(service, requestDetails, customer,
project, owningEntity, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()),
executeBB.getBuildingBlock().getBpmnFlowName());
- return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction,
- customer);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestDetails(requestDetails)
+ .setServiceInstance(serviceInstance).setExecuteBB(executeBB).setRequestAction(requestAction)
+ .setCustomer(customer).build();
+ return this.populateGBBWithSIAndAdditionalInfo(parameter);
} else {
throw new Exception("Could not find customer");
}
@@ -1034,32 +1031,33 @@ public class BBInputSetup implements JavaDelegate {
}
}
- protected GeneralBuildingBlock populateGBBWithSIAndAdditionalInfo(RequestDetails requestDetails,
- ServiceInstance serviceInstance, ExecuteBuildingBlock executeBB, String requestAction, Customer customer)
+ protected GeneralBuildingBlock populateGBBWithSIAndAdditionalInfo(BBInputSetupParameter parameter)
throws Exception {
GeneralBuildingBlock outputBB = new GeneralBuildingBlock();
- OrchestrationContext orchContext = mapperLayer.mapOrchestrationContext(requestDetails);
- RequestContext requestContext = mapperLayer.mapRequestContext(requestDetails);
- requestContext.setAction(requestAction);
- requestContext.setMsoRequestId(executeBB.getRequestId());
+ OrchestrationContext orchContext = mapperLayer.mapOrchestrationContext(parameter.getRequestDetails());
+ RequestContext requestContext = mapperLayer.mapRequestContext(parameter.getRequestDetails());
+ requestContext.setAction(parameter.getRequestAction());
+ requestContext.setMsoRequestId(parameter.getExecuteBB().getRequestId());
org.onap.aai.domain.yang.CloudRegion aaiCloudRegion =
- bbInputSetupUtils.getCloudRegion(requestDetails.getCloudConfiguration());
- CloudRegion cloudRegion = mapperLayer.mapCloudRegion(requestDetails.getCloudConfiguration(), aaiCloudRegion);
- Tenant tenant = getTenant(requestDetails.getCloudConfiguration(), aaiCloudRegion);
+ bbInputSetupUtils.getCloudRegion(parameter.getRequestDetails().getCloudConfiguration());
+ CloudRegion cloudRegion =
+ mapperLayer.mapCloudRegion(parameter.getRequestDetails().getCloudConfiguration(), aaiCloudRegion);
+ Tenant tenant = getTenant(parameter.getRequestDetails().getCloudConfiguration(), aaiCloudRegion);
outputBB.setOrchContext(orchContext);
outputBB.setRequestContext(requestContext);
outputBB.setCloudRegion(cloudRegion);
outputBB.setTenant(tenant);
+ Customer customer = parameter.getCustomer();
if (customer == null) {
- Map<String, String> uriKeys =
- bbInputSetupUtils.getURIKeysFromServiceInstance(serviceInstance.getServiceInstanceId());
+ Map<String, String> uriKeys = bbInputSetupUtils
+ .getURIKeysFromServiceInstance(parameter.getServiceInstance().getServiceInstanceId());
String globalCustomerId = uriKeys.get("global-customer-id");
String subscriptionServiceType = uriKeys.get("service-type");
customer = mapCustomer(globalCustomerId, subscriptionServiceType);
}
- outputBB.setServiceInstance(serviceInstance);
+ outputBB.setServiceInstance(parameter.getServiceInstance());
if (customer.getServiceSubscription() != null) {
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ customer.getServiceSubscription().getServiceInstances().add(parameter.getServiceInstance());
}
outputBB.setCustomer(customer);
return outputBB;
@@ -1185,15 +1183,19 @@ public class BBInputSetup implements JavaDelegate {
Map<ResourceKey, String> lookupKeyMap, String bbName, String key, GeneralBuildingBlock gBB, Service service)
throws Exception {
ServiceInstance serviceInstance = gBB.getServiceInstance();
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setExecuteBB(executeBB)
+ .setRequestId(executeBB.getRequestId()).setServiceInstance(serviceInstance).setService(service)
+ .setBbName(bbName).setLookupKeyMap(lookupKeyMap).setKey(key).build();
if (bbName.contains(NETWORK) && !bbName.contains(NETWORK_COLLECTION)) {
String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID);
- ModelInfo networkModelInfo = new ModelInfo();
+ parameter.setResourceId(networkId);
+ parameter.setModelInfo(new ModelInfo());
+
if ((!Boolean.TRUE.equals(executeBB.getBuildingBlock().isVirtualLink()))) {
NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service);
if (networkCust != null) {
- networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID());
- this.populateL3Network(null, networkModelInfo, service, bbName, serviceInstance, lookupKeyMap,
- networkId, null);
+ parameter.getModelInfo().setModelCustomizationUuid(networkCust.getModelCustomizationUUID());
+ this.populateL3Network(parameter);
} else {
logger.debug("Could not find a network customization with key: {}", key);
}
@@ -1210,15 +1212,16 @@ public class BBInputSetup implements JavaDelegate {
}
}
} else if (bbName.contains("Configuration")) {
- 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());
+ parameter.setResourceId(lookupKeyMap.get(ResourceKey.CONFIGURATION_ID));
+ parameter.setModelInfo(new ModelInfo());
+ parameter.getModelInfo().setModelCustomizationUuid(key);
+ parameter.setConfigurationResourceKeys(executeBB.getConfigurationResourceKeys());
+ parameter.setRequestDetails(executeBB.getRequestDetails());
+ this.populateConfiguration(parameter);
}
if (executeBB.getWorkflowResourceIds() != null) {
- this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance,
- executeBB.getWorkflowResourceIds().getNetworkCollectionId(), key);
+ parameter.setResourceId(executeBB.getWorkflowResourceIds().getNetworkCollectionId());
+ this.populateNetworkCollectionAndInstanceGroupAssign(parameter);
}
RelatedInstance relatedVpnBinding =
bbInputSetupUtils.getRelatedInstanceByType(executeBB.getRequestDetails(), ModelType.vpnBinding);
@@ -1310,6 +1313,10 @@ public class BBInputSetup implements JavaDelegate {
org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
RequestDetails requestDetails = executeBB.getRequestDetails();
+ BBInputSetupParameter parameter =
+ new BBInputSetupParameter.Builder().setExecuteBB(executeBB).setLookupKeyMap(lookupKeyMap)
+ .setBbName(bbName).setRequestAction(requestAction).setCloudConfiguration(cloudConfiguration)
+ .setRequestDetails(requestDetails).setResourceId(serviceInstanceId).build();
GeneralBuildingBlock gBB = null;
Service service = null;
if (serviceInstanceId != null) {
@@ -1328,10 +1335,10 @@ public class BBInputSetup implements JavaDelegate {
throw new NoServiceInstanceFoundException(message);
}
}
-
ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
- gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
+ parameter.setServiceInstance(serviceInstance);
+ gBB = populateGBBWithSIAndAdditionalInfo(parameter);
serviceInstance = gBB.getServiceInstance();
CloudRegion cloudRegion = null;
@@ -1438,8 +1445,9 @@ public class BBInputSetup implements JavaDelegate {
}
}
if (executeBB.getWorkflowResourceIds() != null) {
- this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance,
- executeBB.getWorkflowResourceIds().getNetworkCollectionId(), executeBB.getBuildingBlock().getKey());
+ parameter.setResourceId(executeBB.getWorkflowResourceIds().getNetworkCollectionId());
+ parameter.setKey(executeBB.getBuildingBlock().getKey());
+ this.populateNetworkCollectionAndInstanceGroupAssign(parameter);
}
return gBB;
}
@@ -1458,6 +1466,9 @@ public class BBInputSetup implements JavaDelegate {
CloudConfiguration cloudConfiguration = requestDetails.getCloudConfiguration();
CloudRegion cloudRegion = getCloudRegionFromMacroRequest(cloudConfiguration, resources);
gBB.setCloudRegion(cloudRegion);
+ BBInputSetupParameter parameter =
+ new BBInputSetupParameter.Builder().setRequestId(executeBB.getRequestId()).setService(service)
+ .setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).build();
if (bbName.contains(VNF)) {
vnfs = findVnfsByKey(key, resources, vnfs);
String vnfId = lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID);
@@ -1467,15 +1478,20 @@ public class BBInputSetup implements JavaDelegate {
if (request != null) {
this.bbInputSetupUtils.updateInfraActiveRequestVnfId(request, vnfId);
}
- String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId();
+ parameter.setModelInfo(vnfs.getModelInfo());
+ parameter.setInstanceName(vnfs.getInstanceName());
+ parameter.setPlatform(vnfs.getPlatform());
+ parameter.setLineOfBusiness(vnfs.getLineOfBusiness());
+ parameter.setResourceId(vnfId);
+ parameter.setVnfType(vnfType);
+ parameter.setInstanceParams(vnfs.getInstanceParams());
+ parameter.setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId());
String applicationId = "";
if (vnfs.getApplicationId() != null) {
applicationId = vnfs.getApplicationId();
}
- this.populateGenericVnf(vnfs.getModelInfo(), vnfs.getInstanceName(), vnfs.getPlatform(),
- vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType,
- vnfs.getInstanceParams(), productFamilyId, applicationId, false);
-
+ parameter.setApplicationId(applicationId);
+ this.populateGenericVnf(parameter);
} else if (bbName.contains(PNF)) {
String pnfId = lookupKeyMap.get(ResourceKey.PNF);
resources.getPnfs().stream()
@@ -1491,27 +1507,35 @@ public class BBInputSetup implements JavaDelegate {
if (vnfs == null) {
throw new Exception("Could not find Vnf to orchestrate VfModule");
}
- ModelInfo modelInfo = vfModules.getModelInfo();
+ parameter.setModelInfo(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());
+ parameter.setResourceId(lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
+ parameter.setInstanceName(vfModules.getVolumeGroupInstanceName());
+ parameter.setVnfType(vnfType);
+ parameter.setInstanceParams(vfModules.getInstanceParams());
+ this.populateVolumeGroup(parameter);
} else {
- String vfModuleId = lookupKeyMap.get(ResourceKey.VF_MODULE_ID);
+ parameter.setResourceId(lookupKeyMap.get(ResourceKey.VF_MODULE_ID));
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, serviceModel);
+ parameter.setServiceModel(serviceModel);
+ parameter.setCloudConfiguration(cloudConfig);
+ parameter.setInstanceName(vfModules.getInstanceName());
+ parameter.setInstanceParams(vfModules.getInstanceParams());
+ this.populateVfModule(parameter);
}
} 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());
+ parameter.setInstanceName(networks.getInstanceName());
+ parameter.setModelInfo(networks.getModelInfo());
+ parameter.setInstanceParams(networks.getInstanceParams());
+ parameter.setResourceId(networkId);
+ this.populateL3Network(parameter);
}
} else if (bbName.contains("Configuration")) {
String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
@@ -1520,8 +1544,11 @@ 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());
+ parameter.setModelInfo(configurationModelInfo);
+ parameter.setResourceId(configurationId);
+ parameter.setConfigurationResourceKeys(executeBB.getConfigurationResourceKeys());
+ parameter.setRequestDetails(executeBB.getRequestDetails());
+ this.populateConfiguration(parameter);
} else {
logger.debug("Could not find a configuration customization with key: {}", key);
}
@@ -1669,18 +1696,18 @@ public class BBInputSetup implements JavaDelegate {
return serviceInstance;
}
- protected void populateNetworkCollectionAndInstanceGroupAssign(Service service, String bbName,
- ServiceInstance serviceInstance, String resourceId, String key) throws Exception {
- if (serviceInstance.getCollection() == null
- && bbName.equalsIgnoreCase(AssignFlows.NETWORK_COLLECTION.toString())) {
- Collection collection = this.createCollection(resourceId);
- serviceInstance.setCollection(collection);
- this.mapCatalogCollection(service, serviceInstance.getCollection(), key);
- if (isVlanTagging(service, key)) {
+ protected void populateNetworkCollectionAndInstanceGroupAssign(BBInputSetupParameter parameter) throws Exception {
+ if (parameter.getServiceInstance().getCollection() == null
+ && parameter.getBbName().equalsIgnoreCase(AssignFlows.NETWORK_COLLECTION.toString())) {
+ Collection collection = this.createCollection(parameter.getResourceId());
+ parameter.getServiceInstance().setCollection(collection);
+ this.mapCatalogCollection(parameter.getService(), parameter.getServiceInstance().getCollection(),
+ parameter.getKey());
+ if (isVlanTagging(parameter.getService(), parameter.getKey())) {
InstanceGroup instanceGroup = this.createInstanceGroup();
- serviceInstance.getCollection().setInstanceGroup(instanceGroup);
- this.mapCatalogNetworkCollectionInstanceGroup(service,
- serviceInstance.getCollection().getInstanceGroup(), key);
+ parameter.getServiceInstance().getCollection().setInstanceGroup(instanceGroup);
+ this.mapCatalogNetworkCollectionInstanceGroup(parameter.getService(),
+ parameter.getServiceInstance().getCollection().getInstanceGroup(), parameter.getKey());
}
}
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java
new file mode 100644
index 0000000000..36ac0969ee
--- /dev/null
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java
@@ -0,0 +1,503 @@
+package org.onap.so.bpmn.servicedecomposition.tasks;
+
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Customer;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
+import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys;
+import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.entities.ServiceModel;
+import org.onap.so.db.catalog.beans.Service;
+import org.onap.so.serviceinstancebeans.CloudConfiguration;
+import org.onap.so.serviceinstancebeans.LineOfBusiness;
+import org.onap.so.serviceinstancebeans.ModelInfo;
+import org.onap.so.serviceinstancebeans.Platform;
+import org.onap.so.serviceinstancebeans.RelatedInstanceList;
+import org.onap.so.serviceinstancebeans.RequestDetails;
+
+public class BBInputSetupParameter {
+ private CloudConfiguration cloudConfiguration;
+ private ConfigurationResourceKeys configurationResourceKeys;
+ private List<Map<String, String>> instanceParams;
+ private Map<ResourceKey, String> lookupKeyMap;
+ private ModelInfo modelInfo;
+ private LineOfBusiness lineOfBusiness;
+ private Platform platform;
+ private RelatedInstanceList[] relatedInstanceList;
+ private RequestDetails requestDetails;
+ private Service service;
+ private ServiceInstance serviceInstance;
+ private String bbName;
+ private String instanceGroupId;
+ private String instanceName;
+ private String productFamilyId;
+ private String resourceId;
+ private String vnfType;
+ private ExecuteBuildingBlock executeBB;
+ private String requestAction;
+ private boolean aLaCarte;
+ private Customer customer;
+ private String requestId;
+ private String configurationKey;
+ private String key;
+ private String applicationId;
+ private boolean isReplace;
+ private ServiceModel serviceModel;
+
+ private BBInputSetupParameter(Builder builder) {
+ this.cloudConfiguration = builder.cloudConfiguration;
+ this.configurationResourceKeys = builder.configurationResourceKeys;
+ this.instanceParams = builder.instanceParams;
+ this.lookupKeyMap = builder.lookupKeyMap;
+ this.modelInfo = builder.modelInfo;
+ this.lineOfBusiness = builder.lineOfBusiness;
+ this.platform = builder.platform;
+ this.relatedInstanceList = builder.relatedInstanceList;
+ this.requestDetails = builder.requestDetails;
+ this.service = builder.service;
+ this.serviceInstance = builder.serviceInstance;
+ this.bbName = builder.bbName;
+ this.instanceGroupId = builder.instanceGroupId;
+ this.instanceName = builder.instanceName;
+ this.productFamilyId = builder.productFamilyId;
+ this.resourceId = builder.resourceId;
+ this.vnfType = builder.vnfType;
+ this.executeBB = builder.executeBB;
+ this.requestAction = builder.requestAction;
+ this.aLaCarte = builder.aLaCarte;
+ this.customer = builder.customer;
+ this.requestId = builder.requestId;
+ this.configurationKey = builder.configurationKey;
+ this.key = builder.key;
+ this.applicationId = builder.applicationId;
+ this.isReplace = builder.isReplace;
+ this.serviceModel = builder.serviceModel;
+ }
+
+
+ protected CloudConfiguration getCloudConfiguration() {
+ return cloudConfiguration;
+ }
+
+
+ protected void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ }
+
+
+ protected ConfigurationResourceKeys getConfigurationResourceKeys() {
+ return configurationResourceKeys;
+ }
+
+
+ protected void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
+ this.configurationResourceKeys = configurationResourceKeys;
+ }
+
+
+ protected List<Map<String, String>> getInstanceParams() {
+ return instanceParams;
+ }
+
+
+ protected void setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ }
+
+
+ protected Map<ResourceKey, String> getLookupKeyMap() {
+ return lookupKeyMap;
+ }
+
+
+ protected void setLookupKeyMap(Map<ResourceKey, String> lookupKeyMap) {
+ this.lookupKeyMap = lookupKeyMap;
+ }
+
+
+ protected ModelInfo getModelInfo() {
+ return modelInfo;
+ }
+
+
+ protected void setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ }
+
+
+ protected LineOfBusiness getLineOfBusiness() {
+ return lineOfBusiness;
+ }
+
+
+ protected void setLineOfBusiness(LineOfBusiness lineOfBusiness) {
+ this.lineOfBusiness = lineOfBusiness;
+ }
+
+
+ protected Platform getPlatform() {
+ return platform;
+ }
+
+
+ protected void setPlatform(Platform platform) {
+ this.platform = platform;
+ }
+
+
+ protected RelatedInstanceList[] getRelatedInstanceList() {
+ return relatedInstanceList;
+ }
+
+
+ protected void setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) {
+ this.relatedInstanceList = relatedInstanceList;
+ }
+
+
+ protected RequestDetails getRequestDetails() {
+ return requestDetails;
+ }
+
+
+ protected void setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ }
+
+
+ protected Service getService() {
+ return service;
+ }
+
+
+ protected void setService(Service service) {
+ this.service = service;
+ }
+
+
+ protected ServiceInstance getServiceInstance() {
+ return serviceInstance;
+ }
+
+
+ protected void setServiceInstance(ServiceInstance serviceInstance) {
+ this.serviceInstance = serviceInstance;
+ }
+
+
+ protected String getBbName() {
+ return bbName;
+ }
+
+
+ protected void setBbName(String bbName) {
+ this.bbName = bbName;
+ }
+
+
+ protected String getInstanceGroupId() {
+ return instanceGroupId;
+ }
+
+
+ protected void setInstanceGroupId(String instanceGroupId) {
+ this.instanceGroupId = instanceGroupId;
+ }
+
+
+ protected String getInstanceName() {
+ return instanceName;
+ }
+
+
+ protected void setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ }
+
+
+ protected String getProductFamilyId() {
+ return productFamilyId;
+ }
+
+
+ protected void setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ }
+
+
+ protected String getResourceId() {
+ return resourceId;
+ }
+
+
+ protected void setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ }
+
+
+ protected String getVnfType() {
+ return vnfType;
+ }
+
+
+ protected void setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ }
+
+
+ protected ExecuteBuildingBlock getExecuteBB() {
+ return executeBB;
+ }
+
+
+ protected void setExecuteBB(ExecuteBuildingBlock executeBB) {
+ this.executeBB = executeBB;
+ }
+
+
+ protected String getRequestAction() {
+ return requestAction;
+ }
+
+
+ protected void setRequestAction(String requestAction) {
+ this.requestAction = requestAction;
+ }
+
+
+ protected boolean getaLaCarte() {
+ return aLaCarte;
+ }
+
+ protected void setaLaCarte(boolean aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ }
+
+ protected Customer getCustomer() {
+ return customer;
+ }
+
+ protected void setCustomer(Customer customer) {
+ this.customer = customer;
+ }
+
+ protected void setRequestId(String requestId) {
+ this.requestId = requestId;
+ }
+
+ protected String getRequestId() {
+ return requestId;
+ }
+
+ protected void setConfigurationKey(String configurationKey) {
+ this.configurationKey = configurationKey;
+ }
+
+ protected String getConfigurationKey() {
+ return configurationKey;
+ }
+
+ protected String getKey() {
+ return key;
+ }
+
+ protected void setKey(String key) {
+ this.key = key;
+ }
+
+ protected String getApplicationId() {
+ return applicationId;
+ }
+
+ protected void setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ }
+
+ protected boolean getIsReplace() {
+ return isReplace;
+ }
+
+ protected void setIsReplace(boolean isReplace) {
+ this.isReplace = isReplace;
+ }
+
+ protected ServiceModel getServiceModel() {
+ return this.serviceModel;
+ }
+
+ protected void setServiceModel(ServiceModel serviceModel) {
+ this.serviceModel = serviceModel;
+ }
+
+ public static class Builder {
+ private CloudConfiguration cloudConfiguration;
+ private ConfigurationResourceKeys configurationResourceKeys;
+ private List<Map<String, String>> instanceParams = Collections.emptyList();
+ private Map<ResourceKey, String> lookupKeyMap = Collections.emptyMap();
+ private ModelInfo modelInfo;
+ private LineOfBusiness lineOfBusiness;
+ private Platform platform;
+ private RelatedInstanceList[] relatedInstanceList;
+ private RequestDetails requestDetails;
+ private Service service;
+ private ServiceInstance serviceInstance;
+ private String bbName;
+ private String instanceGroupId;
+ private String instanceName;
+ private String productFamilyId;
+ private String resourceId;
+ private String vnfType;
+ private ExecuteBuildingBlock executeBB;
+ private String requestAction;
+ private boolean aLaCarte;
+ private Customer customer;
+ private String requestId;
+ private String configurationKey;
+ private String key;
+ private String applicationId;
+ private boolean isReplace;
+ private ServiceModel serviceModel;
+
+ public Builder setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ this.cloudConfiguration = cloudConfiguration;
+ return this;
+ }
+
+ public Builder setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
+ this.configurationResourceKeys = configurationResourceKeys;
+ return this;
+ }
+
+ public Builder setInstanceParams(List<Map<String, String>> instanceParams) {
+ this.instanceParams = instanceParams;
+ return this;
+ }
+
+ public Builder setLookupKeyMap(Map<ResourceKey, String> lookupKeyMap) {
+ this.lookupKeyMap = lookupKeyMap;
+ return this;
+ }
+
+ public Builder setModelInfo(ModelInfo modelInfo) {
+ this.modelInfo = modelInfo;
+ return this;
+ }
+
+ public Builder setLineOfBusiness(LineOfBusiness lineOfBusiness) {
+ this.lineOfBusiness = lineOfBusiness;
+ return this;
+ }
+
+ public Builder setPlatform(Platform platform) {
+ this.platform = platform;
+ return this;
+ }
+
+ public Builder setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) {
+ this.relatedInstanceList = relatedInstanceList;
+ return this;
+ }
+
+ public Builder setRequestDetails(RequestDetails requestDetails) {
+ this.requestDetails = requestDetails;
+ return this;
+ }
+
+ public Builder setService(Service service) {
+ this.service = service;
+ return this;
+ }
+
+ public Builder setServiceInstance(ServiceInstance serviceInstance) {
+ this.serviceInstance = serviceInstance;
+ return this;
+ }
+
+ public Builder setBbName(String bbName) {
+ this.bbName = bbName;
+ return this;
+ }
+
+ public Builder setInstanceGroupId(String instanceGroupId) {
+ this.instanceGroupId = instanceGroupId;
+ return this;
+ }
+
+ public Builder setInstanceName(String instanceName) {
+ this.instanceName = instanceName;
+ return this;
+ }
+
+ public Builder setProductFamilyId(String productFamilyId) {
+ this.productFamilyId = productFamilyId;
+ return this;
+ }
+
+ public Builder setResourceId(String resourceId) {
+ this.resourceId = resourceId;
+ return this;
+ }
+
+ public Builder setVnfType(String vnfType) {
+ this.vnfType = vnfType;
+ return this;
+ }
+
+ public Builder setExecuteBB(ExecuteBuildingBlock executeBB) {
+ this.executeBB = executeBB;
+ return this;
+ }
+
+ public Builder setRequestAction(String requestAction) {
+ this.requestAction = requestAction;
+ return this;
+ }
+
+ public Builder setALaCarte(boolean aLaCarte) {
+ this.aLaCarte = aLaCarte;
+ return this;
+ }
+
+ public Builder setCustomer(Customer customer) {
+ this.customer = customer;
+ return this;
+ }
+
+ public Builder setRequestId(String requestId) {
+ this.requestId = requestId;
+ return this;
+ }
+
+ public Builder setConfigurationKey(String configurationKey) {
+ this.configurationKey = configurationKey;
+ return this;
+ }
+
+ public Builder setKey(String key) {
+ this.key = key;
+ return this;
+ }
+
+ protected Builder setApplicationId(String applicationId) {
+ this.applicationId = applicationId;
+ return this;
+ }
+
+ protected Builder setIsReplace(boolean isReplace) {
+ this.isReplace = isReplace;
+ return this;
+ }
+
+ protected Builder setServiceModel(ServiceModel serviceModel) {
+ this.serviceModel = serviceModel;
+ return this;
+ }
+
+ public BBInputSetupParameter build() {
+ return new BBInputSetupParameter(this);
+ }
+ }
+
+}
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupExistingServiceTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupExistingServiceTest.java
index fbb67cb923..07f75db337 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupExistingServiceTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupExistingServiceTest.java
@@ -20,7 +20,16 @@
package org.onap.so.bpmn.servicedecomposition.tasks;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.isA;
+import static org.mockito.Mockito.doReturn;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareLookupKeyMap;
+import java.io.File;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Map;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
@@ -41,16 +50,7 @@ import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.RequestDetails;
-import java.io.File;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Map;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.isA;
-import static org.mockito.Mockito.doReturn;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareLookupKeyMap;
+import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(Parameterized.class)
public class BBInputSetupExistingServiceTest {
@@ -126,8 +126,7 @@ public class BBInputSetupExistingServiceTest {
doReturn(aaiServiceInstance).when(bbInputSetupUtils)
.getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
- doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
doReturn(aaiCloudRegion).when(bbInputSetupUtils).getCloudRegion(requestDetails.getCloudConfiguration());
// when
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java
index 7d45b643e3..d7cfaf94f7 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupPopulateMethodsTest.java
@@ -19,14 +19,27 @@
*/
package org.onap.so.bpmn.servicedecomposition.tasks;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import static org.junit.Assert.assertEquals;
+import static org.mockito.ArgumentMatchers.any;
+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.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys;
+import static org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareLookupKeyMap;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;
-import org.mockito.ArgumentMatchers;
+import org.mockito.ArgumentCaptor;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
@@ -34,34 +47,16 @@ import org.mockito.MockitoAnnotations;
import org.mockito.Spy;
import org.onap.aai.domain.yang.GenericVnf;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
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.db.catalog.beans.ConfigurationResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.serviceinstancebeans.CloudConfiguration;
-import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.RequestDetails;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.isA;
-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.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys;
-import static org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareLookupKeyMap;
+import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(Parameterized.class)
public class BBInputSetupPopulateMethodsTest {
@@ -132,8 +127,7 @@ public class BBInputSetupPopulateMethodsTest {
// when
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
// then
- verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), isA(ModelInfo.class),
- isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any());
+ verify(SPY_bbInputSetup, times(1)).populateL3Network(any(BBInputSetupParameter.class));
}
@Test
@@ -165,11 +159,11 @@ public class BBInputSetupPopulateMethodsTest {
// when
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
// then
- verify(SPY_bbInputSetup, times(1)).populateGenericVnf(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), eq(vnfType), any(), any(String.class),
- any(String.class), eq(false));
+ ArgumentCaptor<BBInputSetupParameter> argument = ArgumentCaptor.forClass(BBInputSetupParameter.class);
+ verify(SPY_bbInputSetup, times(1)).populateGenericVnf(argument.capture());
+
+ assertEquals(argument.getValue().getIsReplace(), false);
+ assertEquals(argument.getValue().getVnfType(), vnfType);
}
@Test
@@ -200,9 +194,7 @@ public class BBInputSetupPopulateMethodsTest {
// when
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
// then
- 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(ServiceModel.class));
+ verify(SPY_bbInputSetup, times(1)).populateVfModule(any(BBInputSetupParameter.class));
}
@Test
@@ -232,9 +224,7 @@ public class BBInputSetupPopulateMethodsTest {
// when
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
// then
- 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(), eq(vnfType), any());
+ verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(any(BBInputSetupParameter.class));
}
@Test
@@ -270,14 +260,10 @@ public class BBInputSetupPopulateMethodsTest {
requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(service).when(bbInputSetupUtils)
.getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
- 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(BBInputSetupParameter.class));
// when
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
// then
- 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(BBInputSetupParameter.class));
}
}
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 50d5ed3cad..a45e803cf0 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
@@ -24,10 +24,28 @@
package org.onap.so.bpmn.servicedecomposition.tasks;
-import com.fasterxml.jackson.core.JsonParseException;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonMappingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import static com.shazam.shazamcrest.MatcherAssert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.ArgumentMatchers.isA;
+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.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys;
+import static org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareLookupKeyMap;
+import java.io.File;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.junit.Assert;
import org.junit.Rule;
@@ -108,28 +126,10 @@ import org.onap.so.serviceinstancebeans.RequestInfo;
import org.onap.so.serviceinstancebeans.RequestParameters;
import org.onap.so.serviceinstancebeans.Resources;
import org.onap.so.serviceinstancebeans.SubscriberInfo;
-import java.io.File;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import static com.shazam.shazamcrest.MatcherAssert.assertThat;
-import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.mockito.ArgumentMatchers.any;
-import static org.mockito.ArgumentMatchers.eq;
-import static org.mockito.ArgumentMatchers.isA;
-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.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareConfigurationResourceKeys;
-import static org.onap.so.bpmn.servicedecomposition.tasks.BaseBBInputSetupTestHelper.prepareLookupKeyMap;
+import com.fasterxml.jackson.core.JsonParseException;
+import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonMappingException;
+import com.fasterxml.jackson.databind.ObjectMapper;
@RunWith(MockitoJUnitRunner.class)
public class BBInputSetupTest {
@@ -137,6 +137,7 @@ 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
@@ -444,13 +445,9 @@ public class BBInputSetupTest {
doReturn(service).when(SPY_bbInputSetupUtils)
.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
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(false), isA(ServiceModel.class));
+ doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(any(BBInputSetupParameter.class));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
- doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
+ doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap,
requestAction, resourceId, vnfType);
@@ -483,19 +480,14 @@ public class BBInputSetupTest {
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));
+ doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(any(BBInputSetupParameter.class));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
- doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
+ doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
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_bbInputSetup, times(1)).populateObjectsOnAssignAndCreateFlows(any(BBInputSetupParameter.class));
verify(SPY_bbInputSetupUtils, times(1)).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
verify(SPY_bbInputSetupUtils, times(1)).getCatalogServiceByModelUUID("modelUUID");
@@ -575,13 +567,10 @@ public class BBInputSetupTest {
.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
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(false), isA(ServiceModel.class));
+ doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(any(BBInputSetupParameter.class));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
- doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
+ doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap,
requestAction, resourceId, vnfType);
@@ -626,8 +615,7 @@ public class BBInputSetupTest {
doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer,
project, owningEntity, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()),
executeBB.getBuildingBlock().getBpmnFlowName());
- doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, customer);
+ doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
requestAction, resourceId);
@@ -674,8 +662,7 @@ public class BBInputSetupTest {
doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer,
project, owningEntity, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()),
executeBB.getBuildingBlock().getBpmnFlowName());
- doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, customer);
+ doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
requestAction, resourceId);
@@ -715,8 +702,7 @@ public class BBInputSetupTest {
doReturn(serviceInstance).when(SPY_bbInputSetup).getALaCarteServiceInstance(service, requestDetails, customer,
null, null, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()),
executeBB.getBuildingBlock().getBpmnFlowName());
- doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, customer);
+ doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
GeneralBuildingBlock actual = SPY_bbInputSetup.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
requestAction, resourceId);
@@ -870,8 +856,6 @@ 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);
doReturn(modelInfo).when(requestDetails).getModelInfo();
doReturn(productFamilyId).when(requestInfo).getProductFamilyId();
doReturn(requestInfo).when(requestDetails).getRequestInfo();
@@ -883,61 +867,55 @@ public class BBInputSetupTest {
doReturn(applicationId).when(requestInfo).getApplicationId();
doReturn(ModelType.network).when(modelInfo).getModelType();
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType, null, null, false, serviceModel);
- verify(SPY_bbInputSetup, times(1)).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, null);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
+ .setRequestDetails(requestDetails).setService(service).setBbName(bbName)
+ .setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).setResourceId(resourceId)
+ .setVnfType(vnfType).setIsReplace(false).setApplicationId(applicationId).build();
+
+ doNothing().when(SPY_bbInputSetup).populateL3Network(parameter);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(parameter);
+ parameter.setInstanceName(instanceName);
+ parameter.setModelInfo(modelInfo);
+ verify(SPY_bbInputSetup, times(1)).populateL3Network(parameter);
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, applicationId, false);
-
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- 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);
+ doNothing().when(SPY_bbInputSetup).populateGenericVnf(parameter);
+ parameter.setResourceId(resourceId);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(parameter);
+ verify(SPY_bbInputSetup, times(1)).populateGenericVnf(parameter);
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,
- lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType, null, null, false, serviceModel);
- verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
+ parameter.setResourceId(resourceId);
+ doNothing().when(SPY_bbInputSetup).populateVolumeGroup(parameter);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(parameter);
+ verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(parameter);
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, false, serviceModel);
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, vnfType, null, null, false, serviceModel);
- verify(SPY_bbInputSetup, times(1)).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false, serviceModel);
+ parameter.setResourceId(resourceId);
+ doNothing().when(SPY_bbInputSetup).populateVfModule(parameter);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(parameter);
+ verify(SPY_bbInputSetup, times(1)).populateVfModule(parameter);
assertEquals("VfModuleId populated", true,
lookupKeyMap.get(ResourceKey.VF_MODULE_ID).equalsIgnoreCase(resourceId));
String bbNameAssignVolume = AssignFlows.VOLUME_GROUP.toString();
doReturn(ModelType.vfModule).when(modelInfo).getModelType();
resourceId = "vfModuleId";
- 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, serviceModel);
- verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbNameAssignVolume, serviceInstance,
- lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
- assertEquals("VolumeGroupId populated", true,
- lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID).equalsIgnoreCase(resourceId));
+ parameter.setResourceId(resourceId);
+ parameter.setBbName(bbNameAssignVolume);
+ doNothing().when(SPY_bbInputSetup).populateVolumeGroup(parameter);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(parameter);
+ verify(SPY_bbInputSetup, times(2)).populateVolumeGroup(parameter);
+ assertEquals(resourceId, lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID));
}
@Test
@@ -1005,9 +983,9 @@ public class BBInputSetupTest {
doReturn(tenant).when(bbInputSetupMapperLayer).mapTenant(aaiTenant);
doReturn(aaiTenants).when(aaiCloudRegion).getTenants();
doReturn(tenants).when(aaiTenants).getTenant();
-
- GeneralBuildingBlock actual = SPY_bbInputSetup.populateGBBWithSIAndAdditionalInfo(requestDetails,
- serviceInstance, executeBB, requestAction, null);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setServiceInstance(serviceInstance)
+ .setRequestDetails(requestDetails).setExecuteBB(executeBB).setRequestAction(requestAction).build();
+ GeneralBuildingBlock actual = SPY_bbInputSetup.populateGBBWithSIAndAdditionalInfo(parameter);
assertThat(actual, sameBeanAs(expected));
}
@@ -1107,6 +1085,7 @@ public class BBInputSetupTest {
InstanceGroup instanceGroup = SPY_bbInputSetup.createInstanceGroup();
assertNull(serviceInstance.getCollection());
doReturn(true).when(SPY_bbInputSetup).isVlanTagging(service, key);
+
doReturn(collection).when(SPY_bbInputSetup).createCollection(resourceId);
doReturn(instanceGroup).when(SPY_bbInputSetup).createInstanceGroup();
doNothing().when(SPY_bbInputSetup).mapCatalogCollection(service, collection, key);
@@ -1122,10 +1101,11 @@ public class BBInputSetupTest {
List<CollectionResourceCustomization> customizations = new ArrayList<>();
customizations.add(networkCollection);
doReturn(customizations).when(service).getCollectionResourceCustomizations();
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setService(service)
+ .setServiceInstance(serviceInstance).setResourceId(resourceId).setKey(key)
+ .setBbName(AssignFlows.NETWORK_COLLECTION.toString()).build();
- SPY_bbInputSetup.populateNetworkCollectionAndInstanceGroupAssign(service,
- AssignFlows.NETWORK_COLLECTION.toString(), serviceInstance, resourceId, key);
-
+ SPY_bbInputSetup.populateNetworkCollectionAndInstanceGroupAssign(parameter);
assertNotNull(serviceInstance.getCollection());
assertNotNull(serviceInstance.getCollection().getInstanceGroup());
@@ -1144,8 +1124,10 @@ public class BBInputSetupTest {
serviceInstance.setServiceInstanceName("test service instance");
serviceInstance.setInstanceGroups(instanceGroups);
- SPY_bbInputSetup.populateInstanceGroup(modelInfo, service, serviceInstance, "instance-group-001",
- "test instance group");
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setModelInfo(modelInfo)
+ .setService(service).setServiceInstance(serviceInstance).setResourceId("instance-group-001")
+ .setInstanceName("test instance group").build();
+ SPY_bbInputSetup.populateInstanceGroup(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogInstanceGroup(isA(InstanceGroup.class), isA(ModelInfo.class),
isA(Service.class));
verify(instanceGroups, times(1)).add(isA(InstanceGroup.class));
@@ -1213,12 +1195,14 @@ 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);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
+ .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
+ .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setRequestDetails(requestDetails)
+ .setInstanceName(reqInfo.getInstanceName()).build();
+ SPY_bbInputSetup.populateVolumeGroup(parameter);
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(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vnf.getVolumeGroups().get(0), modelInfo, service,
"vnfModelCustomizationUUID");
}
@@ -1267,19 +1251,19 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapCatalogNetwork(network, modelInfo, service);
- SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, null);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
+ .setInstanceName(instanceName).setModelInfo(modelInfo).setService(service).setBbName(bbName)
+ .setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).build();
+ SPY_bbInputSetup.populateL3Network(parameter);
lookupKeyMap.put(ResourceKey.NETWORK_ID, null);
- SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, null);
+ SPY_bbInputSetup.populateL3Network(parameter);
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(parameter);
verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network2, modelInfo, service);
}
@@ -1334,27 +1318,30 @@ 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);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
+ .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
+ .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName)
+ .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails).build();
+ SPY_bbInputSetup.populateConfiguration(parameter);
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(parameter);
verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
instanceName = "configurationName2";
resourceId = "resourceId2";
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, "configurationId2");
+ parameter.setInstanceName(instanceName);
+ parameter.setResourceId(resourceId);
Configuration configuration2 = SPY_bbInputSetup.createConfiguration(lookupKeyMap, instanceName, resourceId);
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(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service,
configResourceKeys);
}
@@ -1415,9 +1402,11 @@ 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);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
+ .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
+ .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setInstanceName(instanceName)
+ .setConfigurationResourceKeys(configResourceKeys).setRequestDetails(requestDetails).build();
+ SPY_bbInputSetup.populateConfiguration(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
}
@@ -1460,31 +1449,29 @@ public class BBInputSetupTest {
org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup =
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(), applicationId, false);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
+ .setModelInfo(modelInfo).setInstanceName(instanceName).setPlatform(platform)
+ .setLineOfBusiness(lineOfBusiness).setService(service).setBbName(bbName)
+ .setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap)
+ .setRelatedInstanceList(requestDetails.getRelatedInstanceList()).setResourceId(resourceId)
+ .setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId()).build();
+ SPY_bbInputSetup.populateGenericVnf(parameter);
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(), applicationId, false);
+ SPY_bbInputSetup.populateGenericVnf(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
instanceName = "vnfName2";
GenericVnf vnf2 = SPY_bbInputSetup.createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
- doReturn(vnf2).when(SPY_bbInputSetup).createGenericVnf(lookupKeyMap, instanceName, platform, lineOfBusiness,
- resourceId, vnfType, null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
+
doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
doNothing().when(SPY_bbInputSetup).mapVnfcCollectionInstanceGroup(vnf2, modelInfo, service);
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(), applicationId, false);
+ SPY_bbInputSetup.populateGenericVnf(parameter);
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);
@@ -1517,11 +1504,7 @@ public class BBInputSetupTest {
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId");
String bbName = AssignFlows.VNF.toString();
- Platform expectedPlatform = new Platform();
- LineOfBusiness expectedLineOfBusiness = new LineOfBusiness();
String resourceId = "123";
- doReturn(expectedPlatform).when(bbInputSetupMapperLayer).mapRequestPlatform(platform);
- doReturn(expectedLineOfBusiness).when(bbInputSetupMapperLayer).mapRequestLineOfBusiness(lineOfBusiness);
org.onap.aai.domain.yang.GenericVnf vnfAAI = new org.onap.aai.domain.yang.GenericVnf();
vnfAAI.setModelCustomizationId("modelCustId");
doReturn(vnfAAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
@@ -1532,9 +1515,14 @@ 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(), applicationId, true);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setModelInfo(modelInfo)
+ .setInstanceName(instanceName).setPlatform(platform).setLineOfBusiness(lineOfBusiness)
+ .setService(service).setBbName(bbName).setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap)
+ .setRelatedInstanceList(requestDetails.getRelatedInstanceList()).setResourceId(resourceId)
+ .setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId())
+ .setApplicationId(applicationId).setIsReplace(true).build();
+
+ SPY_bbInputSetup.populateGenericVnf(parameter);
assertEquals("my-test-uuid", modelInfo.getModelCustomizationUuid());
@@ -1608,16 +1596,17 @@ public class BBInputSetupTest {
org.onap.so.db.catalog.beans.InstanceGroup catalogInstanceGroup =
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(), applicationId, false);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
+ .setModelInfo(modelInfo).setInstanceName(instanceName).setPlatform(platform)
+ .setLineOfBusiness(lineOfBusiness).setService(service).setBbName(bbName)
+ .setServiceInstance(serviceInstance).setLookupKeyMap(lookupKeyMap)
+ .setRelatedInstanceList(requestDetails.getRelatedInstanceList()).setResourceId(resourceId)
+ .setVnfType(vnfType).setProductFamilyId(requestDetails.getRequestInfo().getProductFamilyId()).build();
+ SPY_bbInputSetup.populateGenericVnf(parameter);
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(), applicationId, false);
+ SPY_bbInputSetup.populateGenericVnf(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
instanceName = "vnfName2";
@@ -1629,9 +1618,7 @@ 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(), applicationId, false);
+ SPY_bbInputSetup.populateGenericVnf(parameter);
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);
@@ -2099,14 +2086,10 @@ 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(BBInputSetupParameter.class));
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(BBInputSetupParameter.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(),
@@ -2253,8 +2236,7 @@ public class BBInputSetupTest {
// when
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
// then
- verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), isA(ModelInfo.class),
- isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any());
+ verify(SPY_bbInputSetup, times(1)).populateL3Network(any(BBInputSetupParameter.class));
}
@Test
@@ -2322,8 +2304,7 @@ public class BBInputSetupTest {
.getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
doReturn(networkCustList).when(service).getNetworkCustomizations();
doReturn("ab153b6e-c364-44c0-bef6-1f2982117f04").when(networkCust).getModelCustomizationUUID();
- 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(BBInputSetupParameter.class));
// when
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
// then
@@ -2485,8 +2466,7 @@ public class BBInputSetupTest {
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils)
.getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
- doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
doReturn(aaiNetwork).when(SPY_bbInputSetupUtils).getAAIL3Network(network.getNetworkId());
doNothing().when(SPY_bbInputSetup).mapCatalogNetwork(any(L3Network.class), any(ModelInfo.class),
any(Service.class));
@@ -2537,8 +2517,7 @@ public class BBInputSetupTest {
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils)
.getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
- doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
doNothing().when(SPY_bbInputSetup).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class),
any(Service.class));
@@ -2594,8 +2573,7 @@ public class BBInputSetupTest {
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils)
.getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
- doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
doNothing().when(SPY_bbInputSetup).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class),
any(Service.class));
@@ -2656,8 +2634,7 @@ public class BBInputSetupTest {
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils)
.getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
- doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
doNothing().when(SPY_bbInputSetup).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class),
any(Service.class));
@@ -2723,8 +2700,7 @@ public class BBInputSetupTest {
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils)
.getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
- doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
- executeBB, requestAction, null);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(any(BBInputSetupParameter.class));
doReturn(aaiConfiguration).when(SPY_bbInputSetupUtils).getAAIConfiguration(configuration.getConfigurationId());
doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(isA(Configuration.class), isA(ModelInfo.class),
isA(Service.class), isA(ConfigurationResourceKeys.class));
@@ -2999,8 +2975,11 @@ 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, false, serviceModel);
+ SPY_bbInputSetup.populateVfModule(new BBInputSetupParameter.Builder().setRequestId(REQUEST_ID)
+ .setModelInfo(modelInfo).setService(service).setBbName(bbName).setServiceInstance(serviceInstance)
+ .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setRelatedInstanceList(relatedInstanceList)
+ .setInstanceName(instanceName).setInstanceParams(instanceParams)
+ .setCloudConfiguration(cloudConfiguration).setServiceModel(serviceModel).build());
verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
isA(Service.class), isA(String.class));
@@ -3075,8 +3054,12 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
isA(Service.class), isA(String.class));
- SPY_bbInputSetup.populateVfModule(modelInfo, newService, bbName, serviceInstance, lookupKeyMap, resourceId,
- relatedInstanceList, instanceName, instanceParams, cloudConfiguration, true, serviceModel);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setModelInfo(modelInfo)
+ .setService(newService).setBbName(bbName).setServiceInstance(serviceInstance)
+ .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setRelatedInstanceList(relatedInstanceList)
+ .setInstanceName(instanceName).setInstanceParams(instanceParams)
+ .setCloudConfiguration(cloudConfiguration).setIsReplace(true).setServiceModel(serviceModel).build();
+ SPY_bbInputSetup.populateVfModule(parameter);
verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
eq(currentService), eq("vnfModelCustId"));
@@ -3153,8 +3136,14 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
isA(Service.class), isA(String.class));
- SPY_bbInputSetup.populateVfModule(modelInfo, newService, bbName, serviceInstance, lookupKeyMap, resourceId,
- relatedInstanceList, instanceName, instanceParams, cloudConfiguration, true, serviceModel);
+ BBInputSetupParameter parameter = new BBInputSetupParameter.Builder().setModelInfo(modelInfo)
+ .setService(newService).setServiceInstance(serviceInstance).setBbName(bbName)
+ .setLookupKeyMap(lookupKeyMap).setResourceId(resourceId).setRelatedInstanceList(relatedInstanceList)
+ .setInstanceName(instanceName).setInstanceParams(instanceParams)
+ .setCloudConfiguration(cloudConfiguration).setIsReplace(true).setServiceModel(serviceModel).build();
+
+
+ SPY_bbInputSetup.populateVfModule(parameter);
verify(SPY_bbInputSetup, times(2)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
eq(serviceModel.getCurrentService()), isA(String.class));