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
nsiReqBody.setServiceProfile(serviceProfile)
nsiReqBody.setSubnetCapabilities(subnetCapabilities)
nsiReqBody.setNSSTInfo(nsstInfo)
-
+ nsiReqBody.setPreferReuse(preferReuse)
ObjectMapper objectMapper = new ObjectMapper()
private String serviceType;
@JsonProperty("serviceRole")
private String serviceRole;
+ @JsonProperty("serviceCategory")
+ private String serviceCategory;
private ServiceInstance serviceInstance;
private Request request;
private String callbackURN;
this.serviceProxy = serviceProxy;
}
+
// *****
+ public String getServiceCategory() {
+ return serviceCategory;
+ }
+
+ public void setServiceCategory(String serviceCategory) {
+ this.serviceCategory = serviceCategory;
+ }
+
// *****
// Access methods
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
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.
/**
* 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
*/
}
}
- //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())
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"))
}
- def rollbackData = execution.getVariable("RollbackData")
+ RollbackData rollbackData = execution.getVariable("RollbackData")
if (rollbackData == null) {
rollbackData = new RollbackData()
}
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"))
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
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
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
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
//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)
}
}
+ /**
+ * 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
* 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"
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)
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)
<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>
<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>