diff options
12 files changed, 4571 insertions, 0 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy new file mode 100644 index 0000000000..e3470cd011 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy @@ -0,0 +1,678 @@ +/*- + * ============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 groovy.json.JsonSlurper +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.json.JSONObject +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.RequestDBUtil +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInfo +import org.onap.so.bpmn.core.domain.ServiceProxy +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.db.request.beans.OperationStatus +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import org.springframework.web.util.UriUtils + +import static org.apache.commons.lang3.StringUtils.isBlank + +/** + * This groovy class supports the <class>DoCreateCommunicationService.bpmn</class> process. + * AlaCarte flow for 1702 ServiceInstance Create + * + */ +class CreateCommunicationService extends AbstractServiceTaskProcessor { + + String Prefix="CRESI_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + RequestDBUtil requestDBUtil = new RequestDBUtil() + + JsonUtils jsonUtil = new JsonUtils() + + AAIResourcesClient client = getAAIClient() + + private static final Logger logger = LoggerFactory.getLogger(CreateCommunicationService.class) + + @Override + void preProcessRequest(DelegateExecution execution) { + logger.debug(Prefix + "preProcessRequest Start") + execution.setVariable("prefix", Prefix) + execution.setVariable("startTime", System.currentTimeMillis()) + def msg + //execution.setVariable("bpmnRequest", InputString) + try { + // get request input + String siRequest = execution.getVariable("bpmnRequest") + logger.debug(siRequest) + + //String requestId = execution.getVariable("mso-request-id") + String requestId = execution.getVariable("mso-request-id") + execution.setVariable("msoRequestId", requestId) + logger.debug("Input Request:" + siRequest + " reqId:" + requestId) + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + serviceInstanceId = UUID.randomUUID().toString() + } + logger.debug("Generated new Service Instance:" + serviceInstanceId) + serviceInstanceId = UriUtils.encode(serviceInstanceId,"UTF-8") + execution.setVariable("serviceInstanceId", serviceInstanceId) + + //subscriberInfo + String globalSubscriberId = jsonUtil.getJsonValue(siRequest, "requestDetails.subscriberInfo.globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("globalSubscriberId", globalSubscriberId) + } + + //requestInfo + execution.setVariable("source", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.source")) + execution.setVariable("serviceInstanceName", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.instanceName")) + execution.setVariable("disableRollback", jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.suppressRollback")) + String productFamilyId = jsonUtil.getJsonValue(siRequest, "requestDetails.requestInfo.productFamilyId") + if (isBlank(productFamilyId)) + { + msg = "Input productFamilyId is null" + logger.debug(msg) + //exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + execution.setVariable("productFamilyId", productFamilyId) + } + + //modelInfo + String serviceModelInfo = jsonUtil.getJsonValue(siRequest, "requestDetails.modelInfo") + if (isBlank(serviceModelInfo)) { + msg = "Input serviceModelInfo is null" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else + { + execution.setVariable("csServiceModelInfo", serviceModelInfo) + } + + logger.debug("modelInfo: " + serviceModelInfo) + + //requestParameters, subscriptionServiceType is 5G + String subscriptionServiceType = jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType is null" + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } else { + // todo: in create e2e interface, this value is write "MOG", so write it as "5G" + execution.setVariable("subscriptionServiceType", "5G") + } + + + /* + * Extracting User Parameters from incoming Request and converting into a Map + */ + def jsonSlurper = new JsonSlurper() + + Map reqMap = jsonSlurper.parseText(siRequest) as Map + + //InputParams + def userParamsList = reqMap.requestDetails?.requestParameters?.userParams + + Map<String, String> inputMap = [:] + if (userParamsList) { + for (def i=0; i<userParamsList.size(); i++) { + def userParams1 = userParamsList.get(i) + userParams1.each { param -> inputMap.put(param.key, param.value)} + } + } + + logger.debug("User Input Parameters map: " + inputMap.toString()) + execution.setVariable("serviceInputParams", inputMap) + execution.setVariable("uuiRequest", inputMap.get("UUIRequest")) + execution.setVariable("isAllNSMFFinished", "false") + String operationId = UUID.randomUUID().toString() + execution.setVariable("operationId", operationId) + + } catch(BpmnError e) { + throw e + } catch(Exception ex) { + msg = "Exception in CreateCommunicationService.preProcessRequest " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "preProcessRequest Exit") + } + + + /** + * create operation status in request db + * + * Init the Operation Status + */ + def prepareInitOperationStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareInitOperationStatus Start") + + String serviceId = execution.getVariable("serviceInstanceId") + // 生成 operationId + String operationId = execution.getVariable("operationId") + logger.debug("Generated new operation for Service Instance serviceId:" + serviceId + " operationId:" + operationId) + + OperationStatus initStatus = new OperationStatus() + initStatus.setServiceId(serviceId) + initStatus.setOperationId(operationId) + initStatus.setOperation("CREATE") + initStatus.setUserId(execution.getVariable("globalSubscriberId") as String) + initStatus.setResult("processing") + initStatus.setProgress("0") + initStatus.setReason("") + initStatus.setOperationContent("communication service create operation start") + + requestDBUtil.prepareUpdateOperationStatus(execution, initStatus) + + logger.debug(Prefix + "prepareInitOperationStatus Exit") + } + + + /** + * return sync response + */ + def sendSyncResponse = { DelegateExecution execution -> + logger.debug(Prefix + "sendSyncResponse Start") + try { + String operationId = execution.getVariable("operationId") + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String createServiceRestRequest = """ + { + "service": { + "serviceId":"${serviceInstanceId}", + "operationId":"${operationId}" + } + } + """.trim().replaceAll(" ", "") + + logger.debug("sendSyncResponse to APIH:" + "\n" + createServiceRestRequest) + sendWorkflowResponse(execution, 202, createServiceRestRequest) + + execution.setVariable("sentSyncResponse", true) + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "sendSyncResponse Exit") + } + + + /** + * query e2e service + * @param execution + */ + def prepareDoComposeE2E = { DelegateExecution execution -> + logger.debug(Prefix + "prepareDoComposeE2E Start") + try { + ServiceDecomposition serviceDecomposition = execution.getVariable( + "csServiceDecomposition") as ServiceDecomposition + + logger.debug("serviceDecomposition is:" + serviceDecomposition.toJsonString()) + + List<ServiceProxy> serviceProxies = serviceDecomposition.getServiceProxy() + String sourceModelUuid = serviceProxies.get(0).getSourceModelUuid() + + JSONObject queryJson = new JSONObject() + queryJson.put("modelUuid", sourceModelUuid) + + execution.setVariable("e2eServiceModelInfo", queryJson.toString()) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateCommunicationService.prepareDoComposeE2E. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "prepareDoComposeE2E Exit") + } + + + /** + * parse communication service params from request + * @param execution + */ + def parseCSParamsFromReq = { DelegateExecution execution -> + logger.debug(Prefix + "parseCSParamsFromReq Start") + try { + //1. CMS info + + String modelInfo = execution.getVariable("csServiceModelInfo") + String modelInvariantUuid = jsonUtil.getJsonValue(modelInfo, "modelInvariantUuid") + String modelUuid = jsonUtil.getJsonValue(modelInfo, "modelUuid") + + //String modelInvariantUuid = execution.getVariable("modelInvariantId") + //String modelUuid = execution.getVariable("modelUuid") + String uuiRequest = execution.getVariable("uuiRequest") + String useInterval = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.useInterval") + String csServiceName = jsonUtil.getJsonValue(uuiRequest, "service.name") + String csServiceDescription = jsonUtil.getJsonValue(uuiRequest, "service.description") + + execution.setVariable("modelInvariantUuid", modelInvariantUuid) + execution.setVariable("modelUuid", modelUuid) + execution.setVariable("useInterval", useInterval) + execution.setVariable("csServiceName", csServiceName) + execution.setVariable("csServiceDescription", csServiceDescription) + + + //2. profile info + Integer expDataRateDL = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.expDataRateDL") + Integer expDataRateUL = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.expDataRateUL") + Integer latency = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.latency") + Integer maxNumberOfUEs = jsonUtil.getJsonIntValue(uuiRequest, "service.parameters.requestInputs.maxNumberofUEs") + String uEMobilityLevel = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.uemobilityLevel") + String resourceSharingLevel = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.resourceSharingLevel") + String coverageArea = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.coverageAreaList") + + // from template construct input map + //String cstTemplate = execution.getVariable("cstTemplate") + ServiceDecomposition csServiceDecomposition = execution.getVariable( + "csServiceDecomposition") as ServiceDecomposition + //String csServiceType = jsonUtil.getJsonValue(cstTemplate, "serviceResources.serviceType") + String csServiceType = csServiceDecomposition.getServiceType() + execution.setVariable("csServiceType", csServiceType) + + //String cstTemplateInfo = jsonUtil.getJsonValue(cstTemplate, "serviceResources.serviceInfo.serviceInput") + ServiceInfo csServiceInfo = csServiceDecomposition.getServiceInfo() + String cstTemplateInfo = csServiceInfo.getServiceProperties() + + List<String> csInputs = jsonUtil.StringArrayToList(cstTemplateInfo) + + Map<String, ?> csInputMap = new HashMap<>() + for (String csInput : csInputs) { + def value + if (jsonUtil.getJsonValue(csInput, "type") == "integer") { + value = jsonUtil.getJsonValue(csInput, "default") + csInputMap.put(jsonUtil.getJsonValue(csInput, "name"), isBlank(value) ? 0 : (value as Integer)) + } else if (jsonUtil.getJsonValue(csInput, "type") == "string") { + csInputMap.put(jsonUtil.getJsonValue(csInput, "name"), + jsonUtil.getJsonValue(csInput, "default")) + } + } + csInputMap.put("expDataRateDL", expDataRateDL) + csInputMap.put("expDataRateUL", expDataRateUL) + csInputMap.put("latency", latency) + csInputMap.put("maxNumberofUEs", maxNumberOfUEs) + csInputMap.put("uEMobilityLevel", uEMobilityLevel) + csInputMap.put("resourceSharingLevel", resourceSharingLevel) + csInputMap.put("coverageAreaTAList", coverageArea) + csInputMap.put("useInterval", useInterval) + + execution.setVariable("csInputMap", csInputMap) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateCommunicationService.parseCSParamsFromReq. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "parseCSParamsFromReq Exit") + } + + + /** + * get E2EST id through CST id and change communication profile to E2E service profile + * 1. get E2EST id from cst + * 1.1 查source service id + * 1.2 source service + * 1.3 source service input, init e2e profile + */ + def generateE2EServiceProfile = { DelegateExecution execution -> + logger.debug(Prefix + "generateE2EServiceProfile Start") + try { + ServiceDecomposition e2eServiceDecomposition = execution.getVariable( + "e2eServiceDecomposition") as ServiceDecomposition + String e2estTemplateInfo = e2eServiceDecomposition.getServiceInfo().getServiceProperties() + + List<String> e2eInputs = jsonUtil.StringArrayToList(e2estTemplateInfo) + + Map<String, ?> csInputMap = execution.getVariable("csInputMap") as Map + Map<String, ?> e2eInputMap = new HashMap<>() + String key + def value + + + for (String e2eInput in e2eInputs) { + if (jsonUtil.getJsonValue(e2eInput, "type") == "integer") { + def temp + key = jsonUtil.getJsonValue(e2eInput, "name") + value = csInputMap.containsKey(key) ? csInputMap.getOrDefault(key, 0) : (isBlank(temp = jsonUtil.getJsonValue(e2eInput, "default")) ? 0 : temp) + + e2eInputMap.put(key, value as Integer) + } else { + e2eInputMap.put(key = jsonUtil.getJsonValue(e2eInput, "name"), csInputMap.containsKey(key) + ? csInputMap.getOrDefault(key, null) : (jsonUtil.getJsonValue(e2eInput, "default"))) + } + } + + e2eInputMap.put("sNSSAI", execution.getVariable("sNSSAI_id")) + e2eInputMap.put("areaTrafficCapDL", 100) + e2eInputMap.put("areaTrafficCapUL", 100) + e2eInputMap.put("sST", execution.getVariable("csServiceType")) + + execution.setVariable("e2eInputMap", e2eInputMap) + execution.setVariable("e2eServiceType", e2eServiceDecomposition.getServiceType()) + execution.setVariable("e2eModelInvariantUuid", e2eServiceDecomposition.getModelInfo().getModelInvariantUuid()) + execution.setVariable("e2eModelUuid", e2eServiceDecomposition.getModelInfo().getModelUuid()) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateE2EServiceInstance.createRelationShipInAAI. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "generateE2EServiceProfile Exit") + } + + + /** + * call createE2EService get operation id, + * created/processing + */ + def preRequestSend2NSMF(DelegateExecution execution) { + logger.debug(Prefix + "preRequestSend2NSMF Start") + try { + + //String NSMF_endpoint = "/onap/so/infra/e2eServiceInstances/v3" + def NSMF_endpoint = UrnPropertiesReader.getVariable("mso.infra.endpoint.url", execution) + def url = NSMF_endpoint + "/e2eServiceInstances/v3" + execution.setVariable("NSMF_endpoint", url) + //get from model catalog inputs + String payload = """ + { + "service":{ + "name": "${execution.getVariable("csServiceName")}", + "description": "e2eService of ${execution.getVariable("modelUuid")}", + "serviceInvariantUuid": "${execution.getVariable("e2eModelInvariantUuid")}", + "serviceUuid": "${execution.getVariable("e2eModelUuid")}", + "globalSubscriberId": "${execution.getVariable("globalSubscriberId")}", + "serviceType": "${execution.getVariable("subscriptionServiceType")}", + "parameters":{ + "requestInputs": ${execution.getVariable("e2eInputMap") as JSONObject} + } + } + } + """ + execution.setVariable("CSMF_NSMFRequest", payload.replaceAll("\\s+", "")) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateCommunicationService.preRequestSend2NSMF. " + ex.getMessage() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + logger.debug(Prefix + "preRequestSend2NSMF Exit") + } + + + def processNSMFResponse = { DelegateExecution execution -> + logger.debug(Prefix + "processNSMFResponse Start") + //oof + try { + def CSMF_NSMFResponseCode = execution.getVariable("CSMF_NSMFResponseCode") as Integer + if (CSMF_NSMFResponseCode >= 200 && CSMF_NSMFResponseCode < 400) { + def CSMF_NSMFResponse = execution.getVariable("CSMF_NSMFResponse") as String + def e2eServiceInstanceId = jsonUtil.getJsonValue(CSMF_NSMFResponse, "service.serviceId") + def e2eOperationId = jsonUtil.getJsonValue(CSMF_NSMFResponse, "service.operationId") + + execution.setVariable("e2eServiceInstanceId", e2eServiceInstanceId) + execution.setVariable("e2eOperationId", e2eOperationId) + execution.setVariable("ProcessNsmfSuccess", "OK") + } else { + execution.setVariable("ProcessNsmfSuccess", "ERROR") + execution.setVariable("operationStatus", "error") + execution.setVariable("operationContent", + "communication service create operation error: nsmf response fail") + execution.setVariable("orchestrationStatus", "error") + } + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in " + Prefix + "processOOFResponse. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "processNSMFResponse Exit") + } + + + /** + * create communication service and e2e service relationship + * + */ + def createCSAndSSRelationship = { DelegateExecution execution -> + logger.debug(Prefix + "createCSAndSSRelationship Start") + String msg = "" + try { + def e2eServiceInstanceId = execution.getVariable("e2eServiceInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + + Relationship relationship = new Relationship() + String relatedLink = "aai/v16/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${subscriptionServiceType}/service-instances/service-instance/${e2eServiceInstanceId}" + relationship.setRelatedLink(relatedLink) + + // create CS and SS relationship in AAI + createRelationShipInAAI(execution, relationship) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + + msg = "Exception in DoCreateE2EServiceInstance.createCustomRelationship. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "createCSAndSSRelationship Exit") + } + + + /** + * prepare update operation status to 50% after create relationship in aai + * @param execution + */ + def prepareUpdateOperationStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareUpdateOperationStatus Start") + // update status creating + OperationStatus status = new OperationStatus() + status.setServiceId(execution.getVariable("serviceInstanceId") as String) + status.setOperationId(execution.getVariable("operationId") as String) + status.setOperation("CREATE") + status.setResult("processing") + status.setProgress("20") + status.setOperationContent("communication service create operation processing: waiting nsmf service create finished") + status.setUserId(execution.getVariable("globalSubscriberId") as String) + + requestDBUtil.prepareUpdateOperationStatus(execution, status) + logger.debug(Prefix + "prepareUpdateOperationStatus Exit") + } + + + /** + * create relationship in AAI + */ + private createRelationShipInAAI = { DelegateExecution execution, final Relationship relationship -> + logger.debug(Prefix + "createRelationShipInAAI Start") + String msg + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + execution.getVariable("globalSubscriberId"), + execution.getVariable("subscriptionServiceType"), + serviceInstanceId).relationshipAPI() + client.create(uri, relationship) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "createRelationShipInAAI Exit") + + } + + + def prepareCallCheckProcessStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareCallCheckProcessStatus Start") + + def successConditions = new ArrayList<>() + successConditions.add("finished") + execution.setVariable("successConditions", successConditions) + + def errorConditions = new ArrayList<>() + errorConditions.add("error") + execution.setVariable("errorConditions", errorConditions) + + execution.setVariable("processServiceType", "communication service") + + execution.setVariable("subOperationType", "CREATE") + + execution.setVariable("timeOut", 3 * 60 * 60 * 1000) + + def successParamMap = new HashMap<String, Object>() + successParamMap.put("orchestrationStatus", "deactivated") + + execution.setVariable("successParamMap", successParamMap) + + def errorParamMap = new HashMap<String, Object>() + errorParamMap.put("orchestrationStatus", "error") + + execution.setVariable("errorParamMap", errorParamMap) + + def timeOutParamMap = new HashMap<String, Object>() + timeOutParamMap.put("orchestrationStatus", "error") + + execution.setVariable("timeOutParamMap", timeOutParamMap) + + execution.setVariable("initProgress", 20) + execution.setVariable("endProgress", 90) + + logger.debug(Prefix + "prepareCallCheckProcessStatus Exit") + } + + + /** + * prepare update operation status to complete after NSMF process success + * @param execution + */ + def prepareCompleteStatus = { DelegateExecution execution -> + logger.debug(Prefix + "prepareCompleteStatus Start") + OperationStatus status = new OperationStatus() + status.setServiceId(execution.getVariable("serviceInstanceId") as String) + status.setOperationId(execution.getVariable("operationId") as String) + status.setOperation("CREATE") + status.setResult(execution.getVariable("operationStatus") as String) + status.setProgress("100") + status.setOperationContent(execution.getVariable("operationContent") as String) + status.setUserId(execution.getVariable("globalSubscriberId") as String) + + requestDBUtil.prepareUpdateOperationStatus(execution, status) + logger.debug("prepareCompleteStatus end, serviceInstanceId: " + execution.getVariable("serviceInstanceId") + + ", operationId: " + execution.getVariable("operationId")) + logger.debug(Prefix + "prepareCompleteStatus Exit") + } + + + /** + * update NSMF complete status to AAI when the NSMF process finished + * @param execution + */ + def updateFinishStatusInAAI = { DelegateExecution execution -> + logger.debug(Prefix + "updateFinishStatusInAAI Start") + String msg + try { + + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String orchestrationStatus = execution.getVariable("orchestrationStatus") + // create service + ServiceInstance csi = new ServiceInstance() + csi.setOrchestrationStatus(orchestrationStatus) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + globalSubscriberId, subscriptionServiceType, serviceInstanceId) + client.update(uri, csi) + logger.debug(Prefix + "updateFinishStatusInAAI update communication service status to deactivated") + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in complete communication service " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug(Prefix + "updateFinishStatusInAAI Exit") + } + + + public sendSyncError = { DelegateExecution execution -> + logger.debug("sendSyncError Start") + try { + String errorMessage + if (execution.getVariable("WorkflowException") instanceof WorkflowException) { + WorkflowException wfe = execution.getVariable("WorkflowException") as 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.debug(Prefix + "sendSyncError Exit") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy new file mode 100644 index 0000000000..d5b554d841 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy @@ -0,0 +1,338 @@ +package org.onap.so.bpmn.infrastructure.scripts + +import com.google.common.reflect.TypeToken +import com.google.gson.Gson +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.AllottedResource +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.RelationshipList +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.beans.nsmf.SliceTaskParams +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceProxy +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIEdgeLabel +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.db.request.client.RequestsDbClient +import org.onap.so.db.request.beans.OrchestrationTask +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.UriBuilder + +import static org.apache.commons.lang3.StringUtils.isBlank + +class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{ + + private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSIandNSSI.class); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + RequestsDbClient requestsDbClient = new RequestsDbClient() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + + void preProcessRequest (DelegateExecution execution) { + String msg = "" + logger.trace("Enter preProcessRequest()") + Map<String, Object> nssiMap = new HashMap<>() + execution.setVariable("nssiMap", nssiMap) + boolean isMoreNSSTtoProcess = true + execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess) + List<String> nsstSequence = new ArrayList<>(Arrays.asList("cn")) + execution.setVariable("nsstSequence", nsstSequence) + logger.trace("Exit preProcessRequest") + } + + void retriveSliceOption(DelegateExecution execution) { + logger.trace("Enter retriveSliceOption() of DoAllocateNSIandNSSI") + String uuiRequest = execution.getVariable("uuiRequest") + boolean isNSIOptionAvailable = false + List<String> nssiAssociated = new ArrayList<>() + SliceTaskParams sliceParams = execution.getVariable("sliceTaskParams") + try + { + String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.nstar0_allottedresource0_providing_service_uuid") + String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.nstar0_allottedresource0_providing_service_invariant_uuid") + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + //Params sliceParams = new Gson().fromJson(params, new TypeToken<Params>() {}.getType()); + execution.setVariable("sliceParams", sliceParams) + }catch (Exception ex) { + logger.debug( "Unable to get the task information from request DB: " + ex) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Unable to get task information from request DB.") + } + + if(isBlank(sliceParams.getSuggestNsiId())) + { + isNSIOptionAvailable=false + } + else + { + isNSIOptionAvailable=true + execution.setVariable('nsiServiceInstanceId',sliceParams.getSuggestNsiId()) + execution.setVariable('nsiServiceInstanceName',sliceParams.getSuggestNsiName()) + } + execution.setVariable("isNSIOptionAvailable",isNSIOptionAvailable) + logger.trace("Exit retriveSliceOption() of DoAllocateNSIandNSSI") + } + + void updateRelationship(DelegateExecution execution) { + logger.trace("Enter update relationship in DoAllocateNSIandNSSI()") + String nsiServiceInstanceId = execution.getVariable("nsiServiceInstanceId") + String allottedResourceId = execution.getVariable("allottedResourceId") + //Need to check whether nsi exist : Begin + org.onap.aai.domain.yang.ServiceInstance nsiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance() + SliceTaskParams sliceParams = execution.getVariable("sliceParams") + + String nsiServiceInstanceID = sliceParams.getSuggestNsiId() + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceID) + //AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.QUERY_ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceID) + + try { + AAIResultWrapper wrapper = resourceClient.get(nsiServiceuri, NotFoundException.class) + Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) + nsiServiceInstance = si.get() + //allottedResourceId=nsiServiceInstance.getAllottedResources().getAllottedResource().get(0).getId() + +// if(resourceClient.exists(nsiServiceuri)){ +// execution.setVariable("nsi_resourceLink", nsiServiceuri.build().toString()) +// }else{ +// exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " + +// "associate for service :"+serviceInstanceId) +// } + }catch(BpmnError e) { + throw e; + }catch (Exception ex){ + String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceId, allottedResourceId) + getAAIClient().connect(allottedResourceUri,nsiServiceuri) + + List<String> nssiAssociated = new ArrayList<>() + RelationshipList relationshipList = nsiServiceInstance.getRelationshipList() + List<Relationship> relationships = relationshipList.getRelationship() + for(Relationship relationship in relationships) + { + if(relationship.getRelatedTo().equalsIgnoreCase("service-instance")) + { + String NSSIassociated = relationship.getRelatedLink().substring(relationship.getRelatedLink().lastIndexOf("/") + 1); + if(!NSSIassociated.equals(nsiServiceInstanceID)) + nssiAssociated.add(NSSIassociated) + } + } + execution.setVariable("nssiAssociated",nssiAssociated) + execution.setVariable("nsiServiceInstanceName",nsiServiceInstance.getServiceInstanceName()) + logger.trace("Exit update relationship in DoAllocateNSIandNSSI()") + } + + void prepareNssiModelInfo(DelegateExecution execution){ + logger.trace("Enter prepareNssiModelInfo in DoAllocateNSIandNSSI()") + List<String> nssiAssociated = new ArrayList<>() + Map<String, Object> nssiMap = new HashMap<>() + nssiAssociated=execution.getVariable("nssiAssociated") + for(String nssiID in nssiAssociated) + { + try { + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nssiID) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) + org.onap.aai.domain.yang.ServiceInstance nssi = si.get() + nssiMap.put(nssi.getEnvironmentContext(),"""{ + "serviceInstanceId":"${nssi.getServiceInstanceId()}", + "modelUuid":"${nssi.getModelVersionId()}" + }""") + + }catch(NotFoundException e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiID) + }catch(Exception e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiID) + } + execution.setVariable("nssiMap",nssiMap) + + } + logger.trace("Exit prepareNssiModelInfo in DoAllocateNSIandNSSI()") + } + + void createNSIinAAI(DelegateExecution execution) { + logger.trace("Enter CreateNSIinAAI in DoAllocateNSIandNSSI()") + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + org.onap.aai.domain.yang.ServiceInstance nsi = new ServiceInstance(); + String sliceInstanceId = UUID.randomUUID().toString() + execution.setVariable("sliceInstanceId",sliceInstanceId) + nsi.setServiceInstanceId(sliceInstanceId) + String sliceInstanceName = "nsi_"+execution.getVariable("serviceInstanceName") + nsi.setServiceInstanceName(sliceInstanceName) + String serviceType = execution.getVariable("serviceType") + nsi.setServiceType(serviceType) + String serviceStatus = "deactivated" + nsi.setOrchestrationStatus(serviceStatus) + String modelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid() + String modelUuid = serviceDecomposition.getModelInfo().getModelUuid() + nsi.setModelInvariantId(modelInvariantUuid) + nsi.setModelVersionId(modelUuid) + String uuiRequest = execution.getVariable("uuiRequest") + String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList") + nsi.setServiceInstanceLocationId(serviceInstanceLocationid) + //String snssai = jsonUtil.getJsonValue(uuiRequest, "service.requestInputs.snssai") + //nsi.setEnvironmentContext(snssai) + String serviceRole = "nsi" + nsi.setServiceRole(serviceRole) + try { + + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceInstanceId) + client.create(uri, nsi) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + Map<String, Object> nssiMap = new HashMap<>() + List<ServiceProxy> serviceProxyList = serviceDecomposition.getServiceProxy() + List<String> nsstModelInfoList = new ArrayList<>() + for(ServiceProxy serviceProxy : serviceProxyList) + { + //String nsstModelUuid = serviceProxy.getModelInfo().getModelUuid() + String nsstModelUuid = serviceProxy.getSourceModelUuid() + //String nsstModelInvariantUuid = serviceProxy.getModelInfo().getModelInvariantUuid() + String nsstServiceModelInfo = """{ + "modelInvariantUuid":"", + "modelUuid":"${nsstModelUuid}", + "modelVersion":"" + }""" + nsstModelInfoList.add(nsstServiceModelInfo) + } + int currentIndex=0 + int maxIndex=nsstModelInfoList.size() + if(maxIndex < 1) + { + msg = "Exception in DoAllocateNSIandNSSI. There is no NSST associated with NST " + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + execution.setVariable("nsstModelInfoList",nsstModelInfoList) + execution.setVariable("currentIndex",currentIndex) + execution.setVariable("maxIndex",maxIndex) + execution.setVariable('nsiServiceInstanceId',sliceInstanceId) + execution.setVariable("nsiServiceInstanceName",sliceInstanceName) + logger.trace("Exit CreateNSIinAAI in DoAllocateNSIandNSSI()") + } + + void getOneNsstInfo(DelegateExecution execution){ + List<String> nsstModelInfoList = new ArrayList<>() + nsstModelInfoList = execution.getVariable("nsstModelInfoList") + int currentIndex = execution.getVariable("currentIndex") + int maxIndex = execution.getVariable("maxIndex") + boolean isMoreNSSTtoProcess = true + String nsstServiceModelInfo = nsstModelInfoList.get(currentIndex) + execution.setVariable("serviceModelInfo", nsstServiceModelInfo) + execution.setVariable("currentIndex", currentIndex) + currentIndex = currentIndex+1 + if(currentIndex <= maxIndex ) + isMoreNSSTtoProcess = false + execution.setVariable("isMoreNSSTtoProcess", isMoreNSSTtoProcess) + } + + void createNSSTMap(DelegateExecution execution){ + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + String modelUuid= serviceDecomposition.getModelInfo().getModelUuid() + String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent() + //String nsstID = jsonUtil.getJsonValue(content, "metadata.id") + //String vendor = jsonUtil.getJsonValue(content, "metadata.vendor") + //String type = jsonUtil.getJsonValue(content, "metadata.type") + String domain = jsonUtil.getJsonValue(content, "metadata.domainType") + + Map<String, Object> nssiMap = execution.getVariable("nssiMap") + String servicename = execution.getVariable("serviceInstanceName") + String nsiname = "nsi_"+servicename + nssiMap.put(domain,"""{ + "serviceInstanceId":"", + "modelUuid":"${modelUuid}" + }""") + execution.setVariable("nssiMap",nssiMap) + } + + void prepareNSSIList(DelegateExecution execution){ + logger.trace("Enter prepareNSSIList in DoAllocateNSIandNSSI()") + Map<String, Object> nssiMap = new HashMap<>() + Boolean isMoreNSSI = false + nssiMap = execution.getVariable("nssiMap") + List<String> keys=new ArrayList<String>(nssiMap.values()) + List<String> nsstSequence = execution.getVariable("nsstSequence") + Integer currentIndex=0; + execution.setVariable("currentNssiIndex",currentIndex) + Integer maxIndex=keys.size() + execution.setVariable("maxIndex",maxIndex) + if(maxIndex>0) + isMoreNSSI=true + execution.setVariable("isMoreNSSI",isMoreNSSI) + logger.trace("Exit prepareNSSIList in DoAllocateNSIandNSSI()") + } + + + void getOneNSSIInfo(DelegateExecution execution){ + logger.trace("Enter getOneNSSIInfo in DoAllocateNSIandNSSI()") + + //ServiceDecomposition serviceDecompositionObj = execution.getVariable("serviceDecompositionObj") + Map<String, Object> nssiMap=execution.getVariable("nssiMap") + List<String> nsstSequence = execution.getVariable("nsstSequence") + String currentNSST= nsstSequence.get(execution.getVariable("currentNssiIndex")) + boolean isNSSIOptionAvailable = false + String nsstInput=nssiMap.get(currentNSST) + execution.setVariable("nsstInput",nsstInput) + String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid") + String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId") + String nssiserviceModelInfo = """{ + "modelInvariantUuid":"", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + Integer currentIndex = execution.getVariable("currentNssiIndex") + currentIndex=currentIndex+1; + execution.setVariable("currentNssiIndex",currentIndex) + execution.setVariable("nssiserviceModelInfo",nssiserviceModelInfo) + execution.setVariable("nssiInstanceId",nssiInstanceId) + logger.trace("Exit getOneNSSIInfo in DoAllocateNSIandNSSI()") + } + + void updateCurrentIndex(DelegateExecution execution){ + + logger.trace("Enter updateCurrentIndex in DoAllocateNSIandNSSI()") + Integer currentIndex = execution.getVariable("currentNssiIndex") + Integer maxIndex = execution.getVariable("maxIndex") + if(currentIndex>=maxIndex) + { + Boolean isMoreNSSI=false + execution.setVariable("isMoreNSSI",isMoreNSSI) + } + logger.trace("Exit updateCurrentIndex in DoAllocateNSIandNSSI()") + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy new file mode 100644 index 0000000000..d786cb0ba1 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy @@ -0,0 +1,771 @@ +package org.onap.so.bpmn.infrastructure.scripts + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.aai.domain.yang.SliceProfile +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.beans.nsmf.AllocateAnNssi +import org.onap.so.beans.nsmf.AllocateCnNssi +import org.onap.so.beans.nsmf.AllocateTnNssi +import org.onap.so.beans.nsmf.AnSliceProfile +import org.onap.so.beans.nsmf.CnSliceProfile +import org.onap.so.beans.nsmf.EsrInfo +import org.onap.so.beans.nsmf.JobStatusRequest +import org.onap.so.beans.nsmf.NetworkType +import org.onap.so.beans.nsmf.NsiInfo +import org.onap.so.beans.nsmf.NssiAllocateRequest +import org.onap.so.beans.nsmf.PerfReq +import org.onap.so.beans.nsmf.PerfReqEmbbList +import org.onap.so.beans.nsmf.PerfReqUrllcList +import org.onap.so.beans.nsmf.ResourceSharingLevel +import org.onap.so.beans.nsmf.ServiceProfile +import org.onap.so.beans.nsmf.SliceTaskParams +import org.onap.so.beans.nsmf.TnSliceProfile +import org.onap.so.beans.nsmf.UeMobilityLevel +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIEdgeLabel +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import com.fasterxml.jackson.databind.ObjectMapper; +import javax.ws.rs.core.Response + +import static org.apache.commons.lang3.StringUtils.isBlank + + +class DoAllocateNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{ + + private static final Logger logger = LoggerFactory.getLogger( DoAllocateNSSI.class); + private static final ObjectMapper MAPPER = new ObjectMapper(); + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + void preProcessRequest (DelegateExecution execution) { + logger.trace("Enter preProcessRequest()") + String msg = "" + String nssmfOperation = "" + String msoRequestId = execution.getVariable("msoRequestId") + String nsstInput = execution.getVariable("nsstInput") + String modelUuid = jsonUtil.getJsonValue(nsstInput, "modelUuid") + //modelUuid="2763777c-27bd-4df7-93b8-c690e23f4d3f" + String nssiInstanceId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId") + String serviceModelInfo = """{ + "modelInvariantUuid":"", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo",serviceModelInfo) + execution.setVariable("nssiInstanceId",nssiInstanceId) + String nssiProfileID = UUID.randomUUID().toString() + execution.setVariable("nssiProfileID",nssiProfileID) + if(isBlank(nssiInstanceId)) + { + nssmfOperation="create" + nssiInstanceId = UUID.randomUUID().toString() + }else { + nssmfOperation = "update" + } + execution.setVariable("nssmfOperation",nssmfOperation) + execution.setVariable("nssiInstanceId",nssiInstanceId) + + def isDebugLogEnabled ="false" + def isNSSICreated = false + execution.setVariable("isNSSICreated",isNSSICreated) + + int currentCycle = 0 + execution.setVariable("currentCycle", currentCycle) + + logger.trace("Exit preProcessRequest") + } + + + void getNSSTInfo(DelegateExecution execution){ + logger.trace("Enter getNSSTInfo in DoAllocateNSSI()") + ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") + ModelInfo modelInfo = serviceDecomposition.getModelInfo() + String serviceRole = "nssi" + String nssiServiceInvariantUuid = serviceDecomposition.modelInfo.getModelInvariantUuid() + String nssiServiceUuid = serviceDecomposition.modelInfo.getModelUuid() + String nssiServiceType = serviceDecomposition.getServiceType() + String uuiRequest = execution.getVariable("uuiRequest") + String nssiServiceName = "nssi_"+jsonUtil.getJsonValue(uuiRequest, "service.name") + execution.setVariable("nssiServiceName",nssiServiceName) + execution.setVariable("nssiServiceType",nssiServiceType) + execution.setVariable("nssiServiceInvariantUuid",nssiServiceInvariantUuid) + execution.setVariable("nssiServiceUuid",nssiServiceUuid) + execution.setVariable("serviceRole",serviceRole) + + String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent() + String nsstID = jsonUtil.getJsonValue(content, "metadata.id") + String nsstVendor = jsonUtil.getJsonValue(content, "metadata.vendor") + String nsstDomain = jsonUtil.getJsonValue(content, "metadata.domainType") + String nsstType = jsonUtil.getJsonValue(content, "metadata.type") + + execution.setVariable("nsstID",nsstID) + execution.setVariable("nsstVendor",nsstVendor) + execution.setVariable("nsstDomain",nsstDomain) + execution.setVariable("nssiServiceUuid",nssiServiceUuid) + execution.setVariable("nsstType",nsstType) + + String nsstContentInfo = """{ + "NsstID":"${nsstID}", + "Vendor":"${nsstVendor}", + "type":"${nsstType}" + }""" + + logger.trace("Exit getNSSTInfo in DoAllocateNSSI()") + } + + void timeDelay(DelegateExecution execution) { + logger.trace("Enter timeDelay in DoAllocateNSSI()") + try { + Thread.sleep(60000); + int currentCycle = execution.getVariable("currentCycle") + 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 sendUpdateRequestNSSMF(DelegateExecution execution) { + logger.trace("Enter sendUpdateRequestNSSMF in DoAllocateNSSI()") + String urlString = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution) + logger.debug( "get NSSMF: " + urlString) + + //Prepare auth for NSSMF - Begin + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.nssmf.auth", execution) + String domain = execution.getVariable("nsstDomain") + String nssmfRequest = buildUpdateNSSMFRequest(execution, domain.toUpperCase()) + + //send request to update NSSI option - Begin + URL url = new URL(urlString+"/api/rest/provMns/v1/NSS/SliceProfiles") + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) + Response httpResponse = httpClient.post(nssmfRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("NSSMF sync response code is: " + responseCode) + + if(responseCode < 199 && responseCode > 299){ + String nssmfResponse ="NSSMF response have nobody" + if(httpResponse.hasEntity()) + nssmfResponse = httpResponse.readEntity(String.class) + logger.trace("received error message from NSSMF : "+nssmfResponse) + logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()") + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + + if(httpResponse.hasEntity()){ + String nssmfResponse = httpResponse.readEntity(String.class) + execution.setVariable("nssmfResponse", nssmfResponse) + String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId") + String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId") + execution.setVariable("nssiId",nssiId) + execution.setVariable("jobId",jobId) + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + logger.trace("Exit sendUpdateRequestNSSMF in DoAllocateNSSI()") + } + + void sendCreateRequestNSSMF(DelegateExecution execution) { + logger.trace("Enter sendCreateRequestNSSMF in DoAllocateNSSI()") + String urlString = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution) + logger.debug( "get NSSMF: " + urlString) + + //Prepare auth for NSSMF - Begin + String domain = execution.getVariable("nsstDomain") + String nssmfRequest = buildCreateNSSMFRequest(execution, domain.toUpperCase()) + + //send request to get NSI option - Begin + URL url = new URL(urlString+"/api/rest/provMns/v1/NSS/SliceProfiles") + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) + Response httpResponse = httpClient.post(nssmfRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("NSSMF sync response code is: " + responseCode) + + if(responseCode < 199 || responseCode > 299 ){ + String nssmfResponse ="NSSMF response have nobody" + if(httpResponse.hasEntity()) + nssmfResponse = httpResponse.readEntity(String.class) + logger.trace("received error message from NSSMF : "+nssmfResponse) + logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()") + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + + if(httpResponse.hasEntity()){ + String nssmfResponse = httpResponse.readEntity(String.class) + execution.setVariable("nssmfResponse", nssmfResponse) + String nssiId = jsonUtil.getJsonValue(nssmfResponse, "nssiId") + String jobId = jsonUtil.getJsonValue(nssmfResponse, "jobId") + execution.setVariable("nssiId",nssiId) + execution.setVariable("jobId",jobId) + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()") + + } + + void getNSSMFProgresss(DelegateExecution execution) { + logger.trace("Enter getNSSMFProgresss in DoAllocateNSSI()") + + String endpoint = UrnPropertiesReader.getVariable("mso.adapters.nssmf.endpoint", execution) + logger.debug( "get NSSMF: " + endpoint) + + //Prepare auth for NSSMF - Begin + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.nssmf.auth", execution) + + String nssmfRequest = buildNSSMFProgressRequest(execution) + String strUrl="/api/rest/provMns/v1/NSS/jobs/"+execution.getVariable("jobId") + //send request to update NSSI option - Begin + URL url = new URL(endpoint+strUrl) + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.EXTERNAL) + Response httpResponse = httpClient.post(nssmfRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("NSSMF sync response code is: " + responseCode) + + if(responseCode < 199 || responseCode > 299){ + String nssmfResponse ="NSSMF response have nobody" + if(httpResponse.hasEntity()) + nssmfResponse = httpResponse.readEntity(String.class) + logger.trace("received error message from NSSMF : "+nssmfResponse) + logger.trace("Exit sendCreateRequestNSSMF in DoAllocateNSSI()") + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + + if(httpResponse.hasEntity()){ + String nssmfResponse = httpResponse.readEntity(String.class) + Boolean isNSSICreated = false + execution.setVariable("nssmfResponse", nssmfResponse) + Integer progress = java.lang.Integer.parseInt(jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.progress")) + String status = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.status") + String statusDescription = jsonUtil.getJsonValue(nssmfResponse, "responseDescriptor.statusDescription") + execution.setVariable("nssmfProgress",progress) + execution.setVariable("nssmfStatus",status) + execution.setVariable("nddmfStatusDescription",statusDescription) + if(progress>99) + isNSSICreated = true + execution.setVariable("isNSSICreated",isNSSICreated) + + }else{ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from NSSMF.") + } + logger.trace("Exit getNSSMFProgresss in DoAllocateNSSI()") + + } + + void updateRelationship(DelegateExecution execution) { + logger.trace("Enter updateRelationship in DoAllocateNSSI()") + String nssiInstanceId = execution.getVariable("nssiInstanceId") + String nsiInstanceId = execution.getVariable("nsiServiceInstanceId") + try{ + AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nsiInstanceId); + AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId) + getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF); + }catch(Exception ex) { + String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Exit updateRelationship in DoAllocateNSSI()") + } + + + void instantiateNSSIService(DelegateExecution execution) { + logger.trace("Enter instantiateNSSIService in DoAllocateNSSI()") + //String nssiInstanceId = execution.getVariable("nssiInstanceId") + String nssiInstanceId = execution.getVariable("nssiId") + execution.setVariable("nssiInstanceId",nssiInstanceId) + String sliceInstanceId = execution.getVariable("nsiServiceInstanceId") + try { + org.onap.aai.domain.yang.ServiceInstance nssi = new ServiceInstance(); + Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile") + + nssi.setServiceInstanceId(nssiInstanceId) + nssi.setServiceInstanceName(execution.getVariable("nssiServiceName")) + //nssi.setServiceType(execution.getVariable("nssiServiceType")) + nssi.setServiceType(serviceProfileMap.get("sST").toString()) + String serviceStatus = "deactivated" + nssi.setOrchestrationStatus(serviceStatus) + String modelInvariantUuid = execution.getVariable("nssiServiceInvariantUuid") + String modelUuid = execution.getVariable("nssiServiceUuid") + nssi.setModelInvariantId(modelInvariantUuid) + nssi.setModelVersionId(modelUuid) + String uuiRequest = execution.getVariable("uuiRequest") + String serviceInstanceLocationid = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.plmnIdList") + nssi.setServiceInstanceLocationId(serviceInstanceLocationid) + //String snssai = jsonUtil.getJsonValue(uuiRequest, "service.parameters.requestInputs.sNSSAI") + String envContext=execution.getVariable("nsstDomain") + nssi.setEnvironmentContext(envContext) + nssi.setServiceRole(execution.getVariable("serviceRole")) + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), nssiInstanceId) + client.create(uri, nssi) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + try{ + AAIResourceUri nsiServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, sliceInstanceId); + AAIResourceUri nssiServiceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, nssiInstanceId) + getAAIClient().connect(nsiServiceuri, nssiServiceUri, AAIEdgeLabel.COMPOSED_OF); + }catch(Exception ex) { + String msg = "Exception in DoAllocateNSSI InstantiateNSSI service while creating relationship " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + + + def rollbackData = execution.getVariable("RollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData(); + } + //rollbackData.put("SERVICEINSTANCE", "disableRollback", idisableRollback.toStrng()) + rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") + rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", nssiInstanceId) + rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + execution.setVariable("rollbackData", rollbackData) + execution.setVariable("RollbackData", rollbackData) + logger.debug("RollbackData:" + rollbackData) + logger.trace("Exit instantiateNSSIService in DoAllocateNSSI()") + } + + + void createSliceProfile(DelegateExecution execution) { + logger.trace("Enter createSliceProfile in DoAllocateNSSI()") + String sliceserviceInstanceId = execution.getVariable("nssiInstanceId") + String nssiProfileID = execution.getVariable("nssiProfileID") + Map<String, Object> sliceProfileMap = execution.getVariable("sliceProfileCn") + Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile") + SliceProfile sliceProfile = new SliceProfile() + sliceProfile.setServiceAreaDimension("") + sliceProfile.setPayloadSize(0) + sliceProfile.setJitter(0) + sliceProfile.setSurvivalTime(0) + //sliceProfile.setCsAvailability() + //sliceProfile.setReliability() + sliceProfile.setExpDataRate(0) + sliceProfile.setTrafficDensity(0) + sliceProfile.setConnDensity(0) + sliceProfile.setExpDataRateUL(Integer.parseInt(sliceProfileMap.get("expDataRateUL").toString())) + sliceProfile.setExpDataRateDL(Integer.parseInt(sliceProfileMap.get("expDataRateDL").toString())) + sliceProfile.setActivityFactor(Integer.parseInt(sliceProfileMap.get("activityFactor").toString())) + sliceProfile.setResourceSharingLevel(sliceProfileMap.get("activityFactor").toString()) + sliceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString()) + sliceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString()) + sliceProfile.setMaxNumberOfUEs(Integer.parseInt(sliceProfileMap.get("activityFactor").toString())) + sliceProfile.setLatency(Integer.parseInt(sliceProfileMap.get("latency").toString())) + sliceProfile.setProfileId(nssiProfileID) + sliceProfile.setE2ELatency(0) + + try { + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SLICE_PROFILE, + execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, nssiProfileID) + client.create(uri, sliceProfile) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + def rollbackData = execution.getVariable("RollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData(); + } + //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) + rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") + rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", sliceserviceInstanceId) + rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("serviceType")) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + execution.setVariable("rollbackData", rollbackData) + execution.setVariable("RollbackData", rollbackData) + logger.debug("RollbackData:" + rollbackData) + logger.trace("Exit createSliceProfile in DoAllocateNSSI()") + } + + + String buildCreateNSSMFRequest(DelegateExecution execution, String domain) { + + NssiAllocateRequest request = new NssiAllocateRequest() + String strRequest = "" + //String uuiRequest = execution.getVariable("uuiRequest") + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + + switch (domain) { + case "AN": + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(execution.getVariable("networkType")) + esrInfo.setVendor(execution.getVariable("nsstVendor")) + + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) + nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) + + AnSliceProfile anSliceProfile = new AnSliceProfile() + anSliceProfile.setLatency(execution.getVariable("latency")) + anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList")) + anSliceProfile.setQi(execution.getVariable("qi")) + + AllocateAnNssi allocateAnNssi = new AllocateAnNssi() + allocateAnNssi.setNsstId(execution.getVariable("nsstId")) + allocateAnNssi.setNssiName(execution.getVariable("nssiName")) + allocateAnNssi.setNsiInfo(nsiInfo) + allocateAnNssi.setSliceProfile(anSliceProfile) + String anScriptName = sliceTaskParams.getAnScriptName() + allocateAnNssi.setScriptName(anScriptName) + + request.setAllocateAnNssi(allocateAnNssi) + request.setEsrInfo(esrInfo) + break; + case "CN": + Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId")) + nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName")) + + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(NetworkType.fromString(domain)) + esrInfo.setVendor(execution.getVariable("nsstVendor")) + execution.setVariable("esrInfo",esrInfo) + + + PerfReqEmbbList perfReqEmbb = new PerfReqEmbbList() + perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor")) + perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL")) + perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL")) + perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL")) + perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL")) + + List<PerfReqEmbbList> listPerfReqEmbbList = new ArrayList<>() + listPerfReqEmbbList.add(perfReqEmbb) + + PerfReq perfReq = new PerfReq() + perfReq.setPerfReqEmbbList(listPerfReqEmbbList) + + PerfReqUrllcList perfReqUrllc = new PerfReqUrllcList() + perfReqUrllc.setConnDensity(0) + perfReqUrllc.setTrafficDensity(0) + perfReqUrllc.setExpDataRate(0) + perfReqUrllc.setReliability(0) + perfReqUrllc.setCsAvailability(0) + perfReqUrllc.setSurvivalTime(0) + perfReqUrllc.setJitter(0) + perfReqUrllc.setE2eLatency(0) + perfReqUrllc.setPayloadSize("0") + perfReqUrllc.setServiceAreaDimension("") + + List<PerfReqUrllcList> perfReqUrllcList = new ArrayList<>() + perfReqUrllcList.add(perfReqUrllc) + perfReq.setPerfReqUrllcList(perfReqUrllcList) + + CnSliceProfile cnSliceProfile = new CnSliceProfile() + cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID")) + String plmnStr = serviceProfile.get("plmnIdList") + List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|")) + cnSliceProfile.setPlmnIdList(plmnIdList) + + String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString() + cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel)) + + String coverageArea = serviceProfile.get("coverageAreaTAList") + List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|")) + cnSliceProfile.setCoverageAreaTAList(coverageAreaList) + + String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString() + cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel)) + + int latency = serviceProfile.get("latency") + cnSliceProfile.setLatency(latency) + + int maxUE = serviceProfile.get("maxNumberofUEs") + cnSliceProfile.setMaxNumberofUEs(maxUE) + + String snssai = serviceProfile.get("sNSSAI") + List<String> snssaiList = Arrays.asList(snssai.split("\\|")) + cnSliceProfile.setSnssaiList(snssaiList) + + cnSliceProfile.setPerfReq(perfReq) + + AllocateCnNssi allocateCnNssi = new AllocateCnNssi() + allocateCnNssi.setNsstId(execution.getVariable("nsstid")) + allocateCnNssi.setNssiName(execution.getVariable("nssiName")) + allocateCnNssi.setSliceProfile(cnSliceProfile) + allocateCnNssi.setNsiInfo(nsiInfo) + String cnScriptName = sliceTaskParams.getCnScriptName() + allocateCnNssi.setScriptName(cnScriptName) + request.setAllocateCnNssi(allocateCnNssi) + request.setEsrInfo(esrInfo) + break; + case "TN": + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(execution.getVariable("networkType")) + esrInfo.setVendor(execution.getVariable("vendor")) + + TnSliceProfile tnSliceProfile = new TnSliceProfile() + tnSliceProfile.setLatency(execution.getVariable("latency")) + tnSliceProfile.setBandwidth(execution.getVariable("bandWidth")) + + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) + nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) + + AllocateTnNssi allocateTnNssi = new AllocateTnNssi() + allocateTnNssi.setSliceProfile(tnSliceProfile) + allocateTnNssi.setNsiInfo(nsiInfo) + allocateTnNssi.setNsstId(execution.getVariable("nsstid")) + String tnScriptName = sliceTaskParams.getTnScriptName() + allocateTnNssi.setScriptName(tnScriptName) + + request.setAllocateTnNssi(allocateTnNssi) + request.setEsrInfo(esrInfo) + break; + default: + break; + } + try { + strRequest = MAPPER.writeValueAsString(request); + } catch (IOException e) { + logger.error("Invalid get progress request bean to convert as string"); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string") + } + return strRequest + } + + + String buildUpdateNSSMFRequest(DelegateExecution execution, String domain) { + NssiAllocateRequest request = new NssiAllocateRequest() + String nsstInput = execution.getVariable("nsstInput") + String nssiId = jsonUtil.getJsonValue(nsstInput, "serviceInstanceId") + String strRequest = "" + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + switch (domain) { + case "AN": + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(execution.getVariable("nsstType")) + esrInfo.setVendor(execution.getVariable("vendor")) + + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) + nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) + + AnSliceProfile anSliceProfile = new AnSliceProfile() + anSliceProfile.setLatency(execution.getVariable("latency")) + anSliceProfile.setCoverageAreaTAList(execution.getVariable("coverageAreaList")) + anSliceProfile.setQi(execution.getVariable("qi")) + + AllocateAnNssi allocateAnNssi = new AllocateAnNssi() + allocateAnNssi.setNsstId(execution.getVariable("nsstId")) + allocateAnNssi.setNssiName(execution.getVariable("nssiName")) + allocateAnNssi.setNsiInfo(nsiInfo) + allocateAnNssi.setSliceProfile(anSliceProfile) + String anScriptName = sliceTaskParams.getAnScriptName() + allocateAnNssi.setScriptName(anScriptName) + request.setAllocateAnNssi(allocateAnNssi) + request.setEsrInfo(esrInfo) + break; + case "CN": + Map<String, Object> sliceProfileCn =execution.getVariable("sliceProfileCn") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiServiceInstanceId")) + nsiInfo.setNsiName(execution.getVariable("nsiServiceInstanceName")) + + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(NetworkType.fromString(domain)) + esrInfo.setVendor(execution.getVariable("nsstVendor")) + execution.setVariable("esrInfo",esrInfo) + + + PerfReqEmbbList perfReqEmbb = new PerfReqEmbbList() + perfReqEmbb.setActivityFactor(sliceProfileCn.get("activityFactor")) + perfReqEmbb.setAreaTrafficCapDL(sliceProfileCn.get("areaTrafficCapDL")) + perfReqEmbb.setAreaTrafficCapUL(sliceProfileCn.get("areaTrafficCapUL")) + perfReqEmbb.setExpDataRateDL(sliceProfileCn.get("expDataRateDL")) + perfReqEmbb.setExpDataRateUL(sliceProfileCn.get("expDataRateUL")) + + List<PerfReqEmbbList> listPerfReqEmbbList = new ArrayList<>() + listPerfReqEmbbList.add(perfReqEmbb) + + PerfReq perfReq = new PerfReq() + perfReq.setPerfReqEmbbList(listPerfReqEmbbList) + + PerfReqUrllcList perfReqUrllc = new PerfReqUrllcList() + perfReqUrllc.setConnDensity(0) + perfReqUrllc.setTrafficDensity(0) + perfReqUrllc.setExpDataRate(0) + perfReqUrllc.setReliability(0) + perfReqUrllc.setCsAvailability(0) + perfReqUrllc.setSurvivalTime(0) + perfReqUrllc.setJitter(0) + perfReqUrllc.setE2eLatency(0) + perfReqUrllc.setPayloadSize("0") + perfReqUrllc.setServiceAreaDimension("") + + List<PerfReqUrllcList> perfReqUrllcList = new ArrayList<>() + perfReqUrllcList.add(perfReqUrllc) + perfReq.setPerfReqUrllcList(perfReqUrllcList) + + CnSliceProfile cnSliceProfile = new CnSliceProfile() + cnSliceProfile.setSliceProfileId(execution.getVariable("nssiProfileID")) + String plmnStr = serviceProfile.get("plmnIdList") + List<String> plmnIdList=Arrays.asList(plmnStr.split("\\|")) + cnSliceProfile.setPlmnIdList(plmnIdList) + + String resourceSharingLevel = serviceProfile.get("resourceSharingLevel").toString() + cnSliceProfile.setResourceSharingLevel(ResourceSharingLevel.fromString(resourceSharingLevel)) + + String coverageArea = serviceProfile.get("coverageAreaTAList") + List<String> coverageAreaList=Arrays.asList(coverageArea.split("\\|")) + cnSliceProfile.setCoverageAreaTAList(coverageAreaList) + + String ueMobilityLevel = serviceProfile.get("uEMobilityLevel").toString() + cnSliceProfile.setUeMobilityLevel(UeMobilityLevel.fromString(ueMobilityLevel)) + + int latency = serviceProfile.get("latency") + cnSliceProfile.setLatency(latency) + + int maxUE = serviceProfile.get("maxNumberofUEs") + cnSliceProfile.setMaxNumberofUEs(maxUE) + + String snssai = serviceProfile.get("sNSSAI") + List<String> snssaiList = Arrays.asList(snssai.split("\\|")) + cnSliceProfile.setSnssaiList(snssaiList) + + cnSliceProfile.setPerfReq(perfReq) + + AllocateCnNssi allocateCnNssi = new AllocateCnNssi() + allocateCnNssi.setNsstId(execution.getVariable("nsstid")) + allocateCnNssi.setNssiName(execution.getVariable("nssiName")) + allocateCnNssi.setSliceProfile(cnSliceProfile) + allocateCnNssi.setNsiInfo(nsiInfo) + allocateCnNssi.setNssiId(nssiId) // need to check this + String cnScriptName = sliceTaskParams.getCnScriptName() + allocateCnNssi.setScriptName(cnScriptName) + request.setAllocateCnNssi(allocateCnNssi) + request.setEsrInfo(esrInfo) + break; + case "TN": + EsrInfo esrInfo = new EsrInfo() + esrInfo.setNetworkType(execution.getVariable("networkType")) + esrInfo.setVendor(execution.getVariable("vendor")) + + TnSliceProfile tnSliceProfile = new TnSliceProfile() + tnSliceProfile.setLatency(execution.getVariable("latency")) + tnSliceProfile.setBandwidth(execution.getVariable("bandWidth")) + + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.setNsiId(execution.getVariable("nsiInstanceID")) + nsiInfo.setNsiName(execution.getVariable("nsiInstanceName")) + + AllocateTnNssi allocateTnNssi = new AllocateTnNssi() + allocateTnNssi.setSliceProfile(tnSliceProfile) + allocateTnNssi.setNsiInfo(nsiInfo) + allocateTnNssi.setNsstId(execution.getVariable("nsstid")) + String tnScriptName = sliceTaskParams.getTnScriptName() + allocateTnNssi.setScriptName(tnScriptName) + request.setAllocateTnNssi(allocateTnNssi) + request.setEsrInfo(esrInfo) + break; + default: + break; + } + try { + strRequest = MAPPER.writeValueAsString(request); + } catch (IOException e) { + logger.error("Invalid get progress request bean to convert as string"); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string") + } + return strRequest + } + + String buildNSSMFProgressRequest(DelegateExecution execution){ + JobStatusRequest request = new JobStatusRequest() + String strRequest = "" + EsrInfo esrInfo = execution.getVariable("esrInfo") + request.setNsiId(execution.getVariable("nsiServiceInstanceId")) + request.setNssiId(execution.getVariable("nssiId")) + request.setEsrInfo(esrInfo) + + try { + strRequest = MAPPER.writeValueAsString(request); + } catch (IOException e) { + logger.error("Invalid get progress request bean to convert as string"); + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Invalid get progress request bean to convert as string") + } + return strRequest + } + + public void prepareUpdateOrchestrationTask(DelegateExecution execution) { + logger.debug("Start prepareUpdateOrchestrationTask progress") + String requestMethod = "PUT" + String progress = execution.getVariable("nssmfProgress") + String status = execution.getVariable("nssmfStatus") + String statusDescription=execution.getVariable("nddmfStatusDescription") + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + String domain = execution.getVariable("nsstDomain") + switch (domain.toUpperCase()) { + case "AN": + sliceTaskParams.setAnProgress(progress) + sliceTaskParams.setAnStatus(status) + sliceTaskParams.setAnStatusDescription(statusDescription) + break; + case "CN": + sliceTaskParams.setCnProgress(progress) + sliceTaskParams.setCnStatus(status) + sliceTaskParams.setCnStatusDescription(statusDescription) + break; + case "TN": + sliceTaskParams.setTnProgress(progress) + sliceTaskParams.setTnStatus(status) + sliceTaskParams.setTnStatusDescription(statusDescription) + break; + default: + break; + } + String paramJson = sliceTaskParams.convertToJson() + execution.setVariable("CSSOT_paramJson", paramJson) + execution.setVariable("CSSOT_requestMethod", requestMethod) + logger.debug("Finish prepareUpdateOrchestrationTask progress") + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy new file mode 100644 index 0000000000..fb4bd158b7 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationService.groovy @@ -0,0 +1,210 @@ +/*- + * ============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 org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.CommunicationServiceProfile +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.slf4j.Logger +import org.slf4j.LoggerFactory + +import static org.apache.commons.lang3.StringUtils.isBlank + +/** + * This groovy class supports the <class>DoCreateCommunicationService.bpmn</class> process. + * AlaCarte flow for 1702 ServiceInstance Create + * + */ +class DoCreateCommunicationService extends AbstractServiceTaskProcessor{ + String Prefix="DCCS_" + ExceptionUtil exceptionUtil = new ExceptionUtil() + JsonUtils jsonUtil = new JsonUtils() + AAIResourcesClient client = new AAIResourcesClient() + + private static final Logger logger = LoggerFactory.getLogger( DoCreateCommunicationService.class) + + @Override + void preProcessRequest(DelegateExecution execution) { + logger.trace("start preProcessRequest") + execution.setVariable("prefix", Prefix) + String msg = "" + try { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + if (isBlank(serviceInstanceId)) { + msg = "Input serviceInstanceId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String globalSubscriberId = execution.getVariable("globalSubscriberId") + if (isBlank(globalSubscriberId)) { + msg = "Input globalSubscriberId' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + if (isBlank(subscriptionServiceType)) { + msg = "Input subscriptionServiceType' is null" + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) + } + + + } catch(BpmnError e) { + throw e + } catch(Exception ex) { + msg = "Exception in preProcessRequest " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("Exit preProcessRequest") + } + + /** + * create communication service, generate S-NSSAI Id and communication service profile + * 1.create communication service profile + * + */ + def createCommunicationServiceProfile = { DelegateExecution execution -> + logger.trace("createCSandServiceProfile") + String msg = "" + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + try { + // String sNSSAI_id = execution.getVariable("sNSSAI_id") + // create communication service profile + String profileId = UUID.randomUUID().toString() + execution.setVariable("communicationProfileId", profileId) + + def csInputMap = execution.getVariable("csInputMap") as Map<String, ?> + Integer latency = csInputMap.get("latency") as Integer + Integer maxNumberOfUEs = csInputMap.get("maxNumberofUEs") as Integer + Integer expDataRateDL = csInputMap.get("expDataRateDL") as Integer + Integer expDataRateUL = csInputMap.get("expDataRateUL") as Integer + String coverageArea = csInputMap.get("coverageAreaTAList") + String uEMobilityLevel = csInputMap.get("uEMobilityLevel") + String resourceSharingLevel = csInputMap.get("resourceSharingLevel") + + CommunicationServiceProfile csp = new CommunicationServiceProfile() + csp.setProfileId(profileId) + + csp.setLatency(latency) + csp.setMaxNumberOfUEs(maxNumberOfUEs) + csp.setUeMobilityLevel(uEMobilityLevel) + csp.setResourceSharingLevel(resourceSharingLevel) + csp.setExpDataRateDL(expDataRateDL) + csp.setExpDataRateUL(expDataRateUL) + csp.setCoverageAreaList(coverageArea) + + execution.setVariable("communicationServiceInstanceProfile", csp) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.COMMUNICATION_SERVICE_PROFILE, + globalSubscriberId, + subscriptionServiceType, + serviceInstanceId, + profileId + ) + client.create(uri, csp) + + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in createCSandServiceProfile " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("exit createCSandServiceProfile") + } + + + /** + * create communication service, generate S-NSSAI Id + * 1.generate S-NSSAI Id + * 2.create communication service + * + */ + def createCommunicationService = { DelegateExecution execution -> + logger.trace("create communication service") + String msg + String serviceInstanceId = execution.getVariable("serviceInstanceId") + try { + //generate S-NSSAI Id and communication service profile + String sNSSAI_id = generateNSSAI(serviceInstanceId) + + execution.setVariable("sNSSAI_id", sNSSAI_id) + // 创建service + String serviceInstanceName = execution.getVariable("serviceInstanceName") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + String csServiceType = execution.getVariable("csServiceType") + String aaiServiceRole = "communication-service" //待确定 + + String oStatus = "processing" + String uuiRequest = execution.getVariable("uuiRequest") + String modelInvariantUuid = execution.getVariable("modelInvariantUuid") + String modelUuid = execution.getVariable("modelUuid") + String useInterval = execution.getVariable("useInterval") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + + // create service + ServiceInstance csi = new ServiceInstance() + csi.setServiceInstanceName(serviceInstanceName) + csi.setServiceType(csServiceType) + csi.setServiceRole(aaiServiceRole) + csi.setOrchestrationStatus(oStatus) + csi.setModelInvariantId(modelInvariantUuid) + csi.setModelVersionId(modelUuid) + csi.setInputParameters(uuiRequest) + csi.setWorkloadContext(useInterval) + csi.setEnvironmentContext(sNSSAI_id) + + //timestamp format YYYY-MM-DD hh:mm:ss + csi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) + + execution.setVariable("communicationServiceInstance", csi) + + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, subscriptionServiceType, serviceInstanceId) + client.create(uri, csi) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in communication service " + ex.getMessage() + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.trace("exit communication service") + } + + private static generateNSSAI = { final String instanceId -> + int h, res + res = (instanceId == null) ? 0 : (h = instanceId.hashCode()) ^ (h >>> 16) + res = res >>> 1 + return "01-" + Integer.toHexString(res).toUpperCase() + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy new file mode 100644 index 0000000000..ae239d9e68 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy @@ -0,0 +1,232 @@ +package org.onap.so.bpmn.infrastructure.scripts + + +import org.onap.so.bpmn.core.domain.AllottedResource +import org.onap.aai.domain.yang.AllottedResource + +import static org.apache.commons.lang3.StringUtils.*; + +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.OwningEntity +import org.onap.aai.domain.yang.ServiceProfile; +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.CatalogDbUtils +import org.onap.so.bpmn.common.scripts.CatalogDbUtilsFactory +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.core.RollbackData +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInstance +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.aai.groovyflows.AAICreateResources +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.slf4j.Logger +import org.slf4j.LoggerFactory + + + +class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ + + private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceInstance.class); + JsonUtils jsonUtil = new JsonUtils() + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + CatalogDbUtils catalogDbUtils = new CatalogDbUtilsFactory().create() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + void preProcessRequest (DelegateExecution execution) { + String msg = "" + logger.trace("Enter preProcessRequest()") + //Need update + //1. Prepare service parameter. + //2. Prepare slice profile parameters. + + String sliceserviceInstanceId = execution.getVariable("serviceInstanceId") + String allottedResourceId = UUID.randomUUID().toString() + execution.setVariable("sliceserviceInstanceId", sliceserviceInstanceId) + execution.setVariable("allottedResourceId", allottedResourceId) + + String uuiRequest = execution.getVariable("uuiRequest") + String modelInvariantUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceInvariantUuid") + String modelUuid = jsonUtil.getJsonValue(uuiRequest, "service.serviceUuid") + //here modelVersion is not set, we use modelUuid to decompose the service. + def isDebugLogEnabled = true + execution.setVariable("serviceInstanceId",sliceserviceInstanceId) + execution.setVariable("isDebugLogEnabled",isDebugLogEnabled) + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + + logger.trace("Exit preProcessRequest") + } + + + void createServiceProfile(DelegateExecution execution) { + + String sliceserviceInstanceId = execution.getVariable("sliceserviceInstanceId") + Map<String, Object> serviceProfileMap = execution.getVariable("serviceProfile") + String serviceProfileID = UUID.randomUUID().toString() + ServiceProfile serviceProfile = new ServiceProfile(); + serviceProfile.setProfileId(serviceProfileID) + serviceProfile.setLatency(Integer.parseInt(serviceProfileMap.get("latency").toString())) + serviceProfile.setMaxNumberOfUEs(Integer.parseInt(serviceProfileMap.get("maxNumberofUEs").toString())) + serviceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString()) + serviceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString()) + serviceProfile.setResourceSharingLevel(serviceProfileMap.get("resourceSharingLevel").toString()) + serviceProfile.setExpDataRateUL(Integer.parseInt(serviceProfileMap.get("expDataRateUL").toString())) + serviceProfile.setExpDataRateDL(Integer.parseInt(serviceProfileMap.get("expDataRateDL").toString())) + serviceProfile.setAreaTrafficCapUL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapUL").toString())) + serviceProfile.setAreaTrafficCapDL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapDL").toString())) + serviceProfile.setActivityFactor(Integer.parseInt(serviceProfileMap.get("activityFactor").toString())) + + serviceProfile.setJitter(0) + serviceProfile.setSurvivalTime(0) + serviceProfile.setCsAvailability(new Object()) + serviceProfile.setReliability(new Object()) + serviceProfile.setExpDataRate(0) + serviceProfile.setTrafficDensity(0) + serviceProfile.setConnDensity(0) + try { + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_PROFILE, execution.getVariable("globalSubscriberId"), + execution.getVariable("subscriptionServiceType"), sliceserviceInstanceId, serviceProfileID) + client.create(uri, serviceProfile) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + void instantiateSliceService(DelegateExecution execution) { + + ServiceDecomposition serviceDecomposition= execution.getVariable("sliceServiceDecomposition") + String uuiRequest = execution.getVariable("uuiRequest") + ModelInfo modelInfo = serviceDecomposition.getModelInfo() + String serviceRole = "e2eslice-service" + String serviceType = execution.getVariable("serviceType") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + String ssInstanceId = execution.getVariable("serviceInstanceId") + try { + org.onap.aai.domain.yang.ServiceInstance ss = new org.onap.aai.domain.yang.ServiceInstance() + ss.setServiceInstanceId(ssInstanceId) + String sliceInstanceName = execution.getVariable("serviceInstanceName") + ss.setServiceInstanceName(sliceInstanceName) + ss.setServiceType(serviceType) + String serviceStatus = "deactivated" + ss.setOrchestrationStatus(serviceStatus) + String modelInvariantUuid = modelInfo.getModelInvariantUuid() + String modelUuid = modelInfo.getModelUuid() + ss.setModelInvariantId(modelInvariantUuid) + ss.setModelVersionId(modelUuid) + String serviceInstanceLocationid = serviceProfile.get("plmnIdList") + ss.setServiceInstanceLocationId(serviceInstanceLocationid) + String snssai = serviceProfile.get("sNSSAI") + ss.setEnvironmentContext(snssai) + ss.setServiceRole(serviceRole) + AAIResourcesClient client = new AAIResourcesClient() + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), ssInstanceId) + client.create(uri, ss) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + + def rollbackData = execution.getVariable("RollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData(); + } + //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) + rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") + rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", ssInstanceId) + rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + execution.setVariable("rollbackData", rollbackData) + execution.setVariable("RollbackData", rollbackData) + logger.debug("RollbackData:" + rollbackData) + + } + + + void createAllottedResource(DelegateExecution execution) { + String serviceInstanceId = execution.getVariable('sliceserviceInstanceId') + + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri ssServiceuri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, serviceInstanceId) + +// try { +// +// if(resourceClient.exists(ssServiceuri)){ +// execution.setVariable("ssi_resourceLink", uri.build().toString()) +// }else{ +// exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " + +// "associate allotted resource for service :"+serviceInstanceId) +// } +// }catch(BpmnError e) { +// throw e; +// }catch (Exception ex){ +// String msg = "Exception in getServiceInstance. " + ex.getMessage() +// logger.debug(msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// } + + try { + String allottedResourceId = execution.getVariable("allottedResourceId") + ServiceDecomposition serviceDecomposition = execution.getVariable("sliceServiceDecomposition") + List<org.onap.so.bpmn.core.domain.AllottedResource> allottedResourceList = serviceDecomposition.getAllottedResources() + for(org.onap.so.bpmn.core.domain.AllottedResource allottedResource : allottedResourceList) + { + //AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceFromParentURI(ssServiceuri, AAIObjectType.ALLOTTED_RESOURCE, allottedResourceId) + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, + execution.getVariable("globalSubscriberId"),execution.getVariable("subscriptionServiceType"), + execution.getVariable("sliceserviceInstanceId"), allottedResourceId) + execution.setVariable("allottedResourceUri", allottedResourceUri) + String arType = allottedResource.getAllottedResourceType() + String arRole = allottedResource.getAllottedResourceRole() + String modelInvariantId = allottedResource.getModelInfo().getModelInvariantUuid() + String modelVersionId = allottedResource.getModelInfo().getModelUuid() + + org.onap.aai.domain.yang.AllottedResource resource = new org.onap.aai.domain.yang.AllottedResource() + resource.setId(allottedResourceId) + resource.setType(arType) + resource.setAllottedResourceName("Allotted_"+ execution.getVariable("serviceInstanceName")) + resource.setRole(arRole) + resource.setModelInvariantId(modelInvariantId) + resource.setModelVersionId(modelVersionId) + getAAIClient().create(allottedResourceUri, resource) + //AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceFromExistingURI(AAIObjectType.SERVICE_INSTANCE, UriBuilder.fromPath(ssServiceuri).build()) + //getAAIClient().connect(allottedResourceUri,ssServiceuri) + } + //execution.setVariable("aaiARPath", allottedResourceUri.build().toString()); + + }catch (Exception ex) { + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception in createAaiAR " + ex.getMessage()) + } + } + +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy new file mode 100644 index 0000000000..c66a89b9c6 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy @@ -0,0 +1,524 @@ +package org.onap.so.bpmn.infrastructure.scripts + +import com.fasterxml.jackson.core.type.TypeReference +import groovy.json.JsonBuilder +import groovy.json.JsonSlurper +import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.Relationship +import org.onap.aai.domain.yang.RelationshipList +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.logging.filter.base.ONAPComponents +import org.onap.so.beans.nsmf.SliceTaskParams +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.scripts.OofUtils +import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceProxy +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.client.HttpClient +import org.onap.so.client.HttpClientFactory +import org.onap.so.client.aai.AAIObjectType +import org.onap.so.client.aai.AAIResourcesClient +import org.onap.so.client.aai.entities.AAIResultWrapper +import org.onap.so.client.aai.entities.uri.AAIResourceUri +import org.onap.so.client.aai.entities.uri.AAIUriFactory +import org.onap.so.db.request.client.RequestsDbClient +import org.onap.so.db.request.beans.OrchestrationTask +import org.slf4j.Logger +import org.slf4j.LoggerFactory +import javax.ws.rs.NotFoundException +import javax.ws.rs.core.Response + +import static org.apache.commons.lang3.StringUtils.isBlank + +public class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ + + private static final Logger logger = LoggerFactory.getLogger( DoCreateSliceServiceOption.class) + + + ExceptionUtil exceptionUtil = new ExceptionUtil() + + JsonUtils jsonUtil = new JsonUtils() + + RequestsDbClient requestsDbClient = new RequestsDbClient() + + OofUtils oofUtils = new OofUtils() + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + void preProcessRequest (DelegateExecution execution) { + String msg = "" + logger.trace("Enter preProcessRequest()") + String taskID = execution.getVariable("taskID") + Boolean isSharable = true + String resourceSharingLevel = execution.getVariable("resourceSharingLevel") + if (resourceSharingLevel.equals("shared")) + isSharable = true + execution.setVariable("isSharable",isSharable) + logger.trace("Exit preProcessRequest") + + } + + + void getNSIOptionfromOOF(DelegateExecution execution) { + + String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) + logger.debug( "get NSI option OOF Url: " + urlString) + boolean isNSISuggested = true + execution.setVariable("isNSISuggested",isNSISuggested) + String nsiInstanceId = "" + String nsiName = "" + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + //Prepare auth for OOF - Begin + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution) + String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) + + String basicAuthValue = utils.encrypt(basicAuth, msokey) + if (basicAuthValue != null) { + logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue) + try { + authHeader = utils.getBasicAuth(basicAuthValue, msokey) + execution.setVariable("BasicAuthHeaderValue", authHeader) + } catch (Exception ex) { + logger.debug( "Unable to encode username and password string: " + ex) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + + "encode username and password string") + } + } else { + logger.debug( "Unable to obtain BasicAuth - BasicAuth value null") + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + + "value null") + } + //Prepare auth for OOF - End + + String requestId = execution.getVariable("msoRequestId") + Map<String, Object> profileInfo = execution.getVariable("serviceProfile") + String nstModelUuid = execution.getVariable("nstModelUuid") + String nstModelInvariantUuid = execution.getVariable("nstModelInvariantUuid") + String nstInfo = """"NSTInfo" : { + "invariantUUID":"${nstModelInvariantUuid}", + "UUID":"${nstModelUuid}" + }""" + + String oofRequest = oofUtils.buildSelectNSIRequest(execution, requestId, nstInfo, profileInfo) + + //send request to get NSI option - Begin + URL url = new URL(urlString+"/api/oof/v1/selectnsi") + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF) + httpClient.addAdditionalHeader("Authorization", authHeader) + Response httpResponse = httpClient.post(oofRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("OOF sync response code is: " + responseCode) + + if(responseCode != 200){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + logger.debug("Info: No NSI suggested by OOF" ) + } + + if(httpResponse.hasEntity()){ + String OOFResponse = httpResponse.readEntity(String.class) + execution.setVariable("OOFResponse", OOFResponse) + int index = 0 //This needs to be changed to derive a value when we add policy to decide the solution options. + Map OOFResponseObject = new JsonSlurper().parseText(OOFResponse) + if(execution.getVariable("isSharable" ) == true && OOFResponseObject.get("solutions").containsKey("sharedNSIsolutions")) { + nsiInstanceId = OOFResponseObject.get("solutions").get("sharedNSIsolutions").get(0).get("NSISolution").NSIId + nsiName = OOFResponseObject.get("solutions").get("sharedNSIsolutions").get(0).get("NSISolution").NSIName + sliceTaskParams.setNstId(nsiInstanceId) + sliceTaskParams.setSuggestNsiName(nsiName) + execution.setVariable("nsiInstanceId",nsiInstanceId) + execution.setVariable("nsiName",nsiName) + }else { + if(OOFResponseObject.get("solutions").containsKey("newNSISolutions")) { + List NSSImap = OOFResponseObject.get("solutions").get("newNSISolutions").get(index).get("NSSISolutions") + for(Map nssi : NSSImap) { + String nssiName = nssi.get("NSSISolution").NSSIName + String nssiId = nssi.get("NSSISolution").NSSIId + String domain = nssi.get("NSSISolution").domain.toUpperCase() + switch (domain) { + case "AN": + sliceTaskParams.setAnSuggestNssiId(nssiId) + sliceTaskParams.setAnSuggestNssiName(nssiName) + break; + case "CN": + sliceTaskParams.setCnSuggestNssiId(nssiId) + sliceTaskParams.setCnSuggestNssiName(nssiName) + break; + case "TN": + sliceTaskParams.setTnSuggestNssiId(nssiId) + sliceTaskParams.setTnSuggestNssiName(nssiName) + break; + default: + break; + } + } + } + + } + execution.setVariable("sliceTaskParams", sliceTaskParams) + logger.debug("Info: No NSI suggested by OOF" ) + } + //send request to get NSI option - Begin + + + //send request to get NSI service Info - Begin + + /*** + * Need to check whether its needed. + */ +// logger.debug("Begin to query OOF suggetsed NSI from AAI ") +// if(isBlank(nsiInstanceId)){ +// isNSISuggested = false +// execution.setVariable("isNSISuggested",isNSISuggested) +// }else +// { +// try { +// String globalSubscriberId = execution.getVariable('globalSubscriberId') +// String serviceType = execution.getVariable('subscriptionServiceType') +// AAIResourcesClient resourceClient = new AAIResourcesClient() +// AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nsiInstanceId) +// AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) +// Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) +// org.onap.aai.domain.yang.ServiceInstance nsiServiceInstance = si.get() +// execution.setVariable("nsiServiceInstance",nsiServiceInstance) +// isNSISuggested = true +// execution.setVariable("isNSISuggested",isNSISuggested) +// SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") +// sliceTaskParams.setSuggestNsiId(nsiInstanceId) +// sliceTaskParams.setSuggestNsiName(si.get().getServiceInstanceName()) +// execution.setVariable("sliceTaskParams", sliceTaskParams) +// logger.debug("Info: NSI suggested by OOF exist in AAI ") +// }catch(BpmnError e) { +// throw e +// }catch(Exception ex) { +// String msg = "Internal Error in getServiceInstance: " + ex.getMessage() +// //exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) +// logger.debug("Info: NSI suggested by OOF doesnt exist in AAI " + nsiInstanceId) +// } +// } + //send request to get NSI service Info - End + //${OrchestrationTaskHandler.createOrchestrationTask(execution.getVariable("OrchestrationTask"))} + logger.debug( "*** Completed options Call to OOF ***") + + } + + + public void parseServiceProfile(DelegateExecution execution) { + logger.debug("Start parseServiceProfile") + String serviceType = execution.getVariable("serviceType") + Map<String, Object> serviceProfile = execution.getVariable("serviceProfile") + + // set sliceProfile for three domains + Map<String, Object> sliceProfileTn = getSliceProfile(serviceType, "TN", serviceProfile) + Map<String, Object> sliceProfileCn = getSliceProfile(serviceType, "CN", serviceProfile) + Map<String, Object> sliceProfileAn = getSliceProfile(serviceType, "AN", serviceProfile) + + execution.setVariable("sliceProfileTn", sliceProfileTn) + execution.setVariable("sliceProfileCn", sliceProfileCn) + execution.setVariable("sliceProfileAn", sliceProfileAn) + logger.debug("sliceProfileTn: " + sliceProfileTn) + logger.debug("sliceProfileCn: " + sliceProfileCn) + logger.debug("sliceProfileAn: " + sliceProfileAn) + + logger.debug("Finish parseServiceProfile") + } + + public Map getSliceProfile(String serviceType, String domain, Map<String, Object> serviceProfile) { + String variablePath = "nsmf." + serviceType + ".profileMap" + domain + String profileMapStr = UrnPropertiesReader.getVariable(variablePath) + logger.debug("Profile map for " + domain + " : " + profileMapStr) + Map<String, String> profileMaps = objectMapper.readValue(profileMapStr, new TypeReference<Map<String, String>>(){}) + Map<String, Object> sliceProfileTn = [:] + for (Map.Entry<String, String> profileMap : profileMaps) { + sliceProfileTn.put(profileMap.key, serviceProfile.get(profileMap.value)) + } + + return sliceProfileTn + } + + + void prepareNSSIList(DelegateExecution execution) + { + ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") + List<String> nssiAssociated = new ArrayList<>() + Map<String, String> nssimap = new HashMap<>() + String nsiInstanceId=execution.getVariable("nsiInstanceId") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("subscriptionServiceType") + + try { + + ServiceInstance si = execution.getVariable("nsiServiceInstance") + //List<Relationship> relationships = si.getRelationshipList().getRelationship().stream().filter(relation -> + // relation.getRelatedTo().equalsIgnoreCase("service-instance")) + RelationshipList relationshipList = si.getRelationshipList() + List<Relationship> relationships = relationshipList.getRelationship() + for(Relationship relationship in relationships) + { + if(relationship.getRelatedTo().equalsIgnoreCase("service-instance")) + { + String NSSIassociated = relationship.getRelatedLink().substring(relationship.getRelatedLink().lastIndexOf("/") + 1); + if(!NSSIassociated.equals(nsiInstanceId)) + nssiAssociated.add(NSSIassociated) + } + } + }catch(BpmnError e) { + throw e + }catch(Exception ex) { + String msg = "Internal Error in getServiceInstance: " + ex.getMessage() + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + Map<String, Object> params = execution.getVariable("params") + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + for(String nssiID in nssiAssociated) + { + try { + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiID) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) + org.onap.aai.domain.yang.ServiceInstance nssi = si.get() + + String domain = nssi.getEnvironmentContext().toString().toUpperCase() + switch (domain) { + case "AN": + sliceTaskParams.setAnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setAnSuggestNssiName(nssi.getServiceInstanceName()) + break; + case "CN": + sliceTaskParams.setCnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setCnSuggestNssiName(nssi.getServiceInstanceName()) + break; + case "TN": + sliceTaskParams.setTnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setTnSuggestNssiName(nssi.getServiceInstanceName()) + break; + default: + break; + } + }catch(NotFoundException e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiID) + }catch(Exception e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiID) + } + + } + String nstName = serviceDecomposition.getModelInfo().getModelName() + sliceTaskParams.setNstName(nstName) + String nstId = serviceDecomposition.getModelInfo().getModelUuid() + sliceTaskParams.setNstId(nstId) + execution.setVariable("sliceTaskParams",sliceTaskParams) + + } + + + void updateOptionsInDB(DelegateExecution execution) { + logger.debug("Updating options with default value since not sharable : Begin ") + String taskID = execution.getVariable("taskID") + String params = execution.getVariable("params") + logger.debug("Updating options with default value since not sharable : End ") + + } + + void prepareNSTDecompose(DelegateExecution execution) { + + String modelUuid = execution.getVariable("nstModelUuid") + String modelInvariantUuid = execution.getVariable("nstModelInvariantUuid") + + String serviceModelInfo = """{ + "modelInvariantUuid":"${modelInvariantUuid}", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + } + + void prepareNSSTDecompose(DelegateExecution execution) { + Boolean isMoreNSSTtoProcess = false + Integer maxNSST = execution.getVariable("maxNSST") + Integer currentNSST=execution.getVariable("currentNSST") + List<String> nsstModelUUIDList = new ArrayList<>() + nsstModelUUIDList = execution.getVariable("nsstModelUUIDList") + String modelUuid = nsstModelUUIDList.get(currentNSST) + String serviceModelInfo = """{ + "modelInvariantUuid":"", + "modelUuid":"${modelUuid}", + "modelVersion":"" + }""" + execution.setVariable("serviceModelInfo", serviceModelInfo) + currentNSST=currentNSST+1 + if(currentNSST<maxNSST) + isMoreNSSTtoProcess=true + execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess) + execution.setVariable("maxNSST",maxNSST) + execution.setVariable("currentNSST",currentNSST) + } + + + void updateStatusInDB(DelegateExecution execution) { + + String taskID = execution.getVariable("taskID") + //OrchestrationTask orchestrationTask = requestsDbClient.getNetworkSliceOption(taskID); + //orchestrationTask.setTaskStage("wait to confirm") + //requestsDbClient.updateNetworkSliceOption(orchestrationTask) + } + + void prepareNSSTlistfromNST(DelegateExecution execution) { + //Need to update this part from decomposition. + logger.trace("Enter prepareNSSTlistfromNST()") + Boolean isMoreNSSTtoProcess = false + ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + String nstName = serviceDecomposition.getModelInfo().getModelName() + sliceTaskParams.setNstName(nstName) + String nstId = serviceDecomposition.getModelInfo().getModelUuid() + sliceTaskParams.setNstId(nstId) + execution.setVariable("sliceTaskParams",sliceTaskParams) + + List<ServiceProxy> proxyList = serviceDecomposition.getServiceProxy() + List<String> nsstModelUUIDList = new ArrayList<>() + for(ServiceProxy serviceProxy:proxyList) + nsstModelUUIDList.add(serviceProxy.getSourceModelUuid()) + execution.setVariable("nsstModelUUIDList",nsstModelUUIDList) + Integer maxNSST = nsstModelUUIDList.size() + Integer currentNSST=0 + execution.setVariable("maxNSST",maxNSST) + execution.setVariable("currentNSST",currentNSST) + if(currentNSST<maxNSST) + isMoreNSSTtoProcess=true + execution.setVariable("isMoreNSSTtoProcess",isMoreNSSTtoProcess) + logger.trace("Exit prepareNSSTlistfromNST()") + + } + + + void getNSSTOption(DelegateExecution execution) { + ServiceDecomposition serviceDecomposition= execution.getVariable("serviceDecomposition") + String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String serviceType = execution.getVariable("subscriptionServiceType") + String nssiInstanceId ="" + String nssiName ="" + SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") + logger.debug( "get NSI option OOF Url: " + urlString) + boolean isNSISuggested = false + execution.setVariable("isNSISuggested",isNSISuggested) + + //Prepare auth for OOF - Begin + def authHeader = "" + String basicAuth = UrnPropertiesReader.getVariable("mso.oof.auth", execution) + String msokey = UrnPropertiesReader.getVariable("mso.msoKey", execution) + + String basicAuthValue = utils.encrypt(basicAuth, msokey) + if (basicAuthValue != null) { + logger.debug( "Obtained BasicAuth username and password for OOF: " + basicAuthValue) + try { + authHeader = utils.getBasicAuth(basicAuthValue, msokey) + execution.setVariable("BasicAuthHeaderValue", authHeader) + } catch (Exception ex) { + logger.debug( "Unable to encode username and password string: " + ex) + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - Unable to " + + "encode username and password string") + } + } else { + logger.debug( "Unable to obtain BasicAuth - BasicAuth value null") + exceptionUtil.buildAndThrowWorkflowException(execution, 401, "Internal Error - BasicAuth " + + "value null") + } + //Prepare auth for OOF - End + //Prepare send request to OOF - Begin + String requestId = execution.getVariable("msoRequestId") + Map<String, Object> profileInfo = execution.getVariable("serviceProfile") + String nsstModelInvariantUuid = serviceDecomposition.getModelInfo().getModelInvariantUuid() + String nsstModelUuid = serviceDecomposition.getModelInfo().getModelUuid() + String nsstInfo = """"NSSTInfo": { + "invariantUUID":"${nsstModelInvariantUuid}", + "UUID":"${nsstModelUuid}" + }""" + String oofRequest = oofUtils.buildSelectNSSIRequest(execution, requestId, nsstInfo ,profileInfo) + + + URL url = new URL(urlString+"/api/oof/v1/selectnssi") + HttpClient httpClient = new HttpClientFactory().newJsonClient(url, ONAPComponents.OOF) + httpClient.addAdditionalHeader("Authorization", authHeader) + Response httpResponse = httpClient.post(oofRequest) + + int responseCode = httpResponse.getStatus() + logger.debug("OOF sync response code is: " + responseCode) + + if(responseCode != 200){ + exceptionUtil.buildAndThrowWorkflowException(execution, responseCode, "Received a Bad Sync Response from OOF.") + } + + if(httpResponse.hasEntity()){ + String OOFResponse = httpResponse.readEntity(String.class) + execution.setVariable("OOFResponse", OOFResponse) + nssiInstanceId = jsonUtil.getJsonValue(OOFResponse, "NSSIIInfo.NSSIID") + nssiName = jsonUtil.getJsonValue(OOFResponse, "NSSIInfo.NSSIName") + execution.setVariable("nssiInstanceId",nssiInstanceId) + execution.setVariable("nssiName",nssiName) + } + if(isBlank(nssiInstanceId)){ + logger.debug( "There is no valid NSST suggested by OOF.") + }else + { + try { + AAIResourcesClient resourceClient = new AAIResourcesClient() + AAIResourceUri serviceInstanceUri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, globalSubscriberId, serviceType, nssiInstanceId) + AAIResultWrapper wrapper = resourceClient.get(serviceInstanceUri, NotFoundException.class) + Optional<org.onap.aai.domain.yang.ServiceInstance> si = wrapper.asBean(org.onap.aai.domain.yang.ServiceInstance.class) + org.onap.aai.domain.yang.ServiceInstance nssi = si.get() + + String domain = nssi.getEnvironmentContext().toString().toUpperCase() + switch (domain) { + case "AN": + sliceTaskParams.setAnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setAnSuggestNssiName(nssi.getServiceInstanceName()) + break; + case "CN": + sliceTaskParams.setCnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setCnSuggestNssiName(nssi.getServiceInstanceName()) + break; + case "TN": + sliceTaskParams.setTnSuggestNssiId(nssi.getServiceInstanceId()) + sliceTaskParams.setTnSuggestNssiName(nssi.getServiceInstanceName()) + break; + default: + break; + } + }catch(NotFoundException e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId) + }catch(Exception e) + { + logger.debug("NSSI Service Instance not found in AAI: " + nssiInstanceId) + } + } + + + //Prepare send request to OOF - End + +// String content = serviceDecomposition.getServiceInfo().getServiceArtifact().get(0).getContent() +// String nsstID = jsonUtil.getJsonValue(content, "metadata.id") +// String vendor = jsonUtil.getJsonValue(content, "metadata.vendor") +// String domain = jsonUtil.getJsonValue(content, "metadata.domainType") +// String type = jsonUtil.getJsonValue(content, "metadata.type") +// String nsstContentInfo = """{ +// "NsstID":"${nsstID}", +// "Vendor":"${vendor}", +// "type":"${type}" +// }""" + + logger.debug("Prepare NSSI option completed ") + } +} + diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy new file mode 100644 index 0000000000..3622cc0062 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationServiceTest.groovy @@ -0,0 +1,456 @@ +/*- + * ============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 org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.json.JSONObject +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.bpmn.core.domain.ModelInfo +import org.onap.so.bpmn.core.domain.ServiceDecomposition +import org.onap.so.bpmn.core.domain.ServiceInfo +import org.onap.so.bpmn.core.domain.ServiceProxy + +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.times +import static org.mockito.Mockito.when + +class CreateCommunicationServiceTest extends MsoGroovyTest { + + @Before + void init() throws IOException { + super.init("CreateCommunicationService") + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + void testPreProcessRequest() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("bpmnRequest")).thenReturn(""" + { + "requestDetails": { + "modelInfo": { + "modelInvariantId": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "modelType": "service", + "modelNameVersionId": "8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelName": "voLTE", + "modelVersion": "1.0", + "modelVersionId": "8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelUuid": "8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelInvariantUuid": "e75698d9-925a-4cdd-a6c0-edacbe6a0b51" + }, + "requestInfo": { + "source": "UUI", + "instanceName": "CSMFService", + "suppressRollback": true + }, + "subscriberInfo": { + "globalSubscriberId": "5GCustomer" + }, + "requestParameters": { + "subscriptionServiceType": "MOG", + "userParams": [{ + "ServiceInstanceName": "CSMFService", + "UUIRequest": "{\\r\\n \\ + "service\\":{\\r\\n \\"name\\":\\"CSMFService\\",\\r\\n + \\"description\\":\\"CSMFService\\",\\r\\n + \\"serviceInvariantUuid\\":\\"e75698d9-925a-4cdd-a6c0-edacbe6a0b51\\",\\r\\n + \\"serviceUuid\\":\\"8ee5926d-720b-4bb2-86f9-d20e921c143b\\",\\r\\n + \\"globalSubscriberId\\":\\"5GCustomer\\",\\r\\n + \\"serviceType\\":\\"5G\\",\\r\\n + \\"parameters\\":{\\r\\n + \\"requestInputs\\":{\\r\\n + \\"expDataRateDL\\":10,\\r\\n + \\"expDataRateUL\\":30,\\r\\n + \\"latency\\":20,\\r\\n + \\"maxNumberofUEs\\":300,\\r\\n + \\"uemobilityLevel\\":\\"stationary\\",\\r\\n + \\"resourceSharingLevel\\":\\"shared\\",\\r\\n + \\"coverageAreaList\\": \\"01001\\",\\r\\n + \\"useInterval\\":\\"3\\"\\r\\n + }\\r\\n + }\\r\\n }\\r\\n}\\r\\n" + }], + "aLaCarte": true, + "usePreload": true + } + }, + "serviceInstanceId": null, + "vnfInstanceId": null, + "networkInstanceId": null, + "volumeGroupInstanceId": null, + "vfModuleInstanceId": null, + "configurationId": null, + "instanceGroupId": null + }""".replaceAll("\\s+", "")) + when(mockExecution.getVariable("mso-request-id")).thenReturn("edb08d97-e0f9-4c71-840a-72080d7be42e") + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.preProcessRequest(mockExecution) + Mockito.verify(mockExecution, times(14)).setVariable(captor.capture() as String, captor.capture()) + List<ExecutionEntity> values = captor.getAllValues() + assertNotNull(values) + } + + @Test + void testPrepareInitOperationStatus() { + + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + + CreateCommunicationService communicationService = new CreateCommunicationService() + + communicationService.prepareInitOperationStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + assertNotNull(res) + } + + + @Test + void testSendSyncResponse() { + when(mockExecution.getVariable("operationId")).thenReturn("123456") + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.sendSyncResponse(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("sentSyncResponse"), captor.capture()) + def updateVolumeGroupRequest = captor.getValue() + assertEquals(updateVolumeGroupRequest, true) + } + + + @Test + void testPrepareDoComposeE2E() { + ServiceDecomposition serviceDecomposition = new ServiceDecomposition() + ServiceProxy serviceProxy = new ServiceProxy() + serviceProxy.setSourceModelUuid("f2f5967e-72d3-4c5c-b880-e214e71dba4e") + serviceDecomposition.setServiceProxy(Arrays.asList(serviceProxy)) + when(mockExecution.getVariable("csServiceDecomposition")).thenReturn(serviceDecomposition) + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.prepareDoComposeE2E(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("e2eServiceModelInfo"), captor.capture()) + String e2eServiceModelInfo = captor.getValue() + assertEquals(e2eServiceModelInfo.trim().replaceAll(" ", ""), + """{"modelUuid":"f2f5967e-72d3-4c5c-b880-e214e71dba4e"}""") + } + + @Test + void testParseCSParamsFromReq() { + mockData() + when(mockExecution.getVariable("csServiceModelInfo")).thenReturn(""" + { + "modelInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "modelName":"voLTE", + "modelNameVersionId":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelVersion":"1.0", + "modelVersionId":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "modelInvariantId":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "modelType":"service", + "modelUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b" + }""") + + ServiceDecomposition decomposition = new ServiceDecomposition() + decomposition.setServiceType("embb") + ServiceInfo serviceInfo = new ServiceInfo() + serviceInfo.setServiceProperties(""" + [{"name":"useInterval","type":"string","required":false}, + {"default":"39-00","name":"plmnIdList","type":"string","required":false}, + {"name":"maxNumberofUEs","type":"integer","required":false}, + {"name":"latency","type":"integer","required":false}, + {"name":"uEMobilityLevel","type":"string","required":false}, + {"name":"expDataRateUL","type":"integer","required":false}, + {"name":"expDataRateDL","type":"integer","required":false}, + {"name":"coverageAreaList","type":"string","required":false}, + {"name":"sNSSAI","type":"string","required":false}, + {"name":"resourceSharingLevel","type":"string","required":false}] + """) + decomposition.setServiceInfo(serviceInfo) + + when(mockExecution.getVariable("csServiceDecomposition")).thenReturn(decomposition) + + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.parseCSParamsFromReq(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("csInputMap"), captor.capture()) + def csInputMap = captor.getValue() + assertEquals(getExpectCsInputMap(), csInputMap) + + } + + private static Map<String, Object> getExpectCsInputMap() { + Map<String, Object> csInputMap = new HashMap<>() + csInputMap.put("expDataRateDL", 10) + csInputMap.put("expDataRateUL", 30) + csInputMap.put("latency", 20) + csInputMap.put("maxNumberofUEs", 300) + csInputMap.put("uEMobilityLevel", "stationary") + csInputMap.put("resourceSharingLevel", "shared") + csInputMap.put("coverageAreaTAList", "01001") + csInputMap.put("useInterval", "3") + csInputMap.put("coverageAreaList", null) + csInputMap.put("plmnIdList", "39-00") + csInputMap.put("sNSSAI", null) + return csInputMap + } + + @Test + void testGenerateE2EServiceProfile() { + ServiceDecomposition decomposition = new ServiceDecomposition() + decomposition.setServiceType("embb") + ServiceInfo serviceInfo = new ServiceInfo() + serviceInfo.setServiceProperties(""" + [{"name":"nstar0_allottedresource0_providing_service_uuid","type":"string","required":true}, + {"name":"areaTrafficCapDL","type":"integer","required":false}, + {"name":"maxNumberofUEs","type":"integer","required":false}, + {"name":"latency","type":"integer","required":false}, + {"name":"expDataRateUL","type":"integer","required":false}, + {"name":"sNSSAI","type":"string","required":false}, + {"name":"plmnIdList","type":"string","required":false}, + {"name":"sST","type":"integer","required":false}, + {"name":"areaTrafficCapUL","type":"integer","required":false}, + {"name":"uEMobilityLevel","type":"string","required":false}, + {"name":"expDataRateDL","type":"integer","required":false}, + {"name":"nstar0_allottedresource0_providing_service_invariant_uuid","type":"string","required":true}, + {"name":"coverageAreaTAList","type":"string","required":false}, + {"name":"activityFactor","type":"integer","required":false}, + {"name":"resourceSharingLevel","type":"string","required":false}] + """) + decomposition.setServiceInfo(serviceInfo) + + ModelInfo modelInfo = new ModelInfo() + modelInfo.setModelInvariantUuid("e75698d9-925a-4cdd-a6c0-edacbe6a0b51") + modelInfo.setModelUuid("8ee5926d-720b-4bb2-86f9-d20e921c143b") + decomposition.setModelInfo(modelInfo) + + when(mockExecution.getVariable("e2eServiceDecomposition")).thenReturn(decomposition) + when(mockExecution.getVariable("csInputMap")).thenReturn(getExpectCsInputMap()) + + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.generateE2EServiceProfile(mockExecution) + + Mockito.verify(mockExecution, times(1)).setVariable(eq("e2eInputMap"), captor.capture()) + def csInputMap = captor.getValue() + assertEquals(csInputMap, getExpectE2eInputMap()) + } + + private static Map<String, Object> getExpectE2eInputMap() { + Map<String, Object> e2eInputMap = new HashMap<>() + e2eInputMap.put("nstar0_allottedresource0_providing_service_uuid", null) + e2eInputMap.put("nstar0_allottedresource0_providing_service_invariant_uuid", null) + e2eInputMap.put("areaTrafficCapDL", 100) + e2eInputMap.put("areaTrafficCapUL", 100) + e2eInputMap.put("expDataRateDL", 10) + e2eInputMap.put("expDataRateUL", 30) + e2eInputMap.put("latency", 20) + e2eInputMap.put("maxNumberofUEs", 300) + e2eInputMap.put("uEMobilityLevel", "stationary") + e2eInputMap.put("resourceSharingLevel", "shared") + e2eInputMap.put("coverageAreaTAList", "01001") + e2eInputMap.put("sST", null) + e2eInputMap.put("activityFactor", 0) + e2eInputMap.put("plmnIdList", "39-00") + e2eInputMap.put("sNSSAI", null) + + return e2eInputMap + } + + @Test + void testPreRequestSend2NSMF() { + when(mockExecution.getVariable("e2eInputMap")).thenReturn(getExpectE2eInputMap()) + when(mockExecution.getVariable("csServiceName")).thenReturn("testName") + when(mockExecution.getVariable("modelUuid")).thenReturn("12345") + when(mockExecution.getVariable("e2eModelInvariantUuid")).thenReturn("54321") + when(mockExecution.getVariable("e2eModelUuid")).thenReturn("11111") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("test111") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5GConsumer") + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.preRequestSend2NSMF(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("CSMF_NSMFRequest"), captor.capture()) + String resultSuccess = captor.getValue() + + def expectMap = getExpectE2eInputMap() + expectMap.put("nstar0_allottedresource0_providing_service_uuid", null) + expectMap.put("nstar0_allottedresource0_providing_service_invariant_uuid", null) + + String expect = """ + { + "service":{ + "name": "testName", + "description": "e2eService of 12345", + "serviceInvariantUuid": "54321", + "serviceUuid": "11111", + "globalSubscriberId": "test111", + "serviceType": "5GConsumer", + "parameters":{ + "requestInputs": ${expectMap as JSONObject} + } + } + } + """ + assertEquals(expect.replaceAll("\\s+", ""), resultSuccess.replaceAll("\\s+", "")) + } + + @Test + void testProcessNSMFResponseSuccess() { + when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(202) + when(mockExecution.getVariable("CSMF_NSMFResponse")).thenReturn(""" + { + "service": { + "serviceId": "945063ff-1a01-4944-9232-8e7999e0d5e4", + "operationId": "e3819a23-3777-4172-a834-35ee78acf3f4" + } + } + """) + + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.processNSMFResponse(mockExecution) + Mockito.verify(mockExecution, times(3)).setVariable(captor.capture(), captor.capture()) + def resultSuccess = captor.getAllValues() + + def expect = new ArrayList<>() + expect.add("e2eServiceInstanceId") + expect.add("945063ff-1a01-4944-9232-8e7999e0d5e4") + expect.add("e2eOperationId") + expect.add("e3819a23-3777-4172-a834-35ee78acf3f4") + expect.add("ProcessNsmfSuccess") + expect.add("OK") + assertEquals(expect, resultSuccess) + } + + @Test + void testProcessNSMFResponseError() { + when(mockExecution.getVariable("CSMF_NSMFResponseCode")).thenReturn(500) + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.processNSMFResponse(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("ProcessNsmfSuccess"), captor.capture()) + String resultSuccess = captor.getValue() + assertEquals("ERROR", resultSuccess) + } + + @Test + void testPrepareUpdateOperationStatus() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + when(mockExecution.getVariable("mso.adapters.openecomp.db.endpoint")) + .thenReturn("http://localhost:28090/dbadapters/RequestsDbAdapter") + CreateCommunicationService communicationService = new CreateCommunicationService() + + communicationService.prepareUpdateOperationStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + + String expect = getExpectPayload("updateServiceOperationStatus", "processing", "20", + "communication service create operation processing: waiting nsmf service create finished") + + assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", "")) + } + + + @Test + void testPrepareCallCheckProcessStatus() { + CreateCommunicationService communicationService = new CreateCommunicationService() + communicationService.prepareCallCheckProcessStatus(mockExecution) + Mockito.verify(mockExecution, times(10)).setVariable(captor.capture(), captor.capture()) + def resultSuccess = captor.getAllValues() + assertNotNull(resultSuccess) + } + + + @Test + void testPrepareCompleteStatus() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("operationId")).thenReturn("54321") + when(mockExecution.getVariable("operationContent")) + .thenReturn("communication service create operation finished") + + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("11111") + when(mockExecution.getVariable("operationStatus")) + .thenReturn("processing") + CreateCommunicationService communicationService = new CreateCommunicationService() + + communicationService.prepareCompleteStatus(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(eq("updateOperationStatus"), captor.capture()) + String res = captor.getValue() + + String expect = getExpectPayload("updateServiceOperationStatus", "processing", "100", + "communication service create operation finished") + + assertEquals(expect.replaceAll("\\s+", ""), res.replaceAll("\\s+", "")) + } + + private static String getExpectPayload(String type, String result, String progress, String operationContent) { + String expect = + """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" + xmlns:ns="http://org.onap.so/requestsdb"> + <soapenv:Header/> + <soapenv:Body> + <ns:${type} xmlns:ns="http://org.onap.so/requestsdb"> + <serviceId>12345</serviceId> + <operationId>54321</operationId> + <operationType>CREATE</operationType> + <userId>11111</userId> + <result>${result}</result> + <operationContent>${operationContent}</operationContent> + <progress>${progress}</progress> + <reason></reason> + </ns:${type}> + </soapenv:Body> + </soapenv:Envelope> + """ + return expect + } + + private void mockData() { + when(mockExecution.getVariable("uuiRequest")).thenReturn("""{ + "service":{ + "name":"CSMFService", + "description":"CSMFService", + "serviceInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "serviceUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "globalSubscriberId":"5GCustomer", + "serviceType":"5G", + "parameters":{ + "requestInputs":{ + "expDataRateDL":10, + "expDataRateUL":30, + "latency":20, + "maxNumberofUEs":300, + "uemobilityLevel":"stationary", + "resourceSharingLevel":"shared", + "coverageAreaList": "01001", + "useInterval":"3" + } + } + } + }""") + } +} diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy new file mode 100644 index 0000000000..37207f8022 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateCommunicationServiceTest.groovy @@ -0,0 +1,196 @@ +/*- + * ============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 org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity +import org.junit.Before +import org.junit.Test +import org.mockito.ArgumentCaptor +import org.mockito.Captor +import org.mockito.Mockito +import org.onap.aai.domain.yang.CommunicationServiceProfile +import org.onap.aai.domain.yang.ServiceInstance +import org.onap.so.bpmn.common.scripts.MsoGroovyTest +import org.onap.so.client.aai.AAIResourcesClient + +import static com.shazam.shazamcrest.MatcherAssert.assertThat +import static com.shazam.shazamcrest.matcher.Matchers.sameBeanAs +import static org.junit.Assert.assertEquals +import static org.junit.Assert.assertNotNull +import static org.mockito.ArgumentMatchers.eq +import static org.mockito.Mockito.* + +class DoCreateCommunicationServiceTest extends MsoGroovyTest { + + private DoCreateCommunicationService communicationService = new DoCreateCommunicationService() + + @Before + public void setUp() throws Exception { + super.init("DoCreateCommunicationService") + communicationService.client = spy(AAIResourcesClient.class) + } + + @Captor + static ArgumentCaptor<ExecutionEntity> captor = ArgumentCaptor.forClass(ExecutionEntity.class) + + @Test + public void testPreProcessRequest(){ + mockData() + DoCreateCommunicationService communicationService = new DoCreateCommunicationService() + communicationService.preProcessRequest(mockExecution) + Mockito.verify(mockExecution, times(1)).setVariable(captor.capture(), captor.capture()) + assertNotNull(captor.getAllValues()) + } + + @Test + public void testCreateCommunicationService() { + mockData() + ServiceInstance expectedServiceInstanceData = getExpectedServiceInstance() + + try { + communicationService.createCommunicationService(mockExecution) + } catch (Exception e) { + + assertEquals(e.class, BpmnError.class) + } + + + Mockito.verify(mockExecution).setVariable(eq("communicationServiceInstance"), captor.capture()) + ServiceInstance resData = captor.getValue() + resData.setCreatedAt("") + resData.setEnvironmentContext("") + assertThat(resData, sameBeanAs(expectedServiceInstanceData)) + } + + @Test + public void testCreateCommunicationServiceProfile() { + mockData() + DoCreateCommunicationService communicationService = new DoCreateCommunicationService() + + CommunicationServiceProfile expectedServiceInstanceData = getExpectedServiceInstanceProfile() + + try { + communicationService.createCommunicationServiceProfile(mockExecution) + } catch (Exception e) { + assertEquals(e.class, BpmnError.class) + } + + Mockito.verify(mockExecution).setVariable(eq("communicationServiceInstanceProfile"), captor.capture()) + CommunicationServiceProfile resData = captor.getValue() + resData.setProfileId("") + assertThat(resData, sameBeanAs(expectedServiceInstanceData)) + } + + private static CommunicationServiceProfile getExpectedServiceInstanceProfile() { + CommunicationServiceProfile expectedServiceInstanceData = new CommunicationServiceProfile() + expectedServiceInstanceData.setProfileId("") + expectedServiceInstanceData.setLatency(20) + expectedServiceInstanceData.setMaxNumberOfUEs(300) + expectedServiceInstanceData.setUeMobilityLevel("stationary") + expectedServiceInstanceData.setResourceSharingLevel("shared") + expectedServiceInstanceData.setExpDataRateUL(30) + expectedServiceInstanceData.setExpDataRateDL(10) + expectedServiceInstanceData.setCoverageAreaList("01001") + return expectedServiceInstanceData + } + + private static ServiceInstance getExpectedServiceInstance() { + ServiceInstance expectedServiceInstanceData = new ServiceInstance() + expectedServiceInstanceData.setServiceInstanceName("CSMFService") + expectedServiceInstanceData.setServiceRole("communication-service") + expectedServiceInstanceData.setOrchestrationStatus("processing") + expectedServiceInstanceData.setModelInvariantId("e75698d9-925a-4cdd-a6c0-edacbe6a0b51") + expectedServiceInstanceData.setModelVersionId("8ee5926d-720b-4bb2-86f9-d20e921c143b") + expectedServiceInstanceData.setInputParameters("""{ + "service":{ + "name":"CSMFService", + "description":"CSMFService", + "serviceInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "serviceUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "globalSubscriberId":"5GCustomer", + "serviceType":"5G", + "parameters":{ + "requestInputs":{ + "expDataRateDL":10, + "expDataRateUL":30, + "latency":20, + "maxNumberofUEs":300, + "uemobilityLevel":"stationary", + "resourceSharingLevel":"shared", + "coverageAreaList": "01001", + "useInterval":"3" + } + } + } + }""") + expectedServiceInstanceData.setWorkloadContext("3") + expectedServiceInstanceData.setCreatedAt("") + expectedServiceInstanceData.setEnvironmentContext("") + return expectedServiceInstanceData + } + + private void mockData() { + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("12345") + when(mockExecution.getVariable("serviceInstanceName")).thenReturn("CSMFService") + when(mockExecution.getVariable("serviceType")).thenReturn("5G") + when(mockExecution.getVariable("uuiRequest")).thenReturn("""{ + "service":{ + "name":"CSMFService", + "description":"CSMFService", + "serviceInvariantUuid":"e75698d9-925a-4cdd-a6c0-edacbe6a0b51", + "serviceUuid":"8ee5926d-720b-4bb2-86f9-d20e921c143b", + "globalSubscriberId":"5GCustomer", + "serviceType":"5G", + "parameters":{ + "requestInputs":{ + "expDataRateDL":10, + "expDataRateUL":30, + "latency":20, + "maxNumberofUEs":300, + "uemobilityLevel":"stationary", + "resourceSharingLevel":"shared", + "coverageAreaList": "01001", + "useInterval":"3" + } + } + } + }""") + when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true") + when(mockExecution.getVariable("globalSubscriberId")).thenReturn("5GCustomer") + Map<String, Object> csInputMap = new HashMap<>() + csInputMap.put("expDataRateDL", 10) + csInputMap.put("expDataRateUL", 30) + csInputMap.put("latency", 20) + csInputMap.put("maxNumberofUEs", 300) + csInputMap.put("uEMobilityLevel", "stationary") + csInputMap.put("resourceSharingLevel", "shared") + csInputMap.put("coverageAreaTAList", "01001") + csInputMap.put("useInterval", "3") + + when(mockExecution.getVariable("csInputMap")).thenReturn(csInputMap) + + when(mockExecution.getVariable("modelInvariantUuid")).thenReturn("e75698d9-925a-4cdd-a6c0-edacbe6a0b51") + when(mockExecution.getVariable("modelUuid")).thenReturn("8ee5926d-720b-4bb2-86f9-d20e921c143b") + when(mockExecution.getVariable("useInterval")).thenReturn("3") + when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("5G") + } +} diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn new file mode 100644 index 0000000000..9c090e0594 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn @@ -0,0 +1,361 @@ +<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> + <bpmn:process id="DoAllocateNSIandNSSI" name="DoAllocateNSIandNSSI" isExecutable="true"> + <bpmn:scriptTask id="Task_09nzhwk" name="Generate NSI and create NSI in AAI with E2ESS and NSI relationship" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1e40h52</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createNSIinAAI(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" name="Is nsi option available?" default="SequenceFlow_1h5bw41"> + <bpmn:incoming>SequenceFlow_0dj0jvq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="Update AAI relationship for E2ESS and NSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xfhbqw</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoAllocateNSIandNSSI() +dcsi.updateRelationship(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1s23hty" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1e40h52</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_1q3ftu4" name="Prepare NSSI model info and instance id" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0xfhbqw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0uhaps2</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoAllocateNSIandNSSI() +dcsi.prepareNssiModelInfo(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:startEvent id="allocateslice_StartEvent" name="allocatensi_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoAllocateNSIandNSSI() +dcso.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_0o93dvp" name="read NSI options from request DB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0dj0jvq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dansi = new DoAllocateNSIandNSSI() +dansi.retriveSliceOption(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1k1oonn" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1dhpkhd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0hxky5e</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_0gunols" name="Get one NSST Info" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ui528w</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1dhpkhd</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.getOneNsstInfo(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1lpgn98" name="prepare NSST Info" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0hxky5e</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_19jztxv</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnsio = new DoAllocateNSIandNSSI() +dcnsio.createNSSTMap(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1x6k78c"> + <bpmn:incoming>SequenceFlow_0u8fycy</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="finishNSCreate_Task" name="Get a NSSI to process" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_16nvnxi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cq2q6g</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoAllocateNSIandNSSI() +dcsi.getOneNSSIInfo(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_07qkrrb" name="Is there more NSSI to process?" default="SequenceFlow_0u8fycy"> + <bpmn:incoming>SequenceFlow_0g5bwvl</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1jaxstd</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_16nvnxi</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0u8fycy</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:callActivity id="CallActivity_130tuxn" name="Call DoAllocateNSSI" calledElement="DoAllocateNSSI"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + <camunda:in source="nsstInput" target="nsstInput" /> + <camunda:in source="serviceProfile" target="serviceProfile" /> + <camunda:in source="sliceProfileTn" target="sliceProfileTn" /> + <camunda:in source="sliceProfileCn" target="sliceProfileCn" /> + <camunda:in source="sliceProfileAn" target="sliceProfileAn" /> + <camunda:in source="globalSubscriberId" target="globalSubscriberId" /> + <camunda:in source="subscriptionServiceType" target="subscriptionServiceType" /> + <camunda:in source="uuiRequest" target="uuiRequest" /> + <camunda:in source="nsiServiceInstanceId" target="nsiServiceInstanceId" /> + <camunda:in source="nsiServiceInstanceName" target="nsiServiceInstanceName" /> + <camunda:in source="nssiserviceModelInfo" target="nssiserviceModelInfo" /> + <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="taskId" target="CSSOT_taskId" /> + <camunda:in source="taskName" target="CSSOT_name" /> + <camunda:in source="taskStatus" target="CSSOT_status" /> + <camunda:in source="isManual" target="CSSOT_isManual" /> + <camunda:in source="isNSIOptionAvailable" target="isNSIOptionAvailable" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0cq2q6g</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00b8ryw</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_0anyn7v" name="Update current Index" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_00b8ryw</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jaxstd</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoAllocateNSIandNSSI() +dcsi.updateCurrentIndex(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="instantiate_NSTask" name="Prepare NSSI list (with and without shared NSSI)" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0uhaps2</bpmn:incoming> + <bpmn:incoming>SequenceFlow_04yx9ii</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoAllocateNSIandNSSI() +dcso.prepareNSSIList(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_1jg3el3" name="Is NSST available?" default="SequenceFlow_04yx9ii"> + <bpmn:incoming>SequenceFlow_19jztxv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_04yx9ii</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1ui528w</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0uhaps2" sourceRef="ScriptTask_1q3ftu4" targetRef="instantiate_NSTask" /> + <bpmn:sequenceFlow id="SequenceFlow_1e40h52" sourceRef="CallActivity_1s23hty" targetRef="Task_09nzhwk" /> + <bpmn:sequenceFlow id="SequenceFlow_0xfhbqw" sourceRef="ScriptTask_1ehyrsg" targetRef="ScriptTask_1q3ftu4" /> + <bpmn:sequenceFlow id="SequenceFlow_0dj0jvq" sourceRef="ScriptTask_0o93dvp" targetRef="ExclusiveGateway_0b9d9l0" /> + <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="Yes" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="No" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="CallActivity_1s23hty" /> + <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="ScriptTask_0gunols" /> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocateslice_StartEvent" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="ScriptTask_0o93dvp" /> + <bpmn:sequenceFlow id="SequenceFlow_0g5bwvl" sourceRef="instantiate_NSTask" targetRef="ExclusiveGateway_07qkrrb" /> + <bpmn:sequenceFlow id="SequenceFlow_0hxky5e" sourceRef="CallActivity_1k1oonn" targetRef="ScriptTask_1lpgn98" /> + <bpmn:sequenceFlow id="SequenceFlow_1dhpkhd" sourceRef="ScriptTask_0gunols" targetRef="CallActivity_1k1oonn" /> + <bpmn:sequenceFlow id="SequenceFlow_19jztxv" sourceRef="ScriptTask_1lpgn98" targetRef="ExclusiveGateway_1jg3el3" /> + <bpmn:sequenceFlow id="SequenceFlow_0u8fycy" name="No" sourceRef="ExclusiveGateway_07qkrrb" targetRef="EndEvent_1x6k78c" /> + <bpmn:sequenceFlow id="SequenceFlow_16nvnxi" name="Yes" sourceRef="ExclusiveGateway_07qkrrb" targetRef="finishNSCreate_Task"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSI" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0cq2q6g" sourceRef="finishNSCreate_Task" targetRef="CallActivity_130tuxn" /> + <bpmn:sequenceFlow id="SequenceFlow_1jaxstd" sourceRef="ScriptTask_0anyn7v" targetRef="ExclusiveGateway_07qkrrb" /> + <bpmn:sequenceFlow id="SequenceFlow_00b8ryw" sourceRef="CallActivity_130tuxn" targetRef="ScriptTask_0anyn7v" /> + <bpmn:sequenceFlow id="SequenceFlow_04yx9ii" name="No" sourceRef="ExclusiveGateway_1jg3el3" targetRef="instantiate_NSTask" /> + <bpmn:sequenceFlow id="SequenceFlow_1ui528w" sourceRef="ExclusiveGateway_1jg3el3" targetRef="ScriptTask_0gunols"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSI"> + <bpmndi:BPMNEdge id="SequenceFlow_0uhaps2_di" bpmnElement="SequenceFlow_0uhaps2"> + <di:waypoint x="978" y="350" /> + <di:waypoint x="1736" y="350" /> + <di:waypoint x="1736" y="487" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1e40h52_di" bpmnElement="SequenceFlow_1e40h52"> + <di:waypoint x="799" y="527" /> + <di:waypoint x="878" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xfhbqw_di" bpmnElement="SequenceFlow_0xfhbqw"> + <di:waypoint x="799" y="350" /> + <di:waypoint x="878" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0dj0jvq_di" bpmnElement="SequenceFlow_0dj0jvq"> + <di:waypoint x="520" y="527" /> + <di:waypoint x="583" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca"> + <di:waypoint x="608" y="502" /> + <di:waypoint x="608" y="350" /> + <di:waypoint x="699" y="350" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="584" y="422" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41"> + <di:waypoint x="633" y="527" /> + <di:waypoint x="699" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="630" y="509" width="14" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h"> + <di:waypoint x="978" y="527" /> + <di:waypoint x="1036" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="631" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <di:waypoint x="210" y="527" /> + <di:waypoint x="268" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266" y="123" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <di:waypoint x="368" y="527" /> + <di:waypoint x="420" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="436" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl"> + <di:waypoint x="1786" y="527" /> + <di:waypoint x="1871" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0hxky5e_di" bpmnElement="SequenceFlow_0hxky5e"> + <di:waypoint x="1300" y="527" /> + <di:waypoint x="1388" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1dhpkhd_di" bpmnElement="SequenceFlow_1dhpkhd"> + <di:waypoint x="1136" y="527" /> + <di:waypoint x="1200" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_19jztxv_di" bpmnElement="SequenceFlow_19jztxv"> + <di:waypoint x="1488" y="527" /> + <di:waypoint x="1564" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0u8fycy_di" bpmnElement="SequenceFlow_0u8fycy"> + <di:waypoint x="1896" y="502" /> + <di:waypoint x="1896" y="409" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1904" y="453" width="14" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_16nvnxi_di" bpmnElement="SequenceFlow_16nvnxi"> + <di:waypoint x="1921" y="527" /> + <di:waypoint x="1991" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1942" y="500" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0cq2q6g_di" bpmnElement="SequenceFlow_0cq2q6g"> + <di:waypoint x="2091" y="527" /> + <di:waypoint x="2197" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="556.5" y="574" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jaxstd_di" bpmnElement="SequenceFlow_1jaxstd"> + <di:waypoint x="1991" y="665" /> + <di:waypoint x="1896" y="665" /> + <di:waypoint x="1896" y="552" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00b8ryw_di" bpmnElement="SequenceFlow_00b8ryw"> + <di:waypoint x="2247" y="567" /> + <di:waypoint x="2247" y="665" /> + <di:waypoint x="2091" y="665" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_04yx9ii_di" bpmnElement="SequenceFlow_04yx9ii"> + <di:waypoint x="1614" y="527" /> + <di:waypoint x="1686" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1643" y="509" width="14" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ui528w_di" bpmnElement="SequenceFlow_1ui528w"> + <di:waypoint x="1589" y="552" /> + <di:waypoint x="1589" y="671" /> + <di:waypoint x="1086" y="671" /> + <di:waypoint x="1086" y="567" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> + <dc:Bounds x="878" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true"> + <dc:Bounds x="583" y="502" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="578" y="559" width="60" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg"> + <dc:Bounds x="699" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1s23hty_di" bpmnElement="CallActivity_1s23hty"> + <dc:Bounds x="699" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1q3ftu4_di" bpmnElement="ScriptTask_1q3ftu4"> + <dc:Bounds x="878" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocateslice_StartEvent"> + <dc:Bounds x="174" y="509" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="152" y="545" width="82" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="268" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0o93dvp_di" bpmnElement="ScriptTask_0o93dvp"> + <dc:Bounds x="420" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1k1oonn_di" bpmnElement="CallActivity_1k1oonn"> + <dc:Bounds x="1200" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0gunols_di" bpmnElement="ScriptTask_0gunols"> + <dc:Bounds x="1036" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1lpgn98_di" bpmnElement="ScriptTask_1lpgn98"> + <dc:Bounds x="1388" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="1878" y="373" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="412" y="617" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task"> + <dc:Bounds x="1991" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_07qkrrb_di" bpmnElement="ExclusiveGateway_07qkrrb" isMarkerVisible="true"> + <dc:Bounds x="1871" y="502" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1853" y="575" width="86" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_130tuxn_di" bpmnElement="CallActivity_130tuxn"> + <dc:Bounds x="2197" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0anyn7v_di" bpmnElement="ScriptTask_0anyn7v"> + <dc:Bounds x="1991" y="625" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask"> + <dc:Bounds x="1686" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1jg3el3_di" bpmnElement="ExclusiveGateway_1jg3el3" isMarkerVisible="true"> + <dc:Bounds x="1564" y="502" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1564" y="465" width="50" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn new file mode 100644 index 0000000000..445c9378af --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn @@ -0,0 +1,364 @@ +<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> + <bpmn:process id="DoAllocateNSSI" name="DoAllocateNSSI" isExecutable="true"> + <bpmn:startEvent id="allocatenssi_StartEvent" name="allocatenssi_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="allocatenssi_StartEvent" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="CallActivity_09l7bhc" /> + <bpmn:scriptTask id="Task_09nzhwk" name="send create request to NSSMF adapter" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.sendCreateRequestNSSMF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="instantiate_NSTask" name="create slice profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0yie00u</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0kzlbeh</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1r8qkgf</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_09pv5lu</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.createSliceProfile(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1x6k78c"> + <bpmn:incoming>SequenceFlow_09pv5lu</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="finishNSCreate_Task" name="Get NSSI progress" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1smrx3b</bpmn:incoming> + <bpmn:incoming>SequenceFlow_08xcz0v</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1lpxjvi</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.getNSSMFProgresss(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="ExclusiveGateway_0xz0xx2" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" name="Is NSSI sharable?" default="SequenceFlow_0ueeeca"> + <bpmn:incoming>SequenceFlow_0dj0jvq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="No" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="Task_09nzhwk"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "create")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="send update request to NSSMF adapter" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0xfhbqw</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.sendUpdateRequestNSSMF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="Yes" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg" /> + <bpmn:scriptTask id="ScriptTask_0o93dvp" name="Get NSST from Catalog DB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_03bz6dh</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0dj0jvq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.getNSSTInfo(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0dj0jvq" sourceRef="ScriptTask_0o93dvp" targetRef="ExclusiveGateway_0b9d9l0" /> + <bpmn:sequenceFlow id="SequenceFlow_0xfhbqw" sourceRef="ScriptTask_1ehyrsg" targetRef="ExclusiveGateway_0xz0xx2" /> + <bpmn:scriptTask id="ScriptTask_1mv1npn" name="create NSSI and update relationship" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_07azk0i</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0yie00u</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.instantiateNSSIService(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1lpxjvi" sourceRef="finishNSCreate_Task" targetRef="ScriptTask_1fvkcir" /> + <bpmn:callActivity id="CallActivity_09l7bhc" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_03bz6dh</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_03bz6dh" sourceRef="CallActivity_09l7bhc" targetRef="ScriptTask_0o93dvp" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1cgffe3" name="Completed"> + <bpmn:incoming>SequenceFlow_1xzq95u</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1kxwt7k</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0stj4cv</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:scriptTask id="ScriptTask_1escji6" name="Time delay" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0stj4cv</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_08xcz0v</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.timeDelay(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_08xcz0v" sourceRef="ScriptTask_1escji6" targetRef="finishNSCreate_Task" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_0xz0xx2"> + <bpmn:incoming>SequenceFlow_0xfhbqw</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1smrx3b</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1kxwt7k" name="true" sourceRef="ExclusiveGateway_1cgffe3" targetRef="ExclusiveGateway_09hoejm"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSICreated" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0stj4cv" name="false" sourceRef="ExclusiveGateway_1cgffe3" targetRef="ScriptTask_1escji6"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSSICreated" ) == false)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1smrx3b" sourceRef="ExclusiveGateway_0xz0xx2" targetRef="finishNSCreate_Task" /> + <bpmn:sequenceFlow id="SequenceFlow_0yie00u" sourceRef="ScriptTask_1mv1npn" targetRef="instantiate_NSTask" /> + <bpmn:sequenceFlow id="SequenceFlow_09pv5lu" sourceRef="instantiate_NSTask" targetRef="EndEvent_1x6k78c" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_09hoejm" name="Is NSSI sharable?" default="SequenceFlow_0c2o5zl2"> + <bpmn:incoming>SequenceFlow_1kxwt7k</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_07azk0i</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0c2o5zl2</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_07azk0i" sourceRef="ExclusiveGateway_09hoejm" targetRef="ScriptTask_1mv1npn"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "create")}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_0y2xmwi" name="Update relationship" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_14lzy4o</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0kzlbeh</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.updateRelationship(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0c2o5zl2" sourceRef="ExclusiveGateway_09hoejm" targetRef="ScriptTask_0y2xmwi" /> + <bpmn:sequenceFlow id="SequenceFlow_0kzlbeh" sourceRef="ScriptTask_0y2xmwi" targetRef="instantiate_NSTask" /> + <bpmn:scriptTask id="ScriptTask_1fvkcir" name="Prepare Update Orchestration Task" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1lpxjvi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0jjbci8</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcnssi = new DoAllocateNSSI() +dcnssi.prepareUpdateOrchestrationTask(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_11d0poc" name="Call HandleOrchestrationTask" calledElement="HandleOrchestrationTask"> + <bpmn:extensionElements> + <camunda:out source="statusCode" target="CSSOT_dbResponseCode" /> + <camunda:out source="response" target="CSSOT_dbResponse" /> + <camunda:in source="CSSOT_taskId" target="taskId" /> + <camunda:in source="msoRequestId" target="requestId" /> + <camunda:in source="CSSOT_name" target="taskName" /> + <camunda:in source="CSSOT_status" target="taskStatus" /> + <camunda:in source="CSSOT_isManual" target="isManual" /> + <camunda:in source="CSSOT_paramJson" target="paramJson" /> + <camunda:in source="CSSOT_requestMethod" target="method" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_0jjbci8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1xzq95u</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0jjbci8" sourceRef="ScriptTask_1fvkcir" targetRef="CallActivity_11d0poc" /> + <bpmn:sequenceFlow id="SequenceFlow_1xzq95u" sourceRef="CallActivity_11d0poc" targetRef="ExclusiveGateway_1cgffe3" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_19tascw" name="Is NSI option available?" default="SequenceFlow_14lzy4o"> + <bpmn:incoming>SequenceFlow_0c2o5zl2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_14lzy4o</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1r8qkgf</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_14lzy4o" sourceRef="ExclusiveGateway_19tascw" targetRef="ScriptTask_0y2xmwi" /> + <bpmn:sequenceFlow id="SequenceFlow_1r8qkgf" sourceRef="ExclusiveGateway_19tascw" targetRef="instantiate_NSTask"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSIOptionAvailable" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSI"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="allocatenssi_StartEvent"> + <dc:Bounds x="175" y="509" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="152" y="545" width="85" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <di:waypoint x="211" y="527" /> + <di:waypoint x="269" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266" y="123" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <di:waypoint x="369" y="527" /> + <di:waypoint x="444" y="527" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="436" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> + <dc:Bounds x="887" y="659" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="269" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask"> + <dc:Bounds x="2286" y="467" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="2482" y="489" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="412" y="617" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task"> + <dc:Bounds x="1238" y="467" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h"> + <di:waypoint x="987" y="699" /> + <di:waypoint x="1103" y="699" /> + <di:waypoint x="1103" y="532" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="631" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true"> + <dc:Bounds x="778" y="502" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="838" y="520" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41"> + <di:waypoint x="803" y="552" /> + <di:waypoint x="803" y="699" /> + <di:waypoint x="883" y="699" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="836" y="681" width="14" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg"> + <dc:Bounds x="894" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca"> + <di:waypoint x="803" y="502" /> + <di:waypoint x="803" y="350" /> + <di:waypoint x="894" y="350" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="831" y="358" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0o93dvp_di" bpmnElement="ScriptTask_0o93dvp"> + <dc:Bounds x="618" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0dj0jvq_di" bpmnElement="SequenceFlow_0dj0jvq"> + <di:waypoint x="718" y="527" /> + <di:waypoint x="778" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0xfhbqw_di" bpmnElement="SequenceFlow_0xfhbqw"> + <di:waypoint x="994" y="350" /> + <di:waypoint x="1103" y="350" /> + <di:waypoint x="1103" y="482" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1mv1npn_di" bpmnElement="ScriptTask_1mv1npn"> + <dc:Bounds x="2089" y="467" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1lpxjvi_di" bpmnElement="SequenceFlow_1lpxjvi"> + <di:waypoint x="1338" y="507" /> + <di:waypoint x="1411" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_09l7bhc_di" bpmnElement="CallActivity_09l7bhc"> + <dc:Bounds x="444" y="487" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_03bz6dh_di" bpmnElement="SequenceFlow_03bz6dh"> + <di:waypoint x="544" y="527" /> + <di:waypoint x="618" y="527" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1cgffe3_di" bpmnElement="ExclusiveGateway_1cgffe3" isMarkerVisible="true"> + <dc:Bounds x="1773" y="482" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1771" y="458" width="54" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1escji6_di" bpmnElement="ScriptTask_1escji6"> + <dc:Bounds x="1748" y="624" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_08xcz0v_di" bpmnElement="SequenceFlow_08xcz0v"> + <di:waypoint x="1748" y="664" /> + <di:waypoint x="1288" y="664" /> + <di:waypoint x="1288" y="547" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0xz0xx2_di" bpmnElement="ExclusiveGateway_0xz0xx2" isMarkerVisible="true"> + <dc:Bounds x="1078" y="482" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1kxwt7k_di" bpmnElement="SequenceFlow_1kxwt7k"> + <di:waypoint x="1823" y="507" /> + <di:waypoint x="1928" y="507" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1866" y="489" width="19" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0stj4cv_di" bpmnElement="SequenceFlow_0stj4cv"> + <di:waypoint x="1798" y="532" /> + <di:waypoint x="1798" y="624" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1801" y="575" width="24" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1smrx3b_di" bpmnElement="SequenceFlow_1smrx3b"> + <di:waypoint x="1128" y="507" /> + <di:waypoint x="1238" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0yie00u_di" bpmnElement="SequenceFlow_0yie00u"> + <di:waypoint x="2189" y="507" /> + <di:waypoint x="2286" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_09pv5lu_di" bpmnElement="SequenceFlow_09pv5lu"> + <di:waypoint x="2386" y="507" /> + <di:waypoint x="2482" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_09hoejm_di" bpmnElement="ExclusiveGateway_09hoejm" isMarkerVisible="true"> + <dc:Bounds x="1928" y="482" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1908" y="542" width="90" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_07azk0i_di" bpmnElement="SequenceFlow_07azk0i"> + <di:waypoint x="1978" y="507" /> + <di:waypoint x="2089" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0y2xmwi_di" bpmnElement="ScriptTask_0y2xmwi"> + <dc:Bounds x="2089" y="310" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0kzlbeh_di" bpmnElement="SequenceFlow_0kzlbeh"> + <di:waypoint x="2189" y="350" /> + <di:waypoint x="2336" y="350" /> + <di:waypoint x="2336" y="467" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1fvkcir_di" bpmnElement="ScriptTask_1fvkcir"> + <dc:Bounds x="1411" y="467" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_11d0poc_di" bpmnElement="CallActivity_11d0poc"> + <dc:Bounds x="1587" y="467" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0jjbci8_di" bpmnElement="SequenceFlow_0jjbci8"> + <di:waypoint x="1511" y="507" /> + <di:waypoint x="1587" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1xzq95u_di" bpmnElement="SequenceFlow_1xzq95u"> + <di:waypoint x="1687" y="507" /> + <di:waypoint x="1773" y="507" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_19tascw_di" bpmnElement="ExclusiveGateway_19tascw" isMarkerVisible="true"> + <dc:Bounds x="1928" y="325" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1854" y="337" width="64" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0c2o5zl_di" bpmnElement="SequenceFlow_0c2o5zl2"> + <di:waypoint x="1953" y="482" /> + <di:waypoint x="1953" y="375" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14lzy4o_di" bpmnElement="SequenceFlow_14lzy4o"> + <di:waypoint x="1978" y="350" /> + <di:waypoint x="2089" y="350" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1r8qkgf_di" bpmnElement="SequenceFlow_1r8qkgf"> + <di:waypoint x="1953" y="325" /> + <di:waypoint x="1953" y="205" /> + <di:waypoint x="2336" y="205" /> + <di:waypoint x="2336" y="465" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn new file mode 100644 index 0000000000..894f7d39dc --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn @@ -0,0 +1,103 @@ +<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> + <bpmn:process id="DoCreateSliceServiceInstance" name="DoCreateSliceServiceInstance" isExecutable="true"> + <bpmn:startEvent id="createNS_StartEvent" name="createNS_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="instantiate_NSTask" /> + <bpmn:scriptTask id="Task_09nzhwk" name="Create service profile" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_17u69c4</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1uiz85h</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateSliceServiceInstance() +dcsi.createServiceProfile(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Incoming Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateSliceServiceInstance() +dcsi.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="instantiate_NSTask" name="create Slice Service in AAI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateSliceServiceInstance() +dcsi.instantiateSliceService(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:endEvent id="EndEvent_1x6k78c"> + <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1uiz85h" sourceRef="Task_09nzhwk" targetRef="EndEvent_1x6k78c" /> + <bpmn:sequenceFlow id="SequenceFlow_0g5bwvl" sourceRef="instantiate_NSTask" targetRef="ScriptTask_18rzwzb" /> + <bpmn:scriptTask id="ScriptTask_18rzwzb" name="Create Allottedsource" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0g5bwvl</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_17u69c4</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DoCreateSliceServiceInstance() +dcsi.createAllottedResource(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_17u69c4" sourceRef="ScriptTask_18rzwzb" targetRef="Task_09nzhwk" /> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceInstance"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent"> + <dc:Bounds x="175" y="111" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="152" y="147" width="83" height="24" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <di:waypoint x="211" y="129" /> + <di:waypoint x="251" y="129" /> + <di:waypoint x="251" y="129" /> + <di:waypoint x="293" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266" y="123" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <di:waypoint x="393" y="129" /> + <di:waypoint x="474" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="436" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> + <dc:Bounds x="851" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="293" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="instantiate_NSTask"> + <dc:Bounds x="474" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="1049" y="111" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="412" y="617" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1uiz85h_di" bpmnElement="SequenceFlow_1uiz85h"> + <di:waypoint x="951" y="129" /> + <di:waypoint x="1049" y="129" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="631" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0g5bwvl_di" bpmnElement="SequenceFlow_0g5bwvl"> + <di:waypoint x="574" y="129" /> + <di:waypoint x="658" y="129" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_18rzwzb_di" bpmnElement="ScriptTask_18rzwzb"> + <dc:Bounds x="658" y="89" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_17u69c4_di" bpmnElement="SequenceFlow_17u69c4"> + <di:waypoint x="758" y="129" /> + <di:waypoint x="851" y="129" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn new file mode 100644 index 0000000000..435f91921d --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn @@ -0,0 +1,338 @@ +<?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:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="2.2.3"> + <bpmn:process id="DoCreateSliceServiceOption" name="DoCreateSliceServiceOption" isExecutable="true"> + <bpmn:startEvent id="createNS_StartEvent" name="createOption_StartEvent"> + <bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing> + </bpmn:startEvent> + <bpmn:sequenceFlow id="SequenceFlow_1qo2pln" sourceRef="createNS_StartEvent" targetRef="PreprocessIncomingRequest_task" /> + <bpmn:sequenceFlow id="SequenceFlow_0khtova" sourceRef="PreprocessIncomingRequest_task" targetRef="ExclusiveGateway_0b9d9l0" /> + <bpmn:scriptTask id="Task_09nzhwk" name="send request to OOF for NSI options" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1h5bw41</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1utpplq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.getNSIOptionfromOOF(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="PreprocessIncomingRequest_task" name="Preprocess Request" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1qo2pln</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0khtova</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.preProcessRequest(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0cq2q6g" sourceRef="finishNSCreate_Task" targetRef="ScriptTask_0j3wd2o" /> + <bpmn:endEvent id="EndEvent_1x6k78c"> + <bpmn:incoming>SequenceFlow_01ak5x3</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ap8kar</bpmn:incoming> + <bpmn:incoming>SequenceFlow_0hnsycl</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="finishNSCreate_Task" name="prepare list of NSSI associated with NSI" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_15679e8</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0cq2q6g</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.prepareNSSIList(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_0b9d9l0" default="SequenceFlow_0ueeeca"> + <bpmn:incoming>SequenceFlow_0khtova</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1h5bw41</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0ueeeca</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1h5bw41" name="NSI Sharable" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="Task_09nzhwk"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isSharable" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_1ehyrsg" name="update task status in request DB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0ueeeca</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0ojueqq</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.updateStatusInDB(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_0ueeeca" name="NSI Not Sharable" sourceRef="ExclusiveGateway_0b9d9l0" targetRef="ScriptTask_1ehyrsg" /> + <bpmn:endEvent id="EndEvent_00n990e"> + <bpmn:incoming>SequenceFlow_0ojueqq</bpmn:incoming> + </bpmn:endEvent> + <bpmn:scriptTask id="ScriptTask_0j3wd2o" name="updated options in request DB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0cq2q6g</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_01ak5x3</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.updateOptionsInDB(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_01ak5x3" sourceRef="ScriptTask_0j3wd2o" targetRef="EndEvent_1x6k78c" /> + <bpmn:scriptTask id="ScriptTask_0kecvrc" name="prepare list of NSST associated with NST" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1614gtr</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0lt2cdo</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.prepareNSSTlistfromNST(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:scriptTask id="ScriptTask_1mlytov" name="send request to OOF for NSSI options" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0a5f5y6</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1r9n9ef</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.getNSSTOption(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:exclusiveGateway id="ExclusiveGateway_1y1wzs9"> + <bpmn:incoming>SequenceFlow_0lt2cdo</bpmn:incoming> + <bpmn:incoming>SequenceFlow_00gq7h2</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1ap8kar</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0m2mr0o</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_1ap8kar" sourceRef="ExclusiveGateway_1y1wzs9" targetRef="EndEvent_1x6k78c"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == false)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_0lt2cdo" sourceRef="ScriptTask_0kecvrc" targetRef="ExclusiveGateway_1y1wzs9" /> + <bpmn:sequenceFlow id="SequenceFlow_0m2mr0o" sourceRef="ExclusiveGateway_1y1wzs9" targetRef="ScriptTask_1e5ysya"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isMoreNSSTtoProcess" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:scriptTask id="ScriptTask_0ojz4lj" name="save NSI and NSSI options in DB" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1r9n9ef</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_00gq7h2</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.updateOptionsInDB(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_1r9n9ef" sourceRef="ScriptTask_1mlytov" targetRef="ScriptTask_0ojz4lj" /> + <bpmn:sequenceFlow id="SequenceFlow_00gq7h2" sourceRef="ScriptTask_0ojz4lj" targetRef="ExclusiveGateway_1y1wzs9" /> + <bpmn:sequenceFlow id="SequenceFlow_0ojueqq" sourceRef="ScriptTask_1ehyrsg" targetRef="EndEvent_00n990e" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1mdr1l2" default="SequenceFlow_1614gtr"> + <bpmn:incoming>SequenceFlow_041f5ne</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_15679e8</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1614gtr</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_15679e8" sourceRef="ExclusiveGateway_1mdr1l2" targetRef="finishNSCreate_Task"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSISuggested" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:sequenceFlow id="SequenceFlow_1614gtr" sourceRef="ExclusiveGateway_1mdr1l2" targetRef="ScriptTask_0kecvrc" /> + <bpmn:scriptTask id="ScriptTask_0uu3j3h" name="prepare NST decomposition" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0wy6oag</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1jnsyix</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.prepareNSTDecompose(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:callActivity id="CallActivity_1qs8xd5" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_1jnsyix</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_041f5ne</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:scriptTask id="ScriptTask_1e5ysya" name="prepare NSST decomposition" scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_0m2mr0o</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_016vi3s</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.prepareNSSTDecompose(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:sequenceFlow id="SequenceFlow_016vi3s" sourceRef="ScriptTask_1e5ysya" targetRef="CallActivity_1rfnoe2" /> + <bpmn:callActivity id="CallActivity_1rfnoe2" name="Call Decompose Service" calledElement="DecomposeService"> + <bpmn:extensionElements> + <camunda:in source="msoRequestId" target="msoRequestId" /> + <camunda:in source="serviceInstanceId" target="serviceInstanceId" /> + <camunda:in source="serviceModelInfo" target="serviceModelInfo" /> + <camunda:in source="isDebugLogEnabled" target="isDebugLogEnabled" /> + <camunda:out source="serviceDecomposition" target="serviceDecomposition" /> + <camunda:out source="WorkflowException" target="WorkflowException" /> + </bpmn:extensionElements> + <bpmn:incoming>SequenceFlow_016vi3s</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0a5f5y6</bpmn:outgoing> + </bpmn:callActivity> + <bpmn:sequenceFlow id="SequenceFlow_0a5f5y6" sourceRef="CallActivity_1rfnoe2" targetRef="ScriptTask_1mlytov" /> + <bpmn:sequenceFlow id="SequenceFlow_1utpplq" sourceRef="Task_09nzhwk" targetRef="ExclusiveGateway_1skfk7w" /> + <bpmn:sequenceFlow id="SequenceFlow_1jnsyix" sourceRef="ScriptTask_0uu3j3h" targetRef="CallActivity_1qs8xd5" /> + <bpmn:sequenceFlow id="SequenceFlow_041f5ne" sourceRef="CallActivity_1qs8xd5" targetRef="ExclusiveGateway_1mdr1l2" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_1skfk7w" default="SequenceFlow_0wy6oag"> + <bpmn:incoming>SequenceFlow_1utpplq</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0wy6oag</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0hnsycl</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_0wy6oag" sourceRef="ExclusiveGateway_1skfk7w" targetRef="ScriptTask_0uu3j3h" /> + <bpmn:sequenceFlow id="SequenceFlow_0hnsycl" sourceRef="ExclusiveGateway_1skfk7w" targetRef="EndEvent_1x6k78c"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("isNSISuggested" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + </bpmn:process> + <bpmndi:BPMNDiagram id="BPMNDiagram_1"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOption"> + <bpmndi:BPMNShape id="_BPMNShape_StartEvent_2" bpmnElement="createNS_StartEvent"> + <dc:Bounds x="175" y="187" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="150" y="223" width="87" height="27" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln"> + <di:waypoint x="211" y="205" /> + <di:waypoint x="251" y="205" /> + <di:waypoint x="251" y="205" /> + <di:waypoint x="293" y="205" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="266" y="123" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0khtova_di" bpmnElement="SequenceFlow_0khtova"> + <di:waypoint x="393" y="205" /> + <di:waypoint x="448" y="205" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="436" y="108" width="0" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk"> + <dc:Bounds x="594" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task"> + <dc:Bounds x="293" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0cq2q6g_di" bpmnElement="SequenceFlow_0cq2q6g"> + <di:waypoint x="1536" y="205" /> + <di:waypoint x="1592" y="205" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="556.5" y="574" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_15pcuuc_di" bpmnElement="EndEvent_1x6k78c"> + <dc:Bounds x="1813" y="187" width="36" height="36" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="412" y="617" width="90" height="12" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0xxyfku_di" bpmnElement="finishNSCreate_Task"> + <dc:Bounds x="1436" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_0b9d9l0_di" bpmnElement="ExclusiveGateway_0b9d9l0" isMarkerVisible="true"> + <dc:Bounds x="448" y="180" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1h5bw41_di" bpmnElement="SequenceFlow_1h5bw41"> + <di:waypoint x="498" y="205" /> + <di:waypoint x="594" y="205" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="514" y="187" width="66" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_1ehyrsg_di" bpmnElement="ScriptTask_1ehyrsg"> + <dc:Bounds x="602" y="-197" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0ueeeca_di" bpmnElement="SequenceFlow_0ueeeca"> + <di:waypoint x="473" y="180" /> + <di:waypoint x="473" y="-157" /> + <di:waypoint x="602" y="-157" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="415" y="14" width="86" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_00n990e_di" bpmnElement="EndEvent_00n990e"> + <dc:Bounds x="785" y="-175" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_0j3wd2o_di" bpmnElement="ScriptTask_0j3wd2o"> + <dc:Bounds x="1592" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_01ak5x3_di" bpmnElement="SequenceFlow_01ak5x3"> + <di:waypoint x="1692" y="205" /> + <di:waypoint x="1813" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0kecvrc_di" bpmnElement="ScriptTask_0kecvrc"> + <dc:Bounds x="1297" y="391" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1mlytov_di" bpmnElement="ScriptTask_1mlytov"> + <dc:Bounds x="1781" y="533" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ExclusiveGateway_1y1wzs9_di" bpmnElement="ExclusiveGateway_1y1wzs9" isMarkerVisible="true"> + <dc:Bounds x="1461" y="406" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1ap8kar_di" bpmnElement="SequenceFlow_1ap8kar"> + <di:waypoint x="1486" y="406" /> + <di:waypoint x="1486" y="315" /> + <di:waypoint x="1831" y="315" /> + <di:waypoint x="1831" y="223" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0lt2cdo_di" bpmnElement="SequenceFlow_0lt2cdo"> + <di:waypoint x="1397" y="431" /> + <di:waypoint x="1461" y="431" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0m2mr0o_di" bpmnElement="SequenceFlow_0m2mr0o"> + <di:waypoint x="1511" y="431" /> + <di:waypoint x="1592" y="431" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0ojz4lj_di" bpmnElement="ScriptTask_0ojz4lj"> + <dc:Bounds x="1592" y="533" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1r9n9ef_di" bpmnElement="SequenceFlow_1r9n9ef"> + <di:waypoint x="1781" y="573" /> + <di:waypoint x="1692" y="573" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_00gq7h2_di" bpmnElement="SequenceFlow_00gq7h2"> + <di:waypoint x="1592" y="573" /> + <di:waypoint x="1486" y="573" /> + <di:waypoint x="1486" y="456" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0ojueqq_di" bpmnElement="SequenceFlow_0ojueqq"> + <di:waypoint x="702" y="-157" /> + <di:waypoint x="785" y="-157" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1mdr1l2_di" bpmnElement="ExclusiveGateway_1mdr1l2" isMarkerVisible="true"> + <dc:Bounds x="1322" y="180" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_15679e8_di" bpmnElement="SequenceFlow_15679e8"> + <di:waypoint x="1372" y="205" /> + <di:waypoint x="1436" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1614gtr_di" bpmnElement="SequenceFlow_1614gtr"> + <di:waypoint x="1347" y="230" /> + <di:waypoint x="1347" y="391" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0uu3j3h_di" bpmnElement="ScriptTask_0uu3j3h"> + <dc:Bounds x="967" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="CallActivity_1qs8xd5_di" bpmnElement="CallActivity_1qs8xd5"> + <dc:Bounds x="1136" y="165" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ScriptTask_1e5ysya_di" bpmnElement="ScriptTask_1e5ysya"> + <dc:Bounds x="1592" y="391" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_016vi3s_di" bpmnElement="SequenceFlow_016vi3s"> + <di:waypoint x="1692" y="431" /> + <di:waypoint x="1781" y="431" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="CallActivity_1rfnoe2_di" bpmnElement="CallActivity_1rfnoe2"> + <dc:Bounds x="1781" y="391" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0a5f5y6_di" bpmnElement="SequenceFlow_0a5f5y6"> + <di:waypoint x="1881" y="431" /> + <di:waypoint x="1968" y="431" /> + <di:waypoint x="1968" y="573" /> + <di:waypoint x="1881" y="573" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1utpplq_di" bpmnElement="SequenceFlow_1utpplq"> + <di:waypoint x="694" y="205" /> + <di:waypoint x="796" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1jnsyix_di" bpmnElement="SequenceFlow_1jnsyix"> + <di:waypoint x="1067" y="205" /> + <di:waypoint x="1136" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_041f5ne_di" bpmnElement="SequenceFlow_041f5ne"> + <di:waypoint x="1236" y="205" /> + <di:waypoint x="1322" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_1skfk7w_di" bpmnElement="ExclusiveGateway_1skfk7w" isMarkerVisible="true"> + <dc:Bounds x="796" y="180" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0wy6oag_di" bpmnElement="SequenceFlow_0wy6oag"> + <di:waypoint x="846" y="205" /> + <di:waypoint x="967" y="205" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0hnsycl_di" bpmnElement="SequenceFlow_0hnsycl"> + <di:waypoint x="821" y="180" /> + <di:waypoint x="821" y="90" /> + <di:waypoint x="1831" y="90" /> + <di:waypoint x="1831" y="187" /> + </bpmndi:BPMNEdge> + </bpmndi:BPMNPlane> + </bpmndi:BPMNDiagram> +</bpmn:definitions> |