diff options
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
7 files changed, 270 insertions, 133 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 67845910eb..bb6fe212b3 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 @@ -43,6 +43,7 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.db.request.beans.OperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory +import org.springframework.util.StringUtils import org.springframework.web.util.UriUtils import static org.apache.commons.lang3.StringUtils.isBlank @@ -317,14 +318,9 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor { Map<String, ?> csInputMap = new HashMap<>() for (String csInput : csInputs) { - def value - if (jsonUtil.getJsonValue(csInput, "type") == "integer") { - value = jsonUtil.getJsonValue(csInput, "default") - csInputMap.put(jsonUtil.getJsonValue(csInput, "name"), isBlank(value) ? 0 : (value as Integer)) - } else if (jsonUtil.getJsonValue(csInput, "type") == "string") { - csInputMap.put(jsonUtil.getJsonValue(csInput, "name"), - jsonUtil.getJsonValue(csInput, "default")) - } + String key = jsonUtil.getJsonValue(csInput, "name") + def value = jsonUtil.getJsonValue(csInput, "default") + csInputMap.put(key, getDefaultPropertiesByType(value, key)) } csInputMap.put("expDataRateDL", expDataRateDL) csInputMap.put("expDataRateUL", expDataRateUL) @@ -336,6 +332,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor { csInputMap.put("useInterval", useInterval) execution.setVariable("csInputMap", csInputMap) + logger.debug(Prefix + "csInputMap is = " + csInputMap.toString()) } catch (BpmnError e) { throw e } catch (Exception ex) { @@ -365,53 +362,45 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor { Map<String, ?> csInputMap = execution.getVariable("csInputMap") as Map Map<String, ?> e2eInputMap = new HashMap<>() - String key - def value - for (String e2eInput in e2eInputs) { - key = jsonUtil.getJsonValue(e2eInput, "name") + String key = jsonUtil.getJsonValue(e2eInput, "name") String type = jsonUtil.getJsonValue(e2eInput, "type") - if (type == "integer") { - def temp - value = csInputMap.containsKey(key) ? csInputMap.getOrDefault(key, 0) : (isBlank(temp = jsonUtil.getJsonValue(e2eInput, "default")) ? 0 : temp) - - e2eInputMap.put(key, value as Integer) - } else if(type == "string") { - e2eInputMap.put(key, csInputMap.containsKey(key) - ? csInputMap.getOrDefault(key, null) : (jsonUtil.getJsonValue(e2eInput, "default"))) + def value + if (csInputMap.containsKey(key)) { + value = csInputMap.get(key) + } else { + value = jsonUtil.getJsonValue(e2eInput, "default") } + e2eInputMap.put(key, getDefaultPropertiesByType(value, type)) } //TODO temp solution e2eInputMap.put("sNSSAI", execution.getVariable("sNSSAI_id")) e2eInputMap.put("sST", execution.getVariable("csServiceType")) - Integer activityFactor = 60 + Integer activityFactor = Integer.parseInt(e2eInputMap.get("activityFactor").toString()) 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 maxNumberofUEs = Integer.parseInt(e2eInputMap.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("e2eModelUuid", e2eServiceDecomposition.getModelInfo().getModelUuid()) - + logger.debug(Prefix + "e2eInputMap is = " + e2eInputMap.toString()) } catch (BpmnError e) { throw e } catch (Exception ex) { @@ -423,6 +412,25 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor { logger.debug(Prefix + "generateE2EServiceProfile Exit") } + static def getDefaultPropertiesByType(def value, String type) { + + def defaultValue + switch (type) { + case "string": + defaultValue = "" + break + case "integer": + defaultValue = 0 + break + case "float": + defaultValue = 0.0 + break + default: + defaultValue = null + break + } + return StringUtils.isEmpty(value) ? defaultValue : value + } /** * call createE2EService get operation id, @@ -453,7 +461,7 @@ class CreateCommunicationService extends AbstractServiceTaskProcessor { } """ execution.setVariable("CSMF_NSMFRequest", payload.replaceAll("\\s+", "")) - + logger.debug(Prefix + "Sent to NSMF Request = " + payload) } catch (BpmnError e) { throw e } catch (Exception ex) { 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 c136d52b13..e5d390e2aa 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 @@ -354,6 +354,8 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { nstInfo.setName(nstSolution.get("NSTName") as String) sliceTaskParams.setNSTInfo(nstInfo) + sliceTaskParams.setNstId(nstSolution.get("UUID") as String) + sliceTaskParams.setNstName(nstSolution.get("NSTName") as String) execution.setVariable("sliceTaskParams", sliceTaskParams) @@ -399,7 +401,10 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { OrchestrationTask orchestrationTask = objectMapper.readValue(response, OrchestrationTask.class) String paramJson = orchestrationTask.getParams() logger.debug("paramJson: " + paramJson) - SliceTaskParamsAdapter sliceTaskParams = new SliceTaskParamsAdapter() + + SliceTaskParamsAdapter sliceTaskParams = + execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + sliceTaskParams.convertFromJson(paramJson) execution.setVariable("sliceTaskParams", sliceTaskParams) logger.debug("Finish processUserOptions") diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy index b5e1e6b82a..c5a928aaf9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSlice.groovy @@ -49,7 +49,9 @@ import org.onap.so.client.HttpClient import org.onap.so.client.HttpClientFactory import org.onap.logging.filter.base.ONAPComponents import org.onap.so.bpmn.core.UrnPropertiesReader +import org.onap.aai.domain.yang.NetworkRoute import org.onap.aai.domain.yang.v19.ServiceInstance +import org.onap.aai.domain.yang.v20.Relationship import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.entities.AAIResultWrapper import org.onap.aaiclient.client.aai.entities.AAIEdgeLabel @@ -86,6 +88,15 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { //networkServiceModelUuid String networkServiceModelUuid = jsonUtil.getJsonValue(execution.getVariable("networkServiceModelInfo"), "modelUuid") ?: "" execution.setVariable("networkServiceModelUuid", networkServiceModelUuid) + String sliceParams = execution.getVariable("sliceParams") + logger.debug("sliceParams "+sliceParams) + List<String> bhEndPoints = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(sliceParams, "endPoints")) + if(bhEndPoints.empty) { + logger.debug("End point info is empty") + exceptionUtil.buildAndThrowWorkflowException(execution, 500, "End point info is empty") + }else { + execution.setVariable("bh_endpoint", bhEndPoints.get(0)) + } logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice::: preProcessRequest ****") } @@ -376,6 +387,8 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { if(response.getStatus()!=200 || response.getStatus()!=201 || response.getStatus()!=202) { exceptionUtil.buildAndThrowWorkflowException(execution, response.getStatus(), "Set association of NSSI and Network service instance has failed in AAI") } else { + //end point update + createEndPointsInAai(execution) execution.setVariable("progress", 100) execution.setVariable("status", "finished") execution.setVariable("statusDescription", "DoAllocateCoreNonSharedNSSI success") @@ -389,6 +402,63 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor { logger.debug(Prefix+ " **** Exit DoAllocateCoreNonSharedSlice ::: updateRelationship ****") } + private void createEndPointsInAai(DelegateExecution execution) { + String type = "endpoint" + String function = "core_EP" + int prefixLength = 24 + String addressFamily = "ipv4" + //BH RAN end point update + String bh_endpoint = execution.getVariable("bhEndPoints") + String bh_routeId = UUID.randomUUID().toString() + execution.setVariable("coreEp_ID_bh", bh_routeId) + String role = "CN" + String cnIpAddress = jsonUtil.getJsonValue(bh_endpoint, "IpAddress") + String LogicalLinkId = jsonUtil.getJsonValue(bh_endpoint, "LogicalLinkId") + String nextHopInfo = jsonUtil.getJsonValue(bh_endpoint, "nextHopInfo") + NetworkRoute bh_ep = new NetworkRoute() + bh_ep.setRouteId(bh_routeId) + bh_ep.setFunction(function) + bh_ep.setRole(role) + bh_ep.setType(type) + bh_ep.setIpAddress(cnIpAddress) + bh_ep.setLogicalInterfaceId(LogicalLinkId) + bh_ep.setNextHop(nextHopInfo) + bh_ep.setPrefixLength(prefixLength) + bh_ep.setAddressFamily(addressFamily) + try { + AAIResourcesClient client = new AAIResourcesClient() + logger.debug("creating bh endpoint . ID : "+bh_routeId+" node details : "+bh_ep.toString()) + AAIResourceUri networkRouteUri = AAIUriFactory.createResourceUri( new AAIObjectType(AAINamespaceConstants.NETWORK, NetworkRoute.class), bh_routeId) + client.create(networkRouteUri, bh_ep) + //relationship b/w bh_ep and Core NSSI + def coreNssi = execution.getVariable("NSSIserviceInstanceId") + Relationship relationship = new Relationship() + String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}" + relationship.setRelatedLink(relatedLink) + relationship.setRelatedTo("network-route") + relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf") + try { + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE, + execution.getVariable("globalSubscriberId"), + execution.getVariable("subscriptionServiceType"), + coreNssi).relationshipAPI() + client.create(uri, relationship) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in CreateCommunicationService.createRelationShipInAAI. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in createEndPointsInAai " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + /** * prepare ResourceOperation status * @param execution 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 1d7acd31c1..159f4c48ef 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,6 +20,8 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.onap.so.beans.nsmf.NsiInfo +import org.onap.so.beans.nsmf.SliceProfileAdapter import org.onap.so.beans.nsmf.oof.SubnetType import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import javax.ws.rs.NotFoundException @@ -36,15 +38,12 @@ import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.so.beans.nsmf.AllocateAnNssi import org.onap.so.beans.nsmf.AllocateCnNssi import org.onap.so.beans.nsmf.AllocateTnNssi -import org.onap.so.beans.nsmf.AnSliceProfile -import org.onap.so.beans.nsmf.CnSliceProfile import org.onap.so.beans.nsmf.EsrInfo import org.onap.so.beans.nsmf.NssiResponse import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest 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.TnSliceProfile import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.core.json.JsonUtils import org.slf4j.Logger @@ -144,7 +143,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String msg try { - AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceInstanceId)) + AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(execution.getVariable("globalSubscriberId")) + .serviceSubscription(execution.getVariable("subscriptionServiceType")) + .serviceInstance(sliceInstanceId)) client.create(nsiServiceUri, nsi) execution.setVariable("nsiServiceUri", nsiServiceUri) @@ -152,7 +154,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ } catch (BpmnError e) { throw e } catch (Exception ex) { - msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + msg = "Exception in DoAllocateNSIandNSSI.createNSIinAAI: " + ex.getMessage() logger.info(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } @@ -168,16 +170,30 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ */ void createRelationship(DelegateExecution execution) { //relation ship - String allottedResourceId = execution.getVariable("allottedResourceId") - SliceTaskParamsAdapter sliceParams = - execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + logger.debug("Enter createRelationship in DoAllocateNSIandNSSI") + //String allottedResourceId = execution.getVariable("allottedResourceId") + //SliceTaskParamsAdapter sliceParams = + // execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter + String msg + try { + + AAIResourceUri nsiServiceUri = execution.getVariable("nsiServiceUri") as AAIResourceUri + logger.debug("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri.toString()) - AAIResourceUri nsiServiceUri = execution.getVariable("nsiServiceUri") as AAIResourceUri - logger.info("Creating Allotted resource relationship, nsiServiceUri: " + nsiServiceUri) + //AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId)) - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId)) + AAIResourceUri allottedResourceUri = execution.getVariable("allottedResourceUri") as AAIResourceUri + logger.debug("Creating Allotted resource relationship, allottedResourceUri: " + allottedResourceUri.toString()) - client.connect(allottedResourceUri, nsiServiceUri) + client.connect(allottedResourceUri, nsiServiceUri) + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + msg = "Exception in DoAllocateNSIandNSSI.createRelationship. " + ex.getMessage() + logger.info(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + logger.debug("Exit createRelationship in DoAllocateNSIandNSSI") } /** @@ -196,7 +212,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String nsiServiceInstanceID = sliceParams.getSuggestNsiId() //sliceParams.setServiceId(nsiServiceInstanceID) - AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(nsiServiceInstanceID)) + AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(execution.getVariable("globalSubscriberId")) + .serviceSubscription(execution.getVariable("subscriptionServiceType")) + .serviceInstance(nsiServiceInstanceID)) try { AAIResultWrapper wrapper = client.get(nsiServiceUri, NotFoundException.class) @@ -207,8 +226,9 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId)) - + //AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sliceParams.suggestNsiId).allottedResource(allottedResourceId)) + AAIResourceUri allottedResourceUri = execution.getVariable("allottedResourceUri") as AAIResourceUri + logger.debug("updateRelationship Allotted resource relationship, allottedResourceUri: " + allottedResourceUri.toString()) client.connect(allottedResourceUri, nsiServiceUri) execution.setVariable("sliceTaskParams", sliceParams) @@ -233,31 +253,23 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String serviceInstanceId = UUID.randomUUID().toString() execution.setVariable("ranSliceProfileInstanceId", serviceInstanceId) //todo: - String serviceType = "" - String serviceRole = "slice-profile" String oStatus = "deactivated" SliceTaskParamsAdapter sliceParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo sliceTaskInfo.setSliceInstanceId(serviceInstanceId) // create slice profile - ServiceInstance rspi = new ServiceInstance() - rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) - rspi.setServiceType(serviceType) - rspi.setServiceRole(serviceRole) - rspi.setOrchestrationStatus(oStatus) - rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID) - rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID) - rspi.setInputParameters(execution.getVariable("uuiRequest")) - rspi.setWorkloadContext(execution.getVariable("useInterval")) - rspi.setEnvironmentContext(execution.getVariable("sNSSAI_id")) + ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus) //timestamp format YYYY-MM-DD hh:mm:ss rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(serviceInstanceId)) client.create(uri, rspi) execution.setVariable("sliceTaskParams", sliceParams) @@ -275,15 +287,15 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ SliceTaskParamsAdapter sliceParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo - AnSliceProfile anSliceProfile = sliceTaskInfo.sliceProfile + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo + SliceProfileAdapter anSliceProfile = sliceTaskInfo.sliceProfile String profileId = UUID.randomUUID().toString() anSliceProfile.setSliceProfileId(profileId) SliceProfile sliceProfile = new SliceProfile() sliceProfile.setProfileId(profileId) - sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList as String) + sliceProfile.setCoverageAreaTAList(anSliceProfile.coverageAreaTAList) //todo:... AAIResourceUri uri = AAIUriFactory.createResourceUri( AAIFluentTypeBuilder.business().customer(globalSubscriberId) @@ -304,12 +316,18 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ //todo: SliceTaskParamsAdapter sliceParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - SliceTaskInfo<AnSliceProfile> sliceTaskInfo = sliceParams.anSliceTaskInfo + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() AllocateAnNssi allocateAnNssi = new AllocateAnNssi() - allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile + allocateAnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2AnProfile() + allocateAnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID + allocateAnNssi.nssiId = sliceTaskInfo.suggestNssiId + allocateAnNssi.nssiName = sliceTaskInfo.NSSTInfo.name + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.nsiId = sliceParams.suggestNsiId + allocateAnNssi.nsiInfo = nsiInfo EsrInfo esrInfo = new EsrInfo() //todo: vendor and network @@ -348,33 +366,25 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String serviceInstanceId = UUID.randomUUID().toString() execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo: - String serviceType = "" - String serviceRole = "slice-profile" String oStatus = "deactivated" SliceTaskParamsAdapter sliceParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo sliceTaskInfo.setSliceInstanceId(serviceInstanceId) // create slice profile - ServiceInstance rspi = new ServiceInstance() - rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) - rspi.setServiceType(serviceType) - rspi.setServiceRole(serviceRole) - rspi.setOrchestrationStatus(oStatus) - rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID) - rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID) - rspi.setInputParameters(uuiRequest) - rspi.setWorkloadContext(useInterval) - rspi.setEnvironmentContext(sNSSAI_id) + ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus) //timestamp format YYYY-MM-DD hh:mm:ss rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) execution.setVariable("communicationServiceInstance", rspi) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(serviceInstanceId)) client.create(uri, rspi) execution.setVariable("sliceTaskParams", sliceParams) } @@ -392,8 +402,8 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ SliceTaskParamsAdapter sliceParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo - CnSliceProfile cnSliceProfile = sliceTaskInfo.sliceProfile + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo + SliceProfileAdapter cnSliceProfile = sliceTaskInfo.sliceProfile String profileId = UUID.randomUUID().toString() cnSliceProfile.setSliceProfileId(profileId) @@ -402,7 +412,11 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ sliceProfile.setProfileId(profileId) sliceProfile.setCoverageAreaTAList(cnSliceProfile.coverageAreaTAList as String) //todo:... - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(sliceTaskInfo.sliceInstanceId).sliceProfile(profileId)) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(sliceTaskInfo.sliceInstanceId) + .sliceProfile(profileId)) client.create(uri, sliceProfile) execution.setVariable("sliceTaskParams", sliceParams) } @@ -416,7 +430,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ //todo: SliceTaskParamsAdapter sliceParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - SliceTaskInfo<CnSliceProfile> sliceTaskInfo = sliceParams.cnSliceTaskInfo + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() @@ -424,8 +438,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ allocateCnNssi.nsstId = sliceTaskInfo.NSSTInfo.UUID allocateCnNssi.nssiId = sliceTaskInfo.suggestNssiId allocateCnNssi.nssiName = sliceTaskInfo.NSSTInfo.name - allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile - allocateCnNssi.nsiInfo.nsiId = sliceParams.suggestNsiId + allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2CnProfile() + NsiInfo nsiInfo = new NsiInfo() + nsiInfo.nsiId = sliceParams.suggestNsiId + allocateCnNssi.nsiInfo = nsiInfo EsrInfo esrInfo = new EsrInfo() //todo: vendor and network @@ -462,37 +478,29 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ String globalSubscriberId = execution.getVariable("globalSubscriberId") String subscriptionServiceType = execution.getVariable("subscriptionServiceType") - String serviceType = "" - String serviceRole = "slice-profile" String oStatus = "deactivated" SliceTaskParamsAdapter sliceParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo String serviceInstanceId = UUID.randomUUID().toString() sliceTaskInfo.setSliceInstanceId(serviceInstanceId) //execution.setVariable("cnSliceProfileInstanceId", serviceInstanceId) //todo: // create slice profile - ServiceInstance rspi = new ServiceInstance() - rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) - rspi.setServiceType(serviceType) - rspi.setServiceRole(serviceRole) - rspi.setOrchestrationStatus(oStatus) - rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID) - rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID) - rspi.setInputParameters(uuiRequest) - rspi.setWorkloadContext(useInterval) - rspi.setEnvironmentContext(sNSSAI_id) + ServiceInstance rspi = createSliceProfileInstance(sliceTaskInfo, oStatus) //timestamp format YYYY-MM-DD hh:mm:ss rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) execution.setVariable("communicationServiceInstance", rspi) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(serviceInstanceId)) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(serviceInstanceId)) client.create(uri, rspi) execution.setVariable("sliceTaskParams", sliceParams) @@ -510,16 +518,20 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ SliceTaskParamsAdapter sliceParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo - TnSliceProfile tnSliceProfile = sliceTaskInfo.sliceProfile + SliceProfileAdapter tnSliceProfile = sliceTaskInfo.sliceProfile String profileId = UUID.randomUUID().toString() tnSliceProfile.setSliceProfileId(profileId) SliceProfile sliceProfile = new SliceProfile() sliceProfile.setProfileId(profileId) //todo:... - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(sliceTaskInfo.sliceInstanceId).sliceProfile(profileId)) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(sliceTaskInfo.sliceInstanceId) + .sliceProfile(profileId)) client.create(uri, sliceProfile) execution.setVariable("sliceTaskParams", sliceParams) @@ -534,7 +546,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ //todo: SliceTaskParamsAdapter sliceParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter - SliceTaskInfo<TnSliceProfile> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo + SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.tnBHSliceTaskInfo NssmfAdapterNBIRequest nbiRequest = new NssmfAdapterNBIRequest() @@ -545,6 +557,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ allocateTnNssi.setNetworkSliceInfos() + //allocateTnNssi.networkSliceInfos EsrInfo esrInfo = new EsrInfo() @@ -653,7 +666,10 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter //sliceParams.setServiceId(nsiServiceInstanceID) - AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(nssiId)) + AAIResourceUri nsiServiceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(execution.getVariable("globalSubscriberId")) + .serviceSubscription(execution.getVariable("subscriptionServiceType")) + .serviceInstance(nssiId)) String endpointId = null @@ -730,14 +746,39 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{ //relation ship Relationship relationship = new Relationship() - AAIResourceUri targetInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(targetId)) + AAIResourceUri targetInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(execution.getVariable("globalSubscriberId")) + .serviceSubscription(execution.getVariable("subscriptionServiceType")) + .serviceInstance(targetId)) logger.info("Creating relationship, targetInstanceUri: " + targetInstanceUri) relationship.setRelatedLink(targetInstanceUri.build().toString()) - AAIResourceUri sourceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(sourceId)).relationshipAPI() + AAIResourceUri sourceInstanceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(execution.getVariable("globalSubscriberId")) + .serviceSubscription(execution.getVariable("subscriptionServiceType")) + .serviceInstance(sourceId)) + .relationshipAPI() client.create(sourceInstanceUri, relationship) } + static def createSliceProfileInstance(SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo, String oStatus) { + // create slice profile + ServiceInstance rspi = new ServiceInstance() + rspi.setServiceInstanceName(sliceTaskInfo.NSSTInfo.name) + rspi.setServiceType(sliceTaskInfo.sliceProfile.getSST()) + rspi.setServiceRole("slice-profile-instance") + rspi.setOrchestrationStatus(oStatus) + rspi.setServiceInstanceLocationId(sliceTaskInfo.sliceProfile.getPLMNIdList()) + rspi.setModelInvariantId(sliceTaskInfo.NSSTInfo.invariantUUID) + rspi.setModelVersionId(sliceTaskInfo.NSSTInfo.UUID) + rspi.setWorkloadContext(sliceTaskInfo.subnetType.subnetType) + rspi.setEnvironmentContext(sliceTaskInfo.sliceProfile.getSNSSAIList()) + + //timestamp format YYYY-MM-DD hh:mm:ss + rspi.setCreatedAt(new Date(System.currentTimeMillis()).format("yyyy-MM-dd HH:mm:ss", TimeZone.getDefault())) + return rspi + } + } 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 fc80a9f658..ec70bd3780 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 @@ -246,6 +246,7 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ client.create(allottedResourceUri, resource) + execution.setVariable("allottedResourceId", allottedResourceId) } }catch (Exception ex) { 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 2cce68a2b6..9450227467 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 @@ -22,13 +22,12 @@ package org.onap.so.bpmn.infrastructure.scripts import com.fasterxml.jackson.databind.ObjectMapper import org.camunda.bpm.engine.delegate.DelegateExecution -import org.onap.so.beans.nsmf.AnSliceProfile -import org.onap.so.beans.nsmf.CnSliceProfile import org.onap.so.beans.nsmf.EsrInfo import org.onap.so.beans.nsmf.NetworkType import org.onap.so.beans.nsmf.NssmfAdapterNBIRequest +import org.onap.so.beans.nsmf.QuerySubnetCapability +import org.onap.so.beans.nsmf.SliceProfileAdapter import org.onap.so.beans.nsmf.SliceTaskParamsAdapter -import org.onap.so.beans.nsmf.TnSliceProfile import org.onap.so.beans.nsmf.oof.SubnetCapability import org.onap.so.beans.nsmf.oof.SubnetType import org.onap.so.beans.nsmf.oof.TemplateInfo @@ -45,6 +44,7 @@ import org.slf4j.Logger import org.slf4j.LoggerFactory import org.springframework.util.StringUtils + class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ private static final Logger logger = LoggerFactory.getLogger(DoCreateSliceServiceOption.class) @@ -185,6 +185,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ execution.setVariable("sliceTaskParams", sliceParams) execution.setVariable("subnetCapabilities", subnetCapabilities) + execution.setVariable("queryNsiFirst", true) logger.debug("sliceTaskParams= " + sliceParams.toString()) } @@ -290,13 +291,12 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ NssmfAdapterNBIRequest request = new NssmfAdapterNBIRequest() List<String> subnetTypes = new ArrayList<>() - subnetTypes.add(subnetType.subnetType) - Map<String, Object> paramMap = new HashMap<>() - paramMap.put("subnetTypes", subnetTypes) + QuerySubnetCapability req = new QuerySubnetCapability() + req.setSubnetTypes(subnetTypes) - request.setSubnetCapabilityQuery(paramMap) + request.setSubnetCapabilityQuery(req) EsrInfo esrInfo = new EsrInfo() esrInfo.setVendor(vendor) @@ -362,66 +362,73 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ Map<String, Object> resMap = objectMapper.readValue(oofResponse, Map.class) String requestStatus = resMap.get("requestStatus") - if (StringUtils.isEmpty(requestStatus)) { + if (!StringUtils.isEmpty(requestStatus) && requestStatus == "error") { exceptionUtil.buildWorkflowException(execution, 7000, "get nsi from oof error: " + oofResponse) + return } List<Map<String, Object>> nsiSolutions = (List<Map<String, Object>>) resMap.get("solutions") Map<String, Object> solution = nsiSolutions.get(0) - String resourceSharingLevel = execution.getVariable("resourceSharingLevel") - Boolean isSharable = resourceSharingLevel == "shared" + //String resourceSharingLevel = execution.getVariable("resourceSharingLevel") + //Boolean isSharable = resourceSharingLevel == "shared" if (solution != null) { - if (isSharable && solution.get("existingNSI")) { - //sharedNSISolution - processSharedNSI(solution, sliceTaskParams) - execution.setVariable("needQuerySliceProfile", true) - } - else { - if(execution.getVariable("needQuerySliceProfile")){ + if (execution.getVariable("queryNsiFirst")) { + if (solution.get("existingNSI")) { + execution.setVariable("needQuerySliceProfile", true) + } else { + processNewNSI(solution, sliceTaskParams) execution.setVariable("needQuerySliceProfile", false) } - processNewNSI(solution, sliceTaskParams) + execution.setVariable("queryNsiFirst", false) + } else { + processSharedNSI(solution, sliceTaskParams) + execution.setVariable("needQuerySliceProfile", false) } } execution.setVariable("sliceTaskParams", sliceTaskParams) + logger.debug("after req to oof for nis select, sliceTaskParams = " + sliceTaskParams) logger.debug("*** Completed options Call to OOF ***") } - private void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { + private static void processSharedNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { Map<String, Object> sharedNSISolution = solution.get("sharedNSISolution") as Map - String nsiId = sharedNSISolution.get("NSIId") String nsiName = sharedNSISolution.get("NSIName") sliceParams.setSuggestNsiId(nsiId) sliceParams.setSuggestNsiName(nsiName) + List<Map> sliceProfiles = sharedNSISolution.get("sliceProfiles") as List<Map> + handleSliceProfiles(sliceProfiles, sliceParams) } - private void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { + private static void processNewNSI(Map<String, Object> solution, SliceTaskParamsAdapter sliceParams) { Map<String, Object> newNSISolution = solution.get("newNSISolution") as Map List<Map> sliceProfiles = newNSISolution.get("sliceProfiles") as List<Map> + handleSliceProfiles(sliceProfiles, sliceParams) + } + + static def handleSliceProfiles(List<Map> sliceProfiles, SliceTaskParamsAdapter sliceParams) { for (Map sliceProfile : sliceProfiles) { String domainType = sliceProfile.get("domainType") + sliceProfile.remove("domainType") + SliceProfileAdapter adapter = objectMapper.readValue(objectMapper.writeValueAsString(sliceProfile), SliceProfileAdapter.class) switch (domainType.toLowerCase()) { case "tn-bh": - sliceParams.tnBHSliceTaskInfo.sliceProfile = sliceProfile as TnSliceProfile + sliceParams.tnBHSliceTaskInfo.sliceProfile = adapter break case "an-nf": case "an": - sliceParams.anSliceTaskInfo.sliceProfile = sliceProfile as AnSliceProfile + sliceParams.anSliceTaskInfo.sliceProfile = adapter break case "cn": - sliceParams.cnSliceTaskInfo.sliceProfile = sliceProfile as CnSliceProfile + sliceParams.cnSliceTaskInfo.sliceProfile = adapter break default: break } - - //todo - } } @@ -485,7 +492,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ String selection = resMap.get("selection") if ("NSMF".equalsIgnoreCase(selection)) { - execution.setVariable("NEED_CN_NSSI_SELECTION", true) + //execution.setVariable("NEED_CN_NSSI_SELECTION", true) } } @@ -597,7 +604,7 @@ class DoCreateSliceServiceOption extends AbstractServiceTaskProcessor{ TemplateInfo nsstInfo = nssiNeedHandlerInfo.get("nsstInfo") as TemplateInfo Map<String, Object> profileInfo = nssiNeedHandlerInfo.get("sliceProfile") as Map - profileInfo.remove("profileId") + //profileInfo.remove("profileId") String urlString = UrnPropertiesReader.getVariable("mso.oof.endpoint", execution) logger.debug( "get NSI option OOF Url: " + urlString) diff --git a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy index 1eddf66b86..6b15407dd0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/test/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNonSharedSliceTest.groovy @@ -58,9 +58,13 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest { "modelInstanceName" : "5gcembb_proxy 0" }""" + String sliceParams= """{\r\n\t\"sliceProfile\": {\r\n\t\t\"snssaiList\": [\r\n\t\t\t\"001-100001\"\r\n\t\t],\r\n\t\t\"sliceProfileId\": \"ab9af40f13f721b5f13539d87484098\",\r\n\t\t\"plmnIdList\": [\r\n\t\t\t\"460-00\",\r\n\t\t\t\"460-01\"\r\n\t\t],\r\n\t\t\"perfReq\": {\r\n\t\t\t\"perfReqEmbbList \": [{\r\n\t\t\t\t\"activityFactor\": 50\r\n\t\t\t}]\r\n\t\t},\r\n\t\t\"maxNumberofUEs\": 200,\r\n\t\t\"coverageAreaTAList\": [\r\n\t\t\t\"1\",\r\n\t\t\t\"2\",\r\n\t\t\t\"3\",\r\n\t\t\t\"4\"\r\n\t\t],\r\n\t\t\"latency\": 2,\r\n\t\t\"resourceSharingLevel\": \"non-shared\"\r\n\t},\r\n\t\"endPoints\": [{\r\n\t\t\"IpAdress\": \"\",\r\n\t\t\"LogicalLinkId\": \"\",\r\n\t\t\"nextHopInfo\": \"\"\r\n\t}],\r\n\t\"nsiInfo\": {\r\n\t\t\"nsiId\": \"NSI-M-001-HDBNJ-NSMF-01-A-ZX\",\r\n\t\t\"nsiName\": \"eMBB-001\"\r\n\t},\r\n\t\"scriptName\": \"AN1\"\r\n}""" + when(mockExecution.getVariable("serviceInstanceId")).thenReturn("123456") when(mockExecution.getVariable("networkServiceModelInfo")).thenReturn(networkServiceModelInfo) + when(mockExecution.getVariable("sliceParams")).thenReturn(sliceParams) + DoAllocateCoreNonSharedSlice allocateNssi = new DoAllocateCoreNonSharedSlice() allocateNssi.preProcessRequest(mockExecution) @@ -73,7 +77,8 @@ class DoAllocateCoreNonSharedSliceTest extends MsoGroovyTest { Mockito.verify(mockExecution, times(1)).setVariable(eq("orchestrationStatus"), captor.capture()) assertEquals("created", captor.getValue()) - Mockito.verify(mockExecution, times(4)).setVariable(captor.capture() as String, captor.capture()) + + Mockito.verify(mockExecution, times(5)).setVariable(captor.capture() as String, captor.capture()) } @Test |