summaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
authorhetengjiao <hetengjiao@chinamobile.com>2020-09-27 15:26:06 +0800
committerhetengjiao <hetengjiao@chinamobile.com>2020-09-28 00:33:19 +0800
commit2c0e36593e9369ff8ad74a21c415cf502805f0d0 (patch)
treeeb97116d79ecdbb4e30cc3df800570ac6fc23172 /bpmn/so-bpmn-infrastructure-common
parentaf1efe8d52d325929e4e9231576a9a5f97e143ae (diff)
Update NSMF allocate workflow
Issue-ID: SO-2963 Signed-off-by: hetengjiao <hetengjiao@chinamobile.com> Change-Id: Ia4c2fdc15a1fa44de064559cb39af46336e3f5ca
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy29
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy3
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceInstance.groovy16
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateSliceServiceOption.groovy58
4 files changed, 68 insertions, 38 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateCommunicationService.groovy
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/CreateSliceService.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
index 65398eb658..c5f77ff172 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSliceService.groovy
@@ -161,8 +161,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor {
execution.setVariable("serviceInputParams", inputMap)
execution.setVariable("uuiRequest", uuiRequest)
- execution.setVariable("se" +
- "rviceProfile", serviceProfile)
+ execution.setVariable("serviceProfile", serviceProfile)
//TODO
//execution.setVariable("serviceInputParams", jsonUtil.getJsonValue(siRequest, "requestDetails.requestParameters.userParams"))
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)