From bcfee1b5b7bd91f21a6b7b2fd3be9484b10b542c Mon Sep 17 00:00:00 2001 From: hetengjiao Date: Mon, 18 Jan 2021 09:16:38 +0800 Subject: update nsmf workflow of active and deactive nssi Issue-ID: SO-2963 Signed-off-by: hetengjiao Change-Id: Ic144713f9cf55ed8db679bd7c57052fcea2aadf9 --- .../scripts/ActivateSliceService.groovy | 648 ++++++++++----------- .../scripts/DoActivateSliceService.groovy | 273 +++++++++ .../scripts/DoSendCommandToNSSMF.groovy | 423 -------------- .../resources/process/ActivateSliceService.bpmn | 552 ++++++++++-------- .../subprocess/DoActivateSliceService.bpmn | 211 +++++++ .../resources/subprocess/DoSendCommandToNSSMF.bpmn | 344 ----------- 6 files changed, 1070 insertions(+), 1381 deletions(-) create mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateSliceService.groovy delete mode 100644 bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoSendCommandToNSSMF.groovy create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateSliceService.bpmn delete mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoSendCommandToNSSMF.bpmn (limited to 'bpmn') 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 ActivateSliceService.bpmn 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 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 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 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 SNSSIList = new ArrayList<>() - List 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 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 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>() {}.getType() - Map activateNssiMap = new Gson().fromJson(nssiMap, type) - //update tn/cn/an nssi - for (Map.Entry 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 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 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 nssiMap = new HashMap<>() + CustomerInfo customerInfo = execution.getVariable("customerInfo") as CustomerInfo + String globalSubscriberId = customerInfo.globalSubscriberId + String subscriptionServiceType = customerInfo.subscriptionServiceType - List 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 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 si = wrapper.asBean(ServiceInstance.class) - if (si.isPresent()) { - - List 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 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 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 nssiSi = wrapper01.asBean(ServiceInstance.class) + nssiSi.ifPresent(new Consumer() { + @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 stringNSSIHashMap -> - HashMap map = new HashMap() - for (Map.Entry child : stringNSSIHashMap.entrySet()) { - map.put(child.getKey(), child.getValue()) + void isOperationFinished(DelegateExecution execution) { + Queue nssInstances = execution.getVariable("nssInstances") as Queue + 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 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 all_allotted = wrapper_allotted.asBean(AllottedResources.class) - - if (all_allotted.isPresent() && all_allotted.get().getAllottedResource()) { - List 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 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 nssInstances = execution.getVariable("nssInstances") as Queue + 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 = + """ + ${MsoUtils.xmlEscape(errorMessage)} + 7000 + """ + + 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/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>(){}.getType() - Map 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 stringNSSIHashMap) { - HashMap map = new HashMap() - for(Map.Entry 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>(){}.getType() - Map 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 = - """ - - - - ${MsoUtils.xmlEscape(serviceId)} - ${MsoUtils.xmlEscape(operationId)} - ${MsoUtils.xmlEscape(operationType)} - ${MsoUtils.xmlEscape(userId)} - ${MsoUtils.xmlEscape(result)} - ${MsoUtils.xmlEscape(operationContent)} - ${MsoUtils.xmlEscape(progress)} - ${MsoUtils.xmlEscape(reason)} - - - """ - - 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 = - """ - ${MsoUtils.xmlEscape(errorMessage)} - 7000 - """ - - 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 @@ - - - + - - SequenceFlow_1jp9gjt - SequenceFlow_1gkpl5q - import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new ActivateSliceService() -csi.updateStatusSNSSAIandNSIandNSSI(execution) - - - SequenceFlow_1gkpl5q - SequenceFlow_0pzts4p - import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new ActivateSliceService() -csi.prepareCompletionRequest(execution) - - + + SequenceFlow_1tdecf1 + + @@ -28,7 +15,7 @@ csi.prepareCompletionRequest(execution) application/soap+xml - ${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)} + Basic YnBlbDpwYXNzd29yZDEk ${updateOperationStatus} @@ -39,65 +26,95 @@ csi.prepareCompletionRequest(execution) http-connector - SequenceFlow_0pzts4p - SequenceFlow_0ozefu5 + SequenceFlow_1ox6oh6 + SequenceFlow_0szxmyf - - SequenceFlow_0r611x8 - SequenceFlow_0ozefu5 - - - SequenceFlow_1qa8miv - - - - SequenceFlow_00ba5l9 - SequenceFlow_1jp9gjt - SequenceFlow_1qa8miv - - - - - - - - - - - - - - - SequenceFlow_1o4zjvp - SequenceFlow_00ba5l9 - - - SequenceFlow_1yus0c1 - SequenceFlow_1uqgdxr + + SequenceFlow_1tdecf1 + SequenceFlow_0bvnci8 + import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.preProcessRequest(execution) + + + SequenceFlow_0bvnci8 + SequenceFlow_1ox6oh6 + import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.prepareInitServiceOperationStatus(execution) + + + + + + SequenceFlow_0szxmyf + SequenceFlow_1p778c2 import org.onap.so.bpmn.infrastructure.scripts.* def csi = new ActivateSliceService() csi.sendSyncResponse(execution) - - SequenceFlow_1uqgdxr - SequenceFlow_149lhmo + + + SequenceFlow_1p778c2 + SequenceFlow_1wrrg4v + SequenceFlow_0mr8oz6 import org.onap.so.bpmn.infrastructure.scripts.* def csi= new ActivateSliceService() -csi.checkAAIOrchStatusofslice(execution) +csi.checkAAIOrchStatusOfE2ESlice(execution) - - SequenceFlow_149lhmo - SequenceFlow_15fdf5d - SequenceFlow_0r611x8 + + SequenceFlow_19gpkz7 + SequenceFlow_0cn6n0t + SequenceFlow_0cs78yf - - SequenceFlow_15fdf5d - SequenceFlow_144cqr9 + + SequenceFlow_0cn6n0t + + + + #{execution.getVariable("isContinue") == "true"} + + + SequenceFlow_003ne6w + SequenceFlow_1b7nvps import org.onap.so.bpmn.infrastructure.scripts.* def csi= new ActivateSliceService() csi.prepareActivation(execution) - + + SequenceFlow_1pgjdeq + + + + + + + + + + + + + SequenceFlow_1b7nvps + SequenceFlow_1rsr0hp + SequenceFlow_1pgjdeq + SequenceFlow_150j97l + + + SequenceFlow_194fylv + SequenceFlow_0eiek58 + import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.updateStatusSNSSAIandNSIandNSSI(execution) + + + SequenceFlow_0eiek58 + SequenceFlow_0dc8i0s + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new ActivateSliceService() +csi.prepareCompletionRequest(execution) + + @@ -105,7 +122,7 @@ csi.prepareActivation(execution) application/soap+xml - Basic YnBlbDpwYXNzd29yZDEk + ${UrnPropertiesReader.getVariable("mso.adapters.requestDb.auth", execution)} ${updateOperationStatus} @@ -116,256 +133,275 @@ csi.prepareActivation(execution) http-connector - SequenceFlow_1av6du3 - SequenceFlow_1yus0c1 + SequenceFlow_0dc8i0s + SequenceFlow_11u2ido - - SequenceFlow_0qksr1g - SequenceFlow_183ypky - import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new ActivateSliceService() -csi.preProcessRequest(execution) - - - SequenceFlow_144cqr9 - SequenceFlow_1o4zjvp - SequenceFlow_1pj1j1o - - - SequenceFlow_0qksr1g - - - SequenceFlow_1pj1j1o - + + SequenceFlow_11u2ido + SequenceFlow_0cs78yf - - SequenceFlow_183ypky - SequenceFlow_1av6du3 - import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new ActivateSliceService() -csi.prepareInitServiceOperationStatus(execution) - - - - SequenceFlow_0oiiwjo - SequenceFlow_0uckyao + + + + SequenceFlow_16jz1l6 + SequenceFlow_097vxbl import org.onap.so.bpmn.infrastructure.scripts.* def csi= new ActivateSliceService() csi.sendSyncError(execution) - - SequenceFlow_0uckyao + + SequenceFlow_097vxbl - - SequenceFlow_0oiiwjo - + + SequenceFlow_16jz1l6 + - - + + - - - #{execution.getVariable("isNSSIActivate") == "false"} - - + + + #{execution.getVariable("isContinue") == "false"} - - #{execution.getVariable("isNSSIActivate") == "false"} - - - #{execution.getVariable("isNSSIActivate") == "true"} + + SequenceFlow_003ne6w + + + + SequenceFlow_1wrrg4v + SequenceFlow_1ny9zkw + import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.checkAAIOrchStatusOfAllocates(execution) + + + #{execution.getVariable("isContinue") == true} - - - - - - - - #{execution.getVariable("isContinue") == "true"} + + SequenceFlow_0mr8oz6 + + + + + + SequenceFlow_1ny9zkw + SequenceFlow_19gpkz7 + import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.checkAAIOrchStatusOfNSI(execution) + + + + + #{execution.getVariable("WorkflowException") == null} - - - #{execution.getVariable("isNSSIActivate") == "true"} + + #{execution.getVariable("isOperationFinished") == "true"} - - - + + + SequenceFlow_150j97l + SequenceFlow_194fylv + SequenceFlow_1rsr0hp + import org.onap.so.bpmn.infrastructure.scripts.* +def csi= new ActivateSliceService() +csi.isOperationFinished(execution) + + - - - - - - - + + + + + + - - + + - - + + - - + + - - - + + + - - - + + + - - - - - - - - + + + + + + - - + + + + + + - - + + - + - - - - - - - - + + + + + - - + + + - + + + + - - + + - - + + + + + + - - + + - - - - - + + - - + + - - - - - - - - - - - - - - + + - + + + + + - - - - - - - - - - - + + + + + + + + + + + + + + + - - - + + + - - - + + + - - - + + + - - - + + + + + - + - - - + + - + - - - - - - + + + + + + + - + - - - + + - + - - - - - - - - - + + + - - + + + + + + + + + + - - - + + + + + + + - - - + + + - - - + + + + + + + + + + + + + + + + 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 @@ + + + + + + SequenceFlow_13fdjwf + + + SequenceFlow_13fdjwf + SequenceFlow_1lh6vpe + import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.preProcessRequest(execution) + + + + + + + + + + + SequenceFlow_1yqrli6 + SequenceFlow_0ru5d0h + + + SequenceFlow_0ru5d0h + SequenceFlow_0so165e + import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.processDecomposition(execution) + + + SequenceFlow_0so165e + SequenceFlow_05wxhwm + import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.sendCreateRequestNSSMF(execution) + + + + + + + SequenceFlow_1lh6vpe + SequenceFlow_1yqrli6 + import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.prepareCompose(execution) + + + SequenceFlow_0oa5clt + SequenceFlow_05wxhwm + SequenceFlow_1herzai + import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.queryNSSIStatus(execution) + + + SequenceFlow_1herzai + SequenceFlow_0btrzm8 + SequenceFlow_1lvozh0 + + + SequenceFlow_1lvozh0 + + + SequenceFlow_0btrzm8 + SequenceFlow_0oa5clt + import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.timeDelay(execution) + + + + + + #{(execution.getVariable("jobFinished" ) == true)} + + + + + SequenceFlow_0ca8iyv + + + + SequenceFlow_0aqapur + + + SequenceFlow_0ca8iyv + SequenceFlow_0aqapur + import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoActivateSliceService() +dcso.sendSyncError(execution) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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 @@ - - - - - - - - SequenceFlow_0umnozs - SequenceFlow_1vuuuhr - SequenceFlow_1ea3pk8 - import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.getNSSIformlist(execution) - - - SequenceFlow_1yjsv5s - SequenceFlow_1qxmooy - SequenceFlow_1lh0it1 - SequenceFlow_0swcqw8 - - - SequenceFlow_1ea3pk8 - SequenceFlow_080lgb0 - SequenceFlow_1oi86yc - - - - - - - #{execution.getVariable("isActivateSuccessfull") == "waitting"} - - - #{execution.getVariable("isActivateSuccessfull") == "false"} - - - #{execution.getVariable("isActivateSuccessfull") == "true"} - - - #{execution.getVariable("isGetSuccessfull") == "true"} - - - - #{execution.getVariable("isNSSIActivated") == "true"} - - - #{execution.getVariable("isNSSIActivated") == "false"} - - - - - #{execution.getVariable("isGetSuccessfull") == "false"} - - - SequenceFlow_1oi86yc - - - SequenceFlow_1pfo460 - - - SequenceFlow_1pfo460 - SequenceFlow_0umnozs - import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoSendCommandToNSSMF() -dcso.preProcessRequest(execution) - - - - SequenceFlow_0oiiwjo - - - - SequenceFlow_0uckyao - - - - - SequenceFlow_0oiiwjo - SequenceFlow_0uckyao - import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.sendSyncError(execution) - - - - - - SequenceFlow_020xvv4 - SequenceFlow_1lh0it1 - - - - SequenceFlow_1s2oozd - SequenceFlow_0swcqw8 - SequenceFlow_10162l8 - import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.WaitForReturn(execution) - - - SequenceFlow_10162l8 - SequenceFlow_1yjsv5s - import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.GetTheStatusOfActivation(execution) - - - SequenceFlow_08xfw41 - SequenceFlow_1s2oozd - SequenceFlow_020xvv4 - - - SequenceFlow_1a6iu8c - SequenceFlow_08xfw41 - import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.SendCommandToNssmf(execution) - - - - - - - - - - SequenceFlow_080lgb0 - SequenceFlow_1ucjcm1 - - - SequenceFlow_1ucjcm1 - SequenceFlow_1a6iu8c - import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.processDecomposition(execution) - - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic YnBlbDpwYXNzd29yZDEk - - - ${CVFMI_updateServiceOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1oeexsj - SequenceFlow_1vuuuhr - - - SequenceFlow_1qxmooy - SequenceFlow_1oeexsj - import org.onap.so.bpmn.infrastructure.scripts.* -def csi= new DoSendCommandToNSSMF() -csi.UpdateIndex(execution) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit 1.2.3-korg