diff options
Diffstat (limited to 'bpmn')
7 files changed, 82 insertions, 40 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 bd70ee79b7..30cbeaf2d8 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 @@ -659,7 +659,7 @@ return json.toString() public String buildSelectNSIRequest(String requestId, TemplateInfo nstInfo, List<TemplateInfo> nsstInfo, String messageType, Map<String, Object> serviceProfile, - List<SubnetCapability> subnetCapabilities, Integer timeOut){ + List<SubnetCapability> subnetCapabilities, Integer timeOut, boolean preferReuse){ def transactionId = requestId String correlator = requestId @@ -682,7 +682,7 @@ return json.toString() nsiReqBody.setServiceProfile(serviceProfile) nsiReqBody.setSubnetCapabilities(subnetCapabilities) nsiReqBody.setNSSTInfo(nsstInfo) - + nsiReqBody.setPreferReuse(preferReuse) ObjectMapper objectMapper = new ObjectMapper() diff --git a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java index 70c78472ba..daf942605b 100644 --- a/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java +++ b/bpmn/MSOCoreBPMN/src/main/java/org/onap/so/bpmn/core/domain/ServiceDecomposition.java @@ -55,6 +55,8 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { private String serviceType; @JsonProperty("serviceRole") private String serviceRole; + @JsonProperty("serviceCategory") + private String serviceCategory; private ServiceInstance serviceInstance; private Request request; private String callbackURN; @@ -259,8 +261,17 @@ public class ServiceDecomposition extends JsonWrapper implements Serializable { this.serviceProxy = serviceProxy; } + // ***** + public String getServiceCategory() { + return serviceCategory; + } + + public void setServiceCategory(String serviceCategory) { + this.serviceCategory = serviceCategory; + } + // ***** // Access methods diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy index e253855ab3..67845910eb 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy @@ -20,7 +20,7 @@ package org.onap.so.bpmn.infrastructure.scripts -import static org.apache.commons.lang3.StringUtils.isBlank +import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.json.JSONObject @@ -44,7 +44,8 @@ import org.onap.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.web.util.UriUtils -import groovy.json.JsonSlurper + +import static org.apache.commons.lang3.StringUtils.isBlank /** * This groovy class supports the <class>DoCreateCommunicationService.bpmn</class> process. @@ -349,7 +350,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor { /** * get E2EST id through CST id and change communication profile to E2E service profile * 1. get E2EST id from cst - * 1.1 ę„source service id + * 1.1 source service id * 1.2 source service * 1.3 source service input, init e2e profile */ @@ -383,9 +384,29 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor { } } - //TODO + //TODO temp solution e2eInputMap.put("sNSSAI", execution.getVariable("sNSSAI_id")) e2eInputMap.put("sST", execution.getVariable("csServiceType")) + + Integer activityFactor = 60 + Integer random = new Random().nextInt(5) + 2 + Integer dLThptPerUE = Integer.parseInt(csInputMap.get("expDataRateDL").toString()) + Integer uLThptPerUE = Integer.parseInt(csInputMap.get("expDataRateUL").toString()) + Integer maxNumberofUEs = Integer.parseInt(csInputMap.get("maxNumberofUEs").toString()) + Integer dLThptPerSlice = dLThptPerUE * maxNumberofUEs * activityFactor * random + Integer uLThptPerSlice = uLThptPerUE * maxNumberofUEs * activityFactor * random + Integer maxNumberofConns = maxNumberofUEs * activityFactor * 3 + + e2eInputMap.put("jitter", 10) + e2eInputMap.put("activityFactor", activityFactor) + e2eInputMap.put("maxNumberofUEs", maxNumberofUEs) + e2eInputMap.put("dLThptPerUE", dLThptPerUE) + e2eInputMap.put("uLThptPerUE", uLThptPerUE) + e2eInputMap.put("dLThptPerSlice", dLThptPerSlice) + e2eInputMap.put("uLThptPerSlice", uLThptPerSlice) + e2eInputMap.put("maxNumberofConns", maxNumberofConns) + e2eInputMap.put("coverageAreaTAList", csInputMap.get("coverageAreaList")) + execution.setVariable("e2eInputMap", e2eInputMap) execution.setVariable("e2eServiceType", e2eServiceDecomposition.getServiceType()) execution.setVariable("e2eModelInvariantUuid", e2eServiceDecomposition.getModelInfo().getModelInvariantUuid()) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy index f64f5e8ebf..48e1acd523 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy @@ -132,7 +132,7 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ } - def rollbackData = execution.getVariable("RollbackData") + RollbackData rollbackData = execution.getVariable("RollbackData") if (rollbackData == null) { rollbackData = new RollbackData() } @@ -171,19 +171,15 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ serviceProfile.setCoverageAreaTAList(serviceProfileMap.get("coverageAreaTAList").toString()) serviceProfile.setUeMobilityLevel(serviceProfileMap.get("uEMobilityLevel").toString()) serviceProfile.setResourceSharingLevel(serviceProfileMap.get("resourceSharingLevel").toString()) - serviceProfile.setExpDataRateUL(Integer.parseInt(serviceProfileMap.get("expDataRateUL").toString())) - serviceProfile.setExpDataRateDL(Integer.parseInt(serviceProfileMap.get("expDataRateDL").toString())) - serviceProfile.setAreaTrafficCapUL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapUL").toString())) - serviceProfile.setAreaTrafficCapDL(Integer.parseInt(serviceProfileMap.get("areaTrafficCapDL").toString())) + serviceProfile.setDlThptPerSlice(Integer.parseInt(serviceProfileMap.get("dLThptPerSlice").toString())) + serviceProfile.setDlThptPerUE(Integer.parseInt(serviceProfileMap.get("dLThptPerUE").toString())) + serviceProfile.setUlThptPerSlice(Integer.parseInt(serviceProfileMap.get("uLThptPerSlice").toString())) + serviceProfile.setUlThptPerUE(Integer.parseInt(serviceProfileMap.get("uLThptPerUE").toString())) serviceProfile.setActivityFactor(Integer.parseInt(serviceProfileMap.get("activityFactor").toString())) - serviceProfile.setJitter(0) + serviceProfile.setJitter(Integer.parseInt(serviceProfileMap.get("jitter").toString())) serviceProfile.setSurvivalTime("0") - serviceProfile.setCsAvailability(new Object()) serviceProfile.setReliability("") - serviceProfile.setExpDataRate(0) - serviceProfile.setTrafficDensity(0) - serviceProfile.setConnDensity(0) try { AAIResourceUri uri = AAIUriFactory.createResourceUri( AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")) 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 079a31be94..8993127dbc 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 @@ -194,15 +194,12 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ private void handleByType(DelegateExecution execution, ServiceDecomposition serviceDecomposition, SliceTaskParamsAdapter sliceParams, SubnetCapability subnetCapability) { - //todo: - String domainType = "" ModelInfo modelInfo = serviceDecomposition.getModelInfo() String vendor = serviceDecomposition.getServiceRole() - SubnetType subnetType + SubnetType subnetType = convertServiceCategory(serviceDecomposition.getServiceCategory()) - switch (domainType) { - case "tn_bh": - subnetType = SubnetType.TN_BH + switch (subnetType) { + case SubnetType.TN_BH: sliceParams.tnBHSliceTaskInfo.vendor = vendor sliceParams.tnBHSliceTaskInfo.subnetType = subnetType sliceParams.tnBHSliceTaskInfo.networkType = subnetType.networkType @@ -211,8 +208,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ sliceParams.tnBHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName() break - case "tn_mh": - subnetType = SubnetType.TN_MH + case SubnetType.TN_MH: sliceParams.tnMHSliceTaskInfo.vendor = vendor sliceParams.tnMHSliceTaskInfo.subnetType = subnetType sliceParams.tnMHSliceTaskInfo.networkType = subnetType.networkType @@ -221,8 +217,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ sliceParams.tnMHSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName() break - case "an_nf": - subnetType = SubnetType.AN_NF + case SubnetType.AN_NF: sliceParams.anSliceTaskInfo.vendor = vendor sliceParams.anSliceTaskInfo.subnetType = subnetType sliceParams.anSliceTaskInfo.networkType = subnetType.networkType @@ -230,8 +225,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ sliceParams.anSliceTaskInfo.NSSTInfo.invariantUUID = modelInfo.getModelInvariantUuid() sliceParams.anSliceTaskInfo.NSSTInfo.name = modelInfo.getModelName() break - case "cn": - subnetType = SubnetType.CN + case SubnetType.CN: sliceParams.cnSliceTaskInfo.vendor = vendor sliceParams.cnSliceTaskInfo.subnetType = subnetType sliceParams.cnSliceTaskInfo.networkType = subnetType.networkType @@ -246,9 +240,10 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ //todo } - if (subnetType == null) { - //todo: throw error - return + if (null == subnetType) { + def msg = "Get subnetType failed, modelUUId=" + modelInfo.getModelUuid() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } String response = querySubnetCapability(execution, vendor, subnetType) ResponseEntity responseEntity = objectMapper.readValue(response, ResponseEntity.class) @@ -261,6 +256,26 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ } /** + * get subnetType from serviceCategory + * @return + */ + private SubnetType convertServiceCategory(String serviceCategory){ + if(serviceCategory ==~ /CN.*/){ + return SubnetType.CN + } + if (serviceCategory ==~ /AN.*NF.*/){ + return SubnetType.AN_NF + } + if (serviceCategory ==~ /TN.*BH.*/){ + return SubnetType.TN_BH + } + if(serviceCategory ==~ /TN.*MH.*/){ + return SubnetType.TN_MH + } + return null + } + + /** * query Subnet Capability of TN AN CN * @param execution */ @@ -305,12 +320,11 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ * prepare select nsi request * @param execution */ - public void preNSIRequest(DelegateExecution execution) { + public void preNSIRequest(DelegateExecution execution, boolean preferReuse) { String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) logger.debug( "get NSI option OOF Url: " + urlString) - String requestId = execution.getVariable("msoRequestId") String messageType = "NSISelectionResponse" @@ -332,7 +346,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ execution.getVariable("subnetCapabilities") as List<SubnetCapability> String oofRequest = oofUtils.buildSelectNSIRequest(requestId, nstInfo, nsstInfos, - messageType, profileInfo, subnetCapabilities, timeout as Integer) + messageType, profileInfo, subnetCapabilities, timeout as Integer, preferReuse) execution.setVariable("nsiSelection_oofRequest", oofRequest) logger.debug("Sending request to OOF: " + oofRequest) @@ -348,12 +362,12 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ SliceTaskParamsAdapter sliceTaskParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - String OOFResponse = execution.getVariable("nsiSelection_oofResponse") - logger.debug("NSI OOFResponse is: " + OOFResponse) - execution.setVariable("OOFResponse", OOFResponse) + String oofResponse = execution.getVariable("nsiSelection_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) + Map<String, Object> resMap = objectMapper.readValue(oofResponse, Map.class) List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions") Map<String, Object> solution = nsiSolutions.get(0) 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 9d47888b14..2aa7da2cd2 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 @@ -25,7 +25,7 @@ dcsi.preProcessRequest(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_0g5bwvl</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DoCreateSliceServiceInstance() -dcsi.instantiateSliceService(execution)</bpmn:script> +dcsi.createServiceProfileInstance(execution)</bpmn:script> </bpmn:scriptTask> <bpmn:endEvent id="EndEvent_1x6k78c"> <bpmn:incoming>SequenceFlow_1uiz85h</bpmn:incoming> 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 b16ceee0d3..1bda596c6a 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 @@ -163,7 +163,7 @@ dcso.processNSIResp(execution)</bpmn:script> <bpmn:outgoing>SequenceFlow_14o0fxe</bpmn:outgoing> <bpmn:script>import org.onap.so.bpmn.infrastructure.scripts.* def dcso = new DoCreateSliceServiceOption() -dcso.preNSIRequest(execution)</bpmn:script> +dcso.preNSIRequest(execution,true)</bpmn:script> </bpmn:scriptTask> <bpmn:intermediateCatchEvent id="IntermediateCatchEvent_00uke3g" name=" Select NSSI "> <bpmn:outgoing>SequenceFlow_1iawj3m</bpmn:outgoing> |