diff options
Diffstat (limited to 'bpmn')
22 files changed, 1492 insertions, 1633 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java index 4cd1d7dcb0..d971689f94 100644 --- a/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java +++ b/bpmn/MSOCommonBPMN/src/main/java/org/onap/so/bpmn/servicedecomposition/tasks/BBInputSetup.java @@ -640,7 +640,8 @@ public class BBInputSetup implements JavaDelegate { parameter.getServiceModel().getCurrentService(), vnfModelCustomizationUUID); } } - if (vfModule.getModelInfoVfModule() != null && vfModule.getModelInfoVfModule().getModelName() != null + if (vfModule != null && vfModule.getModelInfoVfModule() != null + && vfModule.getModelInfoVfModule().getModelName() != null && vfModule.getModelInfoVfModule().getModelName().contains("helm")) { parameter.setIsHelm(true); } diff --git a/bpmn/mso-infrastructure-bpmn/pom.xml b/bpmn/mso-infrastructure-bpmn/pom.xml index b621853f2b..4f7ceca9b9 100644 --- a/bpmn/mso-infrastructure-bpmn/pom.xml +++ b/bpmn/mso-infrastructure-bpmn/pom.xml @@ -335,8 +335,11 @@ </dependency> <dependency> <groupId>org.onap.aaf.authz</groupId> + <artifactId>aaf-cadi-client</artifactId> + </dependency> + <dependency> + <groupId>org.onap.aaf.authz</groupId> <artifactId>aaf-cadi-aaf</artifactId> - <version>${aaf.cadi.version}</version> <exclusions> <exclusion> <groupId>javax.servlet</groupId> @@ -348,5 +351,20 @@ </exclusion> </exclusions> </dependency> + <dependency> + <groupId>org.onap.aaf.authz</groupId> + <artifactId>aaf-auth-client</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.onap.aaf.authz</groupId> + <artifactId>aaf-misc-env</artifactId> + <scope>runtime</scope> + </dependency> + <dependency> + <groupId>org.onap.aaf.authz</groupId> + <artifactId>aaf-misc-rosetta</artifactId> + <scope>runtime</scope> + </dependency> </dependencies> </project> diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy index 36d579c7ab..5c030a9f86 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSliceService.groovy @@ -20,9 +20,7 @@ package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.isBlank -import java.lang.reflect.Type -import javax.ws.rs.NotFoundException + import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.* @@ -32,9 +30,12 @@ import org.onap.aaiclient.client.aai.entities.uri.AAIPluralResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri 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.logging.filter.base.ErrorCode -import org.onap.so.beans.nsmf.NSSI +import org.onap.so.beans.nsmf.CustomerInfo +import org.onap.so.beans.nsmf.NetworkType +import org.onap.so.beans.nsmf.NssInstance +import org.onap.so.beans.nsmf.OperationType +import org.onap.so.beans.nsmf.OrchestrationStatusEnum import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils @@ -46,8 +47,11 @@ import org.onap.so.logger.LoggingAnchor import org.onap.so.logger.MessageEnum import org.slf4j.Logger import org.slf4j.LoggerFactory -import com.google.gson.Gson -import com.google.gson.reflect.TypeToken + +import javax.ws.rs.NotFoundException +import java.util.function.Consumer + +import static org.apache.commons.lang3.StringUtils.isBlank /** * This groovy class supports the <class>ActivateSliceService.bpmn</class> process. @@ -66,6 +70,8 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { RequestDBUtil requestDBUtil = new RequestDBUtil() + AAIResourcesClient client = getAAIClient() + private static final Logger logger = LoggerFactory.getLogger(ActivateSliceService.class) void preProcessRequest(DelegateExecution execution) { @@ -75,7 +81,7 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { try { // check for incoming json message/input - String siRequest = execution.getVariable("bpmnRequest") + String siRequest = Objects.requireNonNull(execution.getVariable("bpmnRequest")) logger.debug(siRequest) String requestId = execution.getVariable("mso-request-id") @@ -109,13 +115,20 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { } else { execution.setVariable("subscriptionServiceType", subscriptionServiceType) } - String operationId = jsonUtil.getJsonValue(siRequest, "operationId") + String operationId = Objects.requireNonNull(jsonUtil.getJsonValue(siRequest, "operationId")) execution.setVariable("operationId", operationId) - String operationType = execution.getVariable("operationType") - execution.setVariable("operationType", operationType.toUpperCase()) - + String operationType = Objects.requireNonNull(execution.getVariable("operationType")) logger.info("operationType is " + execution.getVariable("operationType") ) + + CustomerInfo customerInfo = CustomerInfo.builder().operationId(operationId) + .operationType(Objects.requireNonNull(OperationType.getOperationType(operationType))) + .globalSubscriberId(globalSubscriberId).serviceInstanceId(serviceInstanceId) + .subscriptionServiceType(subscriptionServiceType) + .build() + + execution.setVariable("customerInfo", customerInfo) + } catch (BpmnError e) { throw e } catch (Exception ex) { @@ -126,14 +139,58 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { logger.debug(Prefix + "preProcessRequest Exit") } + /** + * Init the service Operation Status + */ + def prepareInitServiceOperationStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareActivateServiceOperationStatus Start") + try { + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String serviceId = customerInfo.getServiceInstanceId() + String operationId = customerInfo.getOperationId() + String operationType = customerInfo.getOperationType().getType() + String userId = customerInfo.getGlobalSubscriberId() + String result = "processing" + String progress = "0" + String reason = "" + String operationContent = "Prepare service activation" + + execution.setVariable("e2eserviceInstanceId", serviceId) + //execution.setVariable("operationType", operationType) + + OperationStatus initStatus = new OperationStatus() + initStatus.setServiceId(serviceId) + initStatus.setOperationId(operationId) + initStatus.setOperation(operationType) + initStatus.setUserId(userId) + initStatus.setResult(result) + initStatus.setProgress(progress) + initStatus.setReason(reason) + initStatus.setOperationContent(operationContent) + + requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + + } catch (Exception e) { + logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), + "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", + ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) + execution.setVariable("CVFMI_ErrorResponse", + "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + } + logger.debug(Prefix + "prepareInitServiceOperationStatus Exit") + } + def sendSyncResponse = { DelegateExecution execution -> logger.debug(Prefix + "sendSyncResponse Start") try { - String operationId = execution.getVariable("operationId") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String operationId = customerInfo.getOperationId() + // RESTResponse for API Handler (APIH) Reply Task String Activate5GsliceServiceRestRequest = """{"operationId":"${operationId}"}""".trim() logger.debug(" sendSyncResponse to APIH:" + "\n" + Activate5GsliceServiceRestRequest) + sendWorkflowResponse(execution, 202, Activate5GsliceServiceRestRequest) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { @@ -171,410 +228,289 @@ class ActivateSliceService extends AbstractServiceTaskProcessor { logger.debug(Prefix + "sendSyncError Exit") } + def checkAAIOrchStatusOfE2ESlice = { DelegateExecution execution -> + logger.debug(Prefix + "CheckAAIOrchStatus Start") + execution.setVariable("isContinue", "false") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String msg + String serviceInstanceId = customerInfo.serviceInstanceId + String globalSubscriberId = customerInfo.globalSubscriberId + String subscriptionServiceType = customerInfo.subscriptionServiceType - def prepareCompletionRequest = { DelegateExecution execution -> - logger.debug(Prefix + "prepareCompletionRequest Start") - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String userId = execution.getVariable("globalSubscriberId") - //String result = execution.getVariable("result") - String result = "finished" - String progress = "100" - String reason = "" - String operationContent = execution.getVariable("operationContent") - String operationType = execution.getVariable("operationType") - - OperationStatus initStatus = new OperationStatus() - initStatus.setServiceId(serviceId) - initStatus.setOperationId(operationId) - initStatus.setOperation(operationType) - initStatus.setUserId(userId) - initStatus.setResult(result) - initStatus.setProgress(progress) - initStatus.setReason(reason) - initStatus.setOperationContent(operationContent) - - requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) - - logger.debug(Prefix + "prepareCompletionRequest Exit") - } - + logger.debug("serviceInstanceId: " + serviceInstanceId) - /** - * Init the service Operation Status - */ - def prepareInitServiceOperationStatus = { DelegateExecution execution -> - logger.debug(Prefix + "prepareActivateServiceOperationStatus Start") + //check the e2e slice status try { - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = execution.getVariable("operationId") - String operationType = execution.getVariable("operationType") - String userId = execution.getVariable("globalSubscriberId") - String result = "processing" - String progress = "0" - String reason = "" - String operationContent = "Prepare service activation" - - execution.setVariable("e2eserviceInstanceId", serviceId) - execution.setVariable("operationType", operationType) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(serviceInstanceId)) - OperationStatus initStatus = new OperationStatus() - initStatus.setServiceId(serviceId) - initStatus.setOperationId(operationId) - initStatus.setOperation(operationType) - initStatus.setUserId(userId) - initStatus.setResult(result) - initStatus.setProgress(progress) - initStatus.setReason(reason) - initStatus.setOperationContent(operationContent) + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + ServiceInstance serviceInstance = si.orElseThrow() - requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + boolean isContinue = handleOperation(customerInfo, serviceInstance) + execution.setVariable("isContinue", isContinue) + customerInfo.setSnssai(serviceInstance.getEnvironmentContext()) - } catch (Exception e) { - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception Occured Processing prepareInitServiceOperationStatus.", "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) - execution.setVariable("CVFMI_ErrorResponse", - "Error Occurred during prepareInitServiceOperationStatus Method:\n" + e.getMessage()) + execution.setVariable("customerInfo", customerInfo) + execution.setVariable("ssInstance", serviceInstance) + execution.setVariable("ssiUri", uri) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + execution.setVariable("isContinue", "false") + msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.CheckAAIOrchStatus, " + + "Requested e2eservice does not exist: " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - logger.debug(Prefix + "prepareInitServiceOperationStatus Exit") - } + logger.debug(Prefix + "CheckAAIOrchStatus Exit") + } - private getSNSSIStatusByNsi = { DelegateExecution execution, String NSIServiceId -> + static boolean handleOperation(CustomerInfo customerInfo, ServiceInstance serviceInstance) { + OperationType operationType = customerInfo.operationType + OrchestrationStatusEnum status = OrchestrationStatusEnum.getStatus(Objects.requireNonNull( + serviceInstance.getOrchestrationStatus())) - logger.debug(Prefix + "getSNSSIStatusByNsi Start") - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + return ((OrchestrationStatusEnum.ACTIVATED == status && OperationType.DEACTIVATE == operationType) + || (OrchestrationStatusEnum.DEACTIVATED == status && OperationType.ACTIVATE == operationType)) + } - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(NSIServiceId)) - if (!client.exists(uri)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") - } - AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) - Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - if (si.isPresent()) { + void checkAAIOrchStatusOfAllocates(DelegateExecution execution) { + logger.debug(Prefix + "CheckAAIOrchStatus Start") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String msg + String serviceInstanceId = customerInfo.serviceInstanceId + String globalSubscriberId = customerInfo.globalSubscriberId + String subscriptionServiceType = customerInfo.subscriptionServiceType - List<Relationship> relatedList = si.get().getRelationshipList().getRelationship() - for (Relationship relationship : relatedList) { - String relatedTo = relationship.getRelatedTo() - if (relatedTo.toLowerCase() == "allotted-resource") { - //get snssi from allotted resource in list by nsi - List<String> SNSSIList = new ArrayList<>() - List<RelationshipData> relationshipDataList = relationship.getRelationshipData() - for (RelationshipData relationshipData : relationshipDataList) { - if (relationshipData.getRelationshipKey() == "service-instance.service-instance-id") { - SNSSIList.add(relationshipData.getRelationshipValue()) - } - } - for (String snssi : SNSSIList) { - AAIResourcesClient client01 = new AAIResourcesClient() - AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(snssi)) - if (!client.exists(uri01)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, - "Service Instance was not found in aai") - } - AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class) - Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class) - if (nssiSi.isPresent()) { - return nssiSi.get().getOrchestrationStatus() == "deactivated" - } - } + logger.debug("serviceInstanceId: " + serviceInstanceId) - } - } + //check the NSI is exist or the status of NSI is active or de-active + try { - } - logger.debug(Prefix + "getSNSSIStatusByNsi Exit") - } + //get the allotted-resources by e2e slice id + AAIPluralResourceUri uriAllotted = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(serviceInstanceId) + .allottedResources() + ) + AAIResultWrapper wrapperAllotted = client.get(uriAllotted, NotFoundException.class) + Optional<AllottedResources> allAllotted = wrapperAllotted.asBean(AllottedResources.class) - def updateStatusSNSSAIandNSIandNSSI = { DelegateExecution execution -> - logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Start") - logger.debug(" ***** update SNSSAI NSI NSSI slicing ***** ") - String e2eserviceInstanceId = execution.getVariable("e2eserviceInstanceId") - String NSIserviceInstanceId = execution.getVariable("NSIserviceid") - - String globalCustId = execution.getVariable("globalSubscriberId") - String serviceType = execution.getVariable("serviceType") - String operationType = execution.getVariable("operationType") - - String nssiMap = execution.getVariable("nssiMap") - Type type = new TypeToken<HashMap<String, NSSI>>() {}.getType() - Map<String, NSSI> activateNssiMap = new Gson().fromJson(nssiMap, type) - //update tn/cn/an nssi - for (Map.Entry<String, NSSI> entry : activateNssiMap.entrySet()) { - NSSI nssi = entry.getValue() - String nssiid = nssi.getNssiId() - updateStratus(execution, globalCustId, serviceType, nssiid, operationType) - } - if (operationType.equalsIgnoreCase("activation")) { - //update the s-nssai - updateStratus(execution, globalCustId, serviceType, e2eserviceInstanceId, operationType) - //update the nsi - updateStratus(execution, globalCustId, serviceType, NSIserviceInstanceId, operationType) - } else { - //update the s-nssai - updateStratus(execution, globalCustId, serviceType, e2eserviceInstanceId, operationType) - boolean flag = getSNSSIStatusByNsi(execution, NSIserviceInstanceId) - if (flag) { - //update the nsi - updateStratus(execution, globalCustId, serviceType, NSIserviceInstanceId, operationType) - } else { - logger.error("Service's status update failed") - String msg = "Service's status update failed" - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + AllottedResources allottedResources = allAllotted.get() + List<AllottedResource> AllottedResourceList = allottedResources.getAllottedResource() + if (AllottedResourceList.isEmpty()) { + execution.setVariable("isContinue", "false") + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "allottedResources in aai is empty") } + AllottedResource ar = AllottedResourceList.first() + String relatedLink = ar.getRelationshipList().getRelationship().first().getRelatedLink() + String nsiServiceId = relatedLink.substring(relatedLink.lastIndexOf("/") + 1, relatedLink.length()) + customerInfo.setNsiId(nsiServiceId) + execution.setVariable("customerInfo", customerInfo) + logger.info("the NSI ID is:" + nsiServiceId) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + logger.info("NSI Service doesnt exist") + execution.setVariable("isContinue", "false") + msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.CheckAAIOrchStatus " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Exit") + logger.debug(Prefix + "CheckAAIOrchStatus Exit") } + void checkAAIOrchStatusOfNSI(DelegateExecution execution) { - def updateStratus = { DelegateExecution execution, String globalCustId, - String serviceType, String serviceId, String operationType -> - logger.debug(Prefix + "updateStratus Start") + logger.debug(Prefix + "CheckAAIOrchStatus Start") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String msg = "" + String globalSubscriberId = customerInfo.globalSubscriberId + String subscriptionServiceType = customerInfo.subscriptionServiceType + String nsiServiceId = customerInfo.getNsiId() + + logger.debug("network slice instance id: " + nsiServiceId) + //check the NSI is exist or the status of NSI is active or de-active try { - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalCustId).serviceSubscription(serviceType).serviceInstance(serviceId)) - if (!client.exists(uri)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") - } + //Query nsi by nsi id + + //get the NSI id by e2e slice id + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(nsiServiceId)) + AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - if (si.isPresent()) { - if (operationType.equalsIgnoreCase("activation")) { - if (si.get().getOrchestrationStatus() == "deactivated") { - si.get().setOrchestrationStatus("activated") - client.update(uri, si.get()) - } - } else { - if (si.get().getOrchestrationStatus() == "activated") { - si.get().setOrchestrationStatus("deactivated") - client.update(uri, si.get()) - } - } - + ServiceInstance nsInstance = si.get() + if (!"nsi".equalsIgnoreCase(nsInstance.getServiceRole().toLowerCase())) { + logger.info("the service id" + nsInstance.getServiceInstanceId() + "is " + + nsInstance.getServiceRole()) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - } catch (Exception e) { - logger.info("Service is already in active state") - String msg = "Service is already in active state, " + e.getMessage() + execution.setVariable("nsInstance", nsInstance) + execution.setVariable("nsiUri", uri) + boolean isContinue = handleOperation(customerInfo, nsInstance) + execution.setVariable("isContinue", isContinue) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + logger.info("NSI Service doesnt exist") + execution.setVariable("isActivate", "false") + execution.setVariable("isContinue", "false") + msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.CheckAAIOrchStatus " + ex.getMessage() + logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - - logger.debug(Prefix + "updateStratus Exit") + logger.debug(Prefix + "CheckAAIOrchStatus Exit") } - - def prepareActivation = { DelegateExecution execution -> + void prepareActivation(DelegateExecution execution) { logger.debug(Prefix + "prepareActivation Start") - logger.debug(" ***** prepare active NSI/AN/CN/TN slice ***** ") - String NSIserviceInstanceId = execution.getVariable("NSIserviceid") - - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - - Map<String, NSSI> nssiMap = new HashMap<>() + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String globalSubscriberId = customerInfo.globalSubscriberId + String subscriptionServiceType = customerInfo.subscriptionServiceType - List<String> activationSequence = new ArrayList<>(Arrays.asList("an", "tn", "cn")) - - def activationCount = activationSequence.size() - - execution.setVariable("activationIndex", "0") + logger.debug(" ***** prepare active NSI/AN/CN/TN slice ***** ") - execution.setVariable("activationCount", activationCount) + Queue<NssInstance> nssInstances = new LinkedList<>() + ServiceInstance nsInstance = + execution.getVariable("nsInstance") as ServiceInstance try { //get the TN NSSI id by NSI id, active NSSI TN slicing - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(NSIserviceInstanceId)) - if (!client.exists(uri)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") - } - AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) - Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - if (si.isPresent()) { - - List<Relationship> relatedList = si.get().getRelationshipList().getRelationship() - for (Relationship relationship : relatedList) { - String relatedTo = relationship.getRelatedTo() - if (relatedTo.toLowerCase() == "service-instance") { - String relatioshipurl = relationship.getRelatedLink() - String nssiserviceid = - relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, relatioshipurl.length()) - - AAIResourcesClient client01 = new AAIResourcesClient() - AAIResourceUri uri01 = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiserviceid)) - if (!client.exists(uri01)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, - "Service Instance was not found in aai") - } - AAIResultWrapper wrapper01 = client01.get(uri01, NotFoundException.class) - Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class) - if (nssiSi.isPresent()) { - if (nssiSi.get().getEnvironmentContext().toLowerCase().contains("an") - || nssiSi.get().getEnvironmentContext().toLowerCase().contains("cn") - || nssiSi.get().getEnvironmentContext().toLowerCase().contains("tn")) { - nssiMap.put(nssiSi.get().getEnvironmentContext(), - new NSSI(nssiSi.get().getServiceInstanceId(), - nssiSi.get().getModelInvariantId(), nssiSi.get().getModelVersionId())) - } - } - } + List<Relationship> relatedList = nsInstance.getRelationshipList().getRelationship() + for (Relationship relationship : relatedList) { + String relatedTo = relationship.getRelatedTo() + if (!"service-instance".equalsIgnoreCase(relatedTo)) { + continue } - - + String relatioshipurl = relationship.getRelatedLink() + String nssiserviceid = relatioshipurl.substring(relatioshipurl.lastIndexOf("/") + 1, + relatioshipurl.length()) + + AAIResourceUri nsiUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(nssiserviceid)) + if (!client.exists(nsiUri)) { + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, + "Service Instance was not found in aai") + } + AAIResultWrapper wrapper01 = client.get(nsiUri, NotFoundException.class) + Optional<ServiceInstance> nssiSi = wrapper01.asBean(ServiceInstance.class) + nssiSi.ifPresent(new Consumer<ServiceInstance>() { + @Override + void accept(ServiceInstance instance) { + String env = Objects.requireNonNull(instance.getEnvironmentContext()) + NssInstance nssi = NssInstance.builder().nssiId(instance.getServiceInstanceId()) + .modelInvariantId(instance.getModelInvariantId()) + .modelVersionId(instance.getModelVersionId()) + .networkType(NetworkType.fromString(env)) + .operationType(customerInfo.operationType) + .snssai(customerInfo.snssai) + .serviceType(instance.getServiceType()) + .build() + nssInstances.offer(nssi) + } + }) } + execution.setVariable("nssInstances", nssInstances) + execution.setVariable("nssInstanceInfos", nssInstances) } catch (Exception e) { String msg = "Requested service does not exist:" + e.getMessage() logger.info("Service doesnt exist") exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - if (nssiMap.size() > 0) { - execution.setVariable("isNSSIActivate", "true") - String nssiMap01 = mapToJsonStr(nssiMap) - execution.setVariable("nssiMap", nssiMap01) - execution.setVariable("operation_type", "activate") - execution.setVariable("activationCount", nssiMap.size()) - logger.info("the nssiMap01 is :" + nssiMap01) - } else { - execution.setVariable("isNSSIActivate", "false") - } - logger.debug(Prefix + "prepareActivation Exit") } - - private mapToJsonStr = { HashMap<String, NSSI> stringNSSIHashMap -> - HashMap<String, NSSI> map = new HashMap<String, NSSI>() - for (Map.Entry<String, NSSI> child : stringNSSIHashMap.entrySet()) { - map.put(child.getKey(), child.getValue()) + void isOperationFinished(DelegateExecution execution) { + Queue<NssInstance> nssInstances = execution.getVariable("nssInstances") as Queue<NssInstance> + if (nssInstances.isEmpty()) { + execution.setVariable("isOperationFinished", "true") } - return new Gson().toJson(map) } + def updateStatusSNSSAIandNSIandNSSI = { DelegateExecution execution -> + logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Start") + logger.debug(" ***** update SNSSAI NSI NSSI slicing ***** ") + ServiceInstance ssInstance = execution.getVariable("ssInstance") as ServiceInstance + AAIResourceUri ssUri = execution.getVariable("ssiUri") as AAIResourceUri - def checkAAIOrchStatusofslice = { DelegateExecution execution -> - logger.debug(Prefix + "CheckAAIOrchStatus Start") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + OperationType operationType = customerInfo.operationType - String msg = "" - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String globalSubscriberId = execution.getVariable("globalSubscriberId") - String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - String operationType = execution.getVariable("operationType") + updateStratus(execution, ssInstance, operationType, ssUri) + //update the nsi + ServiceInstance nsInstance = execution.getVariable("nsInstance") as ServiceInstance + AAIResourceUri nsiUri = execution.getVariable("nsiUri") as AAIResourceUri - logger.debug("serviceInstanceId: " + serviceInstanceId) + updateStratus(execution, nsInstance, operationType, nsiUri) - //check the e2e slice status - try { - try { - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) - if (!client.exists(uri)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, - "Service Instance was not found in aai") - } - AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) - Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - if (si.isPresent()) { - if (si.get().getOrchestrationStatus().toLowerCase() == "activated" && - operationType.equalsIgnoreCase("deactivation")) { - logger.info("Service is in active state") - execution.setVariable("e2eservicestatus", "activated") - execution.setVariable("isContinue", "true") - String snssai = si.get().getEnvironmentContext() - execution.setVariable("snssai", snssai) - } else if (si.get().getOrchestrationStatus().toLowerCase() == "deactivated" && - operationType.equalsIgnoreCase("activation")) { - logger.info("Service is in de-activated state") - execution.setVariable("e2eservicestatus", "deactivated") - execution.setVariable("isContinue", "true") - String snssai = si.get().getEnvironmentContext() - execution.setVariable("snssai", snssai) - } else { - execution.setVariable("isContinue", "false") - } - } - } catch (Exception e) { - msg = "Requested e2eservice does not exist" - logger.info("e2eservice doesnt exist") - execution.setVariable("isContinue", "false") - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - //check the NSI is exist or the status of NSI is active or de-active - try { + logger.debug(Prefix + "updateStatusSNSSAIandNSIandNSSI Exit") + } - //get the allotted-resources by e2e slice id - AAIResourcesClient client_allotted = new AAIResourcesClient() - AAIPluralResourceUri uri_allotted = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId).allottedResources() - ) - if (!client_allotted.exists(uri_allotted)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service Instance was not found in aai") - } - AAIResultWrapper wrapper_allotted = client_allotted.get(uri_allotted, NotFoundException.class) - Optional<AllottedResources> all_allotted = wrapper_allotted.asBean(AllottedResources.class) - - if (all_allotted.isPresent() && all_allotted.get().getAllottedResource()) { - List<AllottedResource> AllottedResourceList = all_allotted.get().getAllottedResource() - AllottedResource ar = AllottedResourceList.first() - String relatedLink = ar.getRelationshipList().getRelationship().first().getRelatedLink() - String nsiserviceid = relatedLink.substring(relatedLink.lastIndexOf("/") + 1, relatedLink.length()) - execution.setVariable("NSIserviceid", nsiserviceid) - logger.info("the NSI ID is:" + nsiserviceid) - - //Query nsi by nsi id - try { - //get the NSI id by e2e slice id - AAIResourcesClient client = new AAIResourcesClient() - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nsiserviceid)) - if (!client.exists(uri)) { - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, - "Service Instance was not found in aai") - } - AAIResultWrapper wrapper = client.get(uri, NotFoundException.class) - Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) - - if (si.isPresent()) { - if (si.get().getServiceRole().toLowerCase() == "nsi") { - if (si.get().getOrchestrationStatus() == "activated") { - logger.info("NSI services is in activated state") - execution.setVariable("NSIservicestatus", "activated") - } else { - logger.info("NSI services is in deactivated state") - execution.setVariable("NSIservicestatus", "deactivated") - } - } else { - logger.info("the service id" + si.get().getServiceInstanceId() + "is " + - si.get().getServiceRole()) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - } catch (Exception e) { - msg = "Requested NSI service does not exist:" + e.getMessage() - logger.info("NSI service doesnt exist") - execution.setVariable("isContinue", "false") - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - } - } catch (Exception e) { - msg = "Requested service does not exist: " + e.getMessage() - logger.info("NSI Service doesnt exist") - execution.setVariable("isActivate", "false") - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + void updateStratus(DelegateExecution execution, ServiceInstance serviceInstance, + OperationType operationType, AAIResourceUri uri) { + + logger.debug(Prefix + "updateStratus Start") + + try { + serviceInstance.setOrchestrationStatus() + if (OperationType.ACTIVATE == operationType) { + serviceInstance.setOrchestrationStatus(OrchestrationStatusEnum.ACTIVATED.getValue()) + } else { + serviceInstance.setOrchestrationStatus(OrchestrationStatusEnum.DEACTIVATED.getValue()) } - } catch (BpmnError e) { - throw e - } catch (Exception ex) { - msg = "Exception in org.onap.so.bpmn.common.scripts.CompleteMsoProcess.CheckAAIOrchStatus " + ex.getMessage() - logger.info(msg) + client.update(uri, serviceInstance) + } catch (Exception e) { + logger.info("Service is already in active state") + String msg = "Service is already in active state, " + e.getMessage() exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - logger.debug(Prefix + "CheckAAIOrchStatus Exit") + logger.debug(Prefix + "updateStratus Exit") } + def prepareCompletionRequest = { DelegateExecution execution -> + logger.debug(Prefix + "prepareCompletionRequest Start") + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String serviceId = customerInfo.getServiceInstanceId() + String operationId = customerInfo.getOperationId() + String userId = customerInfo.getGlobalSubscriberId() + + String result = "finished" + String progress = "100" + String reason = "" + String operationContent = "action finished success" + String operationType = customerInfo.operationType.getType() + + OperationStatus initStatus = new OperationStatus() + initStatus.setServiceId(serviceId) + initStatus.setOperationId(operationId) + initStatus.setOperation(operationType) + initStatus.setUserId(userId) + initStatus.setResult(result) + initStatus.setProgress(progress) + initStatus.setReason(reason) + initStatus.setOperationContent(operationContent) + + requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + + logger.debug(Prefix + "prepareCompletionRequest Exit") + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateSliceService.groovy new file mode 100644 index 0000000000..3d9f67653b --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateSliceService.groovy @@ -0,0 +1,273 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + # Copyright (c) 2020, CMCC Technologies Co., Ltd. + # + # Licensed under the Apache License, Version 2.0 (the "License") + # you may not use this file except in compliance with the License. + # You may obtain a copy of the License at + # + # http://www.apache.org/licenses/LICENSE-2.0 + # + # Unless required by applicable law or agreed to in writing, software + # distributed under the License is distributed on an "AS IS" BASIS, + # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + # See the License for the specific language governing permissions and + # limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.scripts + +import com.fasterxml.jackson.databind.ObjectMapper +import com.google.gson.Gson +import com.google.gson.reflect.TypeToken +import org.apache.commons.lang3.StringUtils +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.logging.filter.base.ErrorCode +import org.onap.so.beans.nsmf.* +import org.onap.so.beans.nsmf.oof.SubnetType +import org.onap.so.bpmn.common.scripts.* +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ServiceArtifact +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.logger.LoggingAnchor +import org.onap.so.logger.MessageEnum +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import org.springframework.web.util.UriUtils + +import java.lang.reflect.Type + +/** + * This class supports the DoCreateVnf building block subflow + * with the creation of a generic vnf for + * infrastructure. + * + */ +class DoActivateSliceService extends AbstractServiceTaskProcessor { + + private static final Logger logger = LoggerFactory.getLogger(DoActivateSliceService.class) + + private static final NSSMF_ACTIVATION_URL = "/api/rest/provMns/v1/NSS/%s/activation" + + private static final NSSMF_DEACTIVATION_URL = "/api/rest/provMns/v1/NSS/%s/deactivation" + + private static final NSSMF_QUERY_JOB_STATUS_URL = "/api/rest/provMns/v1/NSS/jobs/%s" + + String Prefix="DoCNSSMF_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + ObjectMapper objectMapper = new ObjectMapper() + + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) + + /** + * This method gets and validates the incoming + * request. + * + * @param - execution + * + */ + public void preProcessRequest(DelegateExecution execution) { + + execution.setVariable("prefix",Prefix) + logger.debug("STARTED Do sendcommandtoNssmf PreProcessRequest Process") + + /*******************/ + try{ + Queue<NssInstance> nssInstances = execution.getVariable("nssInstances") as Queue<NssInstance> + NssInstance nssInstance = nssInstances.poll() + execution.setVariable("nssInstances", nssInstances) + execution.setVariable("nssInstance", nssInstance) + + logger.info("the end !!") + }catch(BpmnError b){ + logger.debug("Rethrowing MSOWorkflowException") + throw b + }catch(Exception e){ + logger.info("the end of catch !!") + logger.debug(" Error Occured in DoSendCommandToNSSMF PreProcessRequest method!" + e.getMessage()) + exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoSendCommandToNSSMF PreProcessRequest") + + } + logger.trace("COMPLETED DoSendCommandToNSSMF PreProcessRequest Process") + } + + void prepareCompose(DelegateExecution execution) { + NssInstance nssInstance = execution.getVariable("nssInstance") as NssInstance + execution.setVariable("nssInstanceId", nssInstance.nssiId) + String serviceModelInfo = """{ + "modelInvariantUuid":"${nssInstance.modelInvariantId}", + "modelUuid":"${nssInstance.modelVersionId}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + /** + * get vendor Info + * @param execution + */ + void processDecomposition(DelegateExecution execution) { + logger.debug("***** processDecomposition *****") + + try { + ServiceDecomposition serviceDecomposition = + execution.getVariable("serviceDecomposition") as ServiceDecomposition + + String vendor = serviceDecomposition.getServiceRole() + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + NssInstance nssInstance = execution.getVariable("nssInstance") as NssInstance + String reqUrl + String actionType + if (OperationType.ACTIVATE == nssInstance.operationType) { + reqUrl = String.format(NSSMF_ACTIVATION_URL, nssInstance.snssai) + actionType = "activate" + } else { + reqUrl = String.format(NSSMF_DEACTIVATION_URL, nssInstance.snssai) + actionType = "deactivate" + } + execution.setVariable("reqUrl", reqUrl) + + NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() + + EsrInfo esrInfo = new EsrInfo() + esrInfo.setVendor(vendor) + esrInfo.setNetworkType(nssInstance.networkType) + + ServiceInfo serviceInfo = ServiceInfo.builder() + .nssiId(nssInstance.nssiId) + .subscriptionServiceType(customerInfo.subscriptionServiceType) + .globalSubscriberId(customerInfo.globalSubscriberId) + .nsiId(customerInfo.nsiId) + .serviceInvariantUuid(nssInstance.modelInvariantId) + .serviceUuid(nssInstance.modelVersionId) + .serviceType(nssInstance.serviceType) + .actionType(actionType) + .build() + + ActDeActNssi actDeActNssi = new ActDeActNssi() + actDeActNssi.setNsiId(customerInfo.nsiId) + actDeActNssi.setNssiId(nssInstance.nssiId) + + nbiRequest.setEsrInfo(esrInfo) + nbiRequest.setServiceInfo(serviceInfo) + nbiRequest.setActDeActNssi(actDeActNssi) + execution.setVariable("nbiRequest", nbiRequest) + execution.setVariable("esrInfo", esrInfo) + execution.setVariable("serviceInfo", serviceInfo) + + } catch (any) { + String exceptionMessage = "Bpmn error encountered in deallocate nssi. processDecomposition() - " + any.getMessage() + logger.debug(exceptionMessage) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + } + logger.debug("***** Exit processDecomposition *****") + } + + /** + * send Create Request NSSMF + * @param execution + */ + void sendCreateRequestNSSMF(DelegateExecution execution) { + NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest + String nssmfRequest = objectMapper.writeValueAsString(nbiRequest) + logger.debug("sendCreateRequestNSSMF: " + nssmfRequest) + + String reqUrl = execution.getVariable("reqUrl") + String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, reqUrl, nssmfRequest) + + if (response != null) { + NssiResponse nssiResponse = objectMapper.readValue(response, NssiResponse.class) + execution.setVariable("nssiAllocateResult", nssiResponse) + } + //todo: error + } + + /** + * query nssi allocate status + * @param execution + */ + void queryNSSIStatus(DelegateExecution execution) { + NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() + EsrInfo esrInfo = execution.getVariable("esrInfo") as EsrInfo + ServiceInfo serviceInfo = execution.getVariable("serviceInfo") as ServiceInfo + nbiRequest.setEsrInfo(esrInfo) + nbiRequest.setServiceInfo(serviceInfo) + + NssiResponse nssiAllocateResult = execution.getVariable("nssiAllocateResult") as NssiResponse + String jobId = nssiAllocateResult.getJobId() + + String endpoint = String.format(NSSMF_QUERY_JOB_STATUS_URL, jobId) + + String response = + nssmfAdapterUtils.sendPostRequestNSSMF(execution, endpoint, objectMapper.writeValueAsString(nbiRequest)) + + logger.debug("nssmf response nssiAllocateStatus:" + response) + + if (response != null) { + JobStatusResponse jobStatusResponse = objectMapper.readValue(response, JobStatusResponse.class) + + execution.setVariable("nssiAllocateStatus", jobStatusResponse) + if (jobStatusResponse.getResponseDescriptor().getProgress() == 100) { + execution.setVariable("jobFinished", true) + } + } + } + + void timeDelay(DelegateExecution execution) { + logger.trace("Enter timeDelay in DoAllocateNSSI()") + try { + Thread.sleep(60000) + + int currentCycle = execution.hasVariable("currentCycle") ? + execution.getVariable("currentCycle") as Integer : 1 + + currentCycle = currentCycle + 1 + if(currentCycle > 60) + { + logger.trace("Completed all the retry times... but still nssmf havent completed the creation process...") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "NSSMF creation didnt complete by time...") + } + execution.setVariable("currentCycle", currentCycle) + } catch(InterruptedException e) { + logger.info("Time Delay exception" + e) + } + logger.trace("Exit timeDelay in DoAllocateNSSI()") + } + + void sendSyncError (DelegateExecution execution) { + logger.trace("start sendSyncError") + try { + String errorMessage = "" + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") + errorMessage = wfe.getErrorMessage() + } else { + errorMessage = "Sending Sync Error." + } + + String buildworkflowException = + """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> + <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> + <aetgt:ErrorCode>7000</aetgt:ErrorCode> + </aetgt:WorkflowException>""" + + logger.debug(buildworkflowException) + sendWorkflowResponse(execution, 500, buildworkflowException) + + } catch (Exception ex) { + logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) + } + logger.trace("finished sendSyncError") + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy index f3f8c8bacf..ff7b0a3b6d 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy @@ -117,6 +117,19 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor { } + String getOrchStatusBasedOnActionType(String actionType) { + String res = "unknown" + if (actionType.equals("activate")) { + res = "activated" + } else if (actionType.equals("deactivate")) { + res = "deactivated" + } else { + logger.error("ERROR: getOrchStatusBasedOnActionType bad actionType= \n" + actionType) + } + + return res + } + void updateAAIOrchStatus(DelegateExecution execution) { logger.debug("Start updateAAIOrchStatus") String tnNssiId = execution.getVariable("sliceServiceInstanceId") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy index f591855b5c..982771f681 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyAccessNSSI.groovy @@ -549,7 +549,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { updateStatus.setResourceTemplateUUID(nsiId) updateStatus.setResourceInstanceID(nssiId) updateStatus.setOperType("Modify") - updateStatus.setProgress(100) + updateStatus.setProgress("100") updateStatus.setStatus("finished") requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus) @@ -571,7 +571,7 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { updateStatus.setResourceTemplateUUID(nsiId) updateStatus.setResourceInstanceID(nssiId) updateStatus.setOperType("Modify") - updateStatus.setProgress(0) + updateStatus.setProgress("0") updateStatus.setStatus("failed") requestDBUtil.prepareUpdateResourceOperationStatus(execution, updateStatus) } @@ -652,4 +652,4 @@ class DoModifyAccessNSSI extends AbstractServiceTaskProcessor { logger.debug("Error occured within deleteServiceInstance method: " + e) } } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy index 6fdfbe3218..e0df9ea64b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoModifyRanNfNssi.groovy @@ -29,7 +29,8 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import com.fasterxml.jackson.databind.ObjectMapper import com.google.gson.JsonObject -import java.sql.Timestamp +import com.google.gson.JsonParser +import java.time.Instant import static org.apache.commons.lang3.StringUtils.isBlank import org.onap.so.bpmn.core.UrnPropertiesReader @@ -75,7 +76,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { execution.setVariable("sliceProfile", sliceProfile) break case "reconfigure": - String resourceConfig = execution.getVariable("additionalProperties") + String resourceConfig = execution.getVariable("additionalProperties") execution.setVariable("resourceConfig", resourceConfig) break default: @@ -83,7 +84,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 500, "Invalid modify Action : "+modifyAction) } } - List<String> snssaiList = objectMapper.readValue(execution.getVariable("snssaiList"), List.class) + List<String> snssaiList = execution.getVariable("snssaiList") String sliceProfileId = execution.getVariable("sliceProfileId") if (isBlank(sliceProfileId) || (snssaiList.empty)) { msg = "Mandatory fields are empty" @@ -109,7 +110,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { logger.debug(Prefix+"createSdnrRequest method start") String callbackUrl = UrnPropertiesReader.getVariable("mso.workflow.message.endpoint") + "/AsyncSdnrResponse/"+execution.getVariable("msoRequestId") String modifyAction = execution.getVariable("modifyAction") - String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "InstantiateRANSlice", callbackUrl) + String sdnrRequest = buildSdnrAllocateRequest(execution, modifyAction, "instantiateRANSlice", callbackUrl) execution.setVariable("createNSSI_sdnrRequest", sdnrRequest) execution.setVariable("createNSSI_timeout", "PT10M") execution.setVariable("createNSSI_correlator", execution.getVariable("msoRequestId")) @@ -123,6 +124,7 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { if(status.equalsIgnoreCase("success")) { String nfIds = jsonUtil.getJsonValue(SDNRResponse, "nfIds") execution.setVariable("ranNfIdsJson", nfIds) + execution.setVariable("ranNfStatus", status) }else { String reason = jsonUtil.getJsonValue(SDNRResponse, "reason") logger.error("received failed status from SDNR "+ reason) @@ -134,53 +136,47 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { private String buildSdnrAllocateRequest(DelegateExecution execution, String action, String rpcName, String callbackUrl) { String requestId = execution.getVariable("msoRequestId") - Date date = new Date().getTime() - Timestamp time = new Timestamp(date) - String sliceProfileString + Instant time = Instant.now() + Map<String,Object> sliceProfile = new HashMap<>() JsonObject response = new JsonObject() JsonObject body = new JsonObject() JsonObject input = new JsonObject() JsonObject commonHeader = new JsonObject() JsonObject payload = new JsonObject() JsonObject payloadInput = new JsonObject() + JsonParser parser = new JsonParser() if(action.equals("allocate")) { - Map<String,Object> sliceProfile = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class) + sliceProfile = objectMapper.readValue(execution.getVariable("sliceProfile"), Map.class) sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId")) sliceProfile.put("maxNumberofConns", sliceProfile.get("maxNumberofPDUSessions")) sliceProfile.put("uLThptPerSlice", sliceProfile.get("expDataRateUL")) sliceProfile.put("dLThptPerSlice", sliceProfile.get("expDataRateDL")) - sliceProfileString = objectMapper.writeValueAsString(sliceProfile) action = "modify-"+action payloadInput.add("additionalproperties", new JsonObject()) }else if(action.equals("deallocate")) { action = "modify-"+action - Map<String,Object> sliceProfile = new HashMap<>() sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId")) sliceProfile.put("sNSSAI", execution.getVariable("snssai")) - sliceProfileString = objectMapper.writeValueAsString(sliceProfile) payloadInput.add("additionalproperties", new JsonObject()) }else if(action.equals("reconfigure")) { - Map<String,Object> sliceProfile = new HashMap<>() sliceProfile.put("sliceProfileId", execution.getVariable("sliceProfileId")) sliceProfile.put("sNSSAI", execution.getVariable("snssai")) - sliceProfileString = objectMapper.writeValueAsString(sliceProfile) JsonObject resourceconfig = new JsonObject() - resourceconfig.addProperty("resourceConfig", execution.getVariable("resourceConfig")) + resourceconfig.add("resourceConfig", (JsonObject) parser.parse(execution.getVariable("resourceConfig"))) payloadInput.add("additionalproperties", resourceconfig) } - commonHeader.addProperty("TimeStamp", time.toString()) - commonHeader.addProperty("APIver", "1.0") - commonHeader.addProperty("RequestID", requestId) - commonHeader.addProperty("SubRequestID", "1") - commonHeader.add("RequestTrack", new JsonObject()) - commonHeader.add("Flags", new JsonObject()) - payloadInput.addProperty("sliceProfile", sliceProfileString) + commonHeader.addProperty("timestamp", time.toString()) + commonHeader.addProperty("api-ver", "1.0") + commonHeader.addProperty("request-id", requestId) + commonHeader.addProperty("sub-request-id", "1") + commonHeader.add("flags", new JsonObject()) + payloadInput.addProperty("sliceProfile", sliceProfile.toString()) payloadInput.addProperty("RANNFNSSIId", execution.getVariable("serviceInstanceID")) payloadInput.addProperty("callbackURL", callbackUrl) payload.add("input", payloadInput) - input.add("CommonHeader", commonHeader) - input.addProperty("Action", action) - input.add("Payload", payload) + input.add("common-header", commonHeader) + input.addProperty("action", action) + input.addProperty("payload", payload.toString()) body.add("input", input) response.add("body", body) response.addProperty("version", "1.0") @@ -190,4 +186,4 @@ class DoModifyRanNfNssi extends AbstractServiceTaskProcessor { return response.toString() } -}
\ No newline at end of file +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy deleted file mode 100644 index a85f5d8ab3..0000000000 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy +++ /dev/null @@ -1,423 +0,0 @@ -/*- - * ============LICENSE_START======================================================= - * ONAP - SO - * ================================================================================ - # Copyright (c) 2019, CMCC Technologies Co., Ltd. - # - # Licensed under the Apache License, Version 2.0 (the "License") - # you may not use this file except in compliance with the License. - # You may obtain a copy of the License at - # - # http://www.apache.org/licenses/LICENSE-2.0 - # - # Unless required by applicable law or agreed to in writing, software - # distributed under the License is distributed on an "AS IS" BASIS, - # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - # See the License for the specific language governing permissions and - # limitations under the License. - * ============LICENSE_END========================================================= - */ - -package org.onap.so.bpmn.infrastructure.scripts - -import com.fasterxml.jackson.databind.ObjectMapper -import com.google.gson.Gson -import com.google.gson.reflect.TypeToken -import org.camunda.bpm.engine.delegate.BpmnError -import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.beans.nsmf.* -import org.onap.so.bpmn.common.scripts.* -import org.onap.so.bpmn.core.UrnPropertiesReader -import org.onap.so.bpmn.core.WorkflowException -import org.onap.so.bpmn.core.domain.ServiceArtifact -import org.onap.so.bpmn.core.domain.ServiceDecomposition -import org.onap.so.bpmn.core.json.JsonUtils -import org.onap.logging.filter.base.ErrorCode -import org.onap.so.logger.LoggingAnchor -import org.onap.so.logger.MessageEnum -import org.slf4j.Logger -import org.slf4j.LoggerFactory -import org.springframework.web.util.UriUtils - -import java.lang.reflect.Type - -/** - * This class supports the DoCreateVnf building block subflow - * with the creation of a generic vnf for - * infrastructure. - * - */ -class DoSendCommandToNSSMF extends AbstractServiceTaskProcessor { - - private static final Logger logger = LoggerFactory.getLogger( DoSendCommandToNSSMF.class); - String Prefix="DoCNSSMF_" - ExceptionUtil exceptionUtil = new ExceptionUtil() - JsonUtils jsonUtil = new JsonUtils() - VidUtils vidUtils = new VidUtils(this) - SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - - private NssmfAdapterUtils nssmfAdapterUtils = new NssmfAdapterUtils(httpClientFactory, jsonUtil) - - /** - * This method gets and validates the incoming - * request. - * - * @param - execution - * - */ - public void preProcessRequest(DelegateExecution execution) { - - execution.setVariable("prefix",Prefix) - logger.debug("STARTED Do sendcommandtoNssmf PreProcessRequest Process") - - /*******************/ - try{ - // Get Variables - String e2eserviceInstanceId = execution.getVariable("e2eserviceInstanceId") - String serviceInstanceId = execution.getVariable("e2eserviceInstanceId") - execution.setVariable("e2eserviceInstanceId", e2eserviceInstanceId) - execution.setVariable("serviceInstanceId", serviceInstanceId) - logger.debug("Incoming e2eserviceInstanceId is: " + e2eserviceInstanceId) - - String NSIserviceid = execution.getVariable("NSIserviceid") - execution.setVariable("NSIserviceid", NSIserviceid) - logger.debug("Incoming NSI id is: " + NSIserviceid) - - - String nssiMap = execution.getVariable("nssiMap") - Type type = new TypeToken<HashMap<String, NSSI>>(){}.getType() - Map<String, NSSI> DonssiMap = new Gson().fromJson(nssiMap,type) - String strDonssiMap = mapToJsonStr(DonssiMap) - execution.setVariable("DonssiMap",strDonssiMap) - logger.debug("Incoming DonssiMap is: " + strDonssiMap) - - String requestId = execution.getVariable("msoRequestId") - execution.setVariable("msoRequestId", requestId) - - String operationType = execution.getVariable("operationType") - execution.setVariable("operationType", operationType.toLowerCase()) - logger.debug("Incoming operationType is: " + operationType) - - if (operationType == "activation") { - execution.setVariable("activationSequence","an,tn,cn") - }else { - execution.setVariable("activationSequence","cn,tn,an") - } - execution.setVariable("activationIndex",0) - execution.setVariable("miniute", "0") - execution.setVariable("activateNumberSlice",0) - - logger.info("the end !!") - }catch(BpmnError b){ - logger.debug("Rethrowing MSOWorkflowException") - throw b - }catch(Exception e){ - logger.info("the end of catch !!") - logger.debug(" Error Occured in DoSendCommandToNSSMF PreProcessRequest method!" + e.getMessage()) - exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Internal Error - Occured in DoSendCommandToNSSMF PreProcessRequest") - - } - logger.trace("COMPLETED DoSendCommandToNSSMF PreProcessRequest Process") - } - - private String mapToJsonStr(Map<String, NSSI> stringNSSIHashMap) { - HashMap<String, NSSI> map = new HashMap<String, NSSI>() - for(Map.Entry<String, NSSI> child:stringNSSIHashMap.entrySet()) - { - map.put(child.getKey(), child.getValue()) - } - return new Gson().toJson(map) - } - - public void getNSSIformlist(DelegateExecution execution) { - - String nssiMap = execution.getVariable("DonssiMap") - Type type = new TypeToken<HashMap<String, NSSI>>(){}.getType() - Map<String, NSSI> DonssiMap = new Gson().fromJson(nssiMap,type) - String isNSSIActivate = execution.getVariable("isNSSIActivate") - - String activationSequence01 = execution.getVariable("activationSequence") - String[] strlist = activationSequence01.split(",") - - int activationIndex = execution.getVariable("activationIndex") - int indexcurrent = 0 - if (isNSSIActivate == "true") - { - execution.setVariable("isGetSuccessfull", "false") - }else{for (int index = activationIndex; index < 3;index++) { - String domaintype01 = strlist[index] - if (DonssiMap.containsKey(domaintype01)) { - NSSI nssiobject = DonssiMap.get(domaintype01) - execution.setVariable("domainType", domaintype01) - execution.setVariable("nssiId", nssiobject.getNssiId()) - execution.setVariable("modelInvariantUuid", nssiobject.getModelInvariantId()) - execution.setVariable("modelUuid", nssiobject.getModelVersionId()) - execution.setVariable("isGetSuccessfull", "true") - String modelInvariantUuid = execution.getVariable("modelInvariantUuid") - String modelUuid = execution.getVariable("modelUuid") - //here modelVersion is not set, we use modelUuid to decompose the service. - String serviceModelInfo = """{ - "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"${modelUuid}", - "modelVersion":"" - }""" - execution.setVariable("serviceModelInfo", serviceModelInfo) - indexcurrent = index - execution.setVariable("activationIndex", indexcurrent) - break - }else - { - indexcurrent = index + 1 - - } - } - if ( activationIndex > 2) { - execution.setVariable("isGetSuccessfull", "false") - } - execution.setVariable("activationIndex", indexcurrent)} - - } - - /** - * get vendor Info - * @param execution - */ - private void processDecomposition(DelegateExecution execution) { - logger.debug("***** processDecomposition *****") - - try { - ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") as ServiceDecomposition - ServiceArtifact serviceArtifact = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0) - String content = serviceArtifact.getContent() - String vendor = jsonUtil.getJsonValue(content, "metadata.vendor") - //String domainType = jsonUtil.getJsonValue(content, "metadata.domainType") - - execution.setVariable("vendor", vendor) - // currentNSSI['domainType'] = domainType - logger.info("processDecomposition, current vendor-domainType:" + vendor) - - } catch (any) { - String exceptionMessage = "Bpmn error encountered in deallocate nssi. processDecomposition() - " + any.getMessage() - logger.debug(exceptionMessage) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) - } - logger.debug("***** Exit processDecomposition *****") - } - - public void UpdateIndex(DelegateExecution execution) { - def activationIndex = execution.getVariable("activationIndex") - int activateNumberSlice = execution.getVariable("activateNumberSlice") as Integer - def activationCount= execution.getVariable("activationCount") - //DecimalFormat df1 = new DecimalFormat("##%") - int rate = (activateNumberSlice / activationCount) * 100 - if (rate == 100) - { - execution.setVariable("isNSSIActivate","true") - } - else{ - execution.setVariable("isNSSIActivate","false") - } - activationIndex = activationIndex + 1 - execution.setVariable("activationIndex",activationIndex) - logger.trace("the Progress of activation is " + rate.toString() + "%" ) - try{ - String serviceId = execution.getVariable("serviceInstanceId") - String operationId = UUID.randomUUID().toString() - String operationType = execution.getVariable("operationType") - String userId = "" - String result = (operationType.equalsIgnoreCase("activation"))? "ACTIVATING": "DEACTIVATING" - int progress = rate - String reason = "" - String operationContent = "Service activation in progress" - logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) - serviceId = UriUtils.encode(serviceId,"UTF-8") - execution.setVariable("e2eserviceInstanceId", serviceId) - execution.setVariable("operationId", operationId) - execution.setVariable("operationType", operationType) - - def dbAdapterEndpoint = UrnPropertiesReader.getVariable("mso.adapters.openecomp.db.endpoint",execution) - execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) - logger.debug("DB Adapter Endpoint is: " + dbAdapterEndpoint) - - String payload = - """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" - xmlns:ns="http://org.onap.so/requestsdb"> - <soapenv:Header/> - <soapenv:Body> - <ns:initServiceOperationStatus xmlns:ns="http://org.onap.so/requestsdb"> - <serviceId>${MsoUtils.xmlEscape(serviceId)}</serviceId> - <operationId>${MsoUtils.xmlEscape(operationId)}</operationId> - <operationType>${MsoUtils.xmlEscape(operationType)}</operationType> - <userId>${MsoUtils.xmlEscape(userId)}</userId> - <result>${MsoUtils.xmlEscape(result)}</result> - <operationContent>${MsoUtils.xmlEscape(operationContent)}</operationContent> - <progress>${MsoUtils.xmlEscape(progress)}</progress> - <reason>${MsoUtils.xmlEscape(reason)}</reason> - </ns:initServiceOperationStatus> - </soapenv:Body> - </soapenv:Envelope>""" - - payload = utils.formatXml(payload) - execution.setVariable("CVFMI_updateServiceOperStatusRequest", payload) - logger.debug("Outgoing CVFMI_updateServiceOperStatusRequest: \n" + payload) - - }catch(Exception e){ - logger.error(LoggingAnchor.FIVE, MessageEnum.BPMN_GENERAL_EXCEPTION_ARG.toString(), - "Exception Occured Processing Activate Slice .", "BPMN", - ErrorCode.UnknownError.getValue(), "Exception is:\n" + e) - execution.setVariable("CVFMI_ErrorResponse", "Error Occurred during Activate Slice Method:\n" + e.getMessage()) - } - logger.trace("finished Activate Slice") - } - - public void WaitForReturn(DelegateExecution execution) { - //logger.debug("Query : "+ Jobid) - String miniute = execution.getVariable("miniute") - Thread.sleep(10000) - int miniute01 = Integer.parseInt(miniute) + 1 - logger.debug("waiting for : "+ miniute + "miniutes") - execution.setVariable("miniute", String.valueOf(miniute01)) - } - - public void GetTheStatusOfActivation(DelegateExecution execution) { - - String domaintype = execution.getVariable("domainType") - String NSIserviceid=execution.getVariable("NSIserviceid") - String nssiId = execution.getVariable("nssiId") - String Jobid=execution.getVariable("JobId") - String miniute=execution.getVariable("miniute") - String vendor = execution.getVariable("vendor") - String jobstatus - - - logger.debug("Query the jobid activation of SNSSAI: "+ Jobid) - logger.debug("the domain is : "+ domaintype) - logger.debug("the NSSID is : "+nssiId) - logger.debug("the NSIserviceid is : "+NSIserviceid) - - JobStatusRequest jobStatusRequest = new JobStatusRequest() - - EsrInfo info = new EsrInfo() - info.setNetworkType(NetworkType.fromString(domaintype)) - info.setVendor(vendor) - - jobStatusRequest.setNsiId(NSIserviceid) - jobStatusRequest.setNssiId(nssiId) - jobStatusRequest.setEsrInfo(info) - - - ObjectMapper mapper = new ObjectMapper() - String nssmfRequest = mapper.writeValueAsString(jobStatusRequest) - String isActivateSuccessfull - - String urlString = "/api/rest/provMns/v1/NSS/jobs/" +Jobid - - JobStatusResponse jobStatusResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest, JobStatusResponse.class) - - if (jobStatusResponse != null) { - execution.setVariable("statusDescription", jobStatusResponse.getResponseDescriptor().getStatusDescription()) - jobstatus = jobStatusResponse.getResponseDescriptor().getStatus() - switch(jobstatus) { - case "started": - case "processing": - isActivateSuccessfull = "waitting" - execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) - break - case "finished": - isActivateSuccessfull = "true" - execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) - execution.setVariable("activateNumberSlice",execution.getVariable("activateNumberSlice")+ 1) - break - case "error": - default: - isActivateSuccessfull = "false" - execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) - - } - if(Integer.parseInt(miniute) > 6 ) - { - isActivateSuccessfull = "false" - execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a timeout job status Response from NSSMF.") - } - } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad job status Response from NSSMF.") - isActivateSuccessfull = false - execution.setVariable("isActivateSuccessfull", isActivateSuccessfull) - } - } - - public void SendCommandToNssmf(DelegateExecution execution) { - - String snssai= execution.getVariable("snssai") - String domaintype = execution.getVariable("domainType") - String NSIserviceid=execution.getVariable("NSIserviceid") - String nssiId = execution.getVariable("nssiId") - String vendor = execution.getVariable("vendor") - - - logger.debug("the domain is : "+domaintype) - logger.debug("SNSSAI: "+snssai +" will be activated") - logger.debug("the NSSID is : "+nssiId) - logger.debug("the NSIserviceid is : "+NSIserviceid) - - EsrInfo esr = new EsrInfo(); - esr.setNetworkType(NetworkType.fromString(domaintype)) - esr.setVendor(vendor) - - ActDeActNssi actNssi = new ActDeActNssi(); - actNssi.setNsiId(NSIserviceid); - actNssi.setNssiId(nssiId); - NssiActDeActRequest actRequest = new NssiActDeActRequest(); - actRequest.setActDeActNssi(actNssi); - actRequest.setEsrInfo(esr) - - ObjectMapper mapper = new ObjectMapper() - String nssmfRequest = mapper.writeValueAsString(actRequest) - - String operationType = execution.getVariable("operationType") - - String urlString = "/api/rest/provMns/v1/NSS/" + snssai + "/" + operationType.toLowerCase() - - NssiResponse nssmfResponse = nssmfAdapterUtils.sendPostRequestNSSMF(execution, urlString, nssmfRequest, NssiResponse.class) - - if (nssmfResponse != null) { - String isNSSIActivated = "true" - execution.setVariable("isNSSIActivated", isNSSIActivated) - String jobId = nssmfResponse.getJobId() ?: "" - execution.setVariable("JobId", jobId) - } else { - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Received a Bad Response from NSSMF.") - String isNSSIActivated = "false" - execution.setVariable("isNSSIActivated", isNSSIActivated) - execution.setVariable("isNSSIActivate","false") - } - - } - - void sendSyncError (DelegateExecution execution) { - logger.trace("start sendSyncError") - try { - String errorMessage = "" - if (execution.getVariable("WorkflowException") instanceof WorkflowException) { - WorkflowException wfe = execution.getVariable("WorkflowException") - errorMessage = wfe.getErrorMessage() - } else { - errorMessage = "Sending Sync Error." - } - - String buildworkflowException = - """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1"> - <aetgt:ErrorMessage>${MsoUtils.xmlEscape(errorMessage)}</aetgt:ErrorMessage> - <aetgt:ErrorCode>7000</aetgt:ErrorCode> - </aetgt:WorkflowException>""" - - logger.debug(buildworkflowException) - sendWorkflowResponse(execution, 500, buildworkflowException) - - } catch (Exception ex) { - logger.debug("Sending Sync Error Activity Failed. " + "\n" + ex.getMessage()) - } - logger.trace("finished sendSyncError") - } -} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn index cd4cf473a6..af89197057 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSliceService.bpmn @@ -2,25 +2,12 @@ <bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_13dsy4w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> <bpmn:error id="Error_0l3pcnc" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> <bpmn:error id="Error_1eyu7sx" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> - <bpmn:collaboration id="Collaboration_0htncd8"> - <bpmn:participant id="ActivateSliceService01" name="ActivateSliceService" processRef="ActivateSliceService" /> - </bpmn:collaboration> + <bpmn:error id="Error_0vq6f5h" name="Error_3ai5jm1" /> <bpmn:process id="ActivateSliceService" name="ActivateSliceService" isExecutable="true"> - <bpmn:scriptTask id="Task_1vscxgp" name="Update the status of SNSSAI and NSI and NSSI" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1jp9gjt</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1gkpl5q</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new ActivateSliceService() -csi.updateStatusSNSSAIandNSIandNSSI(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="ScriptTask_0cbth6k" name="Prepare Completion Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1gkpl5q</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0pzts4p</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new ActivateSliceService() -csi.prepareCompletionRequest(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:serviceTask id="ServiceTask_1aymwlt" name="Update Service Operation Status to Success"> + <bpmn:startEvent id="StartEvent_01bdhbw" name="start"> + <bpmn:outgoing>SequenceFlow_1tdecf1</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:serviceTask id="ServiceTask_1hmtmeq" name="Update Service Operation Status"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -28,7 +15,7 @@ csi.prepareCompletionRequest(execution)</bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)}</camunda:entry> + <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> @@ -39,65 +26,95 @@ csi.prepareCompletionRequest(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_0pzts4p</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0ozefu5</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_1ox6oh6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0szxmyf</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:endEvent id="EndEvent_0d1g3mv"> - <bpmn:incoming>SequenceFlow_0r611x8</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0ozefu5</bpmn:incoming> - </bpmn:endEvent> - <bpmn:endEvent id="EndEvent_1pujgw8"> - <bpmn:incoming>SequenceFlow_1qa8miv</bpmn:incoming> - <bpmn:errorEventDefinition id="ErrorEventDefinition_17jklyl" errorRef="Error_1eyu7sx" /> - </bpmn:endEvent> - <bpmn:exclusiveGateway id="ExclusiveGateway_0z7s0nx" name="IsSuccessfull"> - <bpmn:incoming>SequenceFlow_00ba5l9</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1jp9gjt</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1qa8miv</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:callActivity id="CallActivity_1cvb0iq" name="Send command NSSMF" calledElement="DoSendCommandToNSSMF"> - <bpmn:extensionElements> - <camunda:in source="nssiMap" target="nssiMap" /> - <camunda:in source="operationType" target="operationType" /> - <camunda:in source="NSIserviceid" target="NSIserviceid" /> - <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="isNSSIActivate" target="isNSSIActivate" /> - <camunda:in source="snssai" target="snssai" /> - <camunda:in source="e2eserviceInstanceId" target="e2eserviceInstanceId" /> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="activationCount" target="activationCount" /> - <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1o4zjvp</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_00ba5l9</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_04p0zjj" name="Send Sync Ack Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1yus0c1</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1uqgdxr</bpmn:outgoing> + <bpmn:scriptTask id="ScriptTask_1wow08q" name="Pre Process Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1tdecf1</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0bvnci8</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1730kjg" name="Init Service Operation Status" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0bvnci8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ox6oh6</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.prepareInitServiceOperationStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1tdecf1" sourceRef="StartEvent_01bdhbw" targetRef="ScriptTask_1wow08q" /> + <bpmn:sequenceFlow id="SequenceFlow_0bvnci8" sourceRef="ScriptTask_1wow08q" targetRef="ScriptTask_1730kjg" /> + <bpmn:sequenceFlow id="SequenceFlow_1ox6oh6" sourceRef="ScriptTask_1730kjg" targetRef="ServiceTask_1hmtmeq" /> + <bpmn:scriptTask id="ScriptTask_1gm0rl4" name="Send Sync Ack Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0szxmyf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1p778c2</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi = new ActivateSliceService() csi.sendSyncResponse(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:scriptTask id="Task_1o8fe1v" name="check AAI Orch Status of slice" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1uqgdxr</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_149lhmo</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_0szxmyf" sourceRef="ServiceTask_1hmtmeq" targetRef="ScriptTask_1gm0rl4" /> + <bpmn:scriptTask id="ScriptTask_1yc7wdf" name="check AAI Orch Status of e2e slice" default="SequenceFlow_0mr8oz6" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1p778c2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1wrrg4v</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0mr8oz6</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi= new ActivateSliceService() -csi.checkAAIOrchStatusofslice(execution)</bpmn:script> +csi.checkAAIOrchStatusOfE2ESlice(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0fcc3uy" name="Success?"> - <bpmn:incoming>SequenceFlow_149lhmo</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_15fdf5d</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0r611x8</bpmn:outgoing> + <bpmn:exclusiveGateway id="ExclusiveGateway_0nce7pi" name="Success?"> + <bpmn:incoming>SequenceFlow_19gpkz7</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cn6n0t</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0cs78yf</bpmn:outgoing> </bpmn:exclusiveGateway> - <bpmn:scriptTask id="Task_08zavab" name="PrepareActiviation" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_15fdf5d</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_144cqr9</bpmn:outgoing> + <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_08yipcf" name="goto prepare active"> + <bpmn:incoming>SequenceFlow_0cn6n0t</bpmn:incoming> + <bpmn:linkEventDefinition name="prepareActive" /> + </bpmn:intermediateThrowEvent> + <bpmn:sequenceFlow id="SequenceFlow_0cn6n0t" name="yes" sourceRef="ExclusiveGateway_0nce7pi" targetRef="IntermediateThrowEvent_08yipcf"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "true"}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_0916zkl" name="PrepareActiviation" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_003ne6w</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1b7nvps</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi= new ActivateSliceService() csi.prepareActivation(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:serviceTask id="Task_18urz3r" name="Update Service Operation Status"> + <bpmn:endEvent id="EndEvent_0bvm36p"> + <bpmn:incoming>SequenceFlow_1pgjdeq</bpmn:incoming> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1jpik0g" errorRef="Error_0l3pcnc" /> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_003ne6w" sourceRef="IntermediateThrowEvent_0m13l1h" targetRef="ScriptTask_0916zkl" /> + <bpmn:callActivity id="CallActivity_06ommam" name="DoActivateSliceService" default="SequenceFlow_1pgjdeq" calledElement="DoActivateSliceService"> + <bpmn:extensionElements> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:out source="isNSSIActivate" target="isNSSIActivate" /> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="nssInstances" target="nssInstances" /> + <camunda:out source="nssInstances" target="nssInstances" /> + <camunda:in source="customerInfo" target="customerInfo" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1b7nvps</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1rsr0hp</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1pgjdeq</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_150j97l</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_0x0emke" name="Update the status of SNSSAI and NSI " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_194fylv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0eiek58</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.updateStatusSNSSAIandNSIandNSSI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0032ffo" name="Prepare Completion Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0eiek58</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0dc8i0s</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new ActivateSliceService() +csi.prepareCompletionRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:serviceTask id="ServiceTask_06tcv65" name="Update Service Operation Status to Success"> <bpmn:extensionElements> <camunda:connector> <camunda:inputOutput> @@ -105,7 +122,7 @@ csi.prepareActivation(execution)</bpmn:script> <camunda:inputParameter name="headers"> <camunda:map> <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> + <camunda:entry key="Authorization">${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)}</camunda:entry> </camunda:map> </camunda:inputParameter> <camunda:inputParameter name="payload">${updateOperationStatus}</camunda:inputParameter> @@ -116,256 +133,275 @@ csi.prepareActivation(execution)</bpmn:script> <camunda:connectorId>http-connector</camunda:connectorId> </camunda:connector> </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1av6du3</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1yus0c1</bpmn:outgoing> + <bpmn:incoming>SequenceFlow_0dc8i0s</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_11u2ido</bpmn:outgoing> </bpmn:serviceTask> - <bpmn:scriptTask id="Task_1ossedo" name="Pre Process Incoming Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0qksr1g</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_183ypky</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new ActivateSliceService() -csi.preProcessRequest(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_1g8cg9g" name="Any NSSI to activate?"> - <bpmn:incoming>SequenceFlow_144cqr9</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1o4zjvp</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1pj1j1o</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:startEvent id="StartEvent_1"> - <bpmn:outgoing>SequenceFlow_0qksr1g</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:endEvent id="EndEvent_1taw2p9"> - <bpmn:incoming>SequenceFlow_1pj1j1o</bpmn:incoming> - <bpmn:errorEventDefinition id="ErrorEventDefinition_03iwehr" errorRef="Error_0l3pcnc" /> + <bpmn:endEvent id="EndEvent_1uebh6a" name="end"> + <bpmn:incoming>SequenceFlow_11u2ido</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0cs78yf</bpmn:incoming> </bpmn:endEvent> - <bpmn:scriptTask id="Task_13zoo6a" name="Init Service Operation Status" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_183ypky</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1av6du3</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new ActivateSliceService() -csi.prepareInitServiceOperationStatus(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:subProcess id="SubProcess_0iljxjd" name="sub process for fallouthandler and rollback" triggeredByEvent="true"> - <bpmn:scriptTask id="Task_01ooik6" name="Send Error Response"> - <bpmn:incoming>SequenceFlow_0oiiwjo</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0uckyao</bpmn:outgoing> + <bpmn:sequenceFlow id="SequenceFlow_11u2ido" sourceRef="ServiceTask_06tcv65" targetRef="EndEvent_1uebh6a" /> + <bpmn:subProcess id="SubProcess_1s80wtc" name="sub process for fallouthandler and rollback" triggeredByEvent="true"> + <bpmn:scriptTask id="ScriptTask_0pv8gip" name="Send Error Response"> + <bpmn:incoming>SequenceFlow_16jz1l6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_097vxbl</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def csi= new ActivateSliceService() csi.sendSyncError(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:endEvent id="EndEvent_1wd8iqk"> - <bpmn:incoming>SequenceFlow_0uckyao</bpmn:incoming> + <bpmn:endEvent id="EndEvent_0yy0a8r"> + <bpmn:incoming>SequenceFlow_097vxbl</bpmn:incoming> </bpmn:endEvent> - <bpmn:startEvent id="StartEvent_0hmwdqq"> - <bpmn:outgoing>SequenceFlow_0oiiwjo</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_1il80ww" /> + <bpmn:startEvent id="StartEvent_1a9lxvc"> + <bpmn:outgoing>SequenceFlow_16jz1l6</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_00r6zey" /> </bpmn:startEvent> - <bpmn:sequenceFlow id="SequenceFlow_0oiiwjo" sourceRef="StartEvent_0hmwdqq" targetRef="Task_01ooik6" /> - <bpmn:sequenceFlow id="SequenceFlow_0uckyao" sourceRef="Task_01ooik6" targetRef="EndEvent_1wd8iqk" /> + <bpmn:sequenceFlow id="SequenceFlow_097vxbl" sourceRef="ScriptTask_0pv8gip" targetRef="EndEvent_0yy0a8r" /> + <bpmn:sequenceFlow id="SequenceFlow_16jz1l6" sourceRef="StartEvent_1a9lxvc" targetRef="ScriptTask_0pv8gip" /> </bpmn:subProcess> - <bpmn:sequenceFlow id="SequenceFlow_1av6du3" sourceRef="Task_13zoo6a" targetRef="Task_18urz3r" /> - <bpmn:sequenceFlow id="SequenceFlow_1pj1j1o" name="no" sourceRef="ExclusiveGateway_1g8cg9g" targetRef="EndEvent_1taw2p9"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "false"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_0r611x8" name="NO" sourceRef="ExclusiveGateway_0fcc3uy" targetRef="EndEvent_0d1g3mv"> + <bpmn:sequenceFlow id="SequenceFlow_0eiek58" sourceRef="ScriptTask_0x0emke" targetRef="ScriptTask_0032ffo" /> + <bpmn:sequenceFlow id="SequenceFlow_0dc8i0s" sourceRef="ScriptTask_0032ffo" targetRef="ServiceTask_06tcv65" /> + <bpmn:sequenceFlow id="SequenceFlow_0cs78yf" name="no" sourceRef="ExclusiveGateway_0nce7pi" targetRef="EndEvent_1uebh6a"> <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "false"}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1qa8miv" name="no" sourceRef="ExclusiveGateway_0z7s0nx" targetRef="EndEvent_1pujgw8"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "false"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1jp9gjt" name="yes" sourceRef="ExclusiveGateway_0z7s0nx" targetRef="Task_1vscxgp"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "true"}</bpmn:conditionExpression> + <bpmn:intermediateCatchEvent id="IntermediateThrowEvent_0m13l1h" name="prepareActive"> + <bpmn:outgoing>SequenceFlow_003ne6w</bpmn:outgoing> + <bpmn:linkEventDefinition name="prepareActive" /> + </bpmn:intermediateCatchEvent> + <bpmn:scriptTask id="ScriptTask_1oa27ir" name="check AAI Orch Status of NSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1wrrg4v</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ny9zkw</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.checkAAIOrchStatusOfAllocates(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1wrrg4v" name="continue" sourceRef="ScriptTask_1yc7wdf" targetRef="ScriptTask_1oa27ir"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == true}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_00ba5l9" sourceRef="CallActivity_1cvb0iq" targetRef="ExclusiveGateway_0z7s0nx" /> - <bpmn:sequenceFlow id="SequenceFlow_1uqgdxr" sourceRef="ScriptTask_04p0zjj" targetRef="Task_1o8fe1v" /> - <bpmn:sequenceFlow id="SequenceFlow_0qksr1g" sourceRef="StartEvent_1" targetRef="Task_1ossedo" /> - <bpmn:sequenceFlow id="SequenceFlow_183ypky" sourceRef="Task_1ossedo" targetRef="Task_13zoo6a" /> - <bpmn:sequenceFlow id="SequenceFlow_1yus0c1" sourceRef="Task_18urz3r" targetRef="ScriptTask_04p0zjj" /> - <bpmn:sequenceFlow id="SequenceFlow_149lhmo" sourceRef="Task_1o8fe1v" targetRef="ExclusiveGateway_0fcc3uy" /> - <bpmn:sequenceFlow id="SequenceFlow_15fdf5d" name="yes" sourceRef="ExclusiveGateway_0fcc3uy" targetRef="Task_08zavab"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isContinue") == "true"}</bpmn:conditionExpression> + <bpmn:endEvent id="EndEvent_0n9enas" name="already operate so end"> + <bpmn:incoming>SequenceFlow_0mr8oz6</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_0mr8oz6" sourceRef="ScriptTask_1yc7wdf" targetRef="EndEvent_0n9enas" /> + <bpmn:sequenceFlow id="SequenceFlow_1ny9zkw" sourceRef="ScriptTask_1oa27ir" targetRef="Task_14srbts" /> + <bpmn:sequenceFlow id="SequenceFlow_19gpkz7" sourceRef="Task_14srbts" targetRef="ExclusiveGateway_0nce7pi" /> + <bpmn:scriptTask id="Task_14srbts" name="check AAI Orch Status of NSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1ny9zkw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_19gpkz7</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.checkAAIOrchStatusOfNSI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1b7nvps" sourceRef="ScriptTask_0916zkl" targetRef="CallActivity_06ommam" /> + <bpmn:sequenceFlow id="SequenceFlow_1pgjdeq" sourceRef="CallActivity_06ommam" targetRef="EndEvent_0bvm36p" /> + <bpmn:sequenceFlow id="SequenceFlow_150j97l" sourceRef="CallActivity_06ommam" targetRef="Task_0gu3dv6"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("WorkflowException") == null}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_144cqr9" sourceRef="Task_08zavab" targetRef="ExclusiveGateway_1g8cg9g" /> - <bpmn:sequenceFlow id="SequenceFlow_1o4zjvp" name="yes" sourceRef="ExclusiveGateway_1g8cg9g" targetRef="CallActivity_1cvb0iq"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivate") == "true"}</bpmn:conditionExpression> + <bpmn:sequenceFlow id="SequenceFlow_194fylv" sourceRef="Task_0gu3dv6" targetRef="ScriptTask_0x0emke"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isOperationFinished") == "true"}</bpmn:conditionExpression> </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1gkpl5q" sourceRef="Task_1vscxgp" targetRef="ScriptTask_0cbth6k" /> - <bpmn:sequenceFlow id="SequenceFlow_0pzts4p" sourceRef="ScriptTask_0cbth6k" targetRef="ServiceTask_1aymwlt" /> - <bpmn:sequenceFlow id="SequenceFlow_0ozefu5" sourceRef="ServiceTask_1aymwlt" targetRef="EndEvent_0d1g3mv" /> + <bpmn:sequenceFlow id="SequenceFlow_1rsr0hp" sourceRef="Task_0gu3dv6" targetRef="CallActivity_06ommam" /> + <bpmn:scriptTask id="Task_0gu3dv6" name="isOperationFinished " default="SequenceFlow_1rsr0hp" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_150j97l</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_194fylv</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1rsr0hp</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.isOperationFinished(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1p778c2" sourceRef="ScriptTask_1gm0rl4" targetRef="ScriptTask_1yc7wdf" /> </bpmn:process> - <bpmn:error id="Error_0vq6f5h" name="Error_3ai5jm1" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0htncd8"> - <bpmndi:BPMNShape id="Participant_1x12pgg_di" bpmnElement="ActivateSliceService01" isHorizontal="true"> - <dc:Bounds x="160" y="120" width="2290" height="990" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="SubProcess_1qw5nm4_di" bpmnElement="SubProcess_0iljxjd" isExpanded="true"> - <dc:Bounds x="935" y="680" width="810" height="180" /> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="ActivateSliceService"> + <bpmndi:BPMNShape id="StartEvent_01bdhbw_di" bpmnElement="StartEvent_01bdhbw"> + <dc:Bounds x="172" y="72" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="179" y="115" width="23" height="14" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1azew71_di" bpmnElement="Task_01ooik6"> - <dc:Bounds x="1255" y="720" width="100" height="80" /> + <bpmndi:BPMNShape id="ServiceTask_1hmtmeq_di" bpmnElement="ServiceTask_1hmtmeq"> + <dc:Bounds x="550" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1wd8iqk_di" bpmnElement="EndEvent_1wd8iqk"> - <dc:Bounds x="1492" y="742" width="36" height="36" /> + <bpmndi:BPMNShape id="ScriptTask_1wow08q_di" bpmnElement="ScriptTask_1wow08q"> + <dc:Bounds x="250" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="StartEvent_0hmwdqq_di" bpmnElement="StartEvent_0hmwdqq"> - <dc:Bounds x="1042" y="742" width="36" height="36" /> + <bpmndi:BPMNShape id="ScriptTask_1730kjg_di" bpmnElement="ScriptTask_1730kjg"> + <dc:Bounds x="390" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0oiiwjo_di" bpmnElement="SequenceFlow_0oiiwjo"> - <di:waypoint x="1078" y="760" /> - <di:waypoint x="1255" y="760" /> + <bpmndi:BPMNEdge id="SequenceFlow_1tdecf1_di" bpmnElement="SequenceFlow_1tdecf1"> + <di:waypoint x="208" y="90" /> + <di:waypoint x="250" y="90" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0uckyao_di" bpmnElement="SequenceFlow_0uckyao"> - <di:waypoint x="1355" y="760" /> - <di:waypoint x="1492" y="760" /> + <bpmndi:BPMNEdge id="SequenceFlow_0bvnci8_di" bpmnElement="SequenceFlow_0bvnci8"> + <di:waypoint x="350" y="90" /> + <di:waypoint x="390" y="90" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1lb7w6u_di" bpmnElement="Task_1vscxgp"> - <dc:Bounds x="1670" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0d1g3mv_di" bpmnElement="EndEvent_0d1g3mv"> - <dc:Bounds x="2212" y="332" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1pujgw8_di" bpmnElement="EndEvent_1pujgw8"> - <dc:Bounds x="1462" y="422" width="36" height="36" /> + <bpmndi:BPMNEdge id="SequenceFlow_1ox6oh6_di" bpmnElement="SequenceFlow_1ox6oh6"> + <di:waypoint x="490" y="90" /> + <di:waypoint x="550" y="90" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1gm0rl4_di" bpmnElement="ScriptTask_1gm0rl4"> + <dc:Bounds x="690" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0cbth6k_di" bpmnElement="ScriptTask_0cbth6k"> - <dc:Bounds x="1860" y="310" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_0szxmyf_di" bpmnElement="SequenceFlow_0szxmyf"> + <di:waypoint x="650" y="90" /> + <di:waypoint x="690" y="90" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1yc7wdf_di" bpmnElement="ScriptTask_1yc7wdf"> + <dc:Bounds x="840" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0z7s0nx_di" bpmnElement="ExclusiveGateway_0z7s0nx" isMarkerVisible="true"> - <dc:Bounds x="1455" y="325" width="50" height="50" /> + <bpmndi:BPMNShape id="ExclusiveGateway_0nce7pi_di" bpmnElement="ExclusiveGateway_0nce7pi" isMarkerVisible="true"> + <dc:Bounds x="1315" y="65" width="50" height="50" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1449" y="313" width="65" height="14" /> + <dc:Bounds x="1347" y="55" width="48" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="CallActivity_1cvb0iq_di" bpmnElement="CallActivity_1cvb0iq"> - <dc:Bounds x="1290" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_04p0zjj_di" bpmnElement="ScriptTask_04p0zjj"> - <dc:Bounds x="695" y="310" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1nsbn4r_di" bpmnElement="Task_1o8fe1v"> - <dc:Bounds x="850" y="310" width="100" height="80" /> + <bpmndi:BPMNShape id="IntermediateThrowEvent_10d4tak_di" bpmnElement="IntermediateThrowEvent_08yipcf"> + <dc:Bounds x="1432" y="72" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1422" y="115" width="63" height="27" /> + </bpmndi:BPMNLabel> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0fcc3uy_di" bpmnElement="ExclusiveGateway_0fcc3uy" isMarkerVisible="true"> - <dc:Bounds x="975" y="325" width="50" height="50" /> + <bpmndi:BPMNEdge id="SequenceFlow_0cn6n0t_di" bpmnElement="SequenceFlow_0cn6n0t"> + <di:waypoint x="1365" y="90" /> + <di:waypoint x="1432" y="90" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1006" y="315" width="49" height="14" /> + <dc:Bounds x="1390" y="72" width="17" height="14" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0916zkl_di" bpmnElement="ScriptTask_0916zkl"> + <dc:Bounds x="250" y="390" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0g9vipz_di" bpmnElement="Task_08zavab"> - <dc:Bounds x="1060" y="310" width="100" height="80" /> + <bpmndi:BPMNShape id="EndEvent_0bvm36p_di" bpmnElement="EndEvent_0bvm36p"> + <dc:Bounds x="522" y="532" width="36" height="36" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ServiceTask_1tv1ow6_di" bpmnElement="Task_18urz3r"> - <dc:Bounds x="540" y="310" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_003ne6w_di" bpmnElement="SequenceFlow_003ne6w"> + <di:waypoint x="208" y="430" /> + <di:waypoint x="250" y="430" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_06ommam_di" bpmnElement="CallActivity_06ommam"> + <dc:Bounds x="490" y="390" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0tam79l_di" bpmnElement="Task_1ossedo"> - <dc:Bounds x="290" y="310" width="100" height="80" /> + <bpmndi:BPMNShape id="ScriptTask_0x0emke_di" bpmnElement="ScriptTask_0x0emke"> + <dc:Bounds x="920" y="390" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_1g8cg9g_di" bpmnElement="ExclusiveGateway_1g8cg9g" isMarkerVisible="true"> - <dc:Bounds x="1195" y="325" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1141" y="406" width="58" height="27" /> - </bpmndi:BPMNLabel> + <bpmndi:BPMNShape id="ScriptTask_0032ffo_di" bpmnElement="ScriptTask_0032ffo"> + <dc:Bounds x="1120" y="390" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> - <dc:Bounds x="212" y="332" width="36" height="36" /> + <bpmndi:BPMNShape id="ServiceTask_06tcv65_di" bpmnElement="ServiceTask_06tcv65"> + <dc:Bounds x="1270" y="390" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1o4zjvp_di" bpmnElement="SequenceFlow_1o4zjvp"> - <di:waypoint x="1220" y="350" /> - <di:waypoint x="1290" y="350" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1251" y="332" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_144cqr9_di" bpmnElement="SequenceFlow_144cqr9"> - <di:waypoint x="1160" y="350" /> - <di:waypoint x="1195" y="350" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_15fdf5d_di" bpmnElement="SequenceFlow_15fdf5d"> - <di:waypoint x="1025" y="350" /> - <di:waypoint x="1060" y="350" /> + <bpmndi:BPMNShape id="EndEvent_1uebh6a_di" bpmnElement="EndEvent_1uebh6a"> + <dc:Bounds x="1422" y="412" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1034" y="332" width="18" height="14" /> + <dc:Bounds x="1431" y="455" width="19" height="14" /> </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_11u2ido_di" bpmnElement="SequenceFlow_11u2ido"> + <di:waypoint x="1370" y="430" /> + <di:waypoint x="1422" y="430" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_149lhmo_di" bpmnElement="SequenceFlow_149lhmo"> - <di:waypoint x="950" y="350" /> - <di:waypoint x="975" y="350" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1yus0c1_di" bpmnElement="SequenceFlow_1yus0c1"> - <di:waypoint x="640" y="350" /> - <di:waypoint x="695" y="350" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_183ypky_di" bpmnElement="SequenceFlow_183ypky"> - <di:waypoint x="390" y="350" /> - <di:waypoint x="420" y="350" /> + <bpmndi:BPMNShape id="SubProcess_1s80wtc_di" bpmnElement="SubProcess_1s80wtc" isExpanded="true"> + <dc:Bounds x="410" y="700" width="810" height="180" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0pv8gip_di" bpmnElement="ScriptTask_0pv8gip"> + <dc:Bounds x="730" y="740" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_0yy0a8r_di" bpmnElement="EndEvent_0yy0a8r"> + <dc:Bounds x="967" y="762" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_1a9lxvc_di" bpmnElement="StartEvent_1a9lxvc"> + <dc:Bounds x="517" y="762" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_097vxbl_di" bpmnElement="SequenceFlow_097vxbl"> + <di:waypoint x="830" y="780" /> + <di:waypoint x="967" y="780" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0qksr1g_di" bpmnElement="SequenceFlow_0qksr1g"> - <di:waypoint x="248" y="350" /> - <di:waypoint x="290" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_16jz1l6_di" bpmnElement="SequenceFlow_16jz1l6"> + <di:waypoint x="553" y="780" /> + <di:waypoint x="730" y="780" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1uqgdxr_di" bpmnElement="SequenceFlow_1uqgdxr"> - <di:waypoint x="795" y="350" /> - <di:waypoint x="850" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_0eiek58_di" bpmnElement="SequenceFlow_0eiek58"> + <di:waypoint x="1020" y="430" /> + <di:waypoint x="1120" y="430" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_00ba5l9_di" bpmnElement="SequenceFlow_00ba5l9"> - <di:waypoint x="1390" y="350" /> - <di:waypoint x="1455" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_0dc8i0s_di" bpmnElement="SequenceFlow_0dc8i0s"> + <di:waypoint x="1220" y="430" /> + <di:waypoint x="1270" y="430" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1jp9gjt_di" bpmnElement="SequenceFlow_1jp9gjt"> - <di:waypoint x="1505" y="350" /> - <di:waypoint x="1670" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_0cs78yf_di" bpmnElement="SequenceFlow_0cs78yf"> + <di:waypoint x="1340" y="115" /> + <di:waypoint x="1340" y="170" /> + <di:waypoint x="1440" y="170" /> + <di:waypoint x="1440" y="412" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1596" y="332" width="18" height="14" /> + <dc:Bounds x="1384" y="152" width="13" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1qa8miv_di" bpmnElement="SequenceFlow_1qa8miv"> - <di:waypoint x="1480" y="375" /> - <di:waypoint x="1480" y="422" /> + <bpmndi:BPMNShape id="IntermediateCatchEvent_1vye481_di" bpmnElement="IntermediateThrowEvent_0m13l1h"> + <dc:Bounds x="172" y="412" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1489" y="383" width="12" height="14" /> + <dc:Bounds x="156" y="455" width="68" height="14" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0r611x8_di" bpmnElement="SequenceFlow_0r611x8"> - <di:waypoint x="1000" y="375" /> - <di:waypoint x="1000" y="500" /> - <di:waypoint x="2230" y="500" /> - <di:waypoint x="2230" y="368" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1oa27ir_di" bpmnElement="ScriptTask_1oa27ir"> + <dc:Bounds x="1000" y="50" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1wrrg4v_di" bpmnElement="SequenceFlow_1wrrg4v"> + <di:waypoint x="940" y="90" /> + <di:waypoint x="1000" y="90" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1608" y="482" width="15" height="14" /> + <dc:Bounds x="950" y="72" width="42" height="14" /> </bpmndi:BPMNLabel> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1pj1j1o_di" bpmnElement="SequenceFlow_1pj1j1o"> - <di:waypoint x="1220" y="375" /> - <di:waypoint x="1220" y="422" /> + <bpmndi:BPMNShape id="EndEvent_0n9enas_di" bpmnElement="EndEvent_0n9enas"> + <dc:Bounds x="872" y="182" width="36" height="36" /> <bpmndi:BPMNLabel> - <dc:Bounds x="1199" y="378" width="12" height="14" /> + <dc:Bounds x="855" y="225" width="77" height="27" /> </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_1taw2p9_di" bpmnElement="EndEvent_1taw2p9"> - <dc:Bounds x="1202" y="422" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0uwsu46_di" bpmnElement="Task_13zoo6a"> - <dc:Bounds x="420" y="310" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1av6du3_di" bpmnElement="SequenceFlow_1av6du3"> - <di:waypoint x="520" y="350" /> - <di:waypoint x="540" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_0mr8oz6_di" bpmnElement="SequenceFlow_0mr8oz6"> + <di:waypoint x="890" y="130" /> + <di:waypoint x="890" y="182" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_1aymwlt_di" bpmnElement="ServiceTask_1aymwlt"> - <dc:Bounds x="2020" y="310" width="100" height="80" /> + <bpmndi:BPMNEdge id="SequenceFlow_1ny9zkw_di" bpmnElement="SequenceFlow_1ny9zkw"> + <di:waypoint x="1100" y="90" /> + <di:waypoint x="1170" y="90" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19gpkz7_di" bpmnElement="SequenceFlow_19gpkz7"> + <di:waypoint x="1270" y="90" /> + <di:waypoint x="1315" y="90" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0tmggtr_di" bpmnElement="Task_14srbts"> + <dc:Bounds x="1170" y="50" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0ozefu5_di" bpmnElement="SequenceFlow_0ozefu5"> - <di:waypoint x="2120" y="350" /> - <di:waypoint x="2212" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_1b7nvps_di" bpmnElement="SequenceFlow_1b7nvps"> + <di:waypoint x="350" y="430" /> + <di:waypoint x="490" y="430" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1pgjdeq_di" bpmnElement="SequenceFlow_1pgjdeq"> + <di:waypoint x="540" y="470" /> + <di:waypoint x="540" y="532" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0pzts4p_di" bpmnElement="SequenceFlow_0pzts4p"> - <di:waypoint x="1960" y="350" /> - <di:waypoint x="2020" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_150j97l_di" bpmnElement="SequenceFlow_150j97l"> + <di:waypoint x="590" y="430" /> + <di:waypoint x="710" y="430" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1gkpl5q_di" bpmnElement="SequenceFlow_1gkpl5q"> - <di:waypoint x="1770" y="350" /> - <di:waypoint x="1860" y="350" /> + <bpmndi:BPMNEdge id="SequenceFlow_194fylv_di" bpmnElement="SequenceFlow_194fylv"> + <di:waypoint x="810" y="430" /> + <di:waypoint x="920" y="430" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1rsr0hp_di" bpmnElement="SequenceFlow_1rsr0hp"> + <di:waypoint x="760" y="390" /> + <di:waypoint x="760" y="300" /> + <di:waypoint x="540" y="300" /> + <di:waypoint x="540" y="390" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0i2gnhv_di" bpmnElement="Task_0gu3dv6"> + <dc:Bounds x="710" y="390" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1p778c2_di" bpmnElement="SequenceFlow_1p778c2"> + <di:waypoint x="790" y="90" /> + <di:waypoint x="840" y="90" /> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateSliceService.bpmn new file mode 100644 index 0000000000..ca231b3daf --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateSliceService.bpmn @@ -0,0 +1,211 @@ +<?xml version="1.0" encoding="UTF-8"?> +<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="Definitions_13dsy4w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> + <bpmn:error id="Error_08p7hsc" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> + <bpmn:process id="DoActivateSliceService" name="DoActivateSliceService" isExecutable="true"> + <bpmn:startEvent id="StartEvent_0s4ou5u" name="Start"> + <bpmn:outgoing>SequenceFlow_13fdjwf</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="ScriptTask_1774fcg" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_13fdjwf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1lh6vpe</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_13fdjwf" sourceRef="StartEvent_0s4ou5u" targetRef="ScriptTask_1774fcg" /> + <bpmn:callActivity id="CallActivity_1ba0boc" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="nssInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1yqrli6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ru5d0h</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_0vhhyt1" name="processDecomposition" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ru5d0h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0so165e</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.processDecomposition(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_17x7ifp" name="SendCommandToNssmf" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0so165e</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_05wxhwm</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.sendCreateRequestNSSMF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ru5d0h" sourceRef="CallActivity_1ba0boc" targetRef="ScriptTask_0vhhyt1" /> + <bpmn:sequenceFlow id="SequenceFlow_0so165e" sourceRef="ScriptTask_0vhhyt1" targetRef="ScriptTask_17x7ifp" /> + <bpmn:sequenceFlow id="SequenceFlow_1lh6vpe" sourceRef="ScriptTask_1774fcg" targetRef="Task_0sjhszu" /> + <bpmn:sequenceFlow id="SequenceFlow_1yqrli6" sourceRef="Task_0sjhszu" targetRef="CallActivity_1ba0boc" /> + <bpmn:scriptTask id="Task_0sjhszu" name="Prepare Compose " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1lh6vpe</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1yqrli6</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.prepareCompose(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_00sf7s2" name="Query NSSI progress from adapter" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0oa5clt</bpmn:incoming> + <bpmn:incoming>SequenceFlow_05wxhwm</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1herzai</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.queryNSSIStatus(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0z3hxio" name="Completed" default="SequenceFlow_0btrzm8"> + <bpmn:incoming>SequenceFlow_1herzai</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0btrzm8</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1lvozh0</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:endEvent id="EndEvent_1mivpop" name="end"> + <bpmn:incoming>SequenceFlow_1lvozh0</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1lpgplr" name="Time delay" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0btrzm8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0oa5clt</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.timeDelay(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0oa5clt" sourceRef="ScriptTask_1lpgplr" targetRef="ScriptTask_00sf7s2" /> + <bpmn:sequenceFlow id="SequenceFlow_1herzai" sourceRef="ScriptTask_00sf7s2" targetRef="ExclusiveGateway_0z3hxio" /> + <bpmn:sequenceFlow id="SequenceFlow_0btrzm8" name="false" sourceRef="ExclusiveGateway_0z3hxio" targetRef="ScriptTask_1lpgplr" /> + <bpmn:sequenceFlow id="SequenceFlow_1lvozh0" name="yes" sourceRef="ExclusiveGateway_0z3hxio" targetRef="EndEvent_1mivpop"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("jobFinished" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_05wxhwm" sourceRef="ScriptTask_17x7ifp" targetRef="ScriptTask_00sf7s2" /> + <bpmn:subProcess id="SubProcess_0bkr0v1" name="sub process for fallouthandler and rollback" triggeredByEvent="true"> + <bpmn:startEvent id="StartEvent_0g7e26e"> + <bpmn:outgoing>SequenceFlow_0ca8iyv</bpmn:outgoing> + <bpmn:errorEventDefinition id="ErrorEventDefinition_1cir65m" /> + </bpmn:startEvent> + <bpmn:endEvent id="EndEvent_14z3xck"> + <bpmn:incoming>SequenceFlow_0aqapur</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_1gitk4f" name="Send Error Response" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ca8iyv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0aqapur</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.sendSyncError(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0aqapur" sourceRef="ScriptTask_1gitk4f" targetRef="EndEvent_14z3xck" /> + <bpmn:sequenceFlow id="SequenceFlow_0ca8iyv" sourceRef="StartEvent_0g7e26e" targetRef="ScriptTask_1gitk4f" /> + </bpmn:subProcess> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoActivateSliceService"> + <bpmndi:BPMNShape id="StartEvent_0s4ou5u_di" bpmnElement="StartEvent_0s4ou5u"> + <dc:Bounds x="152" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="158" y="145" width="25" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1774fcg_di" bpmnElement="ScriptTask_1774fcg"> + <dc:Bounds x="220" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_13fdjwf_di" bpmnElement="SequenceFlow_13fdjwf"> + <di:waypoint x="188" y="120" /> + <di:waypoint x="220" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1ba0boc_di" bpmnElement="CallActivity_1ba0boc"> + <dc:Bounds x="520" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0vhhyt1_di" bpmnElement="ScriptTask_0vhhyt1"> + <dc:Bounds x="660" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_17x7ifp_di" bpmnElement="ScriptTask_17x7ifp"> + <dc:Bounds x="810" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ru5d0h_di" bpmnElement="SequenceFlow_0ru5d0h"> + <di:waypoint x="620" y="120" /> + <di:waypoint x="660" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0so165e_di" bpmnElement="SequenceFlow_0so165e"> + <di:waypoint x="760" y="120" /> + <di:waypoint x="810" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1lh6vpe_di" bpmnElement="SequenceFlow_1lh6vpe"> + <di:waypoint x="320" y="120" /> + <di:waypoint x="360" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1yqrli6_di" bpmnElement="SequenceFlow_1yqrli6"> + <di:waypoint x="460" y="120" /> + <di:waypoint x="520" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1mfr1lo_di" bpmnElement="Task_0sjhszu"> + <dc:Bounds x="360" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_00sf7s2_di" bpmnElement="ScriptTask_00sf7s2"> + <dc:Bounds x="960" y="80" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0z3hxio_di" bpmnElement="ExclusiveGateway_0z3hxio" isMarkerVisible="true"> + <dc:Bounds x="1125" y="95" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1123" y="71" width="54" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_1mivpop_di" bpmnElement="EndEvent_1mivpop"> + <dc:Bounds x="1292" y="102" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1301" y="145" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1lpgplr_di" bpmnElement="ScriptTask_1lpgplr"> + <dc:Bounds x="1100" y="260" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0oa5clt_di" bpmnElement="SequenceFlow_0oa5clt"> + <di:waypoint x="1100" y="300" /> + <di:waypoint x="1010" y="300" /> + <di:waypoint x="1010" y="160" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1herzai_di" bpmnElement="SequenceFlow_1herzai"> + <di:waypoint x="1060" y="120" /> + <di:waypoint x="1125" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0btrzm8_di" bpmnElement="SequenceFlow_0btrzm8"> + <di:waypoint x="1150" y="145" /> + <di:waypoint x="1150" y="260" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1126" y="205" width="23" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1lvozh0_di" bpmnElement="SequenceFlow_1lvozh0"> + <di:waypoint x="1175" y="120" /> + <di:waypoint x="1292" y="120" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1226" y="133" width="17" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_05wxhwm_di" bpmnElement="SequenceFlow_05wxhwm"> + <di:waypoint x="910" y="120" /> + <di:waypoint x="960" y="120" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="SubProcess_0bkr0v1_di" bpmnElement="SubProcess_0bkr0v1" isExpanded="true"> + <dc:Bounds x="240" y="420" width="810" height="180" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="StartEvent_0g7e26e_di" bpmnElement="StartEvent_0g7e26e"> + <dc:Bounds x="347" y="482" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_14z3xck_di" bpmnElement="EndEvent_14z3xck"> + <dc:Bounds x="797" y="482" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1gitk4f_di" bpmnElement="ScriptTask_1gitk4f"> + <dc:Bounds x="560" y="460" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0aqapur_di" bpmnElement="SequenceFlow_0aqapur"> + <di:waypoint x="660" y="500" /> + <di:waypoint x="797" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ca8iyv_di" bpmnElement="SequenceFlow_0ca8iyv"> + <di:waypoint x="383" y="500" /> + <di:waypoint x="560" y="500" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn index 51448b027c..eb0c007403 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn @@ -30,7 +30,7 @@ ex.processJavaException(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new DoActivateTnNssi() -runScript.prepareUpdateJobStatus(execution,"finished","100","Activate or Deactivate successfully")</bpmn:script> +runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Activate or Deactivate successfully")</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" /> <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0nhxd67" /> @@ -40,8 +40,9 @@ runScript.prepareUpdateJobStatus(execution,"finished","100","Activate or Deactiv <bpmn:outgoing>SequenceFlow_0kixzdj</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def actionType = execution.getVariable("actionType") -execution.setVariable("orchestrationStatus", actionType) def runScript = new DoActivateTnNssi() +def orchStatus = runScript.getOrchStatusBasedOnActionType(actionType) +execution.setVariable("orchestrationStatus", orchStatus) runScript.updateAAIOrchStatus(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_0kixzdj" sourceRef="ScriptTask_19uxoi8" targetRef="ScriptTask_1ssh2l9" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn index f3bd700d9a..124b75cbe8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateTransportNSSI.bpmn @@ -69,7 +69,7 @@ ex.processJavaException(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_0t094g7</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new TnAllocateNssi() -runScript.prepareUpdateJobStatus(execution,"progress","10","Allocate TN NSSI started")</bpmn:script> +runScript.prepareUpdateJobStatus(execution,"INPROGRESS","10","Allocate TN NSSI started")</bpmn:script> </bpmn:scriptTask> <bpmn:intermediateThrowEvent id="IntermediateThrowEvent_1ex8ke9" name="Goto OOF TN NSSI Selection"> <bpmn:incoming>SequenceFlow_0jrclmc</bpmn:incoming> @@ -80,7 +80,7 @@ runScript.prepareUpdateJobStatus(execution,"progress","10","Allocate TN NSSI sta <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new TnAllocateNssi() -runScript.prepareUpdateJobStatus(execution,"finished","100","Allocated TN NSSI successfully")</bpmn:script> +runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI successfully")</bpmn:script> </bpmn:scriptTask> <bpmn:callActivity id="CallActivity_1bnkmaz" name="Call Decompose Service" calledElement="DecomposeService"> <bpmn:extensionElements> @@ -174,7 +174,7 @@ runScript.updateAAIOrchStatus(execution)</bpmn:script> <bpmn:outgoing>Flow_1853sgs</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new TnAllocateNssi() -runScript.prepareUpdateJobStatus(execution,"finished","100","Allocated TN NSSI successfully")</bpmn:script> +runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Allocated TN NSSI successfully")</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="Flow_1853sgs" sourceRef="Activity_1mh10j4" targetRef="Activity_124z7q2" /> <bpmn:callActivity id="Activity_187hs2t" name="Handle TN NSSI Selection OOF request" calledElement="DoHandleOofRequest"> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn index de8391428d..1dd362bf4b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn @@ -30,7 +30,7 @@ ex.processJavaException(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new DoDeallocateTnNssi() -runScript.prepareUpdateJobStatus(execution,"finished","100","Deallocated TN NSSI successfully")</bpmn:script> +runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Deallocated TN NSSI successfully")</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" /> <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0rgeefb" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn index d70bed68cb..2b122fb5e2 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoModifyTransportNSSI.bpmn @@ -30,7 +30,7 @@ ex.processJavaException(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_1qv8qw1</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def runScript = new DoActivateTnNssi() -runScript.prepareUpdateJobStatus(execution,"finished","100","Modified TN NSSI successfully")</bpmn:script> +runScript.prepareUpdateJobStatus(execution,"FINISHED","100","Modified TN NSSI successfully")</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_03s744c" sourceRef="StartEvent_1nbljfd" targetRef="ScriptTask_1tc44ge" /> <bpmn:sequenceFlow id="SequenceFlow_1qv8qw1" sourceRef="ScriptTask_1ssh2l9" targetRef="Activity_0ziz3ti" /> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn deleted file mode 100644 index 4f12ca7f41..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn +++ /dev/null @@ -1,344 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_13dsy4w" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="3.4.1"> - <bpmn:collaboration id="Collaboration_0htncd8"> - <bpmn:participant id="DoSendCommandToNSSMF01" name="DoSendCommandToNSSMF" processRef="DoSendCommandToNSSMF" /> - </bpmn:collaboration> - <bpmn:process id="DoSendCommandToNSSMF" name="DoSendCommandToNSSMF" isExecutable="true"> - <bpmn:scriptTask id="Task_0qx12sa" name="Get one NSSI info from list" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0umnozs</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1vuuuhr</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ea3pk8</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.getNSSIformlist(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_18qkm4u" name="Activation completed?"> - <bpmn:incoming>SequenceFlow_1yjsv5s</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1qxmooy</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1lh0it1</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0swcqw8</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:exclusiveGateway id="ExclusiveGateway_07yenxg" name="Get successful?"> - <bpmn:incoming>SequenceFlow_1ea3pk8</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_080lgb0</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1oi86yc</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_1vuuuhr" sourceRef="ServiceTask_0myj742" targetRef="Task_0qx12sa" /> - <bpmn:sequenceFlow id="SequenceFlow_1oeexsj" sourceRef="Task_1a9qxuo" targetRef="ServiceTask_0myj742" /> - <bpmn:sequenceFlow id="SequenceFlow_1ea3pk8" sourceRef="Task_0qx12sa" targetRef="ExclusiveGateway_07yenxg" /> - <bpmn:sequenceFlow id="SequenceFlow_1yjsv5s" sourceRef="Task_1y09kt4" targetRef="ExclusiveGateway_18qkm4u" /> - <bpmn:sequenceFlow id="SequenceFlow_0swcqw8" name="waitting" sourceRef="ExclusiveGateway_18qkm4u" targetRef="Task_08qjojj"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "waitting"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1lh0it1" name="no" sourceRef="ExclusiveGateway_18qkm4u" targetRef="EndEvent_0k52g73"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "false"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1qxmooy" name="yes" sourceRef="ExclusiveGateway_18qkm4u" targetRef="Task_1a9qxuo"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isActivateSuccessfull") == "true"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_080lgb0" name="yes" sourceRef="ExclusiveGateway_07yenxg" targetRef="CallActivity_0018jhc"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isGetSuccessfull") == "true"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_08xfw41" sourceRef="Task_0xfp2r8" targetRef="ExclusiveGateway_0ljwjfh" /> - <bpmn:sequenceFlow id="SequenceFlow_1s2oozd" name="yes" sourceRef="ExclusiveGateway_0ljwjfh" targetRef="Task_08qjojj"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivated") == "true"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_020xvv4" name="no" sourceRef="ExclusiveGateway_0ljwjfh" targetRef="EndEvent_0k52g73"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isNSSIActivated") == "false"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_10162l8" sourceRef="Task_08qjojj" targetRef="Task_1y09kt4" /> - <bpmn:sequenceFlow id="SequenceFlow_1pfo460" sourceRef="StartEvent_1" targetRef="ScriptTask_1otgwej" /> - <bpmn:sequenceFlow id="SequenceFlow_1oi86yc" name="no" sourceRef="ExclusiveGateway_07yenxg" targetRef="EndEvent_0d1g3mv"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{execution.getVariable("isGetSuccessfull") == "false"}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:endEvent id="EndEvent_0d1g3mv"> - <bpmn:incoming>SequenceFlow_1oi86yc</bpmn:incoming> - </bpmn:endEvent> - <bpmn:startEvent id="StartEvent_1"> - <bpmn:outgoing>SequenceFlow_1pfo460</bpmn:outgoing> - </bpmn:startEvent> - <bpmn:scriptTask id="ScriptTask_1otgwej" name="Preprocess Request" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1pfo460</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0umnozs</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoSendCommandToNSSMF() -dcso.preProcessRequest(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:subProcess id="SubProcess_0iljxjd" name="sub process for fallouthandler and rollback" triggeredByEvent="true"> - <bpmn:startEvent id="StartEvent_0hmwdqq"> - <bpmn:outgoing>SequenceFlow_0oiiwjo</bpmn:outgoing> - <bpmn:errorEventDefinition id="ErrorEventDefinition_1il80ww" /> - </bpmn:startEvent> - <bpmn:endEvent id="EndEvent_1wd8iqk"> - <bpmn:incoming>SequenceFlow_0uckyao</bpmn:incoming> - </bpmn:endEvent> - <bpmn:sequenceFlow id="SequenceFlow_0oiiwjo" sourceRef="StartEvent_0hmwdqq" targetRef="Task_01ooik6" /> - <bpmn:sequenceFlow id="SequenceFlow_0uckyao" sourceRef="Task_01ooik6" targetRef="EndEvent_1wd8iqk" /> - <bpmn:scriptTask id="Task_01ooik6" name="Send Error Response" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_0oiiwjo</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_0uckyao</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.sendSyncError(execution)</bpmn:script> - </bpmn:scriptTask> - </bpmn:subProcess> - <bpmn:sequenceFlow id="SequenceFlow_0umnozs" sourceRef="ScriptTask_1otgwej" targetRef="Task_0qx12sa" /> - <bpmn:sequenceFlow id="SequenceFlow_1ucjcm1" sourceRef="CallActivity_0018jhc" targetRef="ScriptTask_0q7is68" /> - <bpmn:endEvent id="EndEvent_0k52g73"> - <bpmn:incoming>SequenceFlow_020xvv4</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1lh0it1</bpmn:incoming> - <bpmn:errorEventDefinition id="ErrorEventDefinition_0fypnen" errorRef="Error_08p7hsc" /> - </bpmn:endEvent> - <bpmn:scriptTask id="Task_08qjojj" name="wait for Return" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1s2oozd</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0swcqw8</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_10162l8</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.WaitForReturn(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:scriptTask id="Task_1y09kt4" name="Get the activation status" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_10162l8</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1yjsv5s</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.GetTheStatusOfActivation(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0ljwjfh" name="Activation successful?"> - <bpmn:incoming>SequenceFlow_08xfw41</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1s2oozd</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_020xvv4</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:scriptTask id="Task_0xfp2r8" name="SendCommandToNssmf" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1a6iu8c</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_08xfw41</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.SendCommandToNssmf(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:callActivity id="CallActivity_0018jhc" name="Call Decompose Service" calledElement="DecomposeService"> - <bpmn:extensionElements> - <camunda:in source="msoRequestId" target="msoRequestId" /> - <camunda:in source="nssiId" target="serviceInstanceId" /> - <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> - <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> - <camunda:out source="serviceDecompositionString" target="serviceDecompositionString" /> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_080lgb0</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1ucjcm1</bpmn:outgoing> - </bpmn:callActivity> - <bpmn:scriptTask id="ScriptTask_0q7is68" name="processDecomposition" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1ucjcm1</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1a6iu8c</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.processDecomposition(execution)</bpmn:script> - </bpmn:scriptTask> - <bpmn:sequenceFlow id="SequenceFlow_1a6iu8c" sourceRef="ScriptTask_0q7is68" targetRef="Task_0xfp2r8" /> - <bpmn:serviceTask id="ServiceTask_0myj742" name="Update Service Operation Status"> - <bpmn:extensionElements> - <camunda:connector> - <camunda:inputOutput> - <camunda:inputParameter name="url">${CVFMI_dbAdapterEndpoint}</camunda:inputParameter> - <camunda:inputParameter name="headers"> - <camunda:map> - <camunda:entry key="content-type">application/soap+xml</camunda:entry> - <camunda:entry key="Authorization">Basic YnBlbDpwYXNzd29yZDEk</camunda:entry> - </camunda:map> - </camunda:inputParameter> - <camunda:inputParameter name="payload">${CVFMI_updateServiceOperStatusRequest}</camunda:inputParameter> - <camunda:inputParameter name="method">POST</camunda:inputParameter> - <camunda:outputParameter name="CVFMI_dbResponseCode">${statusCode}</camunda:outputParameter> - <camunda:outputParameter name="CVFMI_dbResponse">${response}</camunda:outputParameter> - </camunda:inputOutput> - <camunda:connectorId>http-connector</camunda:connectorId> - </camunda:connector> - </bpmn:extensionElements> - <bpmn:incoming>SequenceFlow_1oeexsj</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1vuuuhr</bpmn:outgoing> - </bpmn:serviceTask> - <bpmn:scriptTask id="Task_1a9qxuo" name="Update Index" scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1qxmooy</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1oeexsj</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.UpdateIndex(execution)</bpmn:script> - </bpmn:scriptTask> - </bpmn:process> - <bpmn:error id="Error_08p7hsc" name="MSOWorkflowException" errorCode="MSOWorkflowException" /> - <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Collaboration_0htncd8"> - <bpmndi:BPMNShape id="Participant_1x12pgg_di" bpmnElement="DoSendCommandToNSSMF01" isHorizontal="true"> - <dc:Bounds x="160" y="60" width="2080" height="1000" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_0d1g3mv_di" bpmnElement="EndEvent_0d1g3mv"> - <dc:Bounds x="1642" y="302" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="StartEvent_1"> - <dc:Bounds x="262" y="302" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0uckyao_di" bpmnElement="SequenceFlow_0uckyao"> - <di:waypoint x="1120" y="860" /> - <di:waypoint x="1257" y="860" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0oiiwjo_di" bpmnElement="SequenceFlow_0oiiwjo"> - <di:waypoint x="843" y="860" /> - <di:waypoint x="1020" y="860" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="StartEvent_0hmwdqq_di" bpmnElement="StartEvent_0hmwdqq"> - <dc:Bounds x="807" y="842" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="EndEvent_1wd8iqk_di" bpmnElement="EndEvent_1wd8iqk"> - <dc:Bounds x="1257" y="842" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_0s82iw4_di" bpmnElement="Task_0xfp2r8"> - <dc:Bounds x="1230" y="280" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_18qkm4u_di" bpmnElement="ExclusiveGateway_18qkm4u" isMarkerVisible="true"> - <dc:Bounds x="835" y="595" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="832" y="558" width="55" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ea3pk8_di" bpmnElement="SequenceFlow_1ea3pk8"> - <di:waypoint x="770" y="320" /> - <di:waypoint x="815" y="320" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_08xfw41_di" bpmnElement="SequenceFlow_08xfw41"> - <di:waypoint x="1330" y="320" /> - <di:waypoint x="1415" y="320" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1yjsv5s_di" bpmnElement="SequenceFlow_1yjsv5s"> - <di:waypoint x="1390" y="620" /> - <di:waypoint x="885" y="620" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ExclusiveGateway_0ljwjfh_di" bpmnElement="ExclusiveGateway_0ljwjfh" isMarkerVisible="true"> - <dc:Bounds x="1415" y="295" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1412" y="265" width="60" height="27" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1s2oozd_di" bpmnElement="SequenceFlow_1s2oozd"> - <di:waypoint x="1440" y="345" /> - <di:waypoint x="1440" y="420" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1451" y="373" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0k52g73_di" bpmnElement="EndEvent_0k52g73"> - <dc:Bounds x="1532" y="302" width="36" height="36" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_020xvv4_di" bpmnElement="SequenceFlow_020xvv4"> - <di:waypoint x="1465" y="320" /> - <di:waypoint x="1532" y="320" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1494" y="302" width="12" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_121jfnq_di" bpmnElement="Task_0qx12sa"> - <dc:Bounds x="670" y="280" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_07yenxg_di" bpmnElement="ExclusiveGateway_07yenxg" isMarkerVisible="true"> - <dc:Bounds x="815" y="295" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="800" y="353" width="80" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_080lgb0_di" bpmnElement="SequenceFlow_080lgb0"> - <di:waypoint x="865" y="320" /> - <di:waypoint x="930" y="320" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="869" y="302" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_10162l8_di" bpmnElement="SequenceFlow_10162l8"> - <di:waypoint x="1440" y="500" /> - <di:waypoint x="1440" y="580" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1qxmooy_di" bpmnElement="SequenceFlow_1qxmooy"> - <di:waypoint x="835" y="620" /> - <di:waypoint x="770" y="620" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="813" y="623" width="18" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0aspjme_di" bpmnElement="Task_1a9qxuo"> - <dc:Bounds x="670" y="580" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_170g0ll_di" bpmnElement="Task_08qjojj"> - <dc:Bounds x="1390" y="420" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1meh39q_di" bpmnElement="Task_1y09kt4"> - <dc:Bounds x="1390" y="580" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1lh0it1_di" bpmnElement="SequenceFlow_1lh0it1"> - <di:waypoint x="860" y="645" /> - <di:waypoint x="860" y="720" /> - <di:waypoint x="1550" y="720" /> - <di:waypoint x="1550" y="338" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1110" y="702" width="12" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0swcqw8_di" bpmnElement="SequenceFlow_0swcqw8"> - <di:waypoint x="860" y="595" /> - <di:waypoint x="860" y="460" /> - <di:waypoint x="1390" y="460" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1067" y="443" width="38" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1oeexsj_di" bpmnElement="SequenceFlow_1oeexsj"> - <di:waypoint x="720" y="580" /> - <di:waypoint x="720" y="520" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ServiceTask_0myj742_di" bpmnElement="ServiceTask_0myj742"> - <dc:Bounds x="670" y="440" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1vuuuhr_di" bpmnElement="SequenceFlow_1vuuuhr"> - <di:waypoint x="720" y="440" /> - <di:waypoint x="720" y="360" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1pfo460_di" bpmnElement="SequenceFlow_1pfo460"> - <di:waypoint x="298" y="320" /> - <di:waypoint x="420" y="320" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1oi86yc_di" bpmnElement="SequenceFlow_1oi86yc"> - <di:waypoint x="840" y="295" /> - <di:waypoint x="840" y="230" /> - <di:waypoint x="1660" y="230" /> - <di:waypoint x="1660" y="302" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="884" y="212" width="12" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_1otgwej_di" bpmnElement="ScriptTask_1otgwej"> - <dc:Bounds x="420" y="280" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="SubProcess_1hlwd77_di" bpmnElement="SubProcess_0iljxjd" isExpanded="true"> - <dc:Bounds x="700" y="780" width="810" height="180" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ScriptTask_1c5l0io_di" bpmnElement="Task_01ooik6"> - <dc:Bounds x="1020" y="820" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_0umnozs_di" bpmnElement="SequenceFlow_0umnozs"> - <di:waypoint x="520" y="320" /> - <di:waypoint x="670" y="320" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="CallActivity_0018jhc_di" bpmnElement="CallActivity_0018jhc"> - <dc:Bounds x="930" y="280" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1ucjcm1_di" bpmnElement="SequenceFlow_1ucjcm1"> - <di:waypoint x="1030" y="320" /> - <di:waypoint x="1070" y="320" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0q7is68_di" bpmnElement="ScriptTask_0q7is68"> - <dc:Bounds x="1070" y="280" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_1a6iu8c_di" bpmnElement="SequenceFlow_1a6iu8c"> - <di:waypoint x="1170" y="320" /> - <di:waypoint x="1230" y="320" /> - </bpmndi:BPMNEdge> - </bpmndi:BPMNPlane> - </bpmndi:BPMNDiagram> -</bpmn:definitions> diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilder.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilder.java new file mode 100644 index 0000000000..b8699838e2 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilder.java @@ -0,0 +1,217 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Modifications Copyright (c) 2021 Nokia + * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import org.onap.so.bpmn.servicedecomposition.entities.BuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; +import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; +import org.onap.so.serviceinstancebeans.RequestDetails; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.UUID; +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.CONFIGURATION; +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.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.VOLUMEGROUP; + +@Component +public class ExecuteBuildingBlockBuilder { + + private static final Logger logger = LoggerFactory.getLogger(ExecuteBuildingBlockBuilder.class); + + private static final String VNF = "Vnf"; + private static final String PNF = "Pnf"; + private static final String VFMODULE = "VfModule"; + private static final String NETWORK = "Network"; + + protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows, + List<Resource> resourceList, String requestId, String apiVersion, String resourceId, String requestAction, + String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, + boolean replaceVnf) { + List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); + for (OrchestrationFlow orchFlow : orchFlows) { + if (orchFlow.getFlowName().contains(SERVICE)) { + if (!replaceVnf) { + workflowResourceIds.setServiceInstanceId(resourceId); + } + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.SERVICE, orchFlow, requestId, + apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, + false); + } else if (orchFlow.getFlowName().contains(VNF) || (orchFlow.getFlowName().contains(CONTROLLER) + && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) { + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VNF, orchFlow, requestId, + apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, + false); + } else if (orchFlow.getFlowName().contains(PNF) || (orchFlow.getFlowName().contains(CONTROLLER) + && (PNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) { + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.PNF, orchFlow, requestId, + apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, + false); + } else if (orchFlow.getFlowName().contains(NETWORK) + && !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.NETWORK, orchFlow, requestId, + apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, + false); + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VIRTUAL_LINK, orchFlow, + requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, + true, false); + } else if (orchFlow.getFlowName().contains(VFMODULE) || (orchFlow.getFlowName().contains(CONTROLLER) + && (VFMODULE).equalsIgnoreCase(orchFlow.getBpmnScope()))) { + List<Resource> vfModuleResourcesSorted; + if (requestAction.equals(CREATE_INSTANCE) || requestAction.equals(ASSIGNINSTANCE) + || requestAction.equals("activateInstance")) { + vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceList.stream() + .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList())); + } else { + vfModuleResourcesSorted = sortVfModulesByBaseLast(resourceList.stream() + .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList())); + } + for (Resource resource : vfModuleResourcesSorted) { + flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId, + requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null, + false, null)); + } + } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) { + if (requestAction.equalsIgnoreCase(REPLACEINSTANCE) + || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)) { + logger.debug("Replacing workflow resource id by volume group id"); + resourceId = workflowResourceIds.getVolumeGroupId(); + } + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VOLUMEGROUP, orchFlow, + requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, + false, false); + } else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.NETWORKCOLLECTION, orchFlow, + requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, + false, false); + } else if (orchFlow.getFlowName().contains(CONFIGURATION)) { + addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.CONFIGURATION, orchFlow, + requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, + false, true); + } else { + flowsToExecute + .add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, requestAction, + false, vnfType, workflowResourceIds, requestDetails, false, null, null, false, null)); + } + } + return flowsToExecute; + } + + protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, + Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte, + String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, + boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration, + ReplaceInstanceRelatedInformation replaceInfo) { + + BuildingBlock buildingBlock = + new BuildingBlock().setBpmnFlowName(orchFlow.getFlowName()).setMsoId(UUID.randomUUID().toString()) + .setIsVirtualLink(isVirtualLink).setVirtualLinkKey(virtualLinkKey) + .setKey(Optional.ofNullable(resource).map(Resource::getResourceId).orElse("")); + Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(buildingBlock::setBpmnAction); + Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(buildingBlock::setBpmnScope); + String oldVolumeGroupName = ""; + if (replaceInfo != null) { + oldVolumeGroupName = replaceInfo.getOldVolumeGroupName(); + } + if (resource != null + && (orchFlow.getFlowName().contains(VOLUMEGROUP) && (requestAction.equalsIgnoreCase(REPLACEINSTANCE) + || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)))) { + logger.debug("Setting resourceId to volume group id for volume group flow on replace"); + resourceId = workflowResourceIds.getVolumeGroupId(); + } + + ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setApiVersion(apiVersion) + .setaLaCarte(aLaCarte).setRequestAction(requestAction).setResourceId(resourceId).setVnfType(vnfType) + .setWorkflowResourceIds(workflowResourceIds).setRequestId(requestId).setBuildingBlock(buildingBlock) + .setRequestDetails(requestDetails).setOldVolumeGroupName(oldVolumeGroupName); + + if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) { + ConfigurationResourceKeys configurationResourceKeys = getConfigurationResourceKeys(resource, vnfcName); + executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys); + } + return executeBuildingBlock; + } + + protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) { + int count = 0; + for (Resource resource : vfModuleResources) { + if (resource.isBaseVfModule()) { + Collections.swap(vfModuleResources, 0, count); + break; + } + count++; + } + return vfModuleResources; + } + + protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) { + int count = 0; + for (Resource resource : vfModuleResources) { + if (resource.isBaseVfModule()) { + Collections.swap(vfModuleResources, vfModuleResources.size() - 1, count); + break; + } + count++; + } + return vfModuleResources; + } + + private void addBuildingBlockToExecuteBBList(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList, + WorkflowType workflowType, OrchestrationFlow orchFlow, String requestId, String apiVersion, + String resourceId, String requestAction, String vnfType, WorkflowResourceIds workflowResourceIds, + RequestDetails requestDetails, boolean isVirtualLink, boolean isConfiguration) { + + resourceList.stream().filter(resource -> resource.getResourceType().equals(workflowType)) + .forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, + apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails, + isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration, null))); + } + + private ConfigurationResourceKeys getConfigurationResourceKeys(Resource resource, String vnfcName) { + ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); + Optional.ofNullable(vnfcName).ifPresent(configurationResourceKeys::setVnfcName); + configurationResourceKeys.setCvnfcCustomizationUUID(resource.getCvnfModuleCustomizationId()); + configurationResourceKeys.setVfModuleCustomizationUUID(resource.getVfModuleCustomizationId()); + configurationResourceKeys.setVnfResourceCustomizationUUID(resource.getVnfCustomizationId()); + return configurationResourceKeys; + } + + +} 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 7821463acd..aad8b51a48 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 @@ -6,7 +6,7 @@ * ================================================================================ * Modifications Copyright (c) 2019 Samsung * ================================================================================ - * Modifications Copyright (c) 2020 Nokia + * Modifications Copyright (c) 2021 Nokia * ================================================================================ * Modifications Copyright (c) 2020 Tech Mahindra * ================================================================================ @@ -48,7 +48,6 @@ import org.onap.so.bpmn.common.BBConstants; 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.BuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.ConfigurationResourceKeys; import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; import org.onap.so.bpmn.servicedecomposition.entities.WorkflowResourceIds; @@ -80,7 +79,6 @@ import org.springframework.stereotype.Component; import org.springframework.util.CollectionUtils; import java.util.ArrayList; import java.util.Arrays; -import java.util.Collections; import java.util.Comparator; import java.util.List; import java.util.Map; @@ -89,40 +87,36 @@ 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; @Component public class WorkflowAction { + private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class); + private static final String SERVICE_INSTANCES = "serviceInstances"; private static final String VF_MODULES = "vfModules"; private static final String VNF_TYPE = "vnfType"; - private static final String SERVICE = "Service"; - private static final String VNF = "Vnf"; - private static final String PNF = "Pnf"; - private static final String VFMODULE = "VfModule"; - private static final String VOLUMEGROUP = "VolumeGroup"; - private static final String NETWORK = "Network"; - private static final String NETWORKCOLLECTION = "NetworkCollection"; private static final String CONFIGURATION = "Configuration"; - private static final String ASSIGNINSTANCE = "assignInstance"; - private static final String REPLACEINSTANCE = "replaceInstance"; - private static final String REPLACEINSTANCERETAINASSIGNMENTS = "replaceInstanceRetainAssignments"; private static final String SUPPORTEDTYPES = "vnfs|vfModules|networks|networkCollections|volumeGroups|serviceInstances|instanceGroups"; private static final String HOMINGSOLUTION = "Homing_Solution"; private static final String SERVICE_TYPE_TRANSPORT = "TRANSPORT"; private static final String SERVICE_TYPE_BONDING = "BONDING"; private static final String CLOUD_OWNER = "DEFAULT"; - private static final Logger logger = LoggerFactory.getLogger(WorkflowAction.class); private static final String CREATENETWORKBB = "CreateNetworkBB"; private static final String ACTIVATENETWORKBB = "ActivateNetworkBB"; private static final String VOLUMEGROUP_DELETE_PATTERN = "(Un|De)(.*)Volume(.*)"; private static final String VOLUMEGROUP_CREATE_PATTERN = "(A|C)(.*)Volume(.*)"; - private static final String CONTROLLER = "Controller"; private static final String DEFAULT_CLOUD_OWNER = "org.onap.so.cloud-owner"; private static final String HOMING = "homing"; @@ -146,6 +140,8 @@ public class WorkflowAction { private UserParamsServiceTraversal userParamsServiceTraversal; @Autowired private AaiResourceIdValidator aaiResourceIdValidator; + @Autowired + private ExecuteBuildingBlockBuilder executeBuildingBlockBuilder; public void setBbInputSetupUtils(BBInputSetupUtils bbInputSetupUtils) { this.bbInputSetupUtils = bbInputSetupUtils; @@ -227,9 +223,9 @@ public class WorkflowAction { .collect(Collectors.toList()); for (OrchestrationFlow orchFlow : orchFlows) { - ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, - apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds, - requestDetails, false, null, null, false, replaceInfo); + ExecuteBuildingBlock ebb = executeBuildingBlockBuilder.buildExecuteBuildingBlock(orchFlow, + requestId, resourceKey, apiVersion, resourceId, requestAction, true, vnfType, + workflowResourceIds, requestDetails, false, null, null, false, replaceInfo); flowsToExecute.add(ebb); } } @@ -311,8 +307,9 @@ public class WorkflowAction { || REPLACEINSTANCERETAINASSIGNMENTS.equalsIgnoreCase(requestAction))) { vnfReplace = true; } - flowsToExecute = buildExecuteBuildingBlockList(orchFlows, resourceList, requestId, apiVersion, - resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, vnfReplace); + flowsToExecute = executeBuildingBlockBuilder.buildExecuteBuildingBlockList(orchFlows, resourceList, + requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, + requestDetails, vnfReplace); if (isNetworkCollectionInTheResourceList(resourceList)) { logger.info("Sorting for Vlan Tagging"); flowsToExecute = sortExecutionPathByObjectForVlanTagging(flowsToExecute, requestAction); @@ -427,9 +424,9 @@ public class WorkflowAction { requestDetails, requestAction, resourceId, flowsToExecute, vnfType, apiVersion, resourceKey, replaceInfo, configOrchFlows); } else { - ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, requestId, resourceKey, apiVersion, - resourceId, requestAction, true, vnfType, workflowResourceIds, requestDetails, false, null, - null, false, replaceInfo); + ExecuteBuildingBlock ebb = executeBuildingBlockBuilder.buildExecuteBuildingBlock(orchFlow, requestId, + resourceKey, apiVersion, resourceId, requestAction, true, vnfType, workflowResourceIds, + requestDetails, false, null, null, false, replaceInfo); flowsToExecute.add(ebb); } } @@ -597,10 +594,11 @@ public class WorkflowAction { + ": VnfcName does not exist or is null while there is a configuration for the vfModule", new Exception("Vnfc and Configuration do not match")); } - ExecuteBuildingBlock ebb = buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(), - dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(), - dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(), workflowIdsCopy, - dataObj.getRequestDetails(), false, null, vnfcName, true, null); + ExecuteBuildingBlock ebb = + executeBuildingBlockBuilder.buildExecuteBuildingBlock(orchFlow, dataObj.getRequestId(), + dataObj.getResourceKey(), dataObj.getApiVersion(), dataObj.getResourceId(), + dataObj.getRequestAction(), dataObj.isaLaCarte(), dataObj.getVnfType(), + workflowIdsCopy, dataObj.getRequestDetails(), false, null, vnfcName, true, null); flowsToExecuteConfigs.add(ebb); } } @@ -682,29 +680,7 @@ public class WorkflowAction { return orchFlows; } - protected List<Resource> sortVfModulesByBaseFirst(List<Resource> vfModuleResources) { - int count = 0; - for (Resource resource : vfModuleResources) { - if (resource.isBaseVfModule()) { - Collections.swap(vfModuleResources, 0, count); - break; - } - count++; - } - return vfModuleResources; - } - protected List<Resource> sortVfModulesByBaseLast(List<Resource> vfModuleResources) { - int count = 0; - for (Resource resource : vfModuleResources) { - if (resource.isBaseVfModule()) { - Collections.swap(vfModuleResources, vfModuleResources.size() - 1, count); - break; - } - count++; - } - return vfModuleResources; - } private void updateResourceIdsFromAAITraversal(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList, List<Pair<WorkflowType, String>> aaiResourceIds, String serviceInstanceId) { @@ -1331,125 +1307,6 @@ public class WorkflowAction { return sortedOrchFlows; } - private void addBuildingBlockToExecuteBBList(List<ExecuteBuildingBlock> flowsToExecute, List<Resource> resourceList, - WorkflowType workflowType, OrchestrationFlow orchFlow, String requestId, String apiVersion, - String resourceId, String requestAction, String vnfType, WorkflowResourceIds workflowResourceIds, - RequestDetails requestDetails, boolean isVirtualLink, boolean isConfiguration) { - - resourceList.stream().filter(resource -> resource.getResourceType().equals(workflowType)) - .forEach(resource -> flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, - apiVersion, resourceId, requestAction, false, vnfType, workflowResourceIds, requestDetails, - isVirtualLink, resource.getVirtualLinkKey(), null, isConfiguration, null))); - } - - protected List<ExecuteBuildingBlock> buildExecuteBuildingBlockList(List<OrchestrationFlow> orchFlows, - List<Resource> resourceList, String requestId, String apiVersion, String resourceId, String requestAction, - String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, - boolean replaceVnf) { - List<ExecuteBuildingBlock> flowsToExecute = new ArrayList<>(); - for (OrchestrationFlow orchFlow : orchFlows) { - if (orchFlow.getFlowName().contains(SERVICE)) { - if (!replaceVnf) { - workflowResourceIds.setServiceInstanceId(resourceId); - } - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.SERVICE, orchFlow, requestId, - apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, - false); - } else if (orchFlow.getFlowName().contains(VNF) || (orchFlow.getFlowName().contains(CONTROLLER) - && (VNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) { - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VNF, orchFlow, requestId, - apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, - false); - } else if (orchFlow.getFlowName().contains(PNF) || (orchFlow.getFlowName().contains(CONTROLLER) - && (PNF).equalsIgnoreCase(orchFlow.getBpmnScope()))) { - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.PNF, orchFlow, requestId, - apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, - false); - } else if (orchFlow.getFlowName().contains(NETWORK) - && !orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.NETWORK, orchFlow, requestId, - apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, false, - false); - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VIRTUAL_LINK, orchFlow, - requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, - true, false); - } else if (orchFlow.getFlowName().contains(VFMODULE) || (orchFlow.getFlowName().contains(CONTROLLER) - && (VFMODULE).equalsIgnoreCase(orchFlow.getBpmnScope()))) { - List<Resource> vfModuleResourcesSorted; - if (requestAction.equals(CREATE_INSTANCE) || requestAction.equals(ASSIGNINSTANCE) - || requestAction.equals("activateInstance")) { - vfModuleResourcesSorted = sortVfModulesByBaseFirst(resourceList.stream() - .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList())); - } else { - vfModuleResourcesSorted = sortVfModulesByBaseLast(resourceList.stream() - .filter(x -> WorkflowType.VFMODULE == x.getResourceType()).collect(Collectors.toList())); - } - for (Resource resource : vfModuleResourcesSorted) { - flowsToExecute.add(buildExecuteBuildingBlock(orchFlow, requestId, resource, apiVersion, resourceId, - requestAction, false, vnfType, workflowResourceIds, requestDetails, false, null, null, - false, null)); - } - } else if (orchFlow.getFlowName().contains(VOLUMEGROUP)) { - if (requestAction.equalsIgnoreCase(REPLACEINSTANCE) - || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)) { - logger.debug("Replacing workflow resource id by volume group id"); - resourceId = workflowResourceIds.getVolumeGroupId(); - } - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.VOLUMEGROUP, orchFlow, - requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, - false, false); - } else if (orchFlow.getFlowName().contains(NETWORKCOLLECTION)) { - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.NETWORKCOLLECTION, orchFlow, - requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, - false, false); - } else if (orchFlow.getFlowName().contains(CONFIGURATION)) { - addBuildingBlockToExecuteBBList(flowsToExecute, resourceList, WorkflowType.CONFIGURATION, orchFlow, - requestId, apiVersion, resourceId, requestAction, vnfType, workflowResourceIds, requestDetails, - false, true); - } else { - flowsToExecute - .add(buildExecuteBuildingBlock(orchFlow, requestId, null, apiVersion, resourceId, requestAction, - false, vnfType, workflowResourceIds, requestDetails, false, null, null, false, null)); - } - } - return flowsToExecute; - } - - protected ExecuteBuildingBlock buildExecuteBuildingBlock(OrchestrationFlow orchFlow, String requestId, - Resource resource, String apiVersion, String resourceId, String requestAction, boolean aLaCarte, - String vnfType, WorkflowResourceIds workflowResourceIds, RequestDetails requestDetails, - boolean isVirtualLink, String virtualLinkKey, String vnfcName, boolean isConfiguration, - ReplaceInstanceRelatedInformation replaceInfo) { - - BuildingBlock buildingBlock = - new BuildingBlock().setBpmnFlowName(orchFlow.getFlowName()).setMsoId(UUID.randomUUID().toString()) - .setIsVirtualLink(isVirtualLink).setVirtualLinkKey(virtualLinkKey) - .setKey(Optional.ofNullable(resource).map(Resource::getResourceId).orElse("")); - Optional.ofNullable(orchFlow.getBpmnAction()).ifPresent(buildingBlock::setBpmnAction); - Optional.ofNullable(orchFlow.getBpmnScope()).ifPresent(buildingBlock::setBpmnScope); - String oldVolumeGroupName = ""; - if (replaceInfo != null) { - oldVolumeGroupName = replaceInfo.getOldVolumeGroupName(); - } - if (resource != null - && (orchFlow.getFlowName().contains(VOLUMEGROUP) && (requestAction.equalsIgnoreCase(REPLACEINSTANCE) - || requestAction.equalsIgnoreCase(REPLACEINSTANCERETAINASSIGNMENTS)))) { - logger.debug("Setting resourceId to volume group id for volume group flow on replace"); - resourceId = workflowResourceIds.getVolumeGroupId(); - } - - ExecuteBuildingBlock executeBuildingBlock = new ExecuteBuildingBlock().setApiVersion(apiVersion) - .setaLaCarte(aLaCarte).setRequestAction(requestAction).setResourceId(resourceId).setVnfType(vnfType) - .setWorkflowResourceIds(workflowResourceIds).setRequestId(requestId).setBuildingBlock(buildingBlock) - .setRequestDetails(requestDetails).setOldVolumeGroupName(oldVolumeGroupName); - - if (resource != null && (isConfiguration || resource.getResourceType().equals(WorkflowType.CONFIGURATION))) { - ConfigurationResourceKeys configurationResourceKeys = getConfigurationResourceKeys(resource, vnfcName); - executeBuildingBlock.setConfigurationResourceKeys(configurationResourceKeys); - } - return executeBuildingBlock; - } - private ConfigurationResourceKeys getConfigurationResourceKeys(Resource resource, String vnfcName) { ConfigurationResourceKeys configurationResourceKeys = new ConfigurationResourceKeys(); Optional.ofNullable(vnfcName).ifPresent(configurationResourceKeys::setVnfcName); 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 bffa2592c1..5e16097304 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 @@ -28,8 +28,20 @@ package org.onap.so.bpmn.infrastructure.workflow.tasks; public final class WorkflowActionConstants { + private 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"; static final String WORKFLOW_ACTION_ERROR_MESSAGE = "WorkflowActionErrorMessage"; + static final String SERVICE = "Service"; + static final String CONTROLLER = "Controller"; + static final String NETWORKCOLLECTION = "NetworkCollection"; + static final String CONFIGURATION = "Configuration"; + 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/listeners/SkipCDSBuildingBlockListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java index 2119ced951..564ee91fb2 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipCDSBuildingBlockListener.java @@ -84,7 +84,7 @@ public class SkipCDSBuildingBlockListener implements FlowManipulator { VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(customizationUUID, vnfResourceCustomizations); if (null != vrc) { - boolean skipConfigVNF = vrc.isSkipPostInstConf(); + boolean skipConfigVNF = vrc.isSkipPostInstConf().booleanValue(); currentSequenceSkipCheck(execution, skipConfigVNF); } diff --git a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java index 6589ae77f5..83f61e3a4f 100644 --- a/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java +++ b/bpmn/so-bpmn-tasks/src/main/java/org/onap/so/bpmn/infrastructure/workflow/tasks/listeners/SkipConfigVnfListener.java @@ -34,7 +34,7 @@ public class SkipConfigVnfListener implements FlowManipulator { if (vnfResourceCustomizations != null && !vnfResourceCustomizations.isEmpty()) { VnfResourceCustomization vrc = catalogDbClient.findVnfResourceCustomizationInList(vnfCustomizationUUID, vnfResourceCustomizations); - boolean skipConfigVNF = vrc.isSkipPostInstConf(); + boolean skipConfigVNF = vrc.isSkipPostInstConf().booleanValue(); if (skipConfigVNF) { execution.setVariable(BBConstants.G_CURRENT_SEQUENCE, ((int) execution.getVariable(BBConstants.G_CURRENT_SEQUENCE)) + 1); diff --git a/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java new file mode 100644 index 0000000000..c8914f6e02 --- /dev/null +++ b/bpmn/so-bpmn-tasks/src/test/java/org/onap/so/bpmn/infrastructure/workflow/tasks/ExecuteBuildingBlockBuilderTest.java @@ -0,0 +1,90 @@ +/*- + * ============LICENSE_START======================================================= + * ONAP - SO + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Modifications Copyright (c) 2019 Samsung + * ================================================================================ + * Modifications Copyright (c) 2021 Nokia + * ================================================================================ + * Modifications Copyright (c) 2020 Tech Mahindra + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.onap.so.bpmn.infrastructure.workflow.tasks; + +import org.junit.Test; +import org.onap.so.bpmn.servicedecomposition.entities.ExecuteBuildingBlock; +import org.onap.so.db.catalog.beans.macro.OrchestrationFlow; +import java.util.ArrayList; +import java.util.List; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +public class ExecuteBuildingBlockBuilderTest { + + final private ExecuteBuildingBlockBuilder executeBBBuilder = new ExecuteBuildingBlockBuilder(); + + @Test + public void sortVfModulesByBaseFirstTest() { + List<Resource> resources = new ArrayList<>(); + Resource resource1 = new Resource(WorkflowType.VFMODULE, "111", false); + resource1.setBaseVfModule(false); + resources.add(resource1); + Resource resource2 = new Resource(WorkflowType.VFMODULE, "222", false); + resource2.setBaseVfModule(false); + resources.add(resource2); + Resource resource3 = new Resource(WorkflowType.VFMODULE, "333", false); + resource3.setBaseVfModule(true); + resources.add(resource3); + + List<Resource> result = executeBBBuilder.sortVfModulesByBaseFirst(resources); + assertEquals("333", result.get(0).getResourceId()); + assertEquals("222", result.get(1).getResourceId()); + assertEquals("111", result.get(2).getResourceId()); + } + + @Test + public void sortVfModulesByBaseLastTest() { + List<Resource> resources = new ArrayList<>(); + Resource resource1 = new Resource(WorkflowType.VFMODULE, "111", false); + resource1.setBaseVfModule(true); + resources.add(resource1); + Resource resource2 = new Resource(WorkflowType.VFMODULE, "222", false); + resource2.setBaseVfModule(false); + resources.add(resource2); + Resource resource3 = new Resource(WorkflowType.VFMODULE, "333", false); + resource3.setBaseVfModule(false); + resources.add(resource3); + List<Resource> result = executeBBBuilder.sortVfModulesByBaseLast(resources); + assertEquals("333", result.get(0).getResourceId()); + assertEquals("222", result.get(1).getResourceId()); + assertEquals("111", result.get(2).getResourceId()); + } + + @Test + public void verifyLackOfNullPointerExceptionForNullResource() { + ExecuteBuildingBlock result = null; + try { + result = executeBBBuilder.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null, + false, null, null, null, false, null, null, true, null); + } catch (NullPointerException e) { + fail("NullPointerException should not be thrown when 'resource' is null"); + } + assertNotNull(result); + } +} 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 c916e09c79..100c32f1c2 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 @@ -120,6 +120,7 @@ public class WorkflowActionTest extends BaseTaskTest { protected Environment environment; @Mock protected UserParamsServiceTraversal userParamsServiceTraversal; + @Mock private AaiResourceIdValidator aaiResourceIdValidator; @InjectMocks @@ -131,6 +132,9 @@ public class WorkflowActionTest extends BaseTaskTest { @Spy protected WorkflowAction SPY_workflowAction; + @Spy + protected ExecuteBuildingBlockBuilder executeBuildingBlockBuilder; + @Rule public ExpectedException thrown = ExpectedException.none(); @@ -159,6 +163,7 @@ public class WorkflowActionTest extends BaseTaskTest { when(bbSetupUtils.getAAIServiceInstanceByName(anyString(), anyObject())).thenReturn(servInstance); workflowAction.setBbInputSetupUtils(bbSetupUtils); workflowAction.setBbInputSetup(bbInputSetup); + } /** @@ -179,6 +184,7 @@ 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, "AssignNetwork1802BB", "CreateNetworkBB", "ActivateNetworkBB"); @@ -199,6 +205,7 @@ 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, "DeactivateNetworkBB", "DeleteNetworkBB", "UnassignNetwork1802BB"); @@ -219,6 +226,7 @@ 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"); @@ -292,6 +300,7 @@ public class WorkflowActionTest extends BaseTaskTest { .thenReturn(vfModuleCustomization2); when(catalogDbClient.getVfModuleCustomizationByModelCuztomizationUUID("da4d4327-fb7d-4311-ac7a-be7ba60cf969")) .thenReturn(vfModuleCustomization3); + workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignVnfBB", "AssignVolumeGroupBB", @@ -471,6 +480,7 @@ public class WorkflowActionTest extends BaseTaskTest { doReturn(service).when(catalogDbClient).getServiceByID("3c40d244-808e-42ca-b09a-256d83d19d0a"); when(catalogDbClient.getNorthBoundRequestByActionAndIsALaCarteAndRequestScopeAndCloudOwner(gAction, resource, false, "my-custom-cloud-owner")).thenReturn(northBoundRequest); + workflowAction.selectExecutionList(execution); List<ExecuteBuildingBlock> ebbs = (List<ExecuteBuildingBlock>) execution.getVariable("flowsToExecute"); assertEqualsBulkFlowName(ebbs, "AssignServiceInstanceBB", "AssignNetworkBB", "CreateNetworkBB", @@ -2063,41 +2073,7 @@ public class WorkflowActionTest extends BaseTaskTest { workflowAction.traverseCatalogDbService(execution, sIRequest, resourceCounter, aaiResourceIds); } - @Test - public void sortVfModulesByBaseFirstTest() { - List<Resource> resources = new ArrayList<>(); - Resource resource1 = new Resource(WorkflowType.VFMODULE, "111", false); - resource1.setBaseVfModule(false); - resources.add(resource1); - Resource resource2 = new Resource(WorkflowType.VFMODULE, "222", false); - resource2.setBaseVfModule(false); - resources.add(resource2); - Resource resource3 = new Resource(WorkflowType.VFMODULE, "333", false); - resource3.setBaseVfModule(true); - resources.add(resource3); - List<Resource> result = workflowAction.sortVfModulesByBaseFirst(resources); - assertEquals("333", result.get(0).getResourceId()); - assertEquals("222", result.get(1).getResourceId()); - assertEquals("111", result.get(2).getResourceId()); - } - @Test - public void sortVfModulesByBaseLastTest() { - List<Resource> resources = new ArrayList<>(); - Resource resource1 = new Resource(WorkflowType.VFMODULE, "111", false); - resource1.setBaseVfModule(true); - resources.add(resource1); - Resource resource2 = new Resource(WorkflowType.VFMODULE, "222", false); - resource2.setBaseVfModule(false); - resources.add(resource2); - Resource resource3 = new Resource(WorkflowType.VFMODULE, "333", false); - resource3.setBaseVfModule(false); - resources.add(resource3); - List<Resource> result = workflowAction.sortVfModulesByBaseLast(resources); - assertEquals("333", result.get(0).getResourceId()); - assertEquals("222", result.get(1).getResourceId()); - assertEquals("111", result.get(2).getResourceId()); - } @Test public void findCatalogNetworkCollectionTest() { @@ -2136,17 +2112,6 @@ public class WorkflowActionTest extends BaseTaskTest { execution.getVariable("WorkflowActionErrorMessage")); } - @Test - public void verifyLackOfNullPointerExceptionForNullResource() { - ExecuteBuildingBlock result = null; - try { - result = workflowAction.buildExecuteBuildingBlock(new OrchestrationFlow(), null, null, null, null, null, - false, null, null, null, false, null, null, true, null); - } catch (NullPointerException e) { - fail("NullPointerException should not be thrown when 'resource' is null"); - } - assertNotNull(result); - } @Test public void traverseAAIServiceTest() { |