diff options
Diffstat (limited to 'bpmn')
5 files changed, 2358 insertions, 0 deletions
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/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-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> |