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/BBInputSetupParameter.java122
-rw-r--r--bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java12
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowAction.java469
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionBBTasks.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java10
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java485
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java)6
-rw-r--r--bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VrfValidation.java (renamed from bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java)3
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java44
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java)4
-rw-r--r--bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VrfValidationTest.java (renamed from bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java)3
12 files changed, 647 insertions, 561 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java
index 1290f2aeef..df726fed22 100644
--- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java
+++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetupParameter.java
@@ -79,266 +79,266 @@ public class BBInputSetupParameter {
}
- protected CloudConfiguration getCloudConfiguration() {
+ public CloudConfiguration getCloudConfiguration() {
return cloudConfiguration;
}
- protected void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
+ public void setCloudConfiguration(CloudConfiguration cloudConfiguration) {
this.cloudConfiguration = cloudConfiguration;
}
- protected ConfigurationResourceKeys getConfigurationResourceKeys() {
+ public ConfigurationResourceKeys getConfigurationResourceKeys() {
return configurationResourceKeys;
}
- protected void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
+ public void setConfigurationResourceKeys(ConfigurationResourceKeys configurationResourceKeys) {
this.configurationResourceKeys = configurationResourceKeys;
}
- protected List<Map<String, String>> getInstanceParams() {
+ public List<Map<String, String>> getInstanceParams() {
return instanceParams;
}
- protected void setInstanceParams(List<Map<String, String>> instanceParams) {
+ public void setInstanceParams(List<Map<String, String>> instanceParams) {
this.instanceParams = instanceParams;
}
- protected Map<ResourceKey, String> getLookupKeyMap() {
+ public Map<ResourceKey, String> getLookupKeyMap() {
return lookupKeyMap;
}
- protected void setLookupKeyMap(Map<ResourceKey, String> lookupKeyMap) {
+ public void setLookupKeyMap(Map<ResourceKey, String> lookupKeyMap) {
this.lookupKeyMap = lookupKeyMap;
}
- protected ModelInfo getModelInfo() {
+ public ModelInfo getModelInfo() {
return modelInfo;
}
- protected void setModelInfo(ModelInfo modelInfo) {
+ public void setModelInfo(ModelInfo modelInfo) {
this.modelInfo = modelInfo;
}
- protected LineOfBusiness getLineOfBusiness() {
+ public LineOfBusiness getLineOfBusiness() {
return lineOfBusiness;
}
- protected void setLineOfBusiness(LineOfBusiness lineOfBusiness) {
+ public void setLineOfBusiness(LineOfBusiness lineOfBusiness) {
this.lineOfBusiness = lineOfBusiness;
}
- protected Platform getPlatform() {
+ public Platform getPlatform() {
return platform;
}
- protected void setPlatform(Platform platform) {
+ public void setPlatform(Platform platform) {
this.platform = platform;
}
- protected RelatedInstanceList[] getRelatedInstanceList() {
+ public RelatedInstanceList[] getRelatedInstanceList() {
return relatedInstanceList;
}
- protected void setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) {
+ public void setRelatedInstanceList(RelatedInstanceList[] relatedInstanceList) {
this.relatedInstanceList = relatedInstanceList;
}
- protected RequestDetails getRequestDetails() {
+ public RequestDetails getRequestDetails() {
return requestDetails;
}
- protected void setRequestDetails(RequestDetails requestDetails) {
+ public void setRequestDetails(RequestDetails requestDetails) {
this.requestDetails = requestDetails;
}
- protected Service getService() {
+ public Service getService() {
return service;
}
- protected void setService(Service service) {
+ public void setService(Service service) {
this.service = service;
}
- protected ServiceInstance getServiceInstance() {
+ public ServiceInstance getServiceInstance() {
return serviceInstance;
}
- protected void setServiceInstance(ServiceInstance serviceInstance) {
+ public void setServiceInstance(ServiceInstance serviceInstance) {
this.serviceInstance = serviceInstance;
}
- protected String getBbName() {
+ public String getBbName() {
return bbName;
}
- protected void setBbName(String bbName) {
+ public void setBbName(String bbName) {
this.bbName = bbName;
}
- protected String getInstanceGroupId() {
+ public String getInstanceGroupId() {
return instanceGroupId;
}
- protected void setInstanceGroupId(String instanceGroupId) {
+ public void setInstanceGroupId(String instanceGroupId) {
this.instanceGroupId = instanceGroupId;
}
- protected String getInstanceName() {
+ public String getInstanceName() {
return instanceName;
}
- protected void setInstanceName(String instanceName) {
+ public void setInstanceName(String instanceName) {
this.instanceName = instanceName;
}
- protected String getProductFamilyId() {
+ public String getProductFamilyId() {
return productFamilyId;
}
- protected void setProductFamilyId(String productFamilyId) {
+ public void setProductFamilyId(String productFamilyId) {
this.productFamilyId = productFamilyId;
}
- protected String getResourceId() {
+ public String getResourceId() {
return resourceId;
}
- protected void setResourceId(String resourceId) {
+ public void setResourceId(String resourceId) {
this.resourceId = resourceId;
}
- protected String getVnfType() {
+ public String getVnfType() {
return vnfType;
}
- protected void setVnfType(String vnfType) {
+ public void setVnfType(String vnfType) {
this.vnfType = vnfType;
}
- protected ExecuteBuildingBlock getExecuteBB() {
+ public ExecuteBuildingBlock getExecuteBB() {
return executeBB;
}
- protected void setExecuteBB(ExecuteBuildingBlock executeBB) {
+ public void setExecuteBB(ExecuteBuildingBlock executeBB) {
this.executeBB = executeBB;
}
- protected String getRequestAction() {
+ public String getRequestAction() {
return requestAction;
}
- protected void setRequestAction(String requestAction) {
+ public void setRequestAction(String requestAction) {
this.requestAction = requestAction;
}
- protected boolean getaLaCarte() {
+ public boolean getaLaCarte() {
return aLaCarte;
}
- protected void setaLaCarte(boolean aLaCarte) {
+ public void setaLaCarte(boolean aLaCarte) {
this.aLaCarte = aLaCarte;
}
- protected Customer getCustomer() {
+ public Customer getCustomer() {
return customer;
}
- protected void setCustomer(Customer customer) {
+ public void setCustomer(Customer customer) {
this.customer = customer;
}
- protected void setRequestId(String requestId) {
+ public void setRequestId(String requestId) {
this.requestId = requestId;
}
- protected String getRequestId() {
+ public String getRequestId() {
return requestId;
}
- protected void setConfigurationKey(String configurationKey) {
+ public void setConfigurationKey(String configurationKey) {
this.configurationKey = configurationKey;
}
- protected String getConfigurationKey() {
+ public String getConfigurationKey() {
return configurationKey;
}
- protected String getKey() {
+ public String getKey() {
return key;
}
- protected void setKey(String key) {
+ public void setKey(String key) {
this.key = key;
}
- protected String getApplicationId() {
+ public String getApplicationId() {
return applicationId;
}
- protected void setApplicationId(String applicationId) {
+ public void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
- protected boolean getIsReplace() {
+ public boolean getIsReplace() {
return isReplace;
}
- protected void setIsReplace(boolean isReplace) {
+ public void setIsReplace(boolean isReplace) {
this.isReplace = isReplace;
}
- protected ServiceModel getServiceModel() {
+ public ServiceModel getServiceModel() {
return this.serviceModel;
}
- protected void setServiceModel(ServiceModel serviceModel) {
+ public void setServiceModel(ServiceModel serviceModel) {
this.serviceModel = serviceModel;
}
- protected boolean getIsHelm() {
+ public boolean getIsHelm() {
return isHelm;
}
- protected void setIsHelm(boolean isHelm) {
+ public void setIsHelm(boolean isHelm) {
this.isHelm = isHelm;
}
@@ -492,27 +492,27 @@ public class BBInputSetupParameter {
return this;
}
- protected Builder setApplicationId(String applicationId) {
+ public Builder setApplicationId(String applicationId) {
this.applicationId = applicationId;
return this;
}
- protected Builder setIsReplace(boolean isReplace) {
+ public Builder setIsReplace(boolean isReplace) {
this.isReplace = isReplace;
return this;
}
- protected Builder setServiceModel(ServiceModel serviceModel) {
+ public Builder setServiceModel(ServiceModel serviceModel) {
this.serviceModel = serviceModel;
return this;
}
- protected boolean getIsHelm() {
+ public boolean getIsHelm() {
return isHelm;
}
- protected void setIsHelm(boolean isHelm) {
+ public void setIsHelm(boolean isHelm) {
this.isHelm = isHelm;
}
diff --git a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
index 477dce1072..8d6e133a1c 100644
--- a/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
+++ b/bpmn/mso-infrastructure-bpmn/src/main/java/org/onap/so/bpmn/infrastructure/MSOInfrastructureApplication.java
@@ -79,6 +79,7 @@ public class MSOInfrastructureApplication {
private static final String LOGS_DIR = "logs_dir";
private static final String BPMN_SUFFIX = ".bpmn";
private static final String SDC_SOURCE = "sdc";
+ private static final int CANNOT_INVOKE_COMMAND = 126;
private static void setLogsDir() {
@@ -88,9 +89,14 @@ public class MSOInfrastructureApplication {
}
public static void main(String... args) {
- SpringApplication.run(MSOInfrastructureApplication.class, args);
- System.getProperties().setProperty("mso.config.path", ".");
- setLogsDir();
+ try {
+ SpringApplication.run(MSOInfrastructureApplication.class, args);
+ System.getProperties().setProperty("mso.config.path", ".");
+ setLogsDir();
+ } catch (Exception e) {
+ logger.error("Exception has occurred during application startup. App will exit. ", e);
+ System.exit(CANNOT_INVOKE_COMMAND);
+ }
}
@PostConstruct
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
index 59decb56a4..a3e245ffea 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
@@ -120,17 +120,17 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
//set new nsiId to sliceParams suggestNsiId
- sliceParams.setSuggestNsiId(sliceInstanceId)
-
ServiceInstance nsi = new ServiceInstance()
-
String sliceInstanceName = "nsi_"+execution.getVariable("sliceServiceInstanceName")
String serviceType = sliceParams.serviceProfile.get("sST")
String serviceStatus = "deactivated"
String modelInvariantUuid = sliceParams.getNSTInfo().invariantUUID
String modelUuid = sliceParams.getNSTInfo().UUID
+ sliceParams.setSuggestNsiId(sliceInstanceId)
+ sliceParams.setSuggestNsiName(sliceInstanceName)
+
String uuiRequest = execution.getVariable("uuiRequest")
String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList")
String serviceRole = "nsi"
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 ee4e56bc18..29206a6aa9 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
@@ -26,18 +26,30 @@
package org.onap.so.bpmn.infrastructure.workflow.tasks;
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.ObjectMapper;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONTROLLER;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCERETAINASSIGNMENTS;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.SERVICE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE;
import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import java.util.UUID;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+import java.util.stream.Collectors;
import org.apache.commons.lang3.SerializationUtils;
import org.camunda.bpm.engine.delegate.DelegateExecution;
import org.javatuples.Pair;
-import org.onap.aai.domain.yang.Relationship;
-import org.onap.aai.domain.yang.ServiceInstance;
import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
-import org.onap.aai.domain.yang.VpnBinding;
-import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
import org.onap.aaiclient.client.aai.AAIObjectName;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.Relationships;
@@ -46,22 +58,16 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.ServiceEBBLoader;
import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.VnfEBBLoader;
import org.onap.so.bpmn.infrastructure.workflow.tasks.excpetion.VnfcMultipleRelationshipException;
import org.onap.so.bpmn.infrastructure.workflow.tasks.utils.WorkflowResourceIdsUtils;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
-import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock;
import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.client.exception.ExceptionBuilder;
-import org.onap.so.client.orchestration.AAIConfigurationResources;
import org.onap.so.client.orchestration.AAIEntityNotFoundException;
-import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
-import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
-import org.onap.so.db.catalog.beans.InstanceGroup;
import org.onap.so.db.catalog.beans.VfModuleCustomization;
import org.onap.so.db.catalog.beans.macro.NorthBoundRequest;
import org.onap.so.db.catalog.beans.macro.OrchestrationFlow;
@@ -79,26 +85,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
import org.springframework.util.CollectionUtils;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Map;
-import java.util.Optional;
-import java.util.UUID;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.stream.Collectors;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CONTROLLER;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.NETWORKCOLLECTION;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.REPLACEINSTANCERETAINASSIGNMENTS;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.SERVICE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.USER_PARAM_SERVICE;
-import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE;
+import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class WorkflowAction {
@@ -131,21 +118,15 @@ public class WorkflowAction {
@Autowired
private CatalogDbClient catalogDbClient;
@Autowired
- private AAIConfigurationResources aaiConfigurationResources;
- @Autowired
- private WorkflowActionExtractResourcesAAI workflowActionUtils;
- @Autowired
- private VrfValidation vrfValidation;
- @Autowired
private Environment environment;
@Autowired
- private UserParamsServiceTraversal userParamsServiceTraversal;
- @Autowired
private AaiResourceIdValidator aaiResourceIdValidator;
@Autowired
private ExecuteBuildingBlockBuilder executeBuildingBlockBuilder;
@Autowired
private VnfEBBLoader vnfEBBLoader;
+ @Autowired
+ private ServiceEBBLoader serviceEBBLoader;
public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) {
this.bbInputSetupUtils = bbInputSetupUtils;
@@ -295,52 +276,12 @@ public class WorkflowAction {
String cloudOwner, String serviceType, String requestId, String apiVersion, String vnfType,
RequestDetails requestDetails) throws IOException, VrfBondingServiceException {
List<ExecuteBuildingBlock> flowsToExecute;
- boolean containsService = false;
List<Resource> resourceList = new ArrayList<>();
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
- List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
- if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) {
- // SERVICE-MACRO-ASSIGN will always get user params with a
- // service.
-
- if (userParams != null) {
- containsService = isContainsService(sIRequest);
- if (containsService) {
- resourceList = userParamsServiceTraversal.getResourceListFromUserParams(execution, userParams,
- serviceInstanceId, requestAction);
- }
- } else {
- buildAndThrowException(execution,
- "Service-Macro-Assign request details must contain user params with a service");
- }
- } else if (resourceType == WorkflowType.SERVICE && requestAction.equalsIgnoreCase(CREATE_INSTANCE)) {
- // SERVICE-MACRO-CREATE will get user params with a service,
- // a service with a network, a service with a
- // network collection, OR an empty service.
- // If user params is just a service or null and macro
- // queries the SI and finds a VNF, macro fails.
-
- if (userParams != null) {
- containsService = isContainsService(sIRequest);
- }
- if (containsService) {
- resourceList = userParamsServiceTraversal.getResourceListFromUserParams(execution, userParams,
- serviceInstanceId, requestAction);
- }
- if (!foundRelated(resourceList)) {
- traverseCatalogDbService(execution, sIRequest, resourceList, aaiResourceIds);
- }
- } else if (resourceType == WorkflowType.SERVICE && ("activateInstance".equalsIgnoreCase(requestAction)
- || "unassignInstance".equalsIgnoreCase(requestAction)
- || "deleteInstance".equalsIgnoreCase(requestAction)
- || requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
- // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
- // SERVICE-MACRO-DELETE
- // Will never get user params with service, macro will have
- // to query the SI in AAI to find related instances.
- traverseAAIService(execution, resourceList, resourceId, aaiResourceIds);
- } else if (resourceType == WorkflowType.SERVICE && "deactivateInstance".equalsIgnoreCase(requestAction)) {
- resourceList.add(new Resource(WorkflowType.SERVICE, "", false));
+
+ if (resourceType == WorkflowType.SERVICE) {
+ resourceList = serviceEBBLoader.getResourceListForService(sIRequest, requestAction, execution,
+ serviceInstanceId, resourceId, aaiResourceIds);
} else if (resourceType == WorkflowType.VNF && (REPLACEINSTANCE.equalsIgnoreCase(requestAction)
|| ("recreateInstance".equalsIgnoreCase(requestAction)))) {
vnfEBBLoader.traverseAAIVnf(execution, resourceList, workflowResourceIds.getServiceInstanceId(),
@@ -370,7 +311,7 @@ public class WorkflowAction {
}
flowsToExecute = executeBuildingBlockBuilder.buildExecuteBuildingBlockList(orchFlows, resourceList, requestId,
apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, vnfReplace);
- if (isNetworkCollectionInTheResourceList(resourceList)) {
+ if (serviceEBBLoader.isNetworkCollectionInTheResourceList(resourceList)) {
logger.info("Sorting for Vlan Tagging");
flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction);
}
@@ -400,13 +341,6 @@ public class WorkflowAction {
execution.setVariable("isRollbackComplete", false);
}
- private boolean isContainsService(ServiceInstancesRequest sIRequest) {
- boolean containsService;
- List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
- containsService = userParams.stream().anyMatch(param -> param.containsKey(USER_PARAM_SERVICE));
- return containsService;
- }
-
private List<ExecuteBuildingBlock> loadExecuteBuildingBlocks(DelegateExecution execution, String requestId,
String errorMessage) {
List<ExecuteBuildingBlock> flowsToExecute;
@@ -699,8 +633,6 @@ public class WorkflowAction {
return orchFlows;
}
-
-
private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute,
List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) {
for (Pair<WorkflowType, String> pair : aaiResourceIds) {
@@ -759,342 +691,6 @@ public class WorkflowAction {
}
}
- protected CollectionResourceCustomization findCatalogNetworkCollection(DelegateExecution execution,
- org.onap.so.db.catalog.beans.Service service) {
- CollectionResourceCustomization networkCollection = null;
- int count = 0;
- for (CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()) {
- if (catalogDbClient.getNetworkCollectionResourceCustomizationByID(
- collectionCust.getModelCustomizationUUID()) != null) {
- networkCollection = collectionCust;
- count++;
- }
- }
- if (count == 0) {
- return null;
- } else if (count > 1) {
- buildAndThrowException(execution,
- "Found multiple Network Collections in the Service model, only one per Service is supported.");
- }
- return networkCollection;
- }
-
- protected void traverseCatalogDbService(DelegateExecution execution, ServiceInstancesRequest sIRequest,
- List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds)
- throws JsonProcessingException, VrfBondingServiceException {
- String modelUUID = sIRequest.getRequestDetails().getModelInfo().getModelVersionId();
- org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(modelUUID);
-
- if (service == null) {
- buildAndThrowException(execution, "Could not find the service model in catalog db.");
- } else {
- resourceList.add(new Resource(WorkflowType.SERVICE, service.getModelUUID(), false));
- RelatedInstance relatedVpnBinding =
- bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.vpnBinding);
- RelatedInstance relatedLocalNetwork =
- bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.network);
-
- if (relatedVpnBinding != null && relatedLocalNetwork != null) {
- traverseVrfConfiguration(aaiResourceIds, resourceList, service, relatedVpnBinding, relatedLocalNetwork);
- } else {
- traverseNetworkCollection(execution, resourceList, service);
- }
- }
- }
-
- protected void traverseVrfConfiguration(List<Pair<WorkflowType, String>> aaiResourceIds,
- List<Resource> resourceList, org.onap.so.db.catalog.beans.Service service,
- RelatedInstance relatedVpnBinding, RelatedInstance relatedLocalNetwork)
- throws VrfBondingServiceException, JsonProcessingException {
- org.onap.aai.domain.yang.L3Network aaiLocalNetwork =
- bbInputSetupUtils.getAAIL3Network(relatedLocalNetwork.getInstanceId());
- vrfValidation.vrfServiceValidation(service);
- vrfValidation.vrfCatalogDbChecks(service);
- vrfValidation.aaiVpnBindingValidation(relatedVpnBinding.getInstanceId(),
- bbInputSetupUtils.getAAIVpnBinding(relatedVpnBinding.getInstanceId()));
- vrfValidation.aaiNetworkValidation(relatedLocalNetwork.getInstanceId(), aaiLocalNetwork);
- vrfValidation.aaiSubnetValidation(aaiLocalNetwork);
- vrfValidation.aaiAggregateRouteValidation(aaiLocalNetwork);
- vrfValidation.aaiRouteTargetValidation(aaiLocalNetwork);
- String existingAAIVrfConfiguration = getExistingAAIVrfConfiguration(relatedVpnBinding, aaiLocalNetwork);
- if (existingAAIVrfConfiguration != null) {
- aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, existingAAIVrfConfiguration));
- }
- resourceList.add(new Resource(WorkflowType.CONFIGURATION,
- service.getConfigurationCustomizations().get(0).getModelCustomizationUUID(), false));
-
- }
-
- protected String getExistingAAIVrfConfiguration(RelatedInstance relatedVpnBinding,
- org.onap.aai.domain.yang.L3Network aaiLocalNetwork)
- throws JsonProcessingException, VrfBondingServiceException {
- Optional<Relationships> relationshipsOp = new AAIResultWrapper(
- new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiLocalNetwork)).getRelationships();
- if (relationshipsOp.isPresent()) {
- List<AAIResultWrapper> configurationsRelatedToLocalNetwork =
- relationshipsOp.get().getByType(Types.CONFIGURATION);
- if (configurationsRelatedToLocalNetwork.size() > 1) {
- throw new VrfBondingServiceException(
- "Network: " + aaiLocalNetwork.getNetworkId() + " has more than 1 configuration related to it");
- }
- if (configurationsRelatedToLocalNetwork.size() == 1) {
- AAIResultWrapper configWrapper = configurationsRelatedToLocalNetwork.get(0);
- Optional<Configuration> relatedConfiguration = configWrapper.asBean(Configuration.class);
- if (relatedConfiguration.isPresent() && vrfConfigurationAlreadyExists(relatedVpnBinding,
- relatedConfiguration.get(), configWrapper)) {
- return relatedConfiguration.get().getConfigurationId();
- }
- }
- }
- return null;
- }
-
- protected boolean vrfConfigurationAlreadyExists(RelatedInstance relatedVpnBinding, Configuration vrfConfiguration,
- AAIResultWrapper configWrapper) throws VrfBondingServiceException {
- if ("VRF-ENTRY".equalsIgnoreCase(vrfConfiguration.getConfigurationType())) {
- Optional<Relationships> relationshipsConfigOp = configWrapper.getRelationships();
- if (relationshipsConfigOp.isPresent()) {
- Optional<VpnBinding> relatedInfraVpnBindingOp =
- workflowActionUtils.extractRelationshipsVpnBinding(relationshipsConfigOp.get());
- if (relatedInfraVpnBindingOp.isPresent()) {
- VpnBinding relatedInfraVpnBinding = relatedInfraVpnBindingOp.get();
- if (!relatedInfraVpnBinding.getVpnId().equalsIgnoreCase(relatedVpnBinding.getInstanceId())) {
- throw new VrfBondingServiceException("Configuration: " + vrfConfiguration.getConfigurationId()
- + " is not connected to the same vpn binding id provided in request: "
- + relatedVpnBinding.getInstanceId());
- } else {
- return true;
- }
- }
- }
- }
- return false;
- }
-
- protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceList,
- org.onap.so.db.catalog.beans.Service service) {
- if (isVnfCustomizationsInTheService(service)) {
- buildAndThrowException(execution,
- "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
- }
- if (isPnfCustomizationsInTheService(service)) {
- buildAndThrowException(execution,
- "Cannot orchestrate Service-Macro-Create without user params with a pnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
- }
- List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
- if (customizations.isEmpty()) {
- logger.debug("No Collections found. CollectionResourceCustomization list is empty.");
- } else {
- CollectionResourceCustomization collectionResourceCustomization =
- findCatalogNetworkCollection(execution, service);
- traverseNetworkCollectionResourceCustomization(resourceList, collectionResourceCustomization);
- }
- traverseNetworkCollectionCustomization(resourceList, service);
- }
-
- private void traverseNetworkCollectionResourceCustomization(List<Resource> resourceList,
- CollectionResourceCustomization collectionResourceCustomization) {
- if (collectionResourceCustomizationShouldNotBeProcessed(resourceList, collectionResourceCustomization))
- return;
- int minNetworks = 0;
- org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
- collectionResourceCustomization.getCollectionResource().getInstanceGroup();
- CollectionResourceInstanceGroupCustomization collectionInstCust = null;
- if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
- for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
- .getCollectionInstanceGroupCustomizations()) {
- if (collectionInstanceGroupTemp.getModelCustomizationUUID()
- .equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionInstCust = collectionInstanceGroupTemp;
- break;
- }
- }
- if (interfaceNetworkQuantityIsAvailableInCollection(collectionInstCust)) {
- minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
- }
- }
- logger.debug("minNetworks: {}", minNetworks);
- CollectionNetworkResourceCustomization collectionNetworkResourceCust =
- getCollectionNetworkResourceCustomization(collectionResourceCustomization, instanceGroup);
- for (int i = 0; i < minNetworks; i++) {
- if (collectionNetworkResourceCust != null) {
- Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
- collectionNetworkResourceCust.getModelCustomizationUUID(), false);
- resource.setVirtualLinkKey(Integer.toString(i));
- resourceList.add(resource);
- }
- }
- }
-
- private CollectionNetworkResourceCustomization getCollectionNetworkResourceCustomization(
- CollectionResourceCustomization collectionResourceCustomization, InstanceGroup instanceGroup) {
- CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
- for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
- .getCollectionNetworkResourceCustomizations()) {
- if (collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID()
- .equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
- collectionNetworkResourceCust = collectionNetworkTemp;
- break;
- }
- }
- return collectionNetworkResourceCust;
- }
-
- private boolean collectionResourceCustomizationShouldNotBeProcessed(List<Resource> resourceList,
- CollectionResourceCustomization collectionResourceCustomization) {
- if (collectionResourceCustomization == null) {
- logger.debug("No Network Collection Customization found");
- return true;
- }
- resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
- collectionResourceCustomization.getModelCustomizationUUID(), false));
- logger.debug("Found a network collection");
- if (collectionResourceCustomization.getCollectionResource() == null) {
- logger.debug("No Network Collection found. collectionResource is null");
- return true;
- }
- if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() == null) {
- logger.debug("No Instance Group found for network collection.");
- return true;
- }
- String toscaNodeType =
- collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType();
- if (!toscaNodeTypeHasNetworkCollection(toscaNodeType)) {
- logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}", toscaNodeType);
- return true;
- }
- return false;
- }
-
- private boolean interfaceNetworkQuantityIsAvailableInCollection(
- CollectionResourceInstanceGroupCustomization collectionInstCust) {
- return collectionInstCust != null && collectionInstCust.getSubInterfaceNetworkQuantity() != null;
- }
-
- private boolean toscaNodeTypeHasNetworkCollection(String toscaNodeType) {
- return toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION);
- }
-
- private void traverseNetworkCollectionCustomization(List<Resource> resourceList,
- org.onap.so.db.catalog.beans.Service service) {
- if (isNetworkCollectionInTheResourceList(resourceList)) {
- return;
- }
- if (service.getNetworkCustomizations() == null) {
- logger.debug("No networks were found on this service model");
- return;
- }
- for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
- resourceList.add(new Resource(WorkflowType.NETWORK,
- service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false));
- }
- }
-
- private boolean isNetworkCollectionInTheResourceList(List<Resource> resourceList) {
- return resourceList.stream().anyMatch(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType());
- }
-
- private boolean isVnfCustomizationsInTheService(org.onap.so.db.catalog.beans.Service service) {
- return !(service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty());
- }
-
- private boolean isPnfCustomizationsInTheService(org.onap.so.db.catalog.beans.Service service) {
- return !(service.getPnfCustomizations() == null || service.getPnfCustomizations().isEmpty());
- }
-
- protected void traverseAAIService(DelegateExecution execution, List<Resource> resourceList, String resourceId,
- List<Pair<WorkflowType, String>> aaiResourceIds) {
- try {
- ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(resourceId);
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
- bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
- resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
- traverseServiceInstanceMSOVnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
- traverseServiceInstanceMSOPnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
- if (serviceInstanceMSO.getNetworks() != null) {
- for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO
- .getNetworks()) {
- aaiResourceIds.add(new Pair<>(WorkflowType.NETWORK, network.getNetworkId()));
- resourceList.add(new Resource(WorkflowType.NETWORK, network.getNetworkId(), false));
- }
- }
- if (serviceInstanceMSO.getCollection() != null) {
- logger.debug("found networkcollection");
- aaiResourceIds
- .add(new Pair<>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
- resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
- serviceInstanceMSO.getCollection().getId(), false));
- }
- if (serviceInstanceMSO.getConfigurations() != null) {
- for (Configuration config : serviceInstanceMSO.getConfigurations()) {
- Optional<org.onap.aai.domain.yang.Configuration> aaiConfig =
- aaiConfigurationResources.getConfiguration(config.getConfigurationId());
- if (aaiConfig.isPresent() && aaiConfig.get().getRelationshipList() != null) {
- for (Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()) {
- if (relationship.getRelatedTo().contains("vnfc")
- || relationship.getRelatedTo().contains("vpn-binding")) {
- aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, config.getConfigurationId()));
- resourceList.add(
- new Resource(WorkflowType.CONFIGURATION, config.getConfigurationId(), false));
- break;
- }
- }
- }
- }
- }
- } catch (Exception ex) {
- logger.error("Exception in traverseAAIService", ex);
- buildAndThrowException(execution,
- "Could not find existing Service Instance or related Instances to execute the request on.");
- }
- }
-
- private void traverseServiceInstanceMSOVnfs(List<Resource> resourceList,
- List<Pair<WorkflowType, String>> aaiResourceIds,
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
- if (serviceInstanceMSO.getVnfs() == null) {
- return;
- }
- for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
- aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
- resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
- traverseVnfModules(resourceList, aaiResourceIds, vnf);
- if (vnf.getVolumeGroups() != null) {
- for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf.getVolumeGroups()) {
- aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
- resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
- }
- }
- }
- }
-
- private void traverseServiceInstanceMSOPnfs(List<Resource> resourceList,
- List<Pair<WorkflowType, String>> aaiResourceIds,
- org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
- if (serviceInstanceMSO.getPnfs() == null) {
- return;
- }
- for (org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf : serviceInstanceMSO.getPnfs()) {
- aaiResourceIds.add(new Pair<>(WorkflowType.PNF, pnf.getPnfId()));
- resourceList.add(new Resource(WorkflowType.PNF, pnf.getPnfId(), false));
- }
- }
-
- private void traverseVnfModules(List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds,
- org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf) {
- if (vnf.getVfModules() == null) {
- return;
- }
- for (VfModule vfModule : vnf.getVfModules()) {
- aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
- Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false);
- resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
- resourceList.add(resource);
- }
- }
-
-
-
protected WorkflowResourceIds populateResourceIdsFromApiHandler(DelegateExecution execution) {
return WorkflowResourceIdsUtils.getWorkflowResourceIdsFromExecution(execution);
}
@@ -1296,17 +892,6 @@ public class WorkflowAction {
&& (bbInputSetupUtils.getAAIServiceInstanceById(serviceInstanceId) != null));
}
- protected boolean foundRelated(List<Resource> resourceList) {
- return (containsWorkflowType(resourceList, WorkflowType.VNF)
- || containsWorkflowType(resourceList, WorkflowType.PNF)
- || containsWorkflowType(resourceList, WorkflowType.NETWORK)
- || containsWorkflowType(resourceList, WorkflowType.NETWORKCOLLECTION));
- }
-
- protected boolean containsWorkflowType(List<Resource> resourceList, WorkflowType workflowType) {
- return resourceList.stream().anyMatch(resource -> resource.getResourceType().equals(workflowType));
- }
-
private void fillExecutionDefault(DelegateExecution execution) {
execution.setVariable("sentSyncResponse", false);
execution.setVariable(HOMING, false);
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 ec2ca74fa7..cd151bafea 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
@@ -37,6 +37,7 @@ import org.onap.aai.domain.yang.Vnfc;
import org.onap.aai.domain.yang.VolumeGroup;
import org.onap.aaiclient.client.aai.entities.Configuration;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.common.BBConstants;
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;
@@ -68,10 +69,6 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@Component
public class WorkflowActionBBTasks {
- private static final String G_CURRENT_SEQUENCE = "gCurrentSequence";
- private static final String G_REQUEST_ID = "mso-request-id";
- private static final String G_ALACARTE = "aLaCarte";
- private static final String G_ACTION = "requestAction";
private static final String RETRY_COUNT = "retryCount";
private static final String FABRIC_CONFIGURATION = "FabricConfiguration";
private static final String ADD_FABRIC_CONFIGURATION_BB = "AddFabricConfigurationBB";
@@ -112,14 +109,15 @@ public class WorkflowActionBBTasks {
} catch (NullPointerException ex) {
workflowAction.buildAndThrowException(execution, "Error in FlowManipulator Modify Flows", ex);
}
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence);
execution.setVariable("buildingBlock", ebb);
currentSequence++;
execution.setVariable(COMPLETED, currentSequence >= flowsToExecute.size());
- execution.setVariable(G_CURRENT_SEQUENCE, currentSequence);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currentSequence);
+
} catch (Exception e) {
workflowAction.buildAndThrowException(execution, "Internal Error occured during selectBB", e);
}
@@ -127,7 +125,7 @@ public class WorkflowActionBBTasks {
public void updateFlowStatistics(DelegateExecution execution) {
try {
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
if (currentSequence > 1) {
InfraActiveRequests request = this.getUpdatedRequest(execution, currentSequence);
requestDbclient.updateInfraActiveRequests(request);
@@ -142,7 +140,7 @@ public class WorkflowActionBBTasks {
protected InfraActiveRequests getUpdatedRequest(DelegateExecution execution, int currentSequence) {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
ExecuteBuildingBlock completedBB = flowsToExecute.get(currentSequence - 2);
ExecuteBuildingBlock nextBB = flowsToExecute.get(currentSequence - 1);
@@ -171,7 +169,7 @@ public class WorkflowActionBBTasks {
}
public void sendSyncAck(DelegateExecution execution) {
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
final String resourceId = (String) execution.getVariable("resourceId");
ServiceInstancesResponse serviceInstancesResponse = new ServiceInstancesResponse();
RequestReferences requestRef = new RequestReferences();
@@ -199,7 +197,7 @@ public class WorkflowActionBBTasks {
}
public void sendErrorSyncAck(DelegateExecution execution) {
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
try {
ExceptionBuilder exceptionBuilder = new ExceptionBuilder();
String errorMsg = (String) execution.getVariable("WorkflowActionErrorMessage");
@@ -225,10 +223,10 @@ public class WorkflowActionBBTasks {
public void updateRequestStatusToComplete(DelegateExecution execution) {
try {
- final String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ final String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
- final String action = (String) execution.getVariable(G_ACTION);
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
+ final String action = (String) execution.getVariable(BBConstants.G_ACTION);
+ final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
final String resourceName = (String) execution.getVariable("resourceName");
String statusMessage = (String) execution.getVariable("StatusMessage");
String macroAction;
@@ -258,7 +256,7 @@ public class WorkflowActionBBTasks {
public void checkRetryStatus(DelegateExecution execution) {
String handlingCode = (String) execution.getVariable(HANDLINGCODE);
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
String retryDuration = (String) execution.getVariable("RetryDuration");
int retryCount = (int) execution.getVariable(RETRY_COUNT);
int envMaxRetries;
@@ -280,8 +278,8 @@ public class WorkflowActionBBTasks {
logger.warn("Failed to update Request Db Infra Active Requests with Retry Status", ex);
}
if (retryCount < envMaxRetries) {
- int currSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
- execution.setVariable(G_CURRENT_SEQUENCE, currSequence - 1);
+ int currSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, currSequence - 1);
execution.setVariable(RETRY_COUNT, nextCount);
} else {
workflowAction.buildAndThrowException(execution,
@@ -297,7 +295,7 @@ public class WorkflowActionBBTasks {
* working on.
*/
public void rollbackExecutionPath(DelegateExecution execution) {
- final String action = (String) execution.getVariable(G_ACTION);
+ final String action = (String) execution.getVariable(BBConstants.G_ACTION);
final String resourceName = (String) execution.getVariable("resourceName");
if (!(boolean) execution.getVariable("isRollback")) {
List<ExecuteBuildingBlock> flowsToExecute =
@@ -308,7 +306,7 @@ public class WorkflowActionBBTasks {
.collect(Collectors.toList());
List<ExecuteBuildingBlock> rollbackFlows = new ArrayList<>();
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
int listSize = flowsToExecute.size();
for (int i = listSize - 1; i >= 0; i--) {
@@ -381,7 +379,7 @@ public class WorkflowActionBBTasks {
execution.setVariable("flowsToExecute", rollbackFlowsFiltered);
execution.setVariable(HANDLINGCODE, "PreformingRollback");
execution.setVariable("isRollback", true);
- execution.setVariable(G_CURRENT_SEQUENCE, 0);
+ execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, 0);
execution.setVariable(RETRY_COUNT, 0);
} else {
workflowAction.buildAndThrowException(execution,
@@ -391,7 +389,7 @@ public class WorkflowActionBBTasks {
protected void updateInstanceId(DelegateExecution execution) {
try {
- String requestId = (String) execution.getVariable(G_REQUEST_ID);
+ String requestId = (String) execution.getVariable(BBConstants.G_REQUEST_ID);
String resourceId = (String) execution.getVariable("resourceId");
WorkflowType resourceType = (WorkflowType) execution.getVariable("resourceType");
InfraActiveRequests request = requestDbclient.getInfraActiveRequestbyRequestId(requestId);
@@ -424,8 +422,8 @@ public class WorkflowActionBBTasks {
List<ExecuteBuildingBlock> flowsToExecute =
(List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
String handlingCode = (String) execution.getVariable(HANDLINGCODE);
- final boolean aLaCarte = (boolean) execution.getVariable(G_ALACARTE);
- int currentSequence = (int) execution.getVariable(G_CURRENT_SEQUENCE);
+ final boolean aLaCarte = (boolean) execution.getVariable(BBConstants.G_ALACARTE);
+ int currentSequence = (int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE);
logger.debug("Current Sequence: {}", currentSequence);
ExecuteBuildingBlock ebb = flowsToExecute.get(currentSequence - 1);
String bbFlowName = ebb.getBuildingBlock().getBpmnFlowName();
@@ -444,7 +442,7 @@ public class WorkflowActionBBTasks {
protected void postProcessingExecuteBBActivateVfModule(DelegateExecution execution, ExecuteBuildingBlock ebb,
List<ExecuteBuildingBlock> flowsToExecute) {
try {
- String requestAction = (String) execution.getVariable(G_ACTION);
+ String requestAction = (String) execution.getVariable(BBConstants.G_ACTION);
String serviceInstanceId = ebb.getWorkflowResourceIds().getServiceInstanceId();
String vnfId = ebb.getWorkflowResourceIds().getVnfId();
String vfModuleId = ebb.getResourceId();
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java
index 9128e9e3e1..b2cc89545b 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionConstants.java
@@ -32,15 +32,15 @@ public final class WorkflowActionConstants {
throw new IllegalStateException("Utility class");
}
- static final String USER_PARAM_SERVICE = "service";
- static final String CREATE_INSTANCE = "createInstance";
- static final String FABRIC_CONFIGURATION = "FabricConfiguration";
+ public static final String USER_PARAM_SERVICE = "service";
+ public static final String CREATE_INSTANCE = "createInstance";
+ public static final String FABRIC_CONFIGURATION = "FabricConfiguration";
public static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage";
static final String SERVICE = "Service";
static final String CONTROLLER = "Controller";
- static final String NETWORKCOLLECTION = "NetworkCollection";
+ public static final String NETWORKCOLLECTION = "NetworkCollection";
static final String CONFIGURATION = "Configuration";
- static final String ASSIGNINSTANCE = "assignInstance";
+ public static final String ASSIGNINSTANCE = "assignInstance";
static final String REPLACEINSTANCE = "replaceInstance";
static final String VOLUMEGROUP = "VolumeGroup";
static final String REPLACEINSTANCERETAINASSIGNMENTS = "replaceInstanceRetainAssignments";
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java
new file mode 100644
index 0000000000..55a92b0b81
--- /dev/null
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/ServiceEBBLoader.java
@@ -0,0 +1,485 @@
+package org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.javatuples.Pair;
+import org.onap.aai.domain.yang.Relationship;
+import org.onap.aai.domain.yang.ServiceInstance;
+import org.onap.aai.domain.yang.VpnBinding;
+import org.onap.aaiclient.client.aai.AAICommonObjectMapperProvider;
+import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
+import org.onap.aaiclient.client.aai.entities.Relationships;
+import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.VrfBondingServiceException;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionExtractResourcesAAI;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
+import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetup;
+import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
+import org.onap.so.client.exception.ExceptionBuilder;
+import org.onap.so.client.orchestration.AAIConfigurationResources;
+import org.onap.so.db.catalog.beans.CollectionNetworkResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
+import org.onap.so.db.catalog.beans.CollectionResourceInstanceGroupCustomization;
+import org.onap.so.db.catalog.beans.InstanceGroup;
+import org.onap.so.db.catalog.client.CatalogDbClient;
+import org.onap.so.serviceinstancebeans.ModelType;
+import org.onap.so.serviceinstancebeans.RelatedInstance;
+import org.onap.so.serviceinstancebeans.ServiceInstancesRequest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Component;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.WORKFLOW_ACTION_ERROR_MESSAGE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.CREATE_INSTANCE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.FABRIC_CONFIGURATION;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.NETWORKCOLLECTION;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.USER_PARAM_SERVICE;
+import static org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowActionConstants.ASSIGNINSTANCE;
+
+
+@Component
+public class ServiceEBBLoader {
+
+ private static final Logger logger = LoggerFactory.getLogger(ServiceEBBLoader.class);
+
+ private final UserParamsServiceTraversal userParamsServiceTraversal;
+ private final CatalogDbClient catalogDbClient;
+ private final VrfValidation vrfValidation;
+ private final AAIConfigurationResources aaiConfigurationResources;
+ private final WorkflowActionExtractResourcesAAI workflowActionUtils;
+ private final BBInputSetupUtils bbInputSetupUtils;
+ private final BBInputSetup bbInputSetup;
+ private final ExceptionBuilder exceptionBuilder;
+
+ public ServiceEBBLoader(UserParamsServiceTraversal userParamsServiceTraversal, CatalogDbClient catalogDbClient,
+ VrfValidation vrfValidation, AAIConfigurationResources aaiConfigurationResources,
+ WorkflowActionExtractResourcesAAI workflowActionUtils, BBInputSetupUtils bbInputSetupUtils,
+ BBInputSetup bbInputSetup, ExceptionBuilder exceptionBuilder) {
+ this.userParamsServiceTraversal = userParamsServiceTraversal;
+ this.catalogDbClient = catalogDbClient;
+ this.vrfValidation = vrfValidation;
+ this.aaiConfigurationResources = aaiConfigurationResources;
+ this.workflowActionUtils = workflowActionUtils;
+ this.bbInputSetupUtils = bbInputSetupUtils;
+ this.bbInputSetup = bbInputSetup;
+ this.exceptionBuilder = exceptionBuilder;
+ }
+
+ public List<Resource> getResourceListForService(ServiceInstancesRequest sIRequest, String requestAction,
+ DelegateExecution execution, String serviceInstanceId, String resourceId,
+ List<Pair<WorkflowType, String>> aaiResourceIds) throws IOException, VrfBondingServiceException {
+ boolean containsService = false;
+ List<Resource> resourceList = new ArrayList<>();
+ List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ if (requestAction.equalsIgnoreCase(ASSIGNINSTANCE)) {
+ // SERVICE-MACRO-ASSIGN will always get user params with a
+ // service.
+
+ if (userParams != null) {
+ containsService = isContainsService(sIRequest);
+ if (containsService) {
+ resourceList = userParamsServiceTraversal.getResourceListFromUserParams(execution, userParams,
+ serviceInstanceId, requestAction);
+ }
+ } else {
+ buildAndThrowException(execution,
+ "Service-Macro-Assign request details must contain user params with a service");
+ }
+ } else if (requestAction.equalsIgnoreCase(CREATE_INSTANCE)) {
+ // SERVICE-MACRO-CREATE will get user params with a service,
+ // a service with a network, a service with a
+ // network collection, OR an empty service.
+ // If user params is just a service or null and macro
+ // queries the SI and finds a VNF, macro fails.
+
+ if (userParams != null) {
+ containsService = isContainsService(sIRequest);
+ }
+ if (containsService) {
+ resourceList = userParamsServiceTraversal.getResourceListFromUserParams(execution, userParams,
+ serviceInstanceId, requestAction);
+ }
+ if (!foundRelated(resourceList)) {
+ traverseCatalogDbService(execution, sIRequest, resourceList, aaiResourceIds);
+ }
+ } else if (("activateInstance".equalsIgnoreCase(requestAction)
+ || "unassignInstance".equalsIgnoreCase(requestAction)
+ || "deleteInstance".equalsIgnoreCase(requestAction)
+ || requestAction.equalsIgnoreCase("activate" + FABRIC_CONFIGURATION))) {
+ // SERVICE-MACRO-ACTIVATE, SERVICE-MACRO-UNASSIGN, and
+ // SERVICE-MACRO-DELETE
+ // Will never get user params with service, macro will have
+ // to query the SI in AAI to find related instances.
+ traverseAAIService(execution, resourceList, resourceId, aaiResourceIds);
+ } else if ("deactivateInstance".equalsIgnoreCase(requestAction)) {
+ resourceList.add(new Resource(WorkflowType.SERVICE, "", false));
+ }
+ return resourceList;
+ }
+
+ private boolean isContainsService(ServiceInstancesRequest sIRequest) {
+ boolean containsService;
+ List<Map<String, Object>> userParams = sIRequest.getRequestDetails().getRequestParameters().getUserParams();
+ containsService = userParams.stream().anyMatch(param -> param.containsKey(USER_PARAM_SERVICE));
+ return containsService;
+ }
+
+ public void traverseCatalogDbService(DelegateExecution execution, ServiceInstancesRequest sIRequest,
+ List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds)
+ throws JsonProcessingException, VrfBondingServiceException {
+ String modelUUID = sIRequest.getRequestDetails().getModelInfo().getModelVersionId();
+ org.onap.so.db.catalog.beans.Service service = catalogDbClient.getServiceByID(modelUUID);
+
+ if (service == null) {
+ buildAndThrowException(execution, "Could not find the service model in catalog db.");
+ } else {
+ resourceList.add(new Resource(WorkflowType.SERVICE, service.getModelUUID(), false));
+ RelatedInstance relatedVpnBinding =
+ bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.vpnBinding);
+ RelatedInstance relatedLocalNetwork =
+ bbInputSetupUtils.getRelatedInstanceByType(sIRequest.getRequestDetails(), ModelType.network);
+
+ if (relatedVpnBinding != null && relatedLocalNetwork != null) {
+ traverseVrfConfiguration(aaiResourceIds, resourceList, service, relatedVpnBinding, relatedLocalNetwork);
+ } else {
+ traverseNetworkCollection(execution, resourceList, service);
+ }
+ }
+ }
+
+ public boolean foundRelated(List<Resource> resourceList) {
+ return (containsWorkflowType(resourceList, WorkflowType.VNF)
+ || containsWorkflowType(resourceList, WorkflowType.PNF)
+ || containsWorkflowType(resourceList, WorkflowType.NETWORK)
+ || containsWorkflowType(resourceList, WorkflowType.NETWORKCOLLECTION));
+ }
+
+ public void traverseAAIService(DelegateExecution execution, List<Resource> resourceList, String resourceId,
+ List<Pair<WorkflowType, String>> aaiResourceIds) {
+ try {
+ ServiceInstance serviceInstanceAAI = bbInputSetupUtils.getAAIServiceInstanceById(resourceId);
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO =
+ bbInputSetup.getExistingServiceInstance(serviceInstanceAAI);
+ resourceList.add(new Resource(WorkflowType.SERVICE, serviceInstanceMSO.getServiceInstanceId(), false));
+ traverseServiceInstanceMSOVnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
+ traverseServiceInstanceMSOPnfs(resourceList, aaiResourceIds, serviceInstanceMSO);
+ if (serviceInstanceMSO.getNetworks() != null) {
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network network : serviceInstanceMSO
+ .getNetworks()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.NETWORK, network.getNetworkId()));
+ resourceList.add(new Resource(WorkflowType.NETWORK, network.getNetworkId(), false));
+ }
+ }
+ if (serviceInstanceMSO.getCollection() != null) {
+ logger.debug("found networkcollection");
+ aaiResourceIds
+ .add(new Pair<>(WorkflowType.NETWORKCOLLECTION, serviceInstanceMSO.getCollection().getId()));
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ serviceInstanceMSO.getCollection().getId(), false));
+ }
+ if (serviceInstanceMSO.getConfigurations() != null) {
+ for (Configuration config : serviceInstanceMSO.getConfigurations()) {
+ Optional<org.onap.aai.domain.yang.Configuration> aaiConfig =
+ aaiConfigurationResources.getConfiguration(config.getConfigurationId());
+ if (aaiConfig.isPresent() && aaiConfig.get().getRelationshipList() != null) {
+ for (Relationship relationship : aaiConfig.get().getRelationshipList().getRelationship()) {
+ if (relationship.getRelatedTo().contains("vnfc")
+ || relationship.getRelatedTo().contains("vpn-binding")) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, config.getConfigurationId()));
+ resourceList.add(
+ new Resource(WorkflowType.CONFIGURATION, config.getConfigurationId(), false));
+ break;
+ }
+ }
+ }
+ }
+ }
+ } catch (Exception ex) {
+ logger.error("Exception in traverseAAIService", ex);
+ buildAndThrowException(execution,
+ "Could not find existing Service Instance or related Instances to execute the request on.");
+ }
+ }
+
+ private void traverseServiceInstanceMSOVnfs(List<Resource> resourceList,
+ List<Pair<WorkflowType, String>> aaiResourceIds,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
+ if (serviceInstanceMSO.getVnfs() == null) {
+ return;
+ }
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf : serviceInstanceMSO.getVnfs()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.VNF, vnf.getVnfId()));
+ resourceList.add(new Resource(WorkflowType.VNF, vnf.getVnfId(), false));
+ traverseVnfModules(resourceList, aaiResourceIds, vnf);
+ if (vnf.getVolumeGroups() != null) {
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup volumeGroup : vnf.getVolumeGroups()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId()));
+ resourceList.add(new Resource(WorkflowType.VOLUMEGROUP, volumeGroup.getVolumeGroupId(), false));
+ }
+ }
+ }
+ }
+
+ private void traverseServiceInstanceMSOPnfs(List<Resource> resourceList,
+ List<Pair<WorkflowType, String>> aaiResourceIds,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance serviceInstanceMSO) {
+ if (serviceInstanceMSO.getPnfs() == null) {
+ return;
+ }
+ for (org.onap.so.bpmn.servicedecomposition.bbobjects.Pnf pnf : serviceInstanceMSO.getPnfs()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.PNF, pnf.getPnfId()));
+ resourceList.add(new Resource(WorkflowType.PNF, pnf.getPnfId(), false));
+ }
+ }
+
+ protected void traverseVrfConfiguration(List<Pair<WorkflowType, String>> aaiResourceIds,
+ List<Resource> resourceList, org.onap.so.db.catalog.beans.Service service,
+ RelatedInstance relatedVpnBinding, RelatedInstance relatedLocalNetwork)
+ throws VrfBondingServiceException, JsonProcessingException {
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork =
+ bbInputSetupUtils.getAAIL3Network(relatedLocalNetwork.getInstanceId());
+ vrfValidation.vrfServiceValidation(service);
+ vrfValidation.vrfCatalogDbChecks(service);
+ vrfValidation.aaiVpnBindingValidation(relatedVpnBinding.getInstanceId(),
+ bbInputSetupUtils.getAAIVpnBinding(relatedVpnBinding.getInstanceId()));
+ vrfValidation.aaiNetworkValidation(relatedLocalNetwork.getInstanceId(), aaiLocalNetwork);
+ vrfValidation.aaiSubnetValidation(aaiLocalNetwork);
+ vrfValidation.aaiAggregateRouteValidation(aaiLocalNetwork);
+ vrfValidation.aaiRouteTargetValidation(aaiLocalNetwork);
+ String existingAAIVrfConfiguration = getExistingAAIVrfConfiguration(relatedVpnBinding, aaiLocalNetwork);
+ if (existingAAIVrfConfiguration != null) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.CONFIGURATION, existingAAIVrfConfiguration));
+ }
+ resourceList.add(new Resource(WorkflowType.CONFIGURATION,
+ service.getConfigurationCustomizations().get(0).getModelCustomizationUUID(), false));
+
+ }
+
+ protected void traverseNetworkCollection(DelegateExecution execution, List<Resource> resourceList,
+ org.onap.so.db.catalog.beans.Service service) {
+ if (isVnfCustomizationsInTheService(service)) {
+ buildAndThrowException(execution,
+ "Cannot orchestrate Service-Macro-Create without user params with a vnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
+ }
+ if (isPnfCustomizationsInTheService(service)) {
+ buildAndThrowException(execution,
+ "Cannot orchestrate Service-Macro-Create without user params with a pnf. Please update ASDC model for new macro orchestration support or add service_recipe records to route to old macro flows");
+ }
+ List<CollectionResourceCustomization> customizations = service.getCollectionResourceCustomizations();
+ if (customizations.isEmpty()) {
+ logger.debug("No Collections found. CollectionResourceCustomization list is empty.");
+ } else {
+ CollectionResourceCustomization collectionResourceCustomization =
+ findCatalogNetworkCollection(execution, service);
+ traverseNetworkCollectionResourceCustomization(resourceList, collectionResourceCustomization);
+ }
+ traverseNetworkCollectionCustomization(resourceList, service);
+ }
+
+ private void traverseNetworkCollectionResourceCustomization(List<Resource> resourceList,
+ CollectionResourceCustomization collectionResourceCustomization) {
+ if (collectionResourceCustomizationShouldNotBeProcessed(resourceList, collectionResourceCustomization))
+ return;
+ int minNetworks = 0;
+ org.onap.so.db.catalog.beans.InstanceGroup instanceGroup =
+ collectionResourceCustomization.getCollectionResource().getInstanceGroup();
+ CollectionResourceInstanceGroupCustomization collectionInstCust = null;
+ if (!instanceGroup.getCollectionInstanceGroupCustomizations().isEmpty()) {
+ for (CollectionResourceInstanceGroupCustomization collectionInstanceGroupTemp : instanceGroup
+ .getCollectionInstanceGroupCustomizations()) {
+ if (collectionInstanceGroupTemp.getModelCustomizationUUID()
+ .equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionInstCust = collectionInstanceGroupTemp;
+ break;
+ }
+ }
+ if (interfaceNetworkQuantityIsAvailableInCollection(collectionInstCust)) {
+ minNetworks = collectionInstCust.getSubInterfaceNetworkQuantity();
+ }
+ }
+ logger.debug("minNetworks: {}", minNetworks);
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust =
+ getCollectionNetworkResourceCustomization(collectionResourceCustomization, instanceGroup);
+ for (int i = 0; i < minNetworks; i++) {
+ if (collectionNetworkResourceCust != null) {
+ Resource resource = new Resource(WorkflowType.VIRTUAL_LINK,
+ collectionNetworkResourceCust.getModelCustomizationUUID(), false);
+ resource.setVirtualLinkKey(Integer.toString(i));
+ resourceList.add(resource);
+ }
+ }
+ }
+
+ private CollectionNetworkResourceCustomization getCollectionNetworkResourceCustomization(
+ CollectionResourceCustomization collectionResourceCustomization, InstanceGroup instanceGroup) {
+ CollectionNetworkResourceCustomization collectionNetworkResourceCust = null;
+ for (CollectionNetworkResourceCustomization collectionNetworkTemp : instanceGroup
+ .getCollectionNetworkResourceCustomizations()) {
+ if (collectionNetworkTemp.getNetworkResourceCustomization().getModelCustomizationUUID()
+ .equalsIgnoreCase(collectionResourceCustomization.getModelCustomizationUUID())) {
+ collectionNetworkResourceCust = collectionNetworkTemp;
+ break;
+ }
+ }
+ return collectionNetworkResourceCust;
+ }
+
+ private boolean collectionResourceCustomizationShouldNotBeProcessed(List<Resource> resourceList,
+ CollectionResourceCustomization collectionResourceCustomization) {
+ if (collectionResourceCustomization == null) {
+ logger.debug("No Network Collection Customization found");
+ return true;
+ }
+ resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION,
+ collectionResourceCustomization.getModelCustomizationUUID(), false));
+ logger.debug("Found a network collection");
+ if (collectionResourceCustomization.getCollectionResource() == null) {
+ logger.debug("No Network Collection found. collectionResource is null");
+ return true;
+ }
+ if (collectionResourceCustomization.getCollectionResource().getInstanceGroup() == null) {
+ logger.debug("No Instance Group found for network collection.");
+ return true;
+ }
+ String toscaNodeType =
+ collectionResourceCustomization.getCollectionResource().getInstanceGroup().getToscaNodeType();
+ if (!toscaNodeTypeHasNetworkCollection(toscaNodeType)) {
+ logger.debug("Instance Group tosca node type does not contain NetworkCollection: {}", toscaNodeType);
+ return true;
+ }
+ return false;
+ }
+
+ private boolean interfaceNetworkQuantityIsAvailableInCollection(
+ CollectionResourceInstanceGroupCustomization collectionInstCust) {
+ return collectionInstCust != null && collectionInstCust.getSubInterfaceNetworkQuantity() != null;
+ }
+
+ private boolean toscaNodeTypeHasNetworkCollection(String toscaNodeType) {
+ return toscaNodeType != null && toscaNodeType.contains(NETWORKCOLLECTION);
+ }
+
+ private void traverseNetworkCollectionCustomization(List<Resource> resourceList,
+ org.onap.so.db.catalog.beans.Service service) {
+ if (isNetworkCollectionInTheResourceList(resourceList)) {
+ return;
+ }
+ if (service.getNetworkCustomizations() == null) {
+ logger.debug("No networks were found on this service model");
+ return;
+ }
+ for (int i = 0; i < service.getNetworkCustomizations().size(); i++) {
+ resourceList.add(new Resource(WorkflowType.NETWORK,
+ service.getNetworkCustomizations().get(i).getModelCustomizationUUID(), false));
+ }
+ }
+
+ private boolean isVnfCustomizationsInTheService(org.onap.so.db.catalog.beans.Service service) {
+ return !(service.getVnfCustomizations() == null || service.getVnfCustomizations().isEmpty());
+ }
+
+ private boolean isPnfCustomizationsInTheService(org.onap.so.db.catalog.beans.Service service) {
+ return !(service.getPnfCustomizations() == null || service.getPnfCustomizations().isEmpty());
+ }
+
+ private void traverseVnfModules(List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds,
+ org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf vnf) {
+ if (vnf.getVfModules() == null) {
+ return;
+ }
+ for (VfModule vfModule : vnf.getVfModules()) {
+ aaiResourceIds.add(new Pair<>(WorkflowType.VFMODULE, vfModule.getVfModuleId()));
+ Resource resource = new Resource(WorkflowType.VFMODULE, vfModule.getVfModuleId(), false);
+ resource.setBaseVfModule(vfModule.getModelInfoVfModule().getIsBaseBoolean());
+ resourceList.add(resource);
+ }
+ }
+
+
+ protected String getExistingAAIVrfConfiguration(RelatedInstance relatedVpnBinding,
+ org.onap.aai.domain.yang.L3Network aaiLocalNetwork)
+ throws JsonProcessingException, VrfBondingServiceException {
+ Optional<Relationships> relationshipsOp = new AAIResultWrapper(
+ new AAICommonObjectMapperProvider().getMapper().writeValueAsString(aaiLocalNetwork)).getRelationships();
+ if (relationshipsOp.isPresent()) {
+ List<AAIResultWrapper> configurationsRelatedToLocalNetwork =
+ relationshipsOp.get().getByType(AAIFluentTypeBuilder.Types.CONFIGURATION);
+ if (configurationsRelatedToLocalNetwork.size() > 1) {
+ throw new VrfBondingServiceException(
+ "Network: " + aaiLocalNetwork.getNetworkId() + " has more than 1 configuration related to it");
+ }
+ if (configurationsRelatedToLocalNetwork.size() == 1) {
+ AAIResultWrapper configWrapper = configurationsRelatedToLocalNetwork.get(0);
+ Optional<Configuration> relatedConfiguration = configWrapper.asBean(Configuration.class);
+ if (relatedConfiguration.isPresent() && vrfConfigurationAlreadyExists(relatedVpnBinding,
+ relatedConfiguration.get(), configWrapper)) {
+ return relatedConfiguration.get().getConfigurationId();
+ }
+ }
+ }
+ return null;
+ }
+
+ protected boolean vrfConfigurationAlreadyExists(RelatedInstance relatedVpnBinding, Configuration vrfConfiguration,
+ AAIResultWrapper configWrapper) throws VrfBondingServiceException {
+ if ("VRF-ENTRY".equalsIgnoreCase(vrfConfiguration.getConfigurationType())) {
+ Optional<Relationships> relationshipsConfigOp = configWrapper.getRelationships();
+ if (relationshipsConfigOp.isPresent()) {
+ Optional<VpnBinding> relatedInfraVpnBindingOp =
+ workflowActionUtils.extractRelationshipsVpnBinding(relationshipsConfigOp.get());
+ if (relatedInfraVpnBindingOp.isPresent()) {
+ VpnBinding relatedInfraVpnBinding = relatedInfraVpnBindingOp.get();
+ if (!relatedInfraVpnBinding.getVpnId().equalsIgnoreCase(relatedVpnBinding.getInstanceId())) {
+ throw new VrfBondingServiceException("Configuration: " + vrfConfiguration.getConfigurationId()
+ + " is not connected to the same vpn binding id provided in request: "
+ + relatedVpnBinding.getInstanceId());
+ } else {
+ return true;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+ public boolean containsWorkflowType(List<Resource> resourceList, WorkflowType workflowType) {
+ return resourceList.stream().anyMatch(resource -> resource.getResourceType().equals(workflowType));
+ }
+
+ public boolean isNetworkCollectionInTheResourceList(List<Resource> resourceList) {
+ return resourceList.stream().anyMatch(x -> WorkflowType.NETWORKCOLLECTION == x.getResourceType());
+ }
+
+ public CollectionResourceCustomization findCatalogNetworkCollection(DelegateExecution execution,
+ org.onap.so.db.catalog.beans.Service service) {
+ CollectionResourceCustomization networkCollection = null;
+ int count = 0;
+ for (CollectionResourceCustomization collectionCust : service.getCollectionResourceCustomizations()) {
+ if (catalogDbClient.getNetworkCollectionResourceCustomizationByID(
+ collectionCust.getModelCustomizationUUID()) != null) {
+ networkCollection = collectionCust;
+ count++;
+ }
+ }
+ if (count == 0) {
+ return null;
+ } else if (count > 1) {
+ buildAndThrowException(execution,
+ "Found multiple Network Collections in the Service model, only one per Service is supported.");
+ }
+ return networkCollection;
+ }
+
+ protected void buildAndThrowException(DelegateExecution execution, String msg) {
+ logger.error(msg);
+ execution.setVariable(WORKFLOW_ACTION_ERROR_MESSAGE, msg);
+ exceptionBuilder.buildAndThrowWorkflowException(execution, 7000, msg);
+ }
+}
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
index 3a7dd5772f..4b1fdd8da1 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversal.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversal.java
@@ -24,10 +24,12 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.workflow.tasks;
+package org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.camunda.bpm.engine.delegate.DelegateExecution;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.CollectionResourceCustomization;
import org.onap.so.db.catalog.beans.CvnfcConfigurationCustomization;
@@ -68,7 +70,7 @@ public class UserParamsServiceTraversal {
this.exceptionBuilder = exceptionBuilder;
}
- protected List<Resource> getResourceListFromUserParams(DelegateExecution execution,
+ public List<Resource> getResourceListFromUserParams(DelegateExecution execution,
List<Map<String, Object>> userParams, String serviceModelVersionId, String requestAction)
throws IOException {
if (userParams != null) {
diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VrfValidation.java
index 304cb9f4b4..3b54645b35 100644
--- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidation.java
+++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VrfValidation.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.workflow.tasks;
+package org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader;
import java.util.List;
import java.util.Optional;
@@ -26,6 +26,7 @@ import org.onap.aai.domain.yang.L3Network;
import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.VrfBondingServiceException;
import org.onap.so.bpmn.servicedecomposition.tasks.BBInputSetupUtils;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.springframework.beans.factory.annotation.Autowired;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
index 26e0d2f8c9..31f37f4ac3 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/WorkflowActionTest.java
@@ -78,6 +78,8 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.ServiceEBBLoader;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.UserParamsServiceTraversal;
import org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader.VnfEBBLoader;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
@@ -141,6 +143,10 @@ public class WorkflowActionTest extends BaseTaskTest {
@Spy
protected VnfEBBLoader vnfEBBLoaderSpy;
+ @InjectMocks
+ @Spy
+ protected ServiceEBBLoader serviceEBBLoader;
+
@Rule
public ExpectedException thrown = ExpectedException.none();
@@ -232,7 +238,6 @@ public class WorkflowActionTest extends BaseTaskTest {
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
-
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "ActivateServiceInstanceBB");
@@ -1044,7 +1049,7 @@ public class WorkflowActionTest extends BaseTaskTest {
NorthBoundRequest northBoundRequest = new NorthBoundRequest();
List<OrchestrationFlow> orchFlows = createFlowList("AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
- "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB");
+ "AddFabricConfigurationBB");
northBoundRequest.setOrchestrationFlowList(orchFlows);
List<CvnfcCustomization> cvnfcCustomizations = new ArrayList<CvnfcCustomization>();
@@ -1078,15 +1083,14 @@ public class WorkflowActionTest extends BaseTaskTest {
when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource,
true, "my-custom-cloud-owner")).thenReturn(northBoundRequest);
- // when(catalogDbClient.getCvnfcCustomizationByVnfCustomizationUUIDAndVfModuleCustomizationUUID("fc25201d-36d6-43a3-8d39-fdae88e526ae",
- // "9a6d01fd-19a7-490a-9800-460830a12e0b")).thenReturn(cvnfcCustomizations);
+
workflowAction.selectExecutionList(execution);
List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute");
- assertEqualsBulkFlowName(ebbs, "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB",
- "AssignFabricConfigurationBB", "ActivateFabricConfigurationBB", "AssignFabricConfigurationBB",
- "ActivateFabricConfigurationBB");
+ assertEqualsBulkFlowName(ebbs, "AssignVfModuleBB", "CreateVfModuleBB", "ActivateVfModuleBB");
}
+
+
@Test
public void selectExecutionListALaCarteVfModuleNoVolumeGroupReplaceTest() throws Exception {
String gAction = "replaceInstance";
@@ -1450,7 +1454,6 @@ public class WorkflowActionTest extends BaseTaskTest {
"ChangeModelVnfBB", "ChangeModelServiceInstanceBB");
}
-
@Test
public void selectExecutionListALaCarteVfModuleFabricDeleteTest() throws Exception {
String gAction = "deleteInstance";
@@ -2097,7 +2100,7 @@ public class WorkflowActionTest extends BaseTaskTest {
List<Resource> resourceCounter = new ArrayList<>();
thrown.expect(BpmnError.class);
List<Pair<WorkflowType, String>> aaiResourceIds = new ArrayList<>();
- workflowAction.traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds);
+ serviceEBBLoader.traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds);
}
@@ -2109,7 +2112,8 @@ public class WorkflowActionTest extends BaseTaskTest {
networkCustomization.setModelCustomizationUUID("123");
service.getCollectionResourceCustomizations().add(networkCustomization);
doReturn(networkCustomization).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123");
- CollectionResourceCustomization customization = workflowAction.findCatalogNetworkCollection(execution, service);
+ CollectionResourceCustomization customization =
+ serviceEBBLoader.findCatalogNetworkCollection(execution, service);
assertNotNull(customization);
}
@@ -2119,7 +2123,8 @@ public class WorkflowActionTest extends BaseTaskTest {
NetworkCollectionResourceCustomization networkCustomization = new NetworkCollectionResourceCustomization();
networkCustomization.setModelCustomizationUUID("123");
service.getCollectionResourceCustomizations().add(networkCustomization);
- CollectionResourceCustomization customization = workflowAction.findCatalogNetworkCollection(execution, service);
+ CollectionResourceCustomization customization =
+ serviceEBBLoader.findCatalogNetworkCollection(execution, service);
assertNull(customization);
}
@@ -2134,7 +2139,7 @@ public class WorkflowActionTest extends BaseTaskTest {
service.getCollectionResourceCustomizations().add(networkCustomization2);
doReturn(networkCustomization1).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("123");
doReturn(networkCustomization2).when(catalogDbClient).getNetworkCollectionResourceCustomizationByID("321");
- workflowAction.findCatalogNetworkCollection(execution, service);
+ serviceEBBLoader.findCatalogNetworkCollection(execution, service);
assertEquals("Found multiple Network Collections in the Service model, only one per Service is supported.",
execution.getVariable("WorkflowActionErrorMessage"));
}
@@ -2186,7 +2191,7 @@ public class WorkflowActionTest extends BaseTaskTest {
.getConfiguration("testConfigurationId");
doReturn(Optional.of(aaiConfiguration2)).when(aaiConfigurationResources)
.getConfiguration("testConfigurationId2");
- workflowAction.traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
+ serviceEBBLoader.traverseAAIService(execution, resourceCounter, resourceId, aaiResourceIds);
assertEquals(8, resourceCounter.size());
assertTrue(resourceCounter.get(2).isBaseVfModule());
assertThat(aaiResourceIds, sameBeanAs(getExpectedResourceIds()));
@@ -2203,7 +2208,7 @@ public class WorkflowActionTest extends BaseTaskTest {
resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false));
resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false));
- assertEquals(workflowAction.foundRelated(resourceList), true);
+ assertEquals(serviceEBBLoader.foundRelated(resourceList), true);
}
@Test
@@ -2214,11 +2219,11 @@ public class WorkflowActionTest extends BaseTaskTest {
resourceList.add(new Resource(WorkflowType.NETWORK, "model customization id", false));
resourceList.add(new Resource(WorkflowType.NETWORKCOLLECTION, "model customization id", false));
- assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.PNF), true);
- assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.VNF), true);
- assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.NETWORK), true);
- assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.NETWORKCOLLECTION), true);
- assertEquals(workflowAction.containsWorkflowType(resourceList, WorkflowType.CONFIGURATION), false);
+ assertEquals(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.PNF), true);
+ assertEquals(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.VNF), true);
+ assertEquals(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.NETWORK), true);
+ assertEquals(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.NETWORKCOLLECTION), true);
+ assertEquals(serviceEBBLoader.containsWorkflowType(resourceList, WorkflowType.CONFIGURATION), false);
}
private List<Pair<WorkflowType, String>> getExpectedResourceIds() {
@@ -2249,6 +2254,7 @@ public class WorkflowActionTest extends BaseTaskTest {
for (int i = 0; i < ebbs.size(); i++) {
assertEquals(ebbs.get(i).getBuildingBlock().getBpmnFlowName(), flowNames[i]);
}
+ assertEquals(ebbs.size(), flowNames.length);
}
private void initExecution(String gAction, String bpmnRequest, boolean isAlaCarte) {
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
index 99f17a3628..75514b15d7 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/UserParamsServiceTraversalTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/UserParamsServiceTraversalTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.workflow.tasks;
+package org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.camunda.bpm.engine.delegate.DelegateExecution;
@@ -28,6 +28,8 @@ import org.junit.Test;
import org.mockito.Mockito;
import org.onap.so.bpmn.BaseTaskTest;
import org.onap.so.bpmn.common.BBConstants;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.Resource;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.WorkflowType;
import org.onap.so.client.exception.ExceptionBuilder;
import org.onap.so.db.catalog.beans.ConfigurationResource;
import org.onap.so.db.catalog.beans.CvnfcCustomization;
diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VrfValidationTest.java
index 7f9f0417ea..dcccb74f58 100644
--- a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/VrfValidationTest.java
+++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ebb/loader/VrfValidationTest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.onap.so.bpmn.infrastructure.workflow.tasks;
+package org.onap.so.bpmn.infrastructure.workflow.tasks.ebb.loader;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.doReturn;
@@ -45,6 +45,7 @@ import org.onap.aaiclient.client.aai.entities.AAIResultWrapper;
import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri;
import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types;
import org.onap.so.bpmn.BaseTaskTest;
+import org.onap.so.bpmn.infrastructure.workflow.tasks.VrfBondingServiceException;
import org.onap.so.db.catalog.beans.ConfigurationResourceCustomization;
import org.onap.so.db.catalog.beans.Service;
import org.onap.so.db.catalog.beans.ServiceProxyResourceCustomization;