aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-tasks/src/main/java
diff options
context:
space:
mode:
authorSteve Smokowski <ss835w@att.com>2018-12-12 12:48:24 +0000
committerGerrit Code Review <gerrit@onap.org>2018-12-12 12:48:24 +0000
commitbc7c7d78b62477a7994a986a8e03b180bcbee4c7 (patch)
treefe6a855bc9944c8620ab96d890c2f7d45d72f993 /bpmn/so-bpmn-tasks/src/main/java
parent6d30c5883a57bf9a7b8b322b131ed8fabec19594 (diff)
parent01176bd6522e942175ce8429f74ef29e643142b8 (diff)
Merge "Skip cloud regions and fix macro"
Diffstat (limited to 'bpmn/so-bpmn-tasks/src/main/java')
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java19
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java5
2 files changed, 21 insertions, 3 deletions
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
index 54ee26d0ad..4a3cb01b74 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/aai/tasks/AAICreateTasks.java
@@ -20,8 +20,13 @@
package org.onap.so.bpmn.infrastructure.aai.tasks;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
import org.camunda.bpm.engine.delegate.BpmnError;
import org.onap.so.bpmn.common.BuildingBlockExecution;
+import org.onap.so.bpmn.core.UrnPropertiesReader;
import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -52,6 +57,7 @@ import org.onap.so.db.catalog.beans.OrchestrationStatus;
import org.onap.so.logger.MessageEnum;
import org.onap.so.logger.MsoLogger;
import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
@Component
@@ -78,6 +84,8 @@ public class AAICreateTasks {
private AAIVpnBindingResources aaiVpnBindingResources;
@Autowired
private AAIConfigurationResources aaiConfigurationResources;
+ @Autowired
+ private Environment env;
public void createServiceInstance(BuildingBlockExecution execution) {
try {
@@ -356,8 +364,15 @@ public class AAICreateTasks {
*/
public void connectVnfToCloudRegion(BuildingBlockExecution execution) {
try {
- GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
- aaiVnfResources.connectVnfToCloudRegion(vnf, execution.getGeneralBuildingBlock().getCloudRegion());
+ boolean cloudRegionsToSkip = false;
+ String[] cloudRegions = env.getProperty("mso.bpmn.cloudRegionIdsToSkipAddingVnfEdgesTo", String[].class);
+ if (cloudRegions != null){
+ cloudRegionsToSkip = Arrays.stream(cloudRegions).anyMatch(execution.getGeneralBuildingBlock().getCloudRegion().getLcpCloudRegionId()::equals);
+ }
+ if(!cloudRegionsToSkip) {
+ GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
+ aaiVnfResources.connectVnfToCloudRegion(vnf, execution.getGeneralBuildingBlock().getCloudRegion());
+ }
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
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 ac31bc75c0..e04043a352 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
@@ -145,7 +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");
+ 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);
@@ -177,6 +177,9 @@ public class WorkflowAction {
} else {
resourceId = resource.getResourceId();
}
+ if((serviceInstanceId == null || serviceInstanceId.equals("")) && resourceType == WorkflowType.SERVICE){
+ serviceInstanceId = resourceId;
+ }
execution.setVariable("resourceId", resourceId);
execution.setVariable("resourceType", resourceType);