aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
authorRob Daugherty <rd472p@att.com>2018-12-10 18:54:03 +0000
committerGerrit Code Review <gerrit@onap.org>2018-12-10 18:54:03 +0000
commit7b4e6cdf88873d0365b5ccf640f0e087203cded3 (patch)
tree20d979431242cf4c1cc6356c03b69f79c5f4a1d2 /bpmn
parenta578bc0b7df6ec2de62bc1fbd29dea387977b97a (diff)
parentcbd7aba7d3ab278e50afdd3c11a468a10766a828 (diff)
Merge "fix execute and workflow layers for recreate"
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java51
-rw-r--r--bpmn/MSOCommonBPMN/src/test/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupTest.java85
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java20
3 files changed, 102 insertions, 54 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 4be2f030b1..b794e4174b 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
@@ -890,8 +890,20 @@ public class BBInputSetup implements JavaDelegate {
throws Exception {
String bbName = executeBB.getBuildingBlock().getBpmnFlowName();
String key = executeBB.getBuildingBlock().getKey();
+
+ if (requestAction.equalsIgnoreCase("deleteInstance")
+ || requestAction.equalsIgnoreCase("unassignInstance")
+ || requestAction.equalsIgnoreCase("activateInstance")
+ || requestAction.equalsIgnoreCase("activateFabricConfiguration")
+ || requestAction.equalsIgnoreCase("recreateInstance")
+ || requestAction.equalsIgnoreCase("replaceInstance")) {
+ return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, requestAction,
+ requestDetails.getCloudConfiguration());
+ }
+
+ String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
GeneralBuildingBlock gBB = this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction,
- resourceId);
+ serviceInstanceId);
RequestParameters requestParams = requestDetails.getRequestParameters();
Service service = null;
if (gBB != null && gBB.getServiceInstance() != null
@@ -914,16 +926,10 @@ public class BBInputSetup implements JavaDelegate {
if (requestAction.equalsIgnoreCase("deactivateInstance")) {
return gBB;
} else if (requestAction.equalsIgnoreCase("createInstance")) {
- return getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, bbName, key, gBB, service);
- } else if (requestAction.equalsIgnoreCase("deleteInstance")
- || requestAction.equalsIgnoreCase("unassignInstance")
- || requestAction.equalsIgnoreCase("activateInstance")
- || requestAction.equalsIgnoreCase("activateFabricConfiguration")) {
- return getGBBMacroExistingService(executeBB, lookupKeyMap, bbName, gBB, service, requestAction,
- requestDetails.getCloudConfiguration());
+ return getGBBMacroNoUserParamsCreate(executeBB, lookupKeyMap, bbName, key, gBB, service);
} else {
- throw new IllegalArgumentException(
- "No user params on requestAction: assignInstance. Please specify user params.");
+ throw new IllegalArgumentException(
+ "No user params on requestAction: assignInstance. Please specify user params.");
}
}
@@ -995,8 +1001,27 @@ public class BBInputSetup implements JavaDelegate {
}
protected GeneralBuildingBlock getGBBMacroExistingService(ExecuteBuildingBlock executeBB,
- Map<ResourceKey, String> lookupKeyMap, String bbName, GeneralBuildingBlock gBB, Service service,
- String requestAction, CloudConfiguration cloudConfiguration) throws Exception {
+ Map<ResourceKey, String> lookupKeyMap, String bbName, String requestAction, CloudConfiguration cloudConfiguration) throws Exception {
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = null;
+ String serviceInstanceId = lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID);
+ RequestDetails requestDetails = executeBB.getRequestDetails();
+ GeneralBuildingBlock gBB = null;
+ if (serviceInstanceId != null) {
+ aaiServiceInstance = bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId);
+ }
+ Service service = null;
+ if (aaiServiceInstance != null) {
+ service = bbInputSetupUtils.getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+ }
+ if (aaiServiceInstance != null && service != null) {
+ ServiceInstance serviceInstance = this.getExistingServiceInstance(aaiServiceInstance);
+ serviceInstance.setModelInfoServiceInstance(this.mapperLayer.mapCatalogServiceIntoServiceInstance(service));
+ gBB = populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance, executeBB, requestAction, null);
+ } else {
+ msoLogger.debug("Related Service Instance from AAI: " + aaiServiceInstance);
+ msoLogger.debug("Related Service Instance Model Info from AAI: " + service);
+ throw new Exception("Could not find relevant information for related Service Instance");
+ }
ServiceInstance serviceInstance = gBB.getServiceInstance();
CloudRegion cloudRegion = null;
if(cloudConfiguration == null) {
@@ -1005,7 +1030,7 @@ public class BBInputSetup implements JavaDelegate {
cloudRegion = cloudRegionOp.get();
}
}
- if (cloudConfiguration != null && requestAction.equalsIgnoreCase("deleteInstance")) {
+ if (cloudConfiguration != null) {
org.onap.aai.domain.yang.CloudRegion aaiCloudRegion = bbInputSetupUtils.getCloudRegion(cloudConfiguration);
cloudRegion = mapperLayer.mapCloudRegion(cloudConfiguration, aaiCloudRegion);
}
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 cb63f73c9a..f6e433bf38 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
@@ -1744,8 +1744,10 @@ public class BBInputSetupTest {
configResourceKeys.setVfModuleCustomizationUUID("vfModuleCustomizationUUID");
configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
executeBB.setConfigurationResourceKeys(configResourceKeys);
+
+ executeBB.setRequestDetails(requestDetails);
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId());
doReturn(service).when(SPY_bbInputSetupUtils)
.getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
@@ -1754,6 +1756,7 @@ public class BBInputSetupTest {
doReturn("vnfId").when(SPY_bbInputSetup).getVnfId(executeBB, lookupKeyMap);
doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class));
+
executeBB.getBuildingBlock().setBpmnFlowName(AssignFlows.NETWORK_MACRO.toString());
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
@@ -1862,8 +1865,9 @@ public class BBInputSetupTest {
String vnfType = "vnfType";
Service service = Mockito.mock(Service.class);
String requestAction = "createInstance";
+
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(service).when(SPY_bbInputSetupUtils)
.getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
@@ -1888,9 +1892,7 @@ public class BBInputSetupTest {
String vnfType = "vnfType";
Service service = Mockito.mock(Service.class);
String requestAction = "createInstance";
- doReturn(null).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
-
+
executeBB.getBuildingBlock().setBpmnFlowName("Network");
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
@@ -1917,8 +1919,11 @@ public class BBInputSetupTest {
String vnfType = null;
Service service = Mockito.mock(Service.class);
String requestAction = "createInstance";
+
+
+ executeBB.setRequestDetails(requestDetails);
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId());
doReturn(service).when(SPY_bbInputSetupUtils)
.getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
@@ -1978,8 +1983,10 @@ public class BBInputSetupTest {
String vnfType = "vnfType";
Service service = Mockito.mock(Service.class);
String requestAction = "createInstance";
+
+ executeBB.setRequestDetails(requestDetails);
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(request).when(SPY_bbInputSetupUtils).getInfraActiveRequest(executeBB.getRequestId());
doReturn(service).when(SPY_bbInputSetupUtils)
.getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
@@ -2040,7 +2047,7 @@ public class BBInputSetupTest {
Service service = Mockito.mock(Service.class);
String requestAction = "deactivateInstance";
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(service).when(SPY_bbInputSetupUtils)
.getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
String generatedId = "12131";
@@ -2083,8 +2090,9 @@ public class BBInputSetupTest {
Service service = Mockito.mock(Service.class);
String requestAction = "createInstance";
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+
doReturn(service).when(SPY_bbInputSetupUtils)
.getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
List<NetworkResourceCustomization> networkCustList = new ArrayList<>();
@@ -2145,12 +2153,17 @@ public class BBInputSetupTest {
String vnfType = "vnfType";
Service service = Mockito.mock(Service.class);
String requestAction = "deleteInstance";
- doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
- doReturn(service).when(SPY_bbInputSetupUtils)
- .getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
- //doReturn(aaiVnf).when(SPY_bbInputSetupUtils).getAAIGenericVnf(any(String.class));
-
+
+ executeBB.setRequestDetails(requestDetails);
+ ServiceInstance serviceInstance = gBB.getServiceInstance();
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
+ aaiServiceInstance.setModelVersionId("modelVersionId");
+ doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+ doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
+ executeBB, requestAction, null);
+
CloudConfiguration cloudConfig = new CloudConfiguration();
cloudConfig.setLcpCloudRegionId("lcpCloudRegionId");
requestDetails.setCloudConfiguration(cloudConfig);
@@ -2160,37 +2173,37 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(1)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(),
- any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class),
+ any(String.class), isA(String.class),
isA(CloudConfiguration.class));
requestAction = "activateInstance";
- doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
+ executeBB, requestAction, null);
executeBB.getBuildingBlock().setBpmnFlowName("ActivateNetworkBB");
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(2)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(),
- any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class),
+ any(String.class), isA(String.class),
isA(CloudConfiguration.class));
requestAction = "unassignInstance";
- doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
+ executeBB, requestAction, null);
executeBB.getBuildingBlock().setBpmnFlowName("UnassignNetworkBB");
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(3)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(),
- any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class),
+ any(String.class), isA(String.class),
isA(CloudConfiguration.class));
requestAction = "activateFabricConfiguration";
- doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
+ executeBB, requestAction, null);
executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB");
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-134534656234");
SPY_bbInputSetup.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
verify(SPY_bbInputSetup, times(4)).getGBBMacroExistingService(isA(ExecuteBuildingBlock.class), any(),
- any(String.class), any(GeneralBuildingBlock.class), isA(Service.class), isA(String.class),
+ any(String.class), isA(String.class),
isA(CloudConfiguration.class));
}
@@ -2216,7 +2229,7 @@ public class BBInputSetupTest {
Service service = Mockito.mock(Service.class);
String requestAction = "assignInstance";
doReturn(gBB).when(SPY_bbInputSetup).getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap,
- requestAction, resourceId);
+ requestAction, lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
doReturn(service).when(SPY_bbInputSetupUtils)
.getCatalogServiceByModelUUID(gBB.getServiceInstance().getModelInfoServiceInstance().getModelUuid());
String generatedId = "12131";
@@ -2244,6 +2257,7 @@ public class BBInputSetupTest {
CloudConfiguration cloudConfiguration = new CloudConfiguration();
cloudConfiguration.setLcpCloudRegionId("cloudRegionId");
String requestAction = "unassignInstance";
+ executeBB.setRequestDetails(requestDetails);
ConfigurationResourceKeys configResourceKeys = new ConfigurationResourceKeys();
configResourceKeys.setCvnfcCustomizationUUID("cvnfcCustomizationUUID");
@@ -2251,6 +2265,15 @@ public class BBInputSetupTest {
configResourceKeys.setVnfResourceCustomizationUUID("vnfResourceCustomizationUUID");
executeBB.setConfigurationResourceKeys(configResourceKeys);
+ ServiceInstance serviceInstance = gBB.getServiceInstance();
+ org.onap.aai.domain.yang.ServiceInstance aaiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance();
+ aaiServiceInstance.setModelVersionId("modelVersionId");
+ doReturn(service).when(SPY_bbInputSetupUtils).getCatalogServiceByModelUUID(aaiServiceInstance.getModelVersionId());
+ doReturn(aaiServiceInstance).when(SPY_bbInputSetupUtils).getAAIServiceInstanceById(lookupKeyMap.get(ResourceKey.SERVICE_INSTANCE_ID));
+ doReturn(serviceInstance).when(SPY_bbInputSetup).getExistingServiceInstance(aaiServiceInstance);
+ doReturn(gBB).when(SPY_bbInputSetup).populateGBBWithSIAndAdditionalInfo(requestDetails, serviceInstance,
+ executeBB, requestAction, null);
+
L3Network network = new L3Network();
network.setNetworkId("networkId");
gBB.getServiceInstance().getNetworks().add(network);
@@ -2263,7 +2286,7 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setBpmnFlowName("DeleteNetworkBB");
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
- executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration);
+ executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, null);
verify(SPY_bbInputSetup, times(1)).mapCatalogNetwork(any(L3Network.class), any(ModelInfo.class),
any(Service.class));
@@ -2279,7 +2302,7 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setBpmnFlowName("ActivateVnfBB");
executeBB.getBuildingBlock().setKey("ab153b6e-c364-44c0-bef6-1f2982117f04");
SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
- executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration);
+ executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, cloudConfiguration);
verify(SPY_bbInputSetup, times(1)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class),
any(Service.class));
@@ -2293,7 +2316,7 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setBpmnFlowName("UnassignVfModuleBB");
executeBB.getBuildingBlock().setKey("a25e8e8c-58b8-4eec-810c-97dcc1f5cb7f");
SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
- executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration);
+ executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, cloudConfiguration);
verify(SPY_bbInputSetup, times(2)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class),
any(Service.class));
verify(SPY_bbInputSetup, times(1)).mapCatalogVfModule(any(VfModule.class), any(ModelInfo.class),
@@ -2314,7 +2337,7 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setBpmnFlowName("UnassignVolumeGroupBB");
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa8");
SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
- executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, null);
+ executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, null);
verify(SPY_bbInputSetup, times(3)).mapCatalogVnf(any(GenericVnf.class), any(ModelInfo.class),
any(Service.class));
verify(SPY_bbInputSetup, times(1)).mapCatalogVolumeGroup(isA(VolumeGroup.class), isA(ModelInfo.class),
@@ -2331,7 +2354,7 @@ public class BBInputSetupTest {
executeBB.getBuildingBlock().setBpmnFlowName("ActivateFabricConfigurationBB");
executeBB.getBuildingBlock().setKey("72d9d1cd-f46d-447a-abdb-451d6fb05fa9");
SPY_bbInputSetup.getGBBMacroExistingService(executeBB, lookupKeyMap,
- executeBB.getBuildingBlock().getBpmnFlowName(), gBB, service, requestAction, cloudConfiguration);
+ executeBB.getBuildingBlock().getBpmnFlowName(), requestAction, cloudConfiguration);
verify(SPY_bbInputSetup, times(1)).mapCatalogConfiguration(any(Configuration.class), any(ModelInfo.class),
any(Service.class), isA(ConfigurationResourceKeys.class));
}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
index 4eb4ffec2f..ac31bc75c0 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java
@@ -27,7 +27,6 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Optional;
-import java.util.Set;
import java.util.UUID;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -51,7 +50,6 @@ import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
import org.onap.so.client.aai.AAICommonObjectMapperProvider;
-import org.onap.so.client.aai.AAIObjectType;
import org.onap.so.client.aai.entities.AAIResultWrapper;
import org.onap.so.client.aai.entities.Relationships;
import org.onap.so.client.exception.ExceptionBuilder;
@@ -147,6 +145,7 @@ public class WorkflowAction {
final String apiVersion = (String) execution.getVariable(G_APIVERSION);
final String uri = (String) execution.getVariable(G_URI);
final String vnfType = (String) execution.getVariable(VNF_TYPE);
+ final String serviceInstanceId = (String) execution.getVariable("serviceInstanceId");
List<OrchestrationFlow> orchFlows = (List<OrchestrationFlow>) execution.getVariable(G_ORCHESTRATION_FLOW);
List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>();
WorkflowResourceIds workflowResourceIds = populateResourceIdsFromApiHandler(execution);
@@ -261,7 +260,6 @@ public class WorkflowAction {
} else {
buildAndThrowException(execution, "Current Macro Request is not supported");
}
-
String foundObjects = "";
for(WorkflowType type : WorkflowType.values()){
foundObjects = foundObjects + type + " - " + resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList()).size() + " ";
@@ -285,9 +283,9 @@ public class WorkflowAction {
execution.setVariable("calledHoming", false);
}
if (resourceType == WorkflowType.SERVICE && (requestAction.equalsIgnoreCase(ASSIGNINSTANCE) || requestAction.equalsIgnoreCase(CREATEINSTANCE))){
- generateResourceIds(flowsToExecute, resourceCounter);
+ generateResourceIds(flowsToExecute, resourceCounter, serviceInstanceId);
}else{
- updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds);
+ updateResourceIdsFromAAITraversal(flowsToExecute, resourceCounter, aaiResourceIds, serviceInstanceId);
}
}
@@ -338,7 +336,7 @@ public class WorkflowAction {
}
private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
- List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds) {
+ List<Resource> resourceCounter, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
for(Pair<WorkflowType,String> pair : aaiResourceIds){
logger.debug(pair.getValue0() + ", " + pair.getValue1());
}
@@ -346,7 +344,7 @@ public class WorkflowAction {
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
for(int i = 0; i < resources.size(); i++){
- updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null);
+ updateWorkflowResourceIds(flowsToExecute, type, resources.get(i).getResourceId(), retrieveAAIResourceId(aaiResourceIds,type), null, serviceInstanceId);
}
});
}
@@ -362,17 +360,18 @@ public class WorkflowAction {
}
return id;
}
- private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter) {
+ private void generateResourceIds(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceCounter, String serviceInstanceId) {
Arrays.stream(WorkflowType.values()).filter(type -> !type.equals(WorkflowType.SERVICE)).forEach(type -> {
List<Resource> resources = resourceCounter.stream().filter(x -> type.equals(x.getResourceType())).collect(Collectors.toList());
for(int i = 0; i < resources.size(); i++){
Resource resource = resourceCounter.stream().filter(x -> type.equals(x.getResourceType()))
.collect(Collectors.toList()).get(i);
- updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey()); }
+ updateWorkflowResourceIds(flowsToExecute, type, resource.getResourceId(), null, resource.getVirtualLinkKey(),serviceInstanceId);
+ }
});
}
- protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey){
+ protected void updateWorkflowResourceIds(List<ExecuteBuildingBlock> flowsToExecute, WorkflowType resource, String key, String id, String virtualLinkKey, String serviceInstanceId){
String resourceId = id;
if(resourceId==null){
resourceId = UUID.randomUUID().toString();
@@ -380,6 +379,7 @@ public class WorkflowAction {
for(ExecuteBuildingBlock ebb : flowsToExecute){
if(key != null && key.equalsIgnoreCase(ebb.getBuildingBlock().getKey()) && ebb.getBuildingBlock().getBpmnFlowName().contains(resource.toString())){
WorkflowResourceIds workflowResourceIds = new WorkflowResourceIds();
+ workflowResourceIds.setServiceInstanceId(serviceInstanceId);
if(resource == WorkflowType.VNF){
workflowResourceIds.setVnfId(resourceId);
}else if(resource == WorkflowType.VFMODULE){