diff options
author | hetengjiao <hetengjiao@chinamobile.com> | 2020-09-25 16:17:33 +0800 |
---|---|---|
committer | hetengjiao <hetengjiao@chinamobile.com> | 2020-09-25 16:18:15 +0800 |
commit | 3e4d7035ff7fc105465840bfaec14da47f64b3aa (patch) | |
tree | b2fd30b4e6d773cca3258ce91e899835318ac5a6 | |
parent | 2505a543b0e45c1c3c2fe2fb8b85664b08bf2fca (diff) |
Update NSMF workflow of allocate
Issue-ID: SO-2963
Signed-off-by: hetengjiao <hetengjiao@chinamobile.com>
Change-Id: I4ab9272501a76c93e1c56d4bf0ed646699363ecb
11 files changed, 468 insertions, 237 deletions
diff --git a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy index 44188b462b..bd70ee79b7 100644 --- a/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy +++ b/bpmn/MSOCommonBPMN/src/main/groovy/org/onap/so/bpmn/common/scripts/OofUtils.groovy @@ -23,6 +23,7 @@ package org.onap.so.bpmn.common.scripts import org.onap.so.beans.nsmf.oof.NsiReqBody +import org.onap.so.beans.nsmf.oof.NssiReqBody import org.onap.so.beans.nsmf.oof.RequestInfo import org.onap.so.beans.nsmf.oof.SubnetCapability import org.onap.so.beans.nsmf.oof.TemplateInfo @@ -661,6 +662,7 @@ return json.toString() List<SubnetCapability> subnetCapabilities, Integer timeOut){ def transactionId = requestId + String correlator = requestId logger.debug( "transactionId is: " + transactionId) String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator @@ -686,4 +688,33 @@ return json.toString() return objectMapper.writeValueAsString(nsiReqBody) } + + public <T> String buildSelectNSSIRequest(String requestId, TemplateInfo nsstInfo, String messageType, + T sliceProfile, Integer timeOut){ + + def transactionId = requestId + String correlator = requestId + logger.debug( "transactionId is: " + transactionId) + + String callbackUrl = UrnPropertiesReader.getVariable("mso.adapters.oof.callback.endpoint") + "/" + messageType + "/" + correlator + + NssiReqBody nssiReqBody = new NssiReqBody() + + RequestInfo requestInfo = new RequestInfo() + requestInfo.setRequestId(requestId) + requestInfo.setTransactionId(transactionId) + requestInfo.setCallbackUrl(callbackUrl) + requestInfo.setSourceId("so") + requestInfo.setTimeout(timeOut) + //requestInfo.setNumSolutions() + + nssiReqBody.setRequestInfo(requestInfo) + nssiReqBody.setSliceProfile(sliceProfile) + nssiReqBody.setNSSTInfo(nsstInfo) + + + ObjectMapper objectMapper = new ObjectMapper() + + return objectMapper.writeValueAsString(nssiReqBody) + } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy index c497fc4517..d0c189cb04 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy @@ -20,7 +20,8 @@ package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.isBlank +import org.onap.so.beans.nsmf.oof.SubnetType +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import javax.ws.rs.NotFoundException import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution @@ -49,8 +50,9 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import org.slf4j.Logger import org.slf4j.LoggerFactory +import static org.apache.commons.lang3.StringUtils.isBlank -class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor{ +class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ private static final Logger logger = LoggerFactory.getLogger(DoAllocateNSIandNSSI.class); @@ -338,6 +340,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi execution.setVariable("AnAllocateNssiNbiRequest", nbiRequest) execution.setVariable("anBHSliceTaskInfo", sliceTaskInfo) + execution.setVariable("anSubnetType", SubnetType.AN_NF) } @@ -384,7 +387,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi } /** - * create An Slice Profile + * create Cn Slice Profile * @param execution */ void createCnSliceProfile(DelegateExecution execution) { @@ -426,7 +429,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi AllocateCnNssi allocateCnNssi = new AllocateCnNssi() allocateCnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID - allocateCnNssi.nssiId = sliceTaskInfo.NSSTInfo.UUID + allocateCnNssi.nssiId = sliceTaskInfo.suggestNssiId allocateCnNssi.nssiName = sliceTaskInfo.NSSTInfo.name allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile allocateCnNssi.nsiInfo.nsiId = sliceParams.suggestNsiId @@ -446,6 +449,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi serviceInfo.nsiId = sliceParams.suggestNsiId serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID + serviceInfo.nssiId = sliceTaskInfo.suggestNssiId //if shared nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) @@ -453,6 +457,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi execution.setVariable("CnAllocateNssiNbiRequest", nbiRequest) execution.setVariable("cnSliceTaskInfo", sliceTaskInfo) + execution.setVariable("cnSubnetType", SubnetType.CN) } @@ -501,7 +506,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi } /** - * create An Slice Profile + * create Tn Slice Profile * @param execution */ void createTnBHSliceProfile(DelegateExecution execution) { @@ -542,6 +547,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi AllocateTnNssi allocateTnNssi = new AllocateTnNssi() //todo: AllocateTnNssi + //todo: endpointId -> set into tn allocateTnNssi.setTransportSliceNetworks() allocateTnNssi.setNetworkSliceInfos() @@ -561,6 +567,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi serviceInfo.nsiId = sliceParams.suggestNsiId serviceInfo.serviceInvariantUuid = sliceTaskInfo.NSSTInfo.invariantUUID serviceInfo.serviceUuid = sliceTaskInfo.NSSTInfo.UUID + serviceInfo.nssiId = sliceTaskInfo.suggestNssiId nbiRequest.setServiceInfo(serviceInfo) nbiRequest.setEsrInfo(esrInfo) @@ -568,6 +575,7 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi execution.setVariable("TnBHAllocateNssiNbiRequest", nbiRequest) execution.setVariable("tnBHSliceTaskInfo", sliceTaskInfo) + execution.setVariable("tnBHSubnetType", SubnetType.TN_BH) } /** @@ -586,11 +594,13 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi ResponseDescriptor result = execution.getVariable("anNssiAllocateResult") as ResponseDescriptor String nssiId = result.getNssiId() - String endPointId = result.getEndPointId() String nsiId = sliceParams.getSuggestNsiId() String sliceProfileInstanceId = sliceParams.anSliceTaskInfo.sliceInstanceId String serviceProfileInstanceId = sliceParams.serviceId //nsi id + //todo: aai -> nssi -> relationship -> endpointId -> set into tn + String endPointId = getEndpointIdFromAAI(execution, nssiId) + execution.setVariable("endPointIdAn", endPointId) updateRelationship(execution, nsiId, nssiId) @@ -598,8 +608,8 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi updateRelationship(execution, sliceProfileInstanceId, nssiId) - updateRelationship(execution, sliceProfileInstanceId, endPointId) - + sliceParams.anSliceTaskInfo.suggestNssiId = nssiId + execution.setVariable("sliceTaskParams", sliceParams) } @@ -622,6 +632,9 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi String sliceProfileInstanceId = sliceParams.cnSliceTaskInfo.sliceInstanceId String serviceProfileInstanceId = sliceParams.serviceId //nsi id + //todo: aai -> nssi -> relationship -> endpointId -> set into tn + String endPointId = getEndpointIdFromAAI(execution, nssiId) + execution.setVariable("endPointIdCn", endPointId) updateRelationship(execution, nsiId, nssiId) @@ -629,7 +642,58 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi updateRelationship(execution,sliceProfileInstanceId, nssiId) + sliceParams.cnSliceTaskInfo.suggestNssiId = nssiId + execution.setVariable("sliceTaskParams", sliceParams) + } + /** + * get endpoint Id from AAI by nssi id + * @param execution + * @param nssiId + * @return + */ + private String getEndpointIdFromAAI(DelegateExecution execution, String nssiId) { + logger.debug("Enter update relationship in DoAllocateNSIandNSSI()") + //todo: allottedResourceId + + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + //sliceParams.setServiceId(nsiServiceInstanceID) + AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(nssiId)) + + String endpointId = null + + try { + AAIResultWrapper wrapper = client.get(nsiServiceUri, NotFoundException.class) + Optional<ServiceInstance> si = wrapper.asBean(ServiceInstance.class) + //todo: if exists + if (!si.ifPresent()) { + String msg = "NSSI in the option doesn't exist. " + nssiId + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + if (si.ifPresent()) { + ServiceInstance nssiInstance = si.get() + //todo: handle relationship and return endpointId + for (Relationship relationship : nssiInstance.relationshipList.getRelationship()) { + if (relationship.relationshipLabel){ + endpointId = relationship //todo + } + } + + return endpointId + } + + }catch(BpmnError e) { + throw e + }catch (Exception ex){ + String msg = "NSSI suggested in the option doesn't exist. " + nssiId + logger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug("Exit update relationship in DoAllocateNSIandNSSI()") } /** @@ -656,6 +720,9 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId) updateRelationship(execution,sliceProfileInstanceId, nssiId) + + sliceParams.tnBHSliceTaskInfo.suggestNssiId = nssiId + execution.setVariable("sliceTaskParams", sliceParams) } /** 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 index 35f725738d..88014e7b54 100644 --- 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 @@ -1,6 +1,7 @@ package org.onap.so.bpmn.infrastructure.scripts import com.fasterxml.jackson.databind.ObjectMapper +import org.apache.commons.lang3.StringUtils import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.beans.nsmf.EsrInfo import org.onap.so.beans.nsmf.NssiResponse @@ -8,24 +9,16 @@ import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest import org.onap.so.beans.nsmf.ResponseDescriptor import org.onap.so.beans.nsmf.ServiceInfo import org.onap.so.beans.nsmf.SliceTaskInfo +import org.onap.so.beans.nsmf.SliceTaskParamsAdapter +import org.onap.so.beans.nsmf.oof.SubnetType import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.NssmfAdapterUtils -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.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.AAIResourcesClient -import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory -import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder -import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.http.ResponseEntity -import static org.apache.commons.lang3.StringUtils.isBlank class DoAllocateNSSI extends AbstractServiceTaskProcessor { @@ -49,13 +42,15 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor { NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest - //SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo + execution.setVariable("currentCycle", 0) boolean isNSIOptionAvailable = execution.getVariable("isNSIOptionAvailable") as Boolean - if (isNSIOptionAvailable) { - nbiRequest.serviceInfo.setActionType("modify") - } else { + if (!isNSIOptionAvailable) { nbiRequest.serviceInfo.setActionType("allocate") + } else if (StringUtils.isBlank(nbiRequest.serviceInfo.nssiId)){ + nbiRequest.serviceInfo.setActionType("allocate") + } else { + nbiRequest.serviceInfo.setActionType("modify") } execution.setVariable("nbiRequest", nbiRequest) logger.trace("Exit preProcessRequest") @@ -111,11 +106,67 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor { } void prepareUpdateOrchestrationTask(DelegateExecution execution) { - //todo;update orchestration task + logger.debug("Start prepareUpdateOrchestrationTask progress") + String requestMethod = "PUT" + + SliceTaskParamsAdapter sliceParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + ResponseDescriptor response = execution.getVariable("nssiAllocateResult") as ResponseDescriptor + SubnetType subnetType = execution.getVariable("subnetType") as SubnetType + + + SliceTaskInfo sliceTaskInfo = execution.getVariable("sliceTaskInfo") as SliceTaskInfo + sliceTaskInfo.progress = response.getProgress() + sliceTaskInfo.status = response.getStatus() + sliceTaskInfo.statusDescription = response.getStatusDescription() + updateNssiResult(sliceParams, subnetType, sliceTaskInfo) + + String paramJson = sliceParams.convertToJson() + execution.setVariable("CSSOT_paramJson", paramJson) + execution.setVariable("CSSOT_requestMethod", requestMethod) + + execution.setVariable("sliceTaskParams", sliceParams) + execution.setVariable("sliceTaskInfo", sliceTaskInfo) + logger.debug("Finish prepareUpdateOrchestrationTask progress") + } + + private void updateNssiResult(SliceTaskParamsAdapter sliceTaskParams, SubnetType subnetType, + SliceTaskInfo sliceTaskInfo) { + switch (subnetType) { + case SubnetType.CN: + sliceTaskParams.cnSliceTaskInfo = sliceTaskInfo + break + case SubnetType.AN_NF: + sliceTaskParams.anSliceTaskInfo = sliceTaskInfo + break + case SubnetType.TN_BH: + sliceTaskParams.tnBHSliceTaskInfo = sliceTaskInfo + break + case SubnetType.TN_FH: + sliceTaskParams.tnFHSliceTaskInfo = sliceTaskInfo + break + case SubnetType.TN_MH: + sliceTaskParams.tnMHSliceTaskInfo = sliceTaskInfo + break + } } void timeDelay(DelegateExecution execution) { - //todo: time delay + logger.trace("Enter timeDelay in DoAllocateNSSI()") + try { + Thread.sleep(60000) + int currentCycle = execution.getVariable("currentCycle") as Integer + 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()") } } 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 index 161b92080b..079a31be94 100644 --- 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 @@ -27,7 +27,6 @@ import org.onap.so.beans.nsmf.CnSliceProfile import org.onap.so.beans.nsmf.EsrInfo import org.onap.so.beans.nsmf.NetworkType import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest -import org.onap.so.beans.nsmf.SliceTaskParams import org.onap.so.beans.nsmf.SliceTaskParamsAdapter import org.onap.so.beans.nsmf.TnSliceProfile import org.onap.so.beans.nsmf.oof.SubnetCapability @@ -42,15 +41,6 @@ import org.onap.so.bpmn.core.domain.AllottedResource 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.aaiclient.client.aai.AAIObjectType -import org.onap.aaiclient.client.aai.AAIResourcesClient -import org.onap.aaiclient.client.aai.entities.AAIResultWrapper -import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri -import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory -import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder -import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.http.ResponseEntity @@ -181,7 +171,6 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ * @param execution */ public void handleNsstByType(DelegateExecution execution) { - //todo: set to sliceTaskParams by type SliceTaskParamsAdapter sliceParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter @@ -194,11 +183,8 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ for (ServiceDecomposition serviceDecomposition : nsstServiceDecompositions) { - //todo: SubnetCapability subnetCapability = new SubnetCapability() - handleByType(execution, serviceDecomposition, sliceParams, subnetCapability) - subnetCapabilities.add(subnetCapability) } @@ -511,82 +497,182 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter //todo + boolean needCnNssiSelection = execution.getVariable("NEED_CN_NSSI_SELECTION") as Boolean + boolean needAnNssiSelection = execution.getVariable("NEED_AN_NSSI_SELECTION") as Boolean + boolean needTnNssiSelection = execution.getVariable("NEED_TN_NSSI_SELECTION") as Boolean + + /** + * [ + * { + * "subType": subtype, + * "nsstInfo": object, + * "sliceProfile": object + * }, + * { + * "subType": subtype, + * "nsstInfo": object, + * "sliceProfile": object + * } + * ] + */ + List<Map> nssiNeedHandlerInfos = new ArrayList<>() + Map<String, Object> nssiNeedHandlerMap = new HashMap() + + //List<TemplateInfo> nssiNeedHandlers = new ArrayList<>() + //List<Object> nssiProfileNeedHandlers = new ArrayList<>() + if (needCnNssiSelection) { + nssiNeedHandlerMap.put("subnetType", sliceTaskParams.cnSliceTaskInfo.subnetType) + nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.cnSliceTaskInfo.NSSTInfo) + nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.cnSliceTaskInfo.sliceProfile) + nssiNeedHandlerInfos.add(nssiNeedHandlerMap) + } + if (needAnNssiSelection) { + nssiNeedHandlerMap.clear() + nssiNeedHandlerMap.put("subnetType", sliceTaskParams.anSliceTaskInfo.subnetType) + nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.anSliceTaskInfo.NSSTInfo) + nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.anSliceTaskInfo.sliceProfile) + nssiNeedHandlerInfos.add(nssiNeedHandlerMap) + } + if (needTnNssiSelection) { + nssiNeedHandlerMap.clear() + nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnBHSliceTaskInfo.subnetType) + nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnBHSliceTaskInfo.NSSTInfo) + nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnBHSliceTaskInfo.sliceProfile) + nssiNeedHandlerInfos.add(nssiNeedHandlerMap) + + nssiNeedHandlerMap.clear() + nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnMHSliceTaskInfo.subnetType) + nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnMHSliceTaskInfo.NSSTInfo) + nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnMHSliceTaskInfo.sliceProfile) + nssiNeedHandlerInfos.add(nssiNeedHandlerMap) + + nssiNeedHandlerMap.clear() + nssiNeedHandlerMap.put("subnetType", sliceTaskParams.tnFHSliceTaskInfo.subnetType) + nssiNeedHandlerMap.put("nsstInfo", sliceTaskParams.tnFHSliceTaskInfo.NSSTInfo) + nssiNeedHandlerMap.put("sliceProfile", sliceTaskParams.tnFHSliceTaskInfo.sliceProfile) + nssiNeedHandlerInfos.add(nssiNeedHandlerMap) + + } + + if (nssiNeedHandlerInfos.size() > 0) { + execution.setVariable("needSelectNssi", true) + execution.setVariable("currNssiIndex", 0) + execution.setVariable("nssiNeedHandlerInfos", nssiNeedHandlerInfos) + } else { + execution.setVariable("needSelectNssi", false) + } + + execution.setVariable("sliceTaskParams", sliceTaskParams) } /** - * todo: need rewrite * prepare select nssi request * @param execution */ public void preNSSIRequest(DelegateExecution execution) { + List<Map> nssiNeedHandlerInfos = + execution.getVariable("nssiNeedHandlerInfos") as List<Map> + + int currNssiIndex = execution.getVariable("currNssiIndex") as Integer + Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map + + TemplateInfo nsstInfo = nssiNeedHandlerInfo.get("nsstInfo") as TemplateInfo + Object profileInfo = nssiNeedHandlerInfo.get("sliceProfile") + String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) logger.debug( "get NSI option OOF Url: " + urlString) - boolean isNSISuggested = true - execution.setVariable("isNSISuggested", isNSISuggested) String requestId = execution.getVariable("msoRequestId") - String messageType = "NSISelectionResponse" - - Map<String, Object> profileInfo = execution.getVariable("serviceProfile") as Map - Map<String, Object> nstSolution = execution.getVariable("nstSolution") as Map - logger.debug("Get NST selection from OOF: " + nstSolution.toString()) - String nstInfo = """{ - "modelInvariantId":"${nstSolution.invariantUUID}", - "modelVersionId":"${nstSolution.UUID}", - "modelName":"${nstSolution.NSTName}" - }""" + String messageType = "NSSISelectionResponse" - execution.setVariable("nsiSelectionUrl", "/api/oof/selection/nsi/v1") - execution.setVariable("nsiSelection_messageType", messageType) - execution.setVariable("nsiSelection_correlator", requestId) + execution.setVariable("nssiSelectionUrl", "/api/oof/selection/nssi/v1") + execution.setVariable("nssiSelection_messageType", messageType) + execution.setVariable("nssiSelection_correlator", requestId) String timeout = UrnPropertiesReader.getVariable("mso.adapters.oof.timeout", execution) - execution.setVariable("nsiSelection_timeout", timeout) + execution.setVariable("nssiSelection_timeout", timeout) - //todo - String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, messageType, profileInfo) + String oofRequest = oofUtils.buildSelectNSSIRequest(requestId, nsstInfo, messageType, + profileInfo, timeout as Integer) - execution.setVariable("nsiSelection_oofRequest", oofRequest) + execution.setVariable("nssiSelection_oofRequest", oofRequest) logger.debug("Sending request to OOF: " + oofRequest) } /** * process select nssi response - * todo: unfinished * @param execution */ public void processNSSIResp(DelegateExecution execution) { - SliceTaskParams sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParams - String OOFResponse = execution.getVariable("nsiSelection_oofResponse") + List<Map> nssiNeedHandlerInfos = + execution.getVariable("nssiNeedHandlerInfos") as List<Map> + + int currNssiIndex = execution.getVariable("currNssiIndex") as Integer + Map nssiNeedHandlerInfo = nssiNeedHandlerInfos.get(currNssiIndex) as Map + SubnetType subnetType = nssiNeedHandlerInfo.get("subnetType") as SubnetType + + SliceTaskParamsAdapter sliceTaskParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + + + String OOFResponse = execution.getVariable("nssiSelection_oofResponse") logger.debug("NSI OOFResponse is: " + OOFResponse) execution.setVariable("OOFResponse", OOFResponse) //This needs to be changed to derive a value when we add policy to decide the solution options. Map<String, Object> resMap = objectMapper.readValue(OOFResponse, Map.class) List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions") - Map<String, Object> solutions = nsiSolutions.get(0) + Map<String, Object> solution = nsiSolutions.get(0) String resourceSharingLevel = execution.getVariable("resourceSharingLevel") - Boolean isSharable = resourceSharingLevel == "shared" + Boolean isSharable = resourceSharingLevel == "shared" //todo - if (solutions != null) { - if (isSharable && solutions.get("existingNSI")) { - //sharedNSISolution - //processSharedNSISolutions(solutions, execution) - } - else if(solutions.containsKey("newNSISolution")) { - //processNewNSISolutions(solutions, execution) - } + if (isSharable && solution != null) { + processNssiResult(sliceTaskParams, subnetType, solution) } + execution.setVariable("sliceTaskParams", sliceTaskParams) - logger.debug("sliceTaskParams: "+sliceTaskParams.convertToJson()) + //logger.debug("sliceTaskParams: "+ sliceTaskParams.convertToJson()) logger.debug("*** Completed options Call to OOF ***") logger.debug("start parseServiceProfile") //parseServiceProfile(execution) logger.debug("end parseServiceProfile") + + if (currNssiIndex >= nssiNeedHandlerInfos.size() - 1) { + execution.setVariable("needSelectNssi", false) + } else { + execution.setVariable("currNssiIndex", currNssiIndex + 1) + execution.setVariable("needSelectNssi", true) + } + } + private void processNssiResult(SliceTaskParamsAdapter sliceTaskParams, SubnetType subnetType, + Map<String, Object> solution) { + switch (subnetType) { + case SubnetType.CN: + sliceTaskParams.cnSliceTaskInfo.suggestNssiId = solution.get("NSSIId") + sliceTaskParams.cnSliceTaskInfo.suggestNssiName = solution.get("NSSIName") + break + case SubnetType.AN_NF: + sliceTaskParams.anSliceTaskInfo.suggestNssiId = solution.get("NSSIId") + sliceTaskParams.anSliceTaskInfo.suggestNssiName = solution.get("NSSIName") + break + case SubnetType.TN_BH: + sliceTaskParams.tnBHSliceTaskInfo.suggestNssiId = solution.get("NSSIId") + sliceTaskParams.tnBHSliceTaskInfo.suggestNssiName = solution.get("NSSIName") + break + case SubnetType.TN_FH: + sliceTaskParams.tnFHSliceTaskInfo.suggestNssiId = solution.get("NSSIId") + sliceTaskParams.tnFHSliceTaskInfo.suggestNssiName = solution.get("NSSIName") + break + case SubnetType.TN_MH: + sliceTaskParams.tnMHSliceTaskInfo.suggestNssiId = solution.get("NSSIId") + sliceTaskParams.tnMHSliceTaskInfo.suggestNssiName = solution.get("NSSIName") + break + } + } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn index 60d7355a9c..9656c86ae5 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSliceService.bpmn @@ -42,6 +42,8 @@ css.processUserOptions(execution)</bpmn:script> <camunda:out source="rolledBack" target="rolledBack" /> <camunda:out source="serviceInstanceData" target="serviceInstanceData" /> <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:out source="sliceTaskParams" target="sliceTaskParams" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1dfon41</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0jhqtls</bpmn:outgoing> @@ -278,6 +280,7 @@ css.prepareUpdateOrchestrationTask(execution)</bpmn:script> <camunda:out source="rollbackData" target="rollbackData" /> <camunda:out source="rolledBack" target="rolledBack" /> <camunda:in source="allottedResourceId" target="allottedResourceId" /> + <camunda:out source="sliceTaskParams" target="sliceTaskParams" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_1bevt3a</bpmn:incoming> <bpmn:outgoing>SequenceFlow_0mlrlbv</bpmn:outgoing> 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 index e42f001012..9090bf2fab 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSIandNSSI.bpmn @@ -58,19 +58,11 @@ dcnsio.createNSIinAAI(execution)</bpmn:script> <bpmn:callActivity id="CallActivity_1yh9tiq" name="Call DoAllocateNSSI(RAN)" 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" /> @@ -80,6 +72,8 @@ dcnsio.createNSIinAAI(execution)</bpmn:script> <camunda:in source="anSliceTaskInfo" target="sliceTaskInfo" /> <camunda:out source="nssiAllocateResult" target="anNssiAllocateResult" /> <camunda:in source="AnAllocateNssiNbiRequest" target="nbiRequest" /> + <camunda:out source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="anSubnetType" target="subnetType" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0npsyye</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1xb5nx1</bpmn:outgoing> @@ -88,19 +82,11 @@ dcnsio.createNSIinAAI(execution)</bpmn:script> <bpmn:callActivity id="CallActivity_1ixah3o" name="Call DoAllocateNSSI(Core)" 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" /> @@ -111,6 +97,8 @@ dcnsio.createNSIinAAI(execution)</bpmn:script> <camunda:in source="domainType" target="domainType" /> <camunda:out source="nssiAllocateResult" target="cnNssiAllocateResult" /> <camunda:in source="CnAllocateNssiNbiRequest" target="nbiRequest" /> + <camunda:out source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="cnSubnetType" target="subnetType" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0cwbtmr</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1l74seh</bpmn:outgoing> @@ -185,19 +173,11 @@ dcnsio.createTnBHSliceProfile(execution)</bpmn:script> <bpmn:callActivity id="CallActivity_0b28wlb" name="Call DoAllocateNSSI(TN)" 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" /> @@ -207,6 +187,8 @@ dcnsio.createTnBHSliceProfile(execution)</bpmn:script> <camunda:in source="tnBHSliceTaskInfo" target="sliceTaskInfo" /> <camunda:out source="nssiAllocateResult" target="tnBHNssiAllocateResult" /> <camunda:in source="TnBHAllocateNssiNbiRequest" target="nbiRequest" /> + <camunda:out source="sliceTaskParams" target="sliceTaskParams" /> + <camunda:in source="tnBHSubnetType" target="subnetType" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_01isn2q</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1omynpt</bpmn:outgoing> @@ -279,7 +261,7 @@ dcnsio.prepareAllocateTnBHNssi(execution)</bpmn:script> </bpmn:process> <bpmn:message id="Message_1i10pf1" name="Message_2mc69tg" /> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSIV2"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSIandNSSI"> <bpmndi:BPMNShape id="StartEvent_1ym3sha_di" bpmnElement="StartEvent_1ym3sha"> <dc:Bounds x="138" y="122" width="36" height="36" /> <bpmndi:BPMNLabel> 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 index 6e94538775..58795056d4 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoAllocateNSSI.bpmn @@ -76,7 +76,7 @@ dcnssi.timeDelay(execution)</bpmn:script> </bpmn:endEvent> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSIV2"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoAllocateNSSI"> <bpmndi:BPMNShape id="StartEvent_0zs8ezi_di" bpmnElement="StartEvent_0zs8ezi"> <dc:Bounds x="147" y="112" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -155,4 +155,4 @@ dcnssi.timeDelay(execution)</bpmn:script> </bpmndi:BPMNShape> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn index 0345ea7a9f..9d47888b14 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceInstance.bpmn @@ -135,4 +135,4 @@ dcsi.prepareDecomposeService(execution)</bpmn:script> </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> -</bpmn:definitions> +</bpmn:definitions>
\ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn index 045d88daa9..b16ceee0d3 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateSliceServiceOption.bpmn @@ -29,43 +29,19 @@ dcso.processDecompositionNST(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:sequenceFlow id="SequenceFlow_1kzy63m" sourceRef="ScriptTask_11rb2ju" targetRef="CallActivity_0c567r4" /> <bpmn:sequenceFlow id="SequenceFlow_1t317y2" sourceRef="CallActivity_0c567r4" targetRef="ScriptTask_0z0dwk2" /> - <bpmn:parallelGateway id="ParallelGateway_05zg916"> - <bpmn:incoming>SequenceFlow_1h3kdce</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_05250mp</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0euwvgf</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_0il5j01</bpmn:outgoing> - </bpmn:parallelGateway> - <bpmn:parallelGateway id="ParallelGateway_06a2n9u"> - <bpmn:incoming>SequenceFlow_14rhmx9</bpmn:incoming> - <bpmn:incoming>SequenceFlow_103oxyw</bpmn:incoming> - <bpmn:incoming>SequenceFlow_0aasemn</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1tr3i9d</bpmn:outgoing> - </bpmn:parallelGateway> - <bpmn:callActivity id="CallActivity_0tzazs0" name="Handle NSST Selection OOF request" calledElement="DoHandleOofRequest"> + <bpmn:callActivity id="CallActivity_0tzazs0" name="Handle NSSI Selection OOF request" calledElement="DoHandleOofRequest"> <bpmn:extensionElements> - <camunda:in source="nstSelectionUrl" target="apiPath" /> - <camunda:in source="nstSelection_correlator" target="correlator" /> - <camunda:in source="nstSelection_messageType" target="messageType" /> - <camunda:in source="nstSelection_timeout" target="timeout" /> + <camunda:in source="nssiSelectionUrl" target="apiPath" /> + <camunda:in source="nssiSelection_correlator" target="correlator" /> + <camunda:in source="nssiSelection_messageType" target="messageType" /> + <camunda:in source="nssiSelection_timeout" target="timeout" /> <camunda:out source="WorkflowException" target="WorkflowException" /> - <camunda:out source="asyncCallbackResponse" target="nstSelection_oofResponse" /> - <camunda:in source="nstSelection_oofRequest" target="oofRequest" /> + <camunda:out source="asyncCallbackResponse" target="nssiSelection_oofResponse" /> + <camunda:in source="nssiSelection_oofRequest" target="oofRequest" /> </bpmn:extensionElements> <bpmn:incoming>SequenceFlow_0abqxa1</bpmn:incoming> <bpmn:outgoing>SequenceFlow_1tqg26p</bpmn:outgoing> </bpmn:callActivity> - <bpmn:sequenceFlow id="SequenceFlow_05250mp" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_1vzxvna" /> - <bpmn:sequenceFlow id="SequenceFlow_14rhmx9" sourceRef="CallActivity_1vzxvna" targetRef="ParallelGateway_06a2n9u" /> - <bpmn:sequenceFlow id="SequenceFlow_0euwvgf" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0melx8d" /> - <bpmn:sequenceFlow id="SequenceFlow_103oxyw" sourceRef="CallActivity_0melx8d" targetRef="ParallelGateway_06a2n9u" /> - <bpmn:sequenceFlow id="SequenceFlow_0il5j01" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0otry7e" /> - <bpmn:sequenceFlow id="SequenceFlow_0aasemn" sourceRef="CallActivity_0otry7e" targetRef="ParallelGateway_06a2n9u" /> - <bpmn:sequenceFlow id="SequenceFlow_1tr3i9d" sourceRef="ParallelGateway_06a2n9u" targetRef="Task_1jyj2vs" /> - <bpmn:sequenceFlow id="SequenceFlow_0abqxa1" sourceRef="Task_1m9qoo3" targetRef="CallActivity_0tzazs0" /> - <bpmn:sequenceFlow id="SequenceFlow_1tqg26p" sourceRef="CallActivity_0tzazs0" targetRef="Task_00nfg5x" /> - <bpmn:endEvent id="EndEvent_0p0cjhl"> - <bpmn:incoming>SequenceFlow_1nrfy6i</bpmn:incoming> - </bpmn:endEvent> <bpmn:startEvent id="StartEvent_0mwlirs" name="Start"> <bpmn:outgoing>SequenceFlow_1fuwy35</bpmn:outgoing> </bpmn:startEvent> @@ -107,30 +83,11 @@ dcso.preNSSIRequest(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:scriptTask id="Task_00nfg5x" name="Process NSST Solutions" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_1tqg26p</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1i3j8c3</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1ezi1oi</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcso = new DoCreateSliceServiceOption() dcso.processNSSIResp(execution)</bpmn:script> </bpmn:scriptTask> - <bpmn:exclusiveGateway id="ExclusiveGateway_0b52m39" name="need select nssi?" default="SequenceFlow_1nrfy6i"> - <bpmn:incoming>SequenceFlow_1tey3hz</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_126j77n</bpmn:outgoing> - <bpmn:outgoing>SequenceFlow_1nrfy6i</bpmn:outgoing> - </bpmn:exclusiveGateway> - <bpmn:sequenceFlow id="SequenceFlow_126j77n" name="yes" sourceRef="ExclusiveGateway_0b52m39" targetRef="Task_1m9qoo3"> - <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("nssmfOperation" ) == "update")}</bpmn:conditionExpression> - </bpmn:sequenceFlow> - <bpmn:sequenceFlow id="SequenceFlow_1nrfy6i" sourceRef="ExclusiveGateway_0b52m39" targetRef="EndEvent_0p0cjhl" /> - <bpmn:sequenceFlow id="SequenceFlow_1i3j8c3" sourceRef="Task_00nfg5x" targetRef="Task_1jyj2vs" /> - <bpmn:sequenceFlow id="SequenceFlow_1tey3hz" sourceRef="Task_1jyj2vs" targetRef="ExclusiveGateway_0b52m39" /> - <bpmn:scriptTask id="Task_1jyj2vs" name="handle Nssi select " scriptFormat="groovy"> - <bpmn:incoming>SequenceFlow_1tr3i9d</bpmn:incoming> - <bpmn:incoming>SequenceFlow_1i3j8c3</bpmn:incoming> - <bpmn:outgoing>SequenceFlow_1tey3hz</bpmn:outgoing> - <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* -def dcso = new DoCreateSliceServiceOption() -dcso.handleNssiSelect(execution)</bpmn:script> - </bpmn:scriptTask> <bpmn:scriptTask id="ScriptTask_12sydez" name="prepare NSST decomposition" scriptFormat="groovy"> <bpmn:incoming>SequenceFlow_0zglfyw</bpmn:incoming> <bpmn:incoming>SequenceFlow_0t4gmix</bpmn:incoming> @@ -215,10 +172,53 @@ dcso.preNSIRequest(execution)</bpmn:script> <bpmn:sequenceFlow id="SequenceFlow_14o0fxe" sourceRef="ScriptTask_0bgvphs" targetRef="CallActivity_0vs5jgq" /> <bpmn:sequenceFlow id="SequenceFlow_0nwt0ci" sourceRef="CallActivity_0vs5jgq" targetRef="ScriptTask_12t6v71" /> <bpmn:sequenceFlow id="SequenceFlow_1iawj3m" sourceRef="IntermediateCatchEvent_00uke3g" targetRef="ScriptTask_0bgvphs" /> + <bpmn:scriptTask id="Task_1jyj2vs" name="handle Nssi select " scriptFormat="groovy"> + <bpmn:incoming>SequenceFlow_1tr3i9d</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1tey3hz</bpmn:outgoing> + <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* +def dcso = new DoCreateSliceServiceOption() +dcso.handleNssiSelect(execution)</bpmn:script> + </bpmn:scriptTask> + <bpmn:parallelGateway id="ParallelGateway_06a2n9u"> + <bpmn:incoming>SequenceFlow_0aasemn</bpmn:incoming> + <bpmn:incoming>SequenceFlow_103oxyw</bpmn:incoming> + <bpmn:incoming>SequenceFlow_14rhmx9</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_1tr3i9d</bpmn:outgoing> + </bpmn:parallelGateway> + <bpmn:sequenceFlow id="SequenceFlow_1tr3i9d" sourceRef="ParallelGateway_06a2n9u" targetRef="Task_1jyj2vs" /> + <bpmn:sequenceFlow id="SequenceFlow_0aasemn" sourceRef="CallActivity_0otry7e" targetRef="ParallelGateway_06a2n9u" /> + <bpmn:sequenceFlow id="SequenceFlow_103oxyw" sourceRef="CallActivity_0melx8d" targetRef="ParallelGateway_06a2n9u" /> + <bpmn:sequenceFlow id="SequenceFlow_14rhmx9" sourceRef="CallActivity_1vzxvna" targetRef="ParallelGateway_06a2n9u" /> + <bpmn:parallelGateway id="ParallelGateway_05zg916"> + <bpmn:incoming>SequenceFlow_1h3kdce</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_0il5j01</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_0euwvgf</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_05250mp</bpmn:outgoing> + </bpmn:parallelGateway> + <bpmn:sequenceFlow id="SequenceFlow_0il5j01" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0otry7e" /> + <bpmn:sequenceFlow id="SequenceFlow_0euwvgf" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_0melx8d" /> + <bpmn:sequenceFlow id="SequenceFlow_05250mp" sourceRef="ParallelGateway_05zg916" targetRef="CallActivity_1vzxvna" /> <bpmn:sequenceFlow id="SequenceFlow_1h3kdce" sourceRef="ScriptTask_12t6v71" targetRef="ParallelGateway_05zg916" /> + <bpmn:sequenceFlow id="SequenceFlow_1tqg26p" sourceRef="CallActivity_0tzazs0" targetRef="Task_00nfg5x" /> + <bpmn:sequenceFlow id="SequenceFlow_1tey3hz" sourceRef="Task_1jyj2vs" targetRef="ExclusiveGateway_0b52m39" /> + <bpmn:sequenceFlow id="SequenceFlow_0abqxa1" sourceRef="Task_1m9qoo3" targetRef="CallActivity_0tzazs0" /> + <bpmn:exclusiveGateway id="ExclusiveGateway_0b52m39" name="need select nssi?" default="SequenceFlow_1nrfy6i"> + <bpmn:incoming>SequenceFlow_1tey3hz</bpmn:incoming> + <bpmn:incoming>SequenceFlow_1ezi1oi</bpmn:incoming> + <bpmn:outgoing>SequenceFlow_126j77n</bpmn:outgoing> + <bpmn:outgoing>SequenceFlow_1nrfy6i</bpmn:outgoing> + </bpmn:exclusiveGateway> + <bpmn:sequenceFlow id="SequenceFlow_126j77n" name="yes" sourceRef="ExclusiveGateway_0b52m39" targetRef="Task_1m9qoo3"> + <bpmn:conditionExpression xsi:type="bpmn:tFormalExpression">#{(execution.getVariable("needSelectNssi" ) == true)}</bpmn:conditionExpression> + </bpmn:sequenceFlow> + <bpmn:endEvent id="EndEvent_0p0cjhl"> + <bpmn:incoming>SequenceFlow_1nrfy6i</bpmn:incoming> + </bpmn:endEvent> + <bpmn:sequenceFlow id="SequenceFlow_1nrfy6i" sourceRef="ExclusiveGateway_0b52m39" targetRef="EndEvent_0p0cjhl" /> + <bpmn:sequenceFlow id="SequenceFlow_1ezi1oi" sourceRef="Task_00nfg5x" targetRef="ExclusiveGateway_0b52m39" /> </bpmn:process> <bpmndi:BPMNDiagram id="BPMNDiagram_1"> - <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOptionV2"> + <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoCreateSliceServiceOption"> <bpmndi:BPMNShape id="ScriptTask_11rb2ju_di" bpmnElement="ScriptTask_11rb2ju"> <dc:Bounds x="400" y="140" width="100" height="80" /> </bpmndi:BPMNShape> @@ -236,58 +236,9 @@ dcso.preNSIRequest(execution)</bpmn:script> <di:waypoint x="660" y="180" /> <di:waypoint x="710" y="180" /> </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ParallelGateway_05zg916_di" bpmnElement="ParallelGateway_05zg916"> - <dc:Bounds x="635" y="475" width="50" height="50" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ParallelGateway_06a2n9u_di" bpmnElement="ParallelGateway_06a2n9u"> - <dc:Bounds x="905" y="475" width="50" height="50" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="CallActivity_0tzazs0_di" bpmnElement="CallActivity_0tzazs0"> <dc:Bounds x="1410" y="320" width="100" height="80" /> </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_05250mp_di" bpmnElement="SequenceFlow_05250mp"> - <di:waypoint x="660" y="475" /> - <di:waypoint x="660" y="360" /> - <di:waypoint x="740" y="360" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_14rhmx9_di" bpmnElement="SequenceFlow_14rhmx9"> - <di:waypoint x="840" y="360" /> - <di:waypoint x="930" y="360" /> - <di:waypoint x="930" y="475" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0euwvgf_di" bpmnElement="SequenceFlow_0euwvgf"> - <di:waypoint x="685" y="500" /> - <di:waypoint x="740" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_103oxyw_di" bpmnElement="SequenceFlow_103oxyw"> - <di:waypoint x="840" y="500" /> - <di:waypoint x="905" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0il5j01_di" bpmnElement="SequenceFlow_0il5j01"> - <di:waypoint x="660" y="525" /> - <di:waypoint x="660" y="620" /> - <di:waypoint x="740" y="620" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0aasemn_di" bpmnElement="SequenceFlow_0aasemn"> - <di:waypoint x="840" y="620" /> - <di:waypoint x="930" y="620" /> - <di:waypoint x="930" y="525" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1tr3i9d_di" bpmnElement="SequenceFlow_1tr3i9d"> - <di:waypoint x="955" y="500" /> - <di:waypoint x="1010" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_0abqxa1_di" bpmnElement="SequenceFlow_0abqxa1"> - <di:waypoint x="1460" y="460" /> - <di:waypoint x="1460" y="400" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1tqg26p_di" bpmnElement="SequenceFlow_1tqg26p"> - <di:waypoint x="1410" y="360" /> - <di:waypoint x="1110" y="360" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="EndEvent_0p0cjhl_di" bpmnElement="EndEvent_0p0cjhl"> - <dc:Bounds x="1442" y="602" width="36" height="36" /> - </bpmndi:BPMNShape> <bpmndi:BPMNShape id="StartEvent_0mwlirs_di" bpmnElement="StartEvent_0mwlirs"> <dc:Bounds x="162" y="162" width="36" height="36" /> <bpmndi:BPMNLabel> @@ -314,36 +265,7 @@ dcso.preNSIRequest(execution)</bpmn:script> <dc:Bounds x="1410" y="460" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_0aqbm7t_di" bpmnElement="Task_00nfg5x"> - <dc:Bounds x="1010" y="320" width="100" height="80" /> - </bpmndi:BPMNShape> - <bpmndi:BPMNShape id="ExclusiveGateway_0b52m39_di" bpmnElement="ExclusiveGateway_0b52m39" isMarkerVisible="true"> - <dc:Bounds x="1235" y="475" width="50" height="50" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1218" y="463" width="85" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNShape> - <bpmndi:BPMNEdge id="SequenceFlow_126j77n_di" bpmnElement="SequenceFlow_126j77n"> - <di:waypoint x="1285" y="500" /> - <di:waypoint x="1410" y="500" /> - <bpmndi:BPMNLabel> - <dc:Bounds x="1339" y="482" width="17" height="14" /> - </bpmndi:BPMNLabel> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1nrfy6i_di" bpmnElement="SequenceFlow_1nrfy6i"> - <di:waypoint x="1260" y="525" /> - <di:waypoint x="1260" y="620" /> - <di:waypoint x="1442" y="620" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1i3j8c3_di" bpmnElement="SequenceFlow_1i3j8c3"> - <di:waypoint x="1060" y="400" /> - <di:waypoint x="1060" y="460" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNEdge id="SequenceFlow_1tey3hz_di" bpmnElement="SequenceFlow_1tey3hz"> - <di:waypoint x="1110" y="500" /> - <di:waypoint x="1235" y="500" /> - </bpmndi:BPMNEdge> - <bpmndi:BPMNShape id="ScriptTask_0h3fsja_di" bpmnElement="Task_1jyj2vs"> - <dc:Bounds x="1010" y="460" width="100" height="80" /> + <dc:Bounds x="1210" y="320" width="100" height="80" /> </bpmndi:BPMNShape> <bpmndi:BPMNShape id="ScriptTask_12sydez_di" bpmnElement="ScriptTask_12sydez"> <dc:Bounds x="860" y="140" width="100" height="80" /> @@ -420,10 +342,87 @@ dcso.preNSIRequest(execution)</bpmn:script> <di:waypoint x="178" y="500" /> <di:waypoint x="210" y="500" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ScriptTask_0h3fsja_di" bpmnElement="Task_1jyj2vs"> + <dc:Bounds x="1010" y="460" width="100" height="80" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNShape id="ParallelGateway_06a2n9u_di" bpmnElement="ParallelGateway_06a2n9u"> + <dc:Bounds x="905" y="475" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1tr3i9d_di" bpmnElement="SequenceFlow_1tr3i9d"> + <di:waypoint x="955" y="500" /> + <di:waypoint x="1010" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0aasemn_di" bpmnElement="SequenceFlow_0aasemn"> + <di:waypoint x="840" y="620" /> + <di:waypoint x="930" y="620" /> + <di:waypoint x="930" y="525" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_103oxyw_di" bpmnElement="SequenceFlow_103oxyw"> + <di:waypoint x="840" y="500" /> + <di:waypoint x="905" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_14rhmx9_di" bpmnElement="SequenceFlow_14rhmx9"> + <di:waypoint x="840" y="360" /> + <di:waypoint x="930" y="360" /> + <di:waypoint x="930" y="475" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ParallelGateway_05zg916_di" bpmnElement="ParallelGateway_05zg916"> + <dc:Bounds x="635" y="475" width="50" height="50" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_0il5j01_di" bpmnElement="SequenceFlow_0il5j01"> + <di:waypoint x="660" y="525" /> + <di:waypoint x="660" y="620" /> + <di:waypoint x="740" y="620" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0euwvgf_di" bpmnElement="SequenceFlow_0euwvgf"> + <di:waypoint x="685" y="500" /> + <di:waypoint x="740" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_05250mp_di" bpmnElement="SequenceFlow_05250mp"> + <di:waypoint x="660" y="475" /> + <di:waypoint x="660" y="360" /> + <di:waypoint x="740" y="360" /> + </bpmndi:BPMNEdge> <bpmndi:BPMNEdge id="SequenceFlow_1h3kdce_di" bpmnElement="SequenceFlow_1h3kdce"> <di:waypoint x="590" y="500" /> <di:waypoint x="635" y="500" /> </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1tqg26p_di" bpmnElement="SequenceFlow_1tqg26p"> + <di:waypoint x="1410" y="360" /> + <di:waypoint x="1310" y="360" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1tey3hz_di" bpmnElement="SequenceFlow_1tey3hz"> + <di:waypoint x="1110" y="500" /> + <di:waypoint x="1235" y="500" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_0abqxa1_di" bpmnElement="SequenceFlow_0abqxa1"> + <di:waypoint x="1460" y="460" /> + <di:waypoint x="1460" y="400" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="ExclusiveGateway_0b52m39_di" bpmnElement="ExclusiveGateway_0b52m39" isMarkerVisible="true"> + <dc:Bounds x="1235" y="475" width="50" height="50" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1218" y="463" width="85" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_126j77n_di" bpmnElement="SequenceFlow_126j77n"> + <di:waypoint x="1285" y="500" /> + <di:waypoint x="1410" y="500" /> + <bpmndi:BPMNLabel> + <dc:Bounds x="1339" y="482" width="17" height="14" /> + </bpmndi:BPMNLabel> + </bpmndi:BPMNEdge> + <bpmndi:BPMNShape id="EndEvent_0p0cjhl_di" bpmnElement="EndEvent_0p0cjhl"> + <dc:Bounds x="1242" y="632" width="36" height="36" /> + </bpmndi:BPMNShape> + <bpmndi:BPMNEdge id="SequenceFlow_1nrfy6i_di" bpmnElement="SequenceFlow_1nrfy6i"> + <di:waypoint x="1260" y="525" /> + <di:waypoint x="1260" y="632" /> + </bpmndi:BPMNEdge> + <bpmndi:BPMNEdge id="SequenceFlow_1ezi1oi_di" bpmnElement="SequenceFlow_1ezi1oi"> + <di:waypoint x="1260" y="400" /> + <di:waypoint x="1260" y="475" /> + </bpmndi:BPMNEdge> </bpmndi:BPMNPlane> </bpmndi:BPMNDiagram> </bpmn:definitions> diff --git a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java index 87de04a6ee..6ad752f047 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/SliceTaskParamsAdapter.java @@ -19,12 +19,16 @@ */ package org.onap.so.beans.nsmf; -import lombok.Data; +import lombok.*; import org.onap.so.beans.nsmf.oof.TemplateInfo; import java.util.Map; @Data +@NoArgsConstructor +@AllArgsConstructor +@ToString +@Builder public class SliceTaskParamsAdapter { private static final long serialVersionUID = -7785578865170503301L; @@ -53,4 +57,10 @@ public class SliceTaskParamsAdapter { private SliceTaskInfo<CnSliceProfile> cnSliceTaskInfo; private SliceTaskInfo<AnSliceProfile> anSliceTaskInfo; + + public String convertToJson() { + SliceTaskParams sliceTaskParams = new SliceTaskParams(); + sliceTaskParams.setServiceId(serviceId); + return sliceTaskParams.convertToJson(); + } } diff --git a/common/src/main/java/org/onap/so/beans/nsmf/oof/NssiReqBody.java b/common/src/main/java/org/onap/so/beans/nsmf/oof/NssiReqBody.java index 7cfb60c113..96c5b343fd 100644 --- a/common/src/main/java/org/onap/so/beans/nsmf/oof/NssiReqBody.java +++ b/common/src/main/java/org/onap/so/beans/nsmf/oof/NssiReqBody.java @@ -19,17 +19,19 @@ */ package org.onap.so.beans.nsmf.oof; -import lombok.Data; -import org.onap.so.beans.nsmf.ServiceProfile; +import lombok.*; import java.io.Serializable; -import java.util.Map; @Data -public class NssiReqBody implements Serializable { +@NoArgsConstructor +@AllArgsConstructor +@ToString +@Builder +public class NssiReqBody<T> implements Serializable { private static final long serialVersionUID = -76327522074333341L; - private Map<String, Object> serviceProfile; + private T sliceProfile; private RequestInfo requestInfo; |