aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java115
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java16
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java91
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java244
-rw-r--r--bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn22
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AssignPnfInputsCheckerDelegate.java40
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CheckAaiForPnfCorrelationId.java45
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CreatePnfEntryInAai.java34
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/PnfBaseTasks.java29
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AssignPnfInputsCheckerDelegateTest.java52
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfInputCheckersTestUtils.java46
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CheckAaiForPnfCorrelationIdTest.java129
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CreatePnfEntryInAaiTest.java50
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/PnfTasksUtils.java17
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java55
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java107
16 files changed, 671 insertions, 421 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 98f1e847e5..b56f654762 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
@@ -72,7 +72,6 @@ import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
import org.onap.so.db.catalog.beans.VnfcInstanceGroupCustomization;
import org.onap.so.db.request.beans.InfraActiveRequests;
-import org.onap.so.db.request.client.RequestsDbClient;
import org.onap.so.serviceinstancebeans.CloudConfiguration;
import org.onap.so.serviceinstancebeans.ModelInfo;
import org.onap.so.serviceinstancebeans.ModelType;
@@ -121,9 +120,6 @@ public class BBInputSetup implements JavaDelegate {
@Autowired
private ExceptionBuilder exceptionUtil;
- @Autowired
- private RequestsDbClient requestsDbClient;
-
private ObjectMapper mapper = new ObjectMapper();
public BBInputSetupUtils getBbInputSetupUtils() {
@@ -281,9 +277,9 @@ public class BBInputSetup implements JavaDelegate {
ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
- this.populateObjectsOnAssignAndCreateFlows(executeBB.getRequestId(), requestDetails, service, bbName,
- serviceInstance, lookupKeyMap, resourceId, vnfType, executeBB.getBuildingBlock().getKey(),
- executeBB.getConfigurationResourceKeys(), isReplace);
+ this.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance, lookupKeyMap,
+ resourceId, vnfType, executeBB.getBuildingBlock().getKey(), executeBB.getConfigurationResourceKeys(),
+ isReplace);
return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
}
@@ -301,9 +297,6 @@ public class BBInputSetup implements JavaDelegate {
org.onap.aai.domain.yang.GenericVnf aaiGenericVnf = bbInputSetupUtils.getAAIGenericVnf(vnfId);
GenericVnf genericVnf = this.mapperLayer.mapAAIGenericVnfIntoGenericVnf(aaiGenericVnf);
genericVnfs.add(genericVnf);
- if (genericVnf != null) {
- updateInstanceName(executeBB.getRequestId(), ModelType.vnf, genericVnf.getVnfName());
- }
}
String instanceGroupId = lookupKeyMap.get(ResourceKey.INSTANCE_GROUP_ID);
@@ -312,7 +305,6 @@ public class BBInputSetup implements JavaDelegate {
bbInputSetupUtils.getAAIInstanceGroup(instanceGroupId);
InstanceGroup instanceGroup = this.mapperLayer.mapAAIInstanceGroupIntoInstanceGroup(aaiInstancegroup);
instanceGroup.setOrchestrationStatus(OrchestrationStatus.INVENTORIED);
- updateInstanceName(executeBB.getRequestId(), ModelType.instanceGroup, instanceGroup.getInstanceGroupName());
if (serviceInstanceId == null) {
Optional<org.onap.aai.domain.yang.ServiceInstance> aaiServiceInstanceOpt =
@@ -347,10 +339,10 @@ public class BBInputSetup implements JavaDelegate {
customer);
}
- protected void populateObjectsOnAssignAndCreateFlows(String requestId, RequestDetails requestDetails,
- Service service, String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap,
- String resourceId, String vnfType, String configurationKey,
- ConfigurationResourceKeys configurationResourceKeys, boolean isReplace) throws Exception {
+ protected void populateObjectsOnAssignAndCreateFlows(RequestDetails requestDetails, Service service, String bbName,
+ ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId, String vnfType,
+ String configurationKey, ConfigurationResourceKeys configurationResourceKeys, boolean isReplace)
+ throws Exception {
ModelInfo modelInfo = requestDetails.getModelInfo();
String instanceName = requestDetails.getRequestInfo().getInstanceName();
String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId();
@@ -366,28 +358,27 @@ public class BBInputSetup implements JavaDelegate {
if (modelType.equals(ModelType.network)) {
lookupKeyMap.put(ResourceKey.NETWORK_ID, resourceId);
- this.populateL3Network(requestId, instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, null);
+ this.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ null);
} else if (modelType.equals(ModelType.vnf)) {
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, resourceId);
- this.populateGenericVnf(requestId, modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
- serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId,
- applicationId);
+ this.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName, serviceInstance,
+ lookupKeyMap, relatedInstanceList, resourceId, vnfType, null, productFamilyId, applicationId);
} 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(requestId, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
relatedInstanceList, instanceName, vnfType, null);
} else if (modelType.equals(ModelType.vfModule)) {
if (bbName.contains("Configuration")) {
String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
ModelInfo configurationModelInfo = new ModelInfo();
configurationModelInfo.setModelCustomizationUuid(configurationKey);
- populateConfiguration(requestId, configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
configurationId, instanceName, configurationResourceKeys, requestDetails);
} else {
lookupKeyMap.put(ResourceKey.VF_MODULE_ID, resourceId);
- this.populateVfModule(requestId, modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
relatedInstanceList, instanceName, null, requestDetails.getCloudConfiguration(), isReplace);
}
} else if (modelType.equals(ModelType.instanceGroup)) {
@@ -412,7 +403,7 @@ public class BBInputSetup implements JavaDelegate {
// Dependent on MSO-5821 653458 US - MSO - Enhance Catalog DB Schema & Adapter to support VNF Groups
}
- protected void populateConfiguration(String requestId, ModelInfo modelInfo, Service service, String bbName,
+ protected void populateConfiguration(ModelInfo modelInfo, Service service, String bbName,
ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
String instanceName, ConfigurationResourceKeys configurationResourceKeys, RequestDetails requestDetails) {
Configuration configuration = null;
@@ -436,13 +427,11 @@ public class BBInputSetup implements JavaDelegate {
Vnfc vnfc = getVnfcToConfiguration(configurationResourceKeys.getVnfcName());
configuration.setVnfc(vnfc);
this.mapCatalogConfiguration(configuration, modelInfo, service, configurationResourceKeys);
- updateInstanceName(requestId, ModelType.configuration, configuration.getConfigurationName());
} else if (configuration != null && bbName.contains("Vrf")) {
configuration.setModelInfoConfiguration(mapperLayer.mapCatalogConfigurationToConfiguration(
findConfigurationResourceCustomization(modelInfo, service), null));
configuration.setConfigurationType(configuration.getModelInfoConfiguration().getConfigurationType());
configuration.setConfigurationSubType(configuration.getModelInfoConfiguration().getConfigurationRole());
- updateInstanceName(requestId, ModelType.configuration, configuration.getConfigurationName());
}
}
@@ -517,7 +506,7 @@ public class BBInputSetup implements JavaDelegate {
vfModuleCustomizationUUID, cvnfcCustomizationUUID);
}
- protected void populateVfModule(String requestId, ModelInfo modelInfo, Service service, String bbName,
+ protected void populateVfModule(ModelInfo modelInfo, Service service, String bbName,
ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
RelatedInstanceList[] relatedInstanceList, String instanceName, List<Map<String, String>> instanceParams,
CloudConfiguration cloudConfiguration, boolean isReplace) throws Exception {
@@ -581,9 +570,6 @@ public class BBInputSetup implements JavaDelegate {
mapCatalogVfModule(vfModule, modelInfo, service, vnfModelCustomizationUUID);
}
}
- if (vfModule != null) {
- updateInstanceName(requestId, ModelType.vfModule, vfModule.getVfModuleName());
- }
} else {
logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID));
throw new Exception("Could not find relevant information for related VNF");
@@ -648,7 +634,7 @@ public class BBInputSetup implements JavaDelegate {
return vfModule;
}
- protected void populateVolumeGroup(String requestId, ModelInfo modelInfo, Service service, String bbName,
+ 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 {
@@ -694,7 +680,6 @@ public class BBInputSetup implements JavaDelegate {
}
if (volumeGroup != null) {
mapCatalogVolumeGroup(volumeGroup, modelInfo, service, vnfModelCustomizationUUID);
- updateInstanceName(requestId, ModelType.volumeGroup, volumeGroup.getVolumeGroupName());
}
} else {
logger.debug("Related VNF instance Id not found: {}", lookupKeyMap.get(ResourceKey.GENERIC_VNF_ID));
@@ -748,7 +733,7 @@ public class BBInputSetup implements JavaDelegate {
return null;
}
- protected void populateGenericVnf(String requestId, ModelInfo modelInfo, String instanceName,
+ 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,
@@ -793,7 +778,6 @@ public class BBInputSetup implements JavaDelegate {
&& !instanceGroupInList(vnf, instanceGroupId)) {
mapNetworkCollectionInstanceGroup(vnf, instanceGroupId);
}
- updateInstanceName(requestId, ModelType.vnf, vnf.getVnfName());
}
}
@@ -885,8 +869,8 @@ public class BBInputSetup implements JavaDelegate {
return vnfResourceCustomization;
}
- protected void populateL3Network(String requestId, String instanceName, ModelInfo modelInfo, Service service,
- String bbName, ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
+ protected void populateL3Network(String instanceName, ModelInfo modelInfo, Service service, String bbName,
+ ServiceInstance serviceInstance, Map<ResourceKey, String> lookupKeyMap, String resourceId,
List<Map<String, String>> instanceParams) {
L3Network network = null;
for (L3Network networkTemp : serviceInstance.getNetworks()) {
@@ -903,7 +887,6 @@ public class BBInputSetup implements JavaDelegate {
}
if (network != null) {
mapCatalogNetwork(network, modelInfo, service);
- updateInstanceName(requestId, ModelType.network, network.getNetworkName());
}
}
@@ -963,7 +946,6 @@ public class BBInputSetup implements JavaDelegate {
ServiceInstance serviceInstance = this.getALaCarteServiceInstance(service, requestDetails, customer,
project, owningEntity, lookupKeyMap, resourceId, Boolean.TRUE.equals(executeBB.isaLaCarte()),
executeBB.getBuildingBlock().getBpmnFlowName());
- updateInstanceName(executeBB.getRequestId(), ModelType.service, serviceInstance.getServiceInstanceName());
return this.populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction,
customer);
} else {
@@ -1172,8 +1154,8 @@ public class BBInputSetup implements JavaDelegate {
NetworkResourceCustomization networkCust = getNetworkCustomizationByKey(key, service);
if (networkCust != null) {
networkModelInfo.setModelCustomizationUuid(networkCust.getModelCustomizationUUID());
- this.populateL3Network(executeBB.getRequestId(), null, networkModelInfo, service, bbName,
- serviceInstance, lookupKeyMap, networkId, null);
+ this.populateL3Network(null, networkModelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ networkId, null);
} else {
logger.debug("Could not find a network customization with key: {}", key);
}
@@ -1193,9 +1175,8 @@ public class BBInputSetup implements JavaDelegate {
String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
ModelInfo configurationModelInfo = new ModelInfo();
configurationModelInfo.setModelCustomizationUuid(key);
- this.populateConfiguration(executeBB.getRequestId(), configurationModelInfo, service, bbName,
- serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys(),
- executeBB.getRequestDetails());
+ this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ configurationId, null, executeBB.getConfigurationResourceKeys(), executeBB.getRequestDetails());
}
if (executeBB.getWorkflowResourceIds() != null) {
this.populateNetworkCollectionAndInstanceGroupAssign(service, bbName, serviceInstance,
@@ -1312,7 +1293,6 @@ public class BBInputSetup implements JavaDelegate {
ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
- updateInstanceName(executeBB.getRequestId(), ModelType.service, serviceInstance.getServiceInstanceName());
gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
serviceInstance = gBB.getServiceInstance();
@@ -1451,9 +1431,10 @@ public class BBInputSetup implements JavaDelegate {
}
String productFamilyId = requestDetails.getRequestInfo().getProductFamilyId();
String applicationId = "";
- this.populateGenericVnf(executeBB.getRequestId(), vnfs.getModelInfo(), vnfs.getInstanceName(),
- vnfs.getPlatform(), vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null,
- vnfId, vnfType, vnfs.getInstanceParams(), productFamilyId, applicationId);
+ this.populateGenericVnf(vnfs.getModelInfo(), vnfs.getInstanceName(), vnfs.getPlatform(),
+ vnfs.getLineOfBusiness(), service, bbName, serviceInstance, lookupKeyMap, null, vnfId, vnfType,
+ vnfs.getInstanceParams(), productFamilyId, applicationId);
+
} else if (bbName.contains(PNF)) {
String pnfId = lookupKeyMap.get(ResourceKey.PNF);
resources.getPnfs().stream()
@@ -1472,24 +1453,22 @@ public class BBInputSetup implements JavaDelegate {
ModelInfo modelInfo = vfModules.getModelInfo();
if (bbName.contains(VOLUME_GROUP)) {
String volumeGroupId = lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID);
- this.populateVolumeGroup(executeBB.getRequestId(), modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, volumeGroupId, null, vfModules.getVolumeGroupInstanceName(), vnfType,
- vfModules.getInstanceParams());
+ this.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, volumeGroupId, null,
+ vfModules.getVolumeGroupInstanceName(), vnfType, vfModules.getInstanceParams());
} else {
String vfModuleId = lookupKeyMap.get(ResourceKey.VF_MODULE_ID);
CloudConfiguration cloudConfig = new CloudConfiguration();
cloudConfig.setLcpCloudRegionId(cloudRegion.getLcpCloudRegionId());
cloudConfig.setCloudOwner(cloudRegion.getCloudOwner());
- this.populateVfModule(executeBB.getRequestId(), modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, vfModuleId, null, vfModules.getInstanceName(), vfModules.getInstanceParams(),
- cloudConfig, false);
+ this.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, vfModuleId, null,
+ vfModules.getInstanceName(), vfModules.getInstanceParams(), cloudConfig, false);
}
} else if (bbName.contains(NETWORK)) {
networks = findNetworksByKey(key, resources);
String networkId = lookupKeyMap.get(ResourceKey.NETWORK_ID);
if (networks != null) {
- this.populateL3Network(executeBB.getRequestId(), networks.getInstanceName(), networks.getModelInfo(),
- service, bbName, serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams());
+ this.populateL3Network(networks.getInstanceName(), networks.getModelInfo(), service, bbName,
+ serviceInstance, lookupKeyMap, networkId, networks.getInstanceParams());
}
} else if (bbName.contains("Configuration")) {
String configurationId = lookupKeyMap.get(ResourceKey.CONFIGURATION_ID);
@@ -1498,9 +1477,8 @@ public class BBInputSetup implements JavaDelegate {
ConfigurationResourceCustomization configurationCust =
findConfigurationResourceCustomization(configurationModelInfo, service);
if (configurationCust != null) {
- this.populateConfiguration(executeBB.getRequestId(), configurationModelInfo, service, bbName,
- serviceInstance, lookupKeyMap, configurationId, null, executeBB.getConfigurationResourceKeys(),
- executeBB.getRequestDetails());
+ this.populateConfiguration(configurationModelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ configurationId, null, executeBB.getConfigurationResourceKeys(), executeBB.getRequestDetails());
} else {
logger.debug("Could not find a configuration customization with key: {}", key);
}
@@ -2011,25 +1989,4 @@ public class BBInputSetup implements JavaDelegate {
}
return customer;
}
-
- protected void updateInstanceName(String requestId, ModelType resourceType, String instanceName) {
- try {
- if (instanceName != null) {
- InfraActiveRequests request = requestsDbClient.getInfraActiveRequestbyRequestId(requestId);
- if (resourceType.getName(request) == null) {
- logger.info("Updating instanceName to: {} in requestDb for requestId: {}", instanceName, requestId);
- resourceType.setName(request, instanceName);
- requestsDbClient.updateInfraActiveRequests(request);
- }
- } else {
- logger.info("Failed to update instanceName in RequestDb because it was null for requestId: {}",
- requestId);
- }
- } catch (Exception ex) {
- logger.error("Unable to update Request db with instanceName for requestId: {} due to error: {}", requestId,
- ex.getMessage());
- }
- }
-
-
}
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
index 994abda083..ec7b613727 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupUtils.java
@@ -276,7 +276,7 @@ public class BBInputSetupUtils {
}
}
- protected InstanceGroup getAAIInstanceGroup(String instanceGroupId) {
+ public InstanceGroup getAAIInstanceGroup(String instanceGroupId) {
return injectionHelper.getAaiClient().get(InstanceGroup.class,
AAIUriFactory.createResourceUri(AAIObjectType.INSTANCE_GROUP, instanceGroupId)).orElse(null);
}
@@ -549,6 +549,20 @@ public class BBInputSetupUtils {
}
}
+ public Optional<VolumeGroup> getRelatedVolumeGroupByIdFromVnf(String vnfId, String volumeGroupId) {
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.GENERIC_VNF, vnfId);
+ uri.relatedTo(AAIObjectPlurals.VOLUME_GROUP).queryParam("volume-group-id", volumeGroupId);
+ Optional<VolumeGroups> volumeGroups = injectionHelper.getAaiClient().get(VolumeGroups.class, uri);
+ VolumeGroup volumeGroup = null;
+ if (!volumeGroups.isPresent()) {
+ logger.debug("No VolumeGroups matched by id");
+ return Optional.empty();
+ } else {
+ volumeGroup = volumeGroups.get().getVolumeGroup().get(0);
+ return Optional.of(volumeGroup);
+ }
+ }
+
public Optional<VolumeGroup> getRelatedVolumeGroupByNameFromVfModule(String vnfId, String vfModuleId,
String volumeGroupName) throws MultipleObjectsFoundException {
AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.VF_MODULE, vnfId, vfModuleId);
diff --git a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
index 7bd2beeb92..dbd5000387 100644
--- a/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
+++ b/bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/ExtractPojosForBBTest.java
@@ -115,6 +115,12 @@ public class ExtractPojosForBBTest extends BaseTest {
instanceGroupsPend.add(instanceGroupPend);
lookupKeyMap.put(ResourceKey.INSTANCE_GROUP_ID, instanceGroupPend.getId());
+ List<Pnf> pnfsPend = serviceInstancePend.getPnfs();
+ Pnf pnfPend = new Pnf();
+ pnfPend.setPnfId("abc");
+ pnfsPend.add(pnfPend);
+ lookupKeyMap.put(ResourceKey.PNF, pnfPend.getPnfId());
+
customer.getServiceSubscription().getServiceInstances().add(serviceInstancePend);
gBBInput.setCustomer(customer);
@@ -143,89 +149,49 @@ public class ExtractPojosForBBTest extends BaseTest {
InstanceGroup extractInstanceGroupPend = extractPojos.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
assertEquals(instanceGroupPend.getId(), extractInstanceGroupPend.getId());
+
+ Pnf extractPnfPend = extractPojos.extractByKey(execution, ResourceKey.PNF);
+ assertEquals(extractPnfPend.getPnfId(), pnfPend.getPnfId());
}
@Test
public void siError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
-
- extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.SERVICE_INSTANCE_ID);
}
@Test
public void vnfError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.GENERIC_VNF_ID);
}
@Test
public void vfModuleError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VF_MODULE_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.VF_MODULE_ID);
}
@Test
public void configurationError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.CONFIGURATION_ID);
}
@Test
public void allotedError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
-
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.ALLOTTED_RESOURCE_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.ALLOTTED_RESOURCE_ID);
}
@Test
public void vpnBindingError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VPN_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.VPN_ID);
}
@Test
public void vpnBondingLinkError() throws BBObjectNotFoundException {
- expectedException.expect(BBObjectNotFoundException.class);
- Customer customer = new Customer();
- customer.setServiceSubscription(new ServiceSubscription());
- ServiceInstance serviceInstance = new ServiceInstance();
- customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
- gBBInput.setCustomer(customer);
- extractPojos.extractByKey(execution, ResourceKey.VPN_BONDING_LINK_ID);
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.VPN_BONDING_LINK_ID);
+ }
+
+ @Test
+ public void pnfError() throws BBObjectNotFoundException {
+ assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey.PNF);
}
@Test
@@ -239,4 +205,19 @@ public class ExtractPojosForBBTest extends BaseTest {
ServiceInstance extractServPend = extractPojos.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
assertEquals(extractServPend.getServiceInstanceId(), serviceInstancePend.getServiceInstanceId());
}
+
+ private void assertThrowsBBObjectNotFoundForResource_WhenServiceEmpty(ResourceKey key)
+ throws BBObjectNotFoundException {
+ expectedException.expect(BBObjectNotFoundException.class);
+ setCustomerWithEmptyServiceInstance();
+ extractPojos.extractByKey(execution, key);
+ }
+
+ private void setCustomerWithEmptyServiceInstance() {
+ Customer customer = new Customer();
+ customer.setServiceSubscription(new ServiceSubscription());
+ ServiceInstance serviceInstance = new ServiceInstance();
+ customer.getServiceSubscription().getServiceInstances().add(serviceInstance);
+ gBBInput.setCustomer(customer);
+ }
}
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 8ee3979386..e4b1153f4b 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
@@ -456,9 +456,8 @@ public class BBInputSetupTest {
.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId");
- doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(executeBB.getRequestId(),
- requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType, null, null,
- false);
+ doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName",
+ serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false);
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
executeBB, requestAction, null);
@@ -539,9 +538,8 @@ public class BBInputSetupTest {
.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById("instanceId");
- doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(executeBB.getRequestId(),
- requestDetails, service, "bbName", serviceInstance, lookupKeyMap, resourceId, vnfType, null, null,
- false);
+ doNothing().when(SPY_bbInputSetup).populateObjectsOnAssignAndCreateFlows(requestDetails, service, "bbName",
+ serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false);
doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
doReturn(expected).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
@@ -832,8 +830,8 @@ public class BBInputSetupTest {
Mockito.mock(org.onap.so.serviceinstancebeans.LineOfBusiness.class);
Map<ResourceKey, String> lookupKeyMap = new HashMap<>();
- doNothing().when(SPY_bbInputSetup).populateL3Network(REQUEST_ID, instanceName, modelInfo, service, bbName,
- serviceInstance, lookupKeyMap, resourceId, null);
+ 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();
@@ -845,59 +843,59 @@ public class BBInputSetupTest {
doReturn(applicationId).when(requestInfo).getApplicationId();
doReturn(ModelType.network).when(modelInfo).getModelType();
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName,
- serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false);
- verify(SPY_bbInputSetup, times(1)).populateL3Network(REQUEST_ID, instanceName, modelInfo, service, bbName,
- serviceInstance, lookupKeyMap, resourceId, null);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, vnfType, null, null, false);
+ verify(SPY_bbInputSetup, times(1)).populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, null);
assertEquals("NetworkId populated", true,
lookupKeyMap.get(ResourceKey.NETWORK_ID).equalsIgnoreCase(resourceId));
doReturn(ModelType.vnf).when(modelInfo).getModelType();
resourceId = "vnfId";
- doNothing().when(SPY_bbInputSetup).populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform,
- lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId,
- vnfType, null, productFamilyId, applicationId);
+ doNothing().when(SPY_bbInputSetup).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness,
+ service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null,
+ productFamilyId, applicationId);
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName,
- serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false);
- verify(SPY_bbInputSetup, times(1)).populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform,
- lineOfBusiness, service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId,
- vnfType, null, productFamilyId, applicationId);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, vnfType, null, null, false);
+ verify(SPY_bbInputSetup, times(1)).populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness,
+ service, bbName, serviceInstance, lookupKeyMap, relatedInstanceList, resourceId, vnfType, null,
+ productFamilyId, applicationId);
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(REQUEST_ID, modelInfo, service, bbName, serviceInstance,
+ doNothing().when(SPY_bbInputSetup).populateVolumeGroup(modelInfo, service, bbName, serviceInstance,
lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName,
- serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false);
- verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(REQUEST_ID, modelInfo, service, bbName, serviceInstance,
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, vnfType, null, null, false);
+ verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(modelInfo, service, bbName, serviceInstance,
lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
assertEquals("VolumeGroupId populated", true,
lookupKeyMap.get(ResourceKey.VOLUME_GROUP_ID).equalsIgnoreCase(resourceId));
doReturn(ModelType.vfModule).when(modelInfo).getModelType();
resourceId = "vfModuleId";
- doNothing().when(SPY_bbInputSetup).populateVfModule(REQUEST_ID, modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false);
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbName,
- serviceInstance, lookupKeyMap, resourceId, vnfType, null, null, false);
- verify(SPY_bbInputSetup, times(1)).populateVfModule(REQUEST_ID, modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false);
+ doNothing().when(SPY_bbInputSetup).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false);
+ SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(requestDetails, service, bbName, serviceInstance,
+ lookupKeyMap, resourceId, vnfType, null, null, false);
+ verify(SPY_bbInputSetup, times(1)).populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ resourceId, relatedInstanceList, instanceName, null, cloudConfiguration, false);
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(REQUEST_ID, modelInfo, service, bbNameAssignVolume,
- serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
- SPY_bbInputSetup.populateObjectsOnAssignAndCreateFlows(REQUEST_ID, requestDetails, service, bbNameAssignVolume,
+ 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);
- verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(REQUEST_ID, modelInfo, service, bbNameAssignVolume,
- serviceInstance, lookupKeyMap, resourceId, relatedInstanceList, instanceName, vnfType, null);
+ 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));
}
@@ -1178,12 +1176,12 @@ public class BBInputSetupTest {
doReturn(aaiGenericVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf.getVnfId());
lookupKeyMap.put(ResourceKey.VOLUME_GROUP_ID, "volumeGroupId");
- SPY_bbInputSetup.populateVolumeGroup(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null);
+ SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null);
verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vg, modelInfo, service, "vnfModelCustomizationUUID");
vnf.getVolumeGroups().clear();
- SPY_bbInputSetup.populateVolumeGroup(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null);
+ SPY_bbInputSetup.populateVolumeGroup(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ requestDetails.getRelatedInstanceList(), reqInfo.getInstanceName(), null, null);
verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(vnf.getVolumeGroups().get(0), modelInfo, service,
"vnfModelCustomizationUUID");
}
@@ -1232,19 +1230,19 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapCatalogNetwork(network, modelInfo, service);
- SPY_bbInputSetup.populateL3Network(REQUEST_ID, instanceName, modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, null);
+ SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ resourceId, null);
lookupKeyMap.put(ResourceKey.NETWORK_ID, null);
- SPY_bbInputSetup.populateL3Network(REQUEST_ID, instanceName, modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, null);
+ SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ resourceId, null);
verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(network, modelInfo, service);
instanceName = "networkName2";
L3Network network2 = SPY_bbInputSetup.createNetwork(lookupKeyMap, instanceName, resourceId, null);
- SPY_bbInputSetup.populateL3Network(REQUEST_ID, instanceName, modelInfo, service, bbName, serviceInstance,
- lookupKeyMap, resourceId, null);
+ SPY_bbInputSetup.populateL3Network(instanceName, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
+ resourceId, null);
verify(SPY_bbInputSetup, times(2)).mapCatalogNetwork(network2, modelInfo, service);
}
@@ -1302,15 +1300,15 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
- SPY_bbInputSetup.populateConfiguration(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, instanceName, configResourceKeys, requestDetails);
+ SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
lookupKeyMap.put(ResourceKey.CONFIGURATION_ID, null);
- SPY_bbInputSetup.populateConfiguration(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, instanceName, configResourceKeys, requestDetails);
+ SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(2)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
@@ -1321,8 +1319,8 @@ public class BBInputSetupTest {
doReturn(configuration2).when(SPY_bbInputSetup).createConfiguration(lookupKeyMap, instanceName, resourceId);
doNothing().when(SPY_bbInputSetup).mapCatalogConfiguration(configuration2, modelInfo, service,
configResourceKeys);
- SPY_bbInputSetup.populateConfiguration(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, instanceName, configResourceKeys, requestDetails);
+ SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration2, modelInfo, service,
configResourceKeys);
}
@@ -1387,8 +1385,8 @@ public class BBInputSetupTest {
doReturn(null).when(SPY_bbInputSetup).findConfigurationResourceCustomization(modelInfo, service);
doReturn(vnfc).when(SPY_bbInputSetup).getVnfcToConfiguration(vnfcName);
- SPY_bbInputSetup.populateConfiguration(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, instanceName, configResourceKeys, requestDetails);
+ SPY_bbInputSetup.populateConfiguration(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ instanceName, configResourceKeys, requestDetails);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(configuration, modelInfo, service,
configResourceKeys);
}
@@ -1433,15 +1431,15 @@ public class BBInputSetupTest {
new org.onap.so.db.catalog.beans.InstanceGroup();
doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any());
- SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
- bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
- SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
- bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
instanceName = "vnfName2";
@@ -1454,9 +1452,9 @@ public class BBInputSetupTest {
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, "genericVnfId2");
- SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
- bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
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);
@@ -1531,15 +1529,15 @@ public class BBInputSetupTest {
new org.onap.so.db.catalog.beans.InstanceGroup();
doReturn(catalogInstanceGroup).when(SPY_bbInputSetupUtils).getCatalogInstanceGroup(any());
- SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
- bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
- SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
- bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(vnf, modelInfo, service);
instanceName = "vnfName2";
@@ -1551,9 +1549,9 @@ public class BBInputSetupTest {
doReturn(vnf2AAI).when(SPY_bbInputSetupUtils).getAAIGenericVnf(vnf2.getVnfId());
doNothing().when(SPY_bbInputSetup).mapCatalogVnf(vnf2, modelInfo, service);
doNothing().when(SPY_bbInputSetup).mapNetworkCollectionInstanceGroup(vnf2, "{instanceGroupId}");
- SPY_bbInputSetup.populateGenericVnf(REQUEST_ID, modelInfo, instanceName, platform, lineOfBusiness, service,
- bbName, serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType,
- null, requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
+ SPY_bbInputSetup.populateGenericVnf(modelInfo, instanceName, platform, lineOfBusiness, service, bbName,
+ serviceInstance, lookupKeyMap, requestDetails.getRelatedInstanceList(), resourceId, vnfType, null,
+ requestDetails.getRequestInfo().getProductFamilyId(), applicationId);
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);
@@ -2007,14 +2005,14 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString());
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), any(String.class), isA(ModelInfo.class),
+ 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());
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString());
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateGenericVnf(any(String.class), isA(ModelInfo.class),
- any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class),
+ 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), any(String.class), any(),
any(String.class), any(String.class));
@@ -2023,17 +2021,17 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString());
executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateVfModule(any(String.class), isA(ModelInfo.class), isA(Service.class),
- any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class),
- any(), isA(CloudConfiguration.class), Mockito.anyBoolean());
+ 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());
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString());
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(any(String.class), isA(ModelInfo.class),
- isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class),
- ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), any(String.class), any());
+ verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class),
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(),
+ ArgumentMatchers.isNull(), any(String.class), any());
Configuration configuration = new Configuration();
configuration.setConfigurationId("configurationId");
@@ -2043,16 +2041,16 @@ public class BBInputSetupTest {
configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
doReturn(configurationCustList).when(service).getConfigurationCustomizations();
configurationCustList.add(configurationCust);
- doNothing().when(SPY_bbInputSetup).populateConfiguration(any(String.class), isA(ModelInfo.class),
- isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class),
- ArgumentMatchers.isNull(), isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
+ 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));
executeBB.getBuildingBlock().setBpmnFlowName("AssignFabricConfigurationBB");
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateConfiguration(any(String.class), isA(ModelInfo.class),
- isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class),
- ArgumentMatchers.isNull(), isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
+ 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));
}
@@ -2118,16 +2116,16 @@ public class BBInputSetupTest {
ConfigurationResourceCustomization configurationCust = new ConfigurationResourceCustomization();
configurationCust.setModelCustomizationUUID("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
configurationCustList.add(configurationCust);
- doNothing().when(SPY_bbInputSetup).populateConfiguration(any(String.class), isA(ModelInfo.class),
- isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class),
- ArgumentMatchers.isNull(), isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
+ 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));
executeBB.getBuildingBlock().setBpmnFlowName("AssignVrfConfigurationBB");
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
gBB = SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateConfiguration(any(String.class), isA(ModelInfo.class),
- isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class),
- ArgumentMatchers.isNull(), isA(ConfigurationResourceKeys.class), isA(RequestDetails.class));
+ 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));
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(),
@@ -2290,14 +2288,14 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString());
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), any(String.class), isA(ModelInfo.class),
+ 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());
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString());
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateGenericVnf(any(String.class), isA(ModelInfo.class),
- any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class),
+ 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(), ArgumentMatchers.isNull(), any(String.class),
ArgumentMatchers.isNull(), any(), any(String.class), any());
@@ -2306,17 +2304,17 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString());
executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateVfModule(any(String.class), isA(ModelInfo.class), isA(Service.class),
- any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class),
- any(), isA(CloudConfiguration.class), Mockito.anyBoolean());
+ 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());
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString());
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(any(String.class), isA(ModelInfo.class),
- isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class),
- ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), any());
+ verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class),
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(),
+ ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), any());
}
@Test
@@ -2355,14 +2353,14 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString());
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateL3Network(any(String.class), any(String.class), isA(ModelInfo.class),
+ 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());
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VNF.toString());
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateGenericVnf(any(String.class), isA(ModelInfo.class),
- any(String.class), isA(org.onap.so.serviceinstancebeans.Platform.class),
+ 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), any(String.class), any(),
any(String.class), any(String.class));
@@ -2371,17 +2369,17 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VF_MODULE.toString());
executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateVfModule(any(String.class), isA(ModelInfo.class), isA(Service.class),
- any(String.class), isA(ServiceInstance.class), any(), any(String.class), any(), any(String.class),
- any(), isA(CloudConfiguration.class), Mockito.anyBoolean());
+ 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());
lookupKeyMap.put(ResourceKey.GENERIC_VNF_ID, null);
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.VOLUME_GROUP.toString());
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
- verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(any(String.class), isA(ModelInfo.class),
- isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class),
- ArgumentMatchers.isNull(), ArgumentMatchers.isNull(), any(String.class), any());
+ verify(SPY_bbInputSetup, times(1)).populateVolumeGroup(isA(ModelInfo.class), isA(Service.class),
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), ArgumentMatchers.isNull(),
+ ArgumentMatchers.isNull(), any(String.class), any());
}
@Test
@@ -2459,8 +2457,8 @@ public class BBInputSetupTest {
doReturn("ab153b6e-c364-44c0-bef6-1f2982117f04").when(networkCust).getModelCustomizationUUID();
networkCustList.add(networkCust);
doReturn(networkCustList).when(service).getNetworkCustomizations();
- doNothing().when(SPY_bbInputSetup).populateL3Network(any(String.class), any(), isA(ModelInfo.class),
- isA(Service.class), any(String.class), isA(ServiceInstance.class), any(), any(String.class), any());
+ doNothing().when(SPY_bbInputSetup).populateL3Network(any(), isA(ModelInfo.class), isA(Service.class),
+ any(String.class), isA(ServiceInstance.class), any(), any(String.class), any());
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString());
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
@@ -2985,8 +2983,8 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
isA(Service.class), isA(String.class));
- SPY_bbInputSetup.populateVfModule(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, relatedInstanceList, instanceName, instanceParams, cloudConfiguration, false);
+ SPY_bbInputSetup.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ relatedInstanceList, instanceName, instanceParams, cloudConfiguration, false);
verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
isA(Service.class), isA(String.class));
@@ -3054,8 +3052,8 @@ public class BBInputSetupTest {
doNothing().when(SPY_bbInputSetup).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
isA(Service.class), isA(String.class));
- SPY_bbInputSetup.populateVfModule(REQUEST_ID, modelInfo, service, bbName, serviceInstance, lookupKeyMap,
- resourceId, relatedInstanceList, instanceName, instanceParams, cloudConfiguration, true);
+ SPY_bbInputSetup.populateVfModule(modelInfo, service, bbName, serviceInstance, lookupKeyMap, resourceId,
+ relatedInstanceList, instanceName, instanceParams, cloudConfiguration, true);
verify(SPY_bbInputSetup, times(3)).mapCatalogVfModule(isA(VfModule.class), isA(ModelInfo.class),
isA(Service.class), isA(String.class));
@@ -3082,18 +3080,4 @@ public class BBInputSetupTest {
vnfc = SPY_bbInputSetup.getVnfcToConfiguration(vnfcName);
Assert.assertNotNull(vnfc);
}
-
- @Test
- public void updateInstanceNameTest() {
- InfraActiveRequests request = new InfraActiveRequests();
- request.setRequestId(REQUEST_ID);
-
- when(requestsDbClient.getInfraActiveRequestbyRequestId(REQUEST_ID)).thenReturn(request);
- SPY_bbInputSetup.updateInstanceName(REQUEST_ID, ModelType.service, "instanceName");
-
- verify(requestsDbClient).updateInfraActiveRequests(request);
- assertEquals("instanceName", request.getServiceInstanceName());
- }
-
-
}
diff --git a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn
index f9c5d0cdb3..930f666bf0 100644
--- a/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn
+++ b/bpmn/so-bpmn-building-blocks/src/main/resources/subprocess/BuildingBlock/AssignPnfBB.bpmn
@@ -11,8 +11,8 @@
<bpmn:startEvent id="AssignPnf_StartEvent">
<bpmn:outgoing>SequenceFlow_1fu9o4x</bpmn:outgoing>
</bpmn:startEvent>
- <bpmn:serviceTask id="CheckAaiForPnfCorrelationId" name="Check AAI for pnf_correlation_id" camunda:delegateExpression="${CheckAaiForPnfCorrelationIdDelegate}">
- <bpmn:incoming>SequenceFlow_02j05kk</bpmn:incoming>
+ <bpmn:serviceTask id="CheckAaiForPnfCorrelationId" name="Check AAI for pnf_correlation_id" camunda:expression="${CheckAaiForPnfCorrelationId.execute(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
+ <bpmn:incoming>SequenceFlow_1fu9o4x</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_081rs5d</bpmn:outgoing>
</bpmn:serviceTask>
<bpmn:exclusiveGateway id="DoesAaiContainInfoAboutPnf" name="Does AAI contain info about pnf?">
@@ -20,7 +20,7 @@
<bpmn:outgoing>SequenceFlow_0fn5kgz</bpmn:outgoing>
<bpmn:outgoing>SequenceFlow_1ewfz8r</bpmn:outgoing>
</bpmn:exclusiveGateway>
- <bpmn:serviceTask id="CreatePnfEntryInAai" name="Create Pnf entry in AAI" camunda:delegateExpression="${CreatePnfEntryInAaiDelegate}">
+ <bpmn:serviceTask id="CreatePnfEntryInAai" name="Create Pnf entry in AAI" camunda:expression="${CreatePnfEntryInAai.execute(InjectExecution.execute(execution, execution.getVariable(&#34;gBuildingBlockExecution&#34;)))}">
<bpmn:incoming>SequenceFlow_0fn5kgz</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_0l6rtzy</bpmn:outgoing>
</bpmn:serviceTask>
@@ -36,12 +36,7 @@
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{aaiContainsInfoAboutPnf}</bpmn:conditionExpression>
</bpmn:sequenceFlow>
<bpmn:sequenceFlow id="SequenceFlow_0l6rtzy" sourceRef="CreatePnfEntryInAai" targetRef="AaiEntryExists" />
- <bpmn:serviceTask id="CheckInputs" name="Check Inputs" camunda:delegateExpression="${AssignPnfInputsCheckerDelegate}">
- <bpmn:incoming>SequenceFlow_1fu9o4x</bpmn:incoming>
- <bpmn:outgoing>SequenceFlow_02j05kk</bpmn:outgoing>
- </bpmn:serviceTask>
- <bpmn:sequenceFlow id="SequenceFlow_02j05kk" sourceRef="CheckInputs" targetRef="CheckAaiForPnfCorrelationId" />
- <bpmn:sequenceFlow id="SequenceFlow_1fu9o4x" sourceRef="AssignPnf_StartEvent" targetRef="CheckInputs" />
+ <bpmn:sequenceFlow id="SequenceFlow_1fu9o4x" sourceRef="AssignPnf_StartEvent" targetRef="CheckAaiForPnfCorrelationId" />
<bpmn:textAnnotation id="TextAnnotation_184cxp4">
<bpmn:text>Inputs:
- pnfCorrelationId - String
@@ -121,16 +116,9 @@
<di:waypoint x="1020" y="287" />
<di:waypoint x="1152" y="287" />
</bpmndi:BPMNEdge>
- <bpmndi:BPMNShape id="ServiceTask_0tv92eb_di" bpmnElement="CheckInputs">
- <dc:Bounds x="400" y="247" width="100" height="80" />
- </bpmndi:BPMNShape>
- <bpmndi:BPMNEdge id="SequenceFlow_02j05kk_di" bpmnElement="SequenceFlow_02j05kk">
- <di:waypoint x="500" y="287" />
- <di:waypoint x="640" y="287" />
- </bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1fu9o4x_di" bpmnElement="SequenceFlow_1fu9o4x">
<di:waypoint x="255" y="287" />
- <di:waypoint x="400" y="287" />
+ <di:waypoint x="640" y="287" />
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AssignPnfInputsCheckerDelegate.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AssignPnfInputsCheckerDelegate.java
deleted file mode 100644
index 9176948288..0000000000
--- a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AssignPnfInputsCheckerDelegate.java
+++ /dev/null
@@ -1,40 +0,0 @@
-package org.onap.so.bpmn.infrastructure.pnf.delegate;
-
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_UUID;
-import com.google.common.base.Strings;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.camunda.bpm.engine.delegate.JavaDelegate;
-import org.onap.so.bpmn.common.scripts.ExceptionUtil;
-import org.springframework.stereotype.Component;
-
-@Component
-public class AssignPnfInputsCheckerDelegate implements JavaDelegate {
-
- public static final String UUID_REGEX =
- "(?i)^[0-9a-f]{8}-[0-9a-f]{4}-[1-5]{1}[0-9a-f]{3}-[89ab]{1}[0-9a-f]{3}-[0-9a-f]{12}$";
-
- @Override
- public void execute(DelegateExecution execution) {
- validatePnfCorrelationId(execution);
- validatePnfUuid(execution);
- }
-
- private void validatePnfCorrelationId(DelegateExecution execution) {
- String pnfCorrelationId = (String) execution.getVariable(PNF_CORRELATION_ID);
- if (Strings.isNullOrEmpty(pnfCorrelationId)) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999,
- "pnfCorrelationId variable not defined");
- }
- }
-
- private void validatePnfUuid(DelegateExecution execution) {
- String pnfUuid = (String) execution.getVariable(PNF_UUID);
- if (Strings.isNullOrEmpty(pnfUuid)) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid variable not defined");
- }
- if (!pnfUuid.matches(UUID_REGEX)) {
- new ExceptionUtil().buildAndThrowWorkflowException(execution, 9999, "pnfUuid is not a valid UUID");
- }
- }
-}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CheckAaiForPnfCorrelationId.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CheckAaiForPnfCorrelationId.java
new file mode 100644
index 0000000000..29914252d8
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CheckAaiForPnfCorrelationId.java
@@ -0,0 +1,45 @@
+package org.onap.so.bpmn.infrastructure.pnf.tasks;
+
+import joptsimple.internal.Strings;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import java.io.IOException;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
+
+@Component
+public class CheckAaiForPnfCorrelationId extends PnfBaseTasks {
+ private static final Logger logger = LoggerFactory.getLogger(CheckAaiForPnfCorrelationId.class);
+
+ @Override
+ public void execute(BuildingBlockExecution execution) {
+ try {
+ String pnfCorrelationId = extractPnf(execution).getPnfName();
+ checkIfPnfCorrelationIdPresent(execution, pnfCorrelationId);
+ checkIfPnfExistsInAai(execution, pnfCorrelationId);
+ } catch (BBObjectNotFoundException e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
+ }
+
+ }
+
+ private void checkIfPnfCorrelationIdPresent(BuildingBlockExecution execution, String pnfCorrelationId) {
+ if (Strings.isNullOrEmpty(pnfCorrelationId)) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 500, PNF_CORRELATION_ID + " is not set");
+ }
+ }
+
+ private void checkIfPnfExistsInAai(BuildingBlockExecution execution, String pnfCorrelationId) {
+ try {
+ boolean isEntry = pnfManagement.getEntryFor(pnfCorrelationId).isPresent();
+ logger.debug("AAI entry is found for pnf correlation id {}: {}", PNF_CORRELATION_ID, isEntry);
+ execution.setVariable(AAI_CONTAINS_INFO_ABOUT_PNF, isEntry);
+ } catch (IOException e) {
+ logger.error("Exception in check AAI for pnf_correlation_id execution", e);
+ exceptionUtil.buildAndThrowWorkflowException(execution, 9999, e);
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CreatePnfEntryInAai.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CreatePnfEntryInAai.java
new file mode 100644
index 0000000000..6e86ad619e
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CreatePnfEntryInAai.java
@@ -0,0 +1,34 @@
+package org.onap.so.bpmn.infrastructure.pnf.tasks;
+
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+
+@Component
+public class CreatePnfEntryInAai extends PnfBaseTasks {
+ private static final Logger logger = LoggerFactory.getLogger(CreatePnfEntryInAai.class);
+
+ @Override
+ public void execute(BuildingBlockExecution execution) throws Exception {
+ try {
+ org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf = extractPnf(execution);
+ String pnfCorrelationId = pnf.getPnfName();
+ pnfManagement.createEntry(pnfCorrelationId, preparePnfForAai(pnf));
+ logger.debug("AAI entry is created for pnf correlation id: {}, pnf uuid: {}", pnfCorrelationId,
+ pnf.getPnfId());
+ } catch (BBObjectNotFoundException e) {
+ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, e);
+ }
+ }
+
+ private Pnf preparePnfForAai(org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf) {
+ Pnf pnfAai = new Pnf();
+ pnfAai.setPnfId(pnf.getPnfId());
+ pnfAai.setPnfName(pnf.getPnfName());
+ return pnfAai;
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/PnfBaseTasks.java b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/PnfBaseTasks.java
new file mode 100644
index 0000000000..d8e3379afb
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/java/org/onap/so/bpmn/infrastructure/pnf/tasks/PnfBaseTasks.java
@@ -0,0 +1,29 @@
+package org.onap.so.bpmn.infrastructure.pnf.tasks;
+
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.BBObjectNotFoundException;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.springframework.beans.factory.annotation.Autowired;
+
+public abstract class PnfBaseTasks {
+ protected PnfManagement pnfManagement;
+ @Autowired
+ protected ExceptionBuilder exceptionUtil;
+ @Autowired
+ protected ExtractPojosForBB extractPojosForBB;
+
+ @Autowired
+ public void setPnfManagement(PnfManagement pnfManagement) {
+ this.pnfManagement = pnfManagement;
+ }
+
+ public abstract void execute(BuildingBlockExecution execution) throws Exception;
+
+ protected Pnf extractPnf(BuildingBlockExecution execution) throws BBObjectNotFoundException {
+ return extractPojosForBB.extractByKey(execution, ResourceKey.PNF);
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AssignPnfInputsCheckerDelegateTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AssignPnfInputsCheckerDelegateTest.java
deleted file mode 100644
index a562da490b..0000000000
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/AssignPnfInputsCheckerDelegateTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-package org.onap.so.bpmn.infrastructure.pnf.delegate;
-
-import org.apache.commons.lang3.StringUtils;
-import org.camunda.bpm.engine.delegate.BpmnError;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.junit.Before;
-import org.junit.Test;
-import static org.assertj.core.api.Assertions.assertThatThrownBy;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfInputCheckersTestUtils.DelegateExecutionBuilder;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfInputCheckersTestUtils.RESERVED_UUID;
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfInputCheckersTestUtils.VALID_UUID;
-
-public class AssignPnfInputsCheckerDelegateTest {
-
- private DelegateExecutionBuilder delegateExecutionBuilder;
- private AssignPnfInputsCheckerDelegate testedObject;
- private DelegateExecution execution;
-
- @Before
- public void setUp() {
- testedObject = new AssignPnfInputsCheckerDelegate();
- delegateExecutionBuilder = new DelegateExecutionBuilder();
- }
-
- @Test
- public void shouldThrowException_whenPnfCorrelationIdNotSet() {
- execution = delegateExecutionBuilder.setPnfCorrelationId(null).setPnfUuid(VALID_UUID).build();
- assertThatSutExecutionThrowsExceptionOfInstance(BpmnError.class);
- }
-
- @Test
- public void shouldThrowException_whenPnfUuidIsNotSet() {
- execution = delegateExecutionBuilder.setPnfUuid(null).build();
- assertThatSutExecutionThrowsExceptionOfInstance(BpmnError.class);
- }
-
- @Test
- public void shouldThrowException_whenPnfUuidIsEmptyString() {
- execution = delegateExecutionBuilder.setPnfUuid(StringUtils.EMPTY).build();
- assertThatSutExecutionThrowsExceptionOfInstance(BpmnError.class);
- }
-
- @Test
- public void shouldThrowException_whenPnfUuidIsReservedUuid() {
- execution = delegateExecutionBuilder.setPnfUuid(RESERVED_UUID).build();
- assertThatSutExecutionThrowsExceptionOfInstance(BpmnError.class);
- }
-
- private void assertThatSutExecutionThrowsExceptionOfInstance(Class<?> type) {
- assertThatThrownBy(() -> testedObject.execute(execution)).isInstanceOf(type);
- }
-}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfInputCheckersTestUtils.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfInputCheckersTestUtils.java
deleted file mode 100644
index c1c7f06d4e..0000000000
--- a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/delegate/PnfInputCheckersTestUtils.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package org.onap.so.bpmn.infrastructure.pnf.delegate;
-
-import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.*;
-import org.camunda.bpm.engine.delegate.DelegateExecution;
-import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
-import java.util.UUID;
-
-
-public class PnfInputCheckersTestUtils {
-
- static final String PNF_ENTRY_NOTIFICATION_TIMEOUT = "P1D";
- static final String VALID_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString();
- static final String RESERVED_UUID = new UUID(0, 0).toString();
- private static final String DEFAULT_SERVICE_INSTANCE_ID = "da7d07d9-b71c-4128-809d-2ec01c807169";
- private static final String DEFAULT_PNF_CORRELATION_ID = "testPnfCorrelationId";
-
- static class DelegateExecutionBuilder {
- private String pnfCorrelationId = DEFAULT_PNF_CORRELATION_ID;
- private String pnfUuid = VALID_UUID;
- private String serviceInstanceId = DEFAULT_SERVICE_INSTANCE_ID;
-
- public DelegateExecutionBuilder setPnfCorrelationId(String pnfCorrelationId) {
- this.pnfCorrelationId = pnfCorrelationId;
- return this;
- }
-
- public DelegateExecutionBuilder setPnfUuid(String pnfUuid) {
- this.pnfUuid = pnfUuid;
- return this;
- }
-
- public DelegateExecutionBuilder setServiceInstanceId(String serviceInstanceId) {
- this.serviceInstanceId = serviceInstanceId;
- return this;
- }
-
- public DelegateExecution build() {
- DelegateExecution execution = new DelegateExecutionFake();
- execution.setVariable("testProcessKey", "testProcessKeyValue");
- execution.setVariable(PNF_CORRELATION_ID, this.pnfCorrelationId);
- execution.setVariable(PNF_UUID, this.pnfUuid);
- execution.setVariable(SERVICE_INSTANCE_ID, this.serviceInstanceId);
- return execution;
- }
- }
-}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CheckAaiForPnfCorrelationIdTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CheckAaiForPnfCorrelationIdTest.java
new file mode 100644
index 0000000000..3fa9fbf3b5
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CheckAaiForPnfCorrelationIdTest.java
@@ -0,0 +1,129 @@
+package org.onap.so.bpmn.infrastructure.pnf.tasks;
+
+import org.camunda.bpm.engine.delegate.BpmnError;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.experimental.runners.Enclosed;
+import org.junit.rules.ExpectedException;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl;
+import org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementThrowingException;
+import org.onap.so.bpmn.infrastructure.pnf.management.PnfManagement;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import org.onap.so.client.exception.ExceptionBuilder;
+import java.io.IOException;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.anyInt;
+import static org.mockito.Mockito.anyString;
+import static org.mockito.Mockito.doThrow;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.AAI_CONTAINS_INFO_ABOUT_PNF;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.ExecutionVariableNames.PNF_CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITHOUT_ENTRY;
+import static org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl.ID_WITH_ENTRY;
+import static org.onap.so.bpmn.infrastructure.pnf.tasks.PnfTasksUtils.PNF_UUID;
+import static org.onap.so.bpmn.infrastructure.pnf.tasks.PnfTasksUtils.preparePnf;
+
+@RunWith(Enclosed.class)
+public class CheckAaiForPnfCorrelationIdTest {
+
+ @RunWith(MockitoJUnitRunner.class)
+ public static class ConnectionOkTests {
+
+ @Mock
+ private ExtractPojosForBB extractPojosForBB;
+ @Mock
+ private ExceptionBuilder exceptionUtil;
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @InjectMocks
+ private CheckAaiForPnfCorrelationId task = new CheckAaiForPnfCorrelationId();
+ private PnfManagement pnfManagementTest = new PnfManagementTestImpl();
+
+ @Before
+ public void setUp() {
+ task.setPnfManagement(pnfManagementTest);
+ }
+
+ @Test
+ public void shouldThrowExceptionWhenPnfCorrelationIdIsNotSet() throws Exception {
+ // given
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.PNF))).thenReturn(preparePnf(null, PNF_UUID));
+ BuildingBlockExecution execution = mock(BuildingBlockExecution.class);
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(eq(execution),
+ anyInt(), anyString());
+ // when, then
+ expectedException.expect(BpmnError.class);
+ task.execute(execution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(eq(execution), anyInt(), anyString());
+ }
+
+ @Test
+ public void shouldSetCorrectVariablesWhenAaiDoesNotContainInfoAboutPnf() throws Exception {
+ // given
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.PNF)))
+ .thenReturn(preparePnf(ID_WITHOUT_ENTRY, PNF_UUID));
+ BuildingBlockExecution execution = mock(BuildingBlockExecution.class);
+ // when
+ task.execute(execution);
+ // then
+ verify(execution).setVariable(AAI_CONTAINS_INFO_ABOUT_PNF, false);
+ }
+
+ @Test
+ public void shouldSetCorrectVariablesWhenAaiContainsInfoAboutPnfWithoutIp() throws Exception {
+ // given
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.PNF)))
+ .thenReturn(preparePnf(ID_WITH_ENTRY, PNF_UUID));
+ BuildingBlockExecution execution = mock(BuildingBlockExecution.class);
+ // when
+ task.execute(execution);
+ // then
+ verify(execution).setVariable(AAI_CONTAINS_INFO_ABOUT_PNF, true);
+ }
+ }
+
+ @RunWith(MockitoJUnitRunner.class)
+ public static class NoConnectionTests {
+
+ @Mock
+ private ExtractPojosForBB extractPojosForBB;
+ @Mock
+ private ExceptionBuilder exceptionUtil;
+ @Rule
+ public ExpectedException expectedException = ExpectedException.none();
+
+ @InjectMocks
+ private CheckAaiForPnfCorrelationId task = new CheckAaiForPnfCorrelationId();
+ private PnfManagement pnfManagementTest = new PnfManagementThrowingException();
+
+ @Before
+ public void setUp() throws Exception {
+ task.setPnfManagement(pnfManagementTest);
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.PNF)))
+ .thenReturn(preparePnf(PNF_CORRELATION_ID, PNF_UUID));
+ }
+
+ @Test
+ public void shouldThrowExceptionWhenIoExceptionOnConnectionToAai() {
+ // given
+ BuildingBlockExecution execution = mock(BuildingBlockExecution.class);
+ doThrow(new BpmnError("BPMN Error")).when(exceptionUtil).buildAndThrowWorkflowException(eq(execution),
+ anyInt(), any(IOException.class));
+ // when, then
+ expectedException.expect(BpmnError.class);
+ task.execute(execution);
+ verify(exceptionUtil).buildAndThrowWorkflowException(eq(execution), anyInt(), any(IOException.class));
+ }
+ }
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CreatePnfEntryInAaiTest.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CreatePnfEntryInAaiTest.java
new file mode 100644
index 0000000000..ed8dd82efb
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/CreatePnfEntryInAaiTest.java
@@ -0,0 +1,50 @@
+package org.onap.so.bpmn.infrastructure.pnf.tasks;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.InjectMocks;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+import org.onap.aai.domain.yang.Pnf;
+import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.infrastructure.pnf.delegate.PnfManagementTestImpl;
+import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
+import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.when;
+import static org.onap.so.bpmn.infrastructure.pnf.tasks.PnfTasksUtils.PNF_CORRELATION_ID;
+import static org.onap.so.bpmn.infrastructure.pnf.tasks.PnfTasksUtils.PNF_UUID;
+import static org.onap.so.bpmn.infrastructure.pnf.tasks.PnfTasksUtils.preparePnf;
+
+@RunWith(MockitoJUnitRunner.class)
+public class CreatePnfEntryInAaiTest {
+
+ @Mock
+ private ExtractPojosForBB extractPojosForBB;
+ @InjectMocks
+ private CreatePnfEntryInAai task = new CreatePnfEntryInAai();
+ private PnfManagementTestImpl pnfManagementTest = new PnfManagementTestImpl();
+
+ @Before
+ public void setUp() throws Exception {
+ task.setPnfManagement(pnfManagementTest);
+ when(extractPojosForBB.extractByKey(any(), eq(ResourceKey.PNF)))
+ .thenReturn(preparePnf(PNF_CORRELATION_ID, PNF_UUID));
+ }
+
+ @Test
+ public void shouldSetPnfIdAndPnfName() throws Exception {
+ // when
+ task.execute(mock(BuildingBlockExecution.class));
+ // then
+ Pnf createdEntry = pnfManagementTest.getCreated().get(PNF_CORRELATION_ID);
+ assertThat(createdEntry.getPnfId()).isEqualTo(PNF_UUID);
+ assertThat(createdEntry.getPnfName()).isEqualTo(PNF_CORRELATION_ID);
+ assertThat(createdEntry.isInMaint()).isNull();
+ }
+
+}
diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/PnfTasksUtils.java b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/PnfTasksUtils.java
new file mode 100644
index 0000000000..49fe96c3d9
--- /dev/null
+++ b/bpmn/so-bpmn-infrastructure-common/src/test/java/org/onap/so/bpmn/infrastructure/pnf/tasks/PnfTasksUtils.java
@@ -0,0 +1,17 @@
+package org.onap.so.bpmn.infrastructure.pnf.tasks;
+
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf;
+import java.util.UUID;
+
+public class PnfTasksUtils {
+ static final String PNF_UUID = UUID.nameUUIDFromBytes("testUuid".getBytes()).toString();
+ static final String PNF_CORRELATION_ID = "testPnfCorrelationId";
+
+ public static Pnf preparePnf(String pnfName, String pnfUuid) {
+ Pnf pnf = new Pnf();
+ pnf.setPnfName(pnfName);
+ pnf.setPnfId(pnfUuid);
+ return pnf;
+ }
+
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
index 39aa9d6c41..9d45272a60 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java
@@ -23,10 +23,17 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import java.util.UUID;
import javax.persistence.EntityNotFoundException;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.InstanceGroup;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.VfModule;
import org.onap.aai.domain.yang.Vnfc;
+import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.bpmn.common.DelegateExecutionImpl;
import org.onap.so.bpmn.common.listener.db.RequestsDbListenerRunner;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
@@ -357,6 +364,8 @@ public class WorkflowActionBBTasks {
} else if (resourceType == WorkflowType.INSTANCE_GROUP) {
request.setInstanceGroupId(resourceId);
}
+ setInstanceName(resourceId, resourceType, request);
+ request.setLastModifiedBy("CamundaBPMN");
requestDbclient.updateInfraActiveRequests(request);
} catch (Exception ex) {
logger.error("Exception in updateInstanceId", ex);
@@ -461,4 +470,50 @@ public class WorkflowActionBBTasks {
configBB.setConfigurationResourceKeys(configurationResourceKeys);
return configBB;
}
+
+ protected void setInstanceName(String resourceId, WorkflowType resourceType, InfraActiveRequests request) {
+ logger.debug("Setting instanceName in infraActiveRequest");
+ try {
+ if (resourceType == WorkflowType.SERVICE && request.getServiceInstanceName() == null) {
+ ServiceInstance service = bbInputSetupUtils.getAAIServiceInstanceById(resourceId);
+ if (service != null) {
+ request.setServiceInstanceName(service.getServiceInstanceName());
+ }
+ } else if (resourceType == WorkflowType.VNF && request.getVnfName() == null) {
+ GenericVnf vnf = bbInputSetupUtils.getAAIGenericVnf(resourceId);
+ if (vnf != null) {
+ request.setVnfName(vnf.getVnfName());
+ }
+ } else if (resourceType == WorkflowType.VFMODULE && request.getVfModuleName() == null) {
+ VfModule vfModule = bbInputSetupUtils.getAAIVfModule(request.getVnfId(), resourceId);
+ if (vfModule != null) {
+ request.setVfModuleName(vfModule.getVfModuleName());
+ }
+ } else if (resourceType == WorkflowType.VOLUMEGROUP && request.getVolumeGroupName() == null) {
+ Optional<VolumeGroup> volumeGroup =
+ bbInputSetupUtils.getRelatedVolumeGroupByIdFromVnf(request.getVnfId(), resourceId);
+ if (volumeGroup.isPresent()) {
+ request.setVolumeGroupName(volumeGroup.get().getVolumeGroupName());
+ }
+ } else if (resourceType == WorkflowType.NETWORK && request.getNetworkName() == null) {
+ L3Network network = bbInputSetupUtils.getAAIL3Network(resourceId);
+ if (network != null) {
+ request.setNetworkName(network.getNetworkName());
+ }
+ } else if (resourceType == WorkflowType.CONFIGURATION && request.getConfigurationName() == null) {
+ org.onap.aai.domain.yang.Configuration configuration =
+ bbInputSetupUtils.getAAIConfiguration(resourceId);
+ if (configuration != null) {
+ request.setConfigurationName(configuration.getConfigurationName());
+ }
+ } else if (resourceType == WorkflowType.INSTANCE_GROUP && request.getInstanceGroupName() == null) {
+ InstanceGroup instanceGroup = bbInputSetupUtils.getAAIInstanceGroup(resourceId);
+ if (instanceGroup != null) {
+ request.setInstanceGroupName(instanceGroup.getInstanceGroupName());
+ }
+ }
+ } catch (Exception ex) {
+ logger.error("Exception in setInstanceName", ex);
+ }
+ }
}
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
index ac7d82cd51..4991fa59ee 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasksTest.java
@@ -21,14 +21,18 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertThat;
+import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs;
import static org.mockito.ArgumentMatchers.anyObject;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.ArgumentMatchers.isA;
import static org.mockito.Mockito.doNothing;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.when;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
+import java.util.Optional;
import org.camunda.bpm.engine.delegate.BpmnError;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.camunda.bpm.extension.mockito.delegate.DelegateExecutionFake;
@@ -40,17 +44,25 @@ import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.Spy;
+import org.onap.aai.domain.yang.Configuration;
import org.onap.aai.domain.yang.GenericVnf;
+import org.onap.aai.domain.yang.InstanceGroup;
+import org.onap.aai.domain.yang.L3Network;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.VfModule;
+import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.listener.flowmanipulator.FlowManipulatorListenerRunner;
import org.onap.so.bpmn.core.WorkflowException;
import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
-import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.db.catalog.beans.VnfResourceCustomization;
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.ModelType;
import org.onap.so.serviceinstancebeans.RequestDetails;
+import org.onap.so.serviceinstancebeans.RequestInfo;
import org.springframework.core.env.Environment;
public class WorkflowActionBBTasksTest extends BaseTaskTest {
@@ -479,5 +491,98 @@ public class WorkflowActionBBTasksTest extends BaseTaskTest {
assertEquals(workflowActionBBTasks.getConfigurationId(vnfc), "configurationId");
}
+ @Test
+ public void setServiceInstanceNameTest() {
+ String resourceId = "40bc4ebd-11df-4610-8055-059f7441ec1c";
+ WorkflowType resourceType = WorkflowType.SERVICE;
+ InfraActiveRequests request = new InfraActiveRequests();
+ ServiceInstance service = new ServiceInstance();
+ service.setServiceInstanceName("serviceInstanceName");
+ doReturn(service).when(bbSetupUtils).getAAIServiceInstanceById(resourceId);
+
+ workflowActionBBTasks.setInstanceName(resourceId, resourceType, request);
+ assertEquals("serviceInstanceName", request.getServiceInstanceName());
+ }
+
+ @Test
+ public void setVnfNameTest() {
+ String resourceId = "40bc4ebd-11df-4610-8055-059f7441ec1c";
+ WorkflowType resourceType = WorkflowType.VNF;
+ InfraActiveRequests request = new InfraActiveRequests();
+ GenericVnf vnf = new GenericVnf();
+ vnf.setVnfName("vnfName");
+ doReturn(vnf).when(bbSetupUtils).getAAIGenericVnf(resourceId);
+
+ workflowActionBBTasks.setInstanceName(resourceId, resourceType, request);
+ assertEquals("vnfName", request.getVnfName());
+ }
+ @Test
+ public void setVfModuleNameTest() {
+ String resourceId = "40bc4ebd-11df-4610-8055-059f7441ec1c";
+ WorkflowType resourceType = WorkflowType.VFMODULE;
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setVnfId("ae5cc3e8-c13c-4d88-aaf6-694ab4977b0e");
+ VfModule vfModule = new VfModule();
+ vfModule.setVfModuleName("vfModuleName");
+ doReturn(vfModule).when(bbSetupUtils).getAAIVfModule("ae5cc3e8-c13c-4d88-aaf6-694ab4977b0e", resourceId);
+
+ workflowActionBBTasks.setInstanceName(resourceId, resourceType, request);
+ assertEquals("vfModuleName", request.getVfModuleName());
+ }
+
+ @Test
+ public void setNetworkNameTest() {
+ String resourceId = "40bc4ebd-11df-4610-8055-059f7441ec1c";
+ WorkflowType resourceType = WorkflowType.NETWORK;
+ InfraActiveRequests request = new InfraActiveRequests();
+ L3Network network = new L3Network();
+ network.setNetworkName("networkName");
+ doReturn(network).when(bbSetupUtils).getAAIL3Network(resourceId);
+
+ workflowActionBBTasks.setInstanceName(resourceId, resourceType, request);
+ assertEquals("networkName", request.getNetworkName());
+ }
+
+ @Test
+ public void setConfigurationNameTest() {
+ String resourceId = "40bc4ebd-11df-4610-8055-059f7441ec1c";
+ WorkflowType resourceType = WorkflowType.CONFIGURATION;
+ InfraActiveRequests request = new InfraActiveRequests();
+ Configuration configuration = new Configuration();
+ configuration.setConfigurationName("configurationName");
+ doReturn(configuration).when(bbSetupUtils).getAAIConfiguration(resourceId);
+
+ workflowActionBBTasks.setInstanceName(resourceId, resourceType, request);
+ assertEquals("configurationName", request.getConfigurationName());
+ }
+
+ @Test
+ public void setInstanceGroupNameTest() {
+ String resourceId = "40bc4ebd-11df-4610-8055-059f7441ec1c";
+ WorkflowType resourceType = WorkflowType.INSTANCE_GROUP;
+ InfraActiveRequests request = new InfraActiveRequests();
+ InstanceGroup instanceGroup = new InstanceGroup();
+ instanceGroup.setInstanceGroupName("instanceGroupName");
+ doReturn(instanceGroup).when(bbSetupUtils).getAAIInstanceGroup(resourceId);
+
+ workflowActionBBTasks.setInstanceName(resourceId, resourceType, request);
+ assertEquals("instanceGroupName", request.getInstanceGroupName());
+ }
+
+ @Test
+ public void setVolumeGroupNameTest() {
+ String resourceId = "40bc4ebd-11df-4610-8055-059f7441ec1c";
+ WorkflowType resourceType = WorkflowType.VOLUMEGROUP;
+ InfraActiveRequests request = new InfraActiveRequests();
+ request.setVnfId("4aa72c90-21eb-4465-8847-997e27af6c3e");
+ VolumeGroup volumeGroup = new VolumeGroup();
+ volumeGroup.setVolumeGroupName("volumeGroupName");
+ Optional<VolumeGroup> returnVolumeGroup = Optional.of(volumeGroup);
+
+ doReturn(returnVolumeGroup).when(bbSetupUtils).getRelatedVolumeGroupByIdFromVnf(request.getVnfId(), resourceId);
+ workflowActionBBTasks.setInstanceName(resourceId, resourceType, request);
+
+ assertEquals("volumeGroupName", request.getVolumeGroupName());
+ }
}