diff options
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap')
5 files changed, 201 insertions, 80 deletions
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 72fd052f31..5f0d412de0 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 @@ -21,6 +21,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder +import org.onap.so.serviceinstancebeans.Service import static org.apache.commons.lang3.StringUtils.* import org.camunda.bpm.engine.delegate.BpmnError @@ -126,21 +127,22 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { logger.debug("modelInfo: " + serviceModelInfo) - //requestParameters - String subscriptionServiceType = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestParameters.subscriptionServiceType") - if (isBlank(subscriptionServiceType)) { - msg = "Input subscriptionServiceType is null" - logger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) - } else { - execution.setVariable("subscriptionServiceType", subscriptionServiceType) - } - logger.debug("subscriptionServiceType: " + subscriptionServiceType) +// //requestParameters +// String subscriptionServiceType = jsonUtil.getJsonValue(ssRequest, "requestDetails.requestParameters.subscriptionServiceType") +// if (isBlank(subscriptionServiceType)) { +// msg = "Input subscriptionServiceType is null" +// logger.debug(msg) +// exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) +// } else { +// subscriptionServiceType = "5G" +// execution.setVariable("subscriptionServiceType", subscriptionServiceType) +// } +// logger.debug("subscriptionServiceType: " + subscriptionServiceType) /* * Extracting User Parameters from incoming Request and converting into a Map */ - Map reqMap = jsonSlurper.parseText(ssRequest) + Map reqMap = jsonSlurper.parseText(ssRequest) as Map //InputParams def userParamsList = reqMap.requestDetails?.requestParameters?.userParams @@ -168,6 +170,7 @@ public class CreateSliceService extends AbstractServiceTaskProcessor { execution.setVariable("serviceInputParams", inputMap) execution.setVariable("uuiRequest", uuiRequest) execution.setVariable("serviceProfile", serviceProfile) + execution.setVariable("subscriptionServiceType", serviceObject.get("serviceType")) //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 48e1acd523..fc80a9f658 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 @@ -101,6 +101,9 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ */ String serviceRole = "service-profile" String serviceType = execution.getVariable("serviceType") + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") + Map<String, Object> serviceProfile = sliceParams.getServiceProfile() String ssInstanceId = execution.getVariable("serviceInstanceId") try { @@ -121,7 +124,10 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ ss.setEnvironmentContext(snssai) ss.setServiceRole(serviceRole) - AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(ssInstanceId)) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(ssInstanceId)) client.create(uri, ss) } catch (BpmnError e) { throw e @@ -139,8 +145,8 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ //rollbackData.put("SERVICEINSTANCE", "disableRollback", disableRollback.toString()) rollbackData.put("SERVICEINSTANCE", "rollbackAAI", "true") rollbackData.put("SERVICEINSTANCE", "serviceInstanceId", ssInstanceId) - rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", execution.getVariable("subscriptionServiceType")) - rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", execution.getVariable("globalSubscriberId")) + rollbackData.put("SERVICEINSTANCE", "subscriptionServiceType", subscriptionServiceType) + rollbackData.put("SERVICEINSTANCE", "globalSubscriberId", globalSubscriberId) execution.setVariable("rollbackData", rollbackData) execution.setVariable("RollbackData", rollbackData) logger.debug("RollbackData:" + rollbackData) @@ -156,6 +162,8 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ /** * todo: ServiceProfile params changed */ + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") SliceTaskParamsAdapter sliceParams = execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter Map<String, Object> serviceProfileMap = sliceParams.getServiceProfile() @@ -181,11 +189,11 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ serviceProfile.setSurvivalTime("0") serviceProfile.setReliability("") try { - AAIResourceUri uri = AAIUriFactory.createResourceUri( - AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")) - .serviceSubscription(execution.getVariable("subscriptionServiceType")) - .serviceInstance(serviceProfileInstanceId) - .serviceProfile(serviceProfileId)) + AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(serviceProfileInstanceId) + .serviceProfile(serviceProfileId)) client.create(uri, serviceProfile) execution.setVariable("sliceTaskParams", sliceParams) @@ -206,15 +214,21 @@ class DoCreateSliceServiceInstance extends AbstractServiceTaskProcessor{ public void createAllottedResource(DelegateExecution execution) { try { - + String globalSubscriberId = execution.getVariable("globalSubscriberId") + String subscriptionServiceType = execution.getVariable("subscriptionServiceType") ServiceDecomposition serviceDecomposition = execution.getVariable("serviceProfileDecomposition") as ServiceDecomposition + String serviceInstanceId = execution.getVariable("serviceInstanceId") List<org.onap.so.bpmn.core.domain.AllottedResource> allottedResourceList = serviceDecomposition.getAllottedResources() for(org.onap.so.bpmn.core.domain.AllottedResource allottedResource : allottedResourceList) { String allottedResourceId = UUID.randomUUID().toString() - AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(execution.getVariable("globalSubscriberId")).serviceSubscription(execution.getVariable("subscriptionServiceType")).serviceInstance(execution.getVariable("serviceInstanceId")).allottedResource(allottedResourceId)) + AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(globalSubscriberId) + .serviceSubscription(subscriptionServiceType) + .serviceInstance(serviceInstanceId) + .allottedResource(allottedResourceId)) execution.setVariable("allottedResourceUri", allottedResourceUri) String arType = allottedResource.getAllottedResourceType() diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy index 7beafefc28..f20bca9837 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoCreateTnNssiInstance.groovy @@ -22,6 +22,7 @@ package org.onap.so.bpmn.infrastructure.scripts import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution +import org.onap.aai.domain.yang.NetworkPolicy import org.onap.aai.domain.yang.SliceProfile import org.onap.aaiclient.client.aai.AAIResourcesClient import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri @@ -133,7 +134,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { throw e } catch (Exception ex) { String msg = "Exception in DoCreateTnNssiInstance.createServiceInstance: " + ex.getMessage() - logger.info(msg) + logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -163,6 +164,8 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { resource.setAllottedResourceName("network_" + execution.getVariable("sliceServiceInstanceName")) getAAIClient().create(allottedResourceUri, resource) + createNetworkPolicyForAllocatedResource(execution, ssInstanceId, allottedResourceId) + String linkArrayStr = jsonUtil.getJsonValue(networkStr, "connectionLinks") createLogicalLinksForAllocatedResource(execution, linkArrayStr, ssInstanceId, allottedResourceId) } @@ -170,7 +173,81 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { throw e } catch (Exception ex) { String msg = "Exception in DoCreateTnNssiInstance.createAllottedResource: " + ex.getMessage() - logger.info(msg) + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + void createNetworkPolicy(DelegateExecution execution, String ssInstanceId, String networkPolicyId) { + try { + + String sliceProfileStr = execution.getVariable("sliceProfile") + if (sliceProfileStr == null || sliceProfileStr.isEmpty()) { + String msg = "ERROR: createNetworkPolicy: sliceProfile is null" + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + + NetworkPolicy networkPolicy = new NetworkPolicy(); + networkPolicy.setNetworkPolicyId(networkPolicyId) + networkPolicy.setName("TSCi policy") + networkPolicy.setType("SLA") + networkPolicy.setNetworkPolicyFqdn(ssInstanceId) + + String latencyStr = jsonUtil.getJsonValue(sliceProfileStr, "latency") + if (latencyStr != null && !latencyStr.isEmpty()) { + networkPolicy.setLatency(Integer.parseInt(latencyStr)) + } + + String bwStr = jsonUtil.getJsonValue(sliceProfileStr, "maxBandwidth") + if (bwStr != null && !bwStr.isEmpty()) { + networkPolicy.setMaxBandwidth(Integer.parseInt(bwStr)) + } else { + log.debug("ERROR: createNetworkPolicy: maxBandwidth is null") + } + + //networkPolicy.setReliability(new Object()) + + AAIResourceUri networkPolicyUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkPolicy(networkPolicyId)) + getAAIClient().create(networkPolicyUri, networkPolicy) + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.error(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + } + + void createNetworkPolicyForAllocatedResource(DelegateExecution execution, + String ssInstanceId, + String allottedResourceId) { + try { + AAIResourceUri allottedResourceUri = + AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business() + .customer(execution.getVariable("globalSubscriberId")) + .serviceSubscription(execution.getVariable("subscriptionServiceType")) + .serviceInstance(ssInstanceId) + .allottedResource(allottedResourceId)) + + if (!getAAIClient().exists(allottedResourceUri)) { + logger.info("ERROR: createLogicalLinksForAllocatedResource: allottedResource not exist: uri={}", + allottedResourceUri) + return + } + + String networkPolicyId = UUID.randomUUID().toString() + createNetworkPolicy(execution, ssInstanceId, networkPolicyId) + + tnNssmfUtils.attachNetworkPolicyToAllottedResource(execution, AAI_VERSION, allottedResourceUri, networkPolicyId); + + } catch (BpmnError e) { + throw e + } catch (Exception ex) { + String msg = "Exception in DoCreateSliceServiceInstance.instantiateSliceService. " + ex.getMessage() + logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } @@ -219,7 +296,7 @@ class DoCreateTnNssiInstance extends AbstractServiceTaskProcessor { throw e } catch (Exception ex) { String msg = "Exception in DoCreateTnNssiInstance.createLogicalLinksForAllocatedResource: " + ex.getMessage() - logger.info(msg) + logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy index e856522fca..8a276ed330 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnAllocateNssi.groovy @@ -321,7 +321,8 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { String status, String progress, String statusDescription) { - String serviceId = execution.getVariable("sliceServiceInstanceId") + String serviceId = execution.getVariable("dummyServiceId") + String ssInstanceId = execution.getVariable("sliceServiceInstanceId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") @@ -329,6 +330,7 @@ class TnAllocateNssi extends AbstractServiceTaskProcessor { roStatus.setServiceId(serviceId) roStatus.setOperationId(jobId) roStatus.setResourceTemplateUUID(nsiId) + roStatus.setResourceInstanceID(ssInstanceId) roStatus.setOperType("Allocate") roStatus.setProgress(progress) roStatus.setStatus(status) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy index 869b55b5d2..d97f416db9 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy @@ -118,55 +118,67 @@ class TnNssmfUtils { if (execution.getVariable("vnfParamsExistFlag") == true) { sdncVNFParamsXml = buildSDNCParamsXml(execution) } else { - sdncVNFParamsXml = "" + sdncVNFParamsXml = buildDefaultVnfInputParams(vnfId) } String sdncRequest = - """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" - xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" - xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1"> - <sdncadapter:RequestHeader> - <sdncadapter:RequestId>${MsoUtils.xmlEscape(uuid)}</sdncadapter:RequestId> - <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(svcAction)}</sdncadapter:SvcAction> - <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> - <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl> - <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> - </sdncadapter:RequestHeader> - <sdncadapterworkflow:SDNCRequestData> - <request-information> - <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> - <request-action>${MsoUtils.xmlEscape(reqAction)}</request-action> - <source>${MsoUtils.xmlEscape(source)}</source> - <notification-url/> - <order-number/> - <order-version/> - </request-information> - <service-information> - <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(subServiceType)}</subscription-service-type> - ${serviceEcompModelInformation} - <service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id> - <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id> - </service-information> - <vnf-information> - <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> - <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> - ${vnfEcompModelInformation} - </vnf-information> - <vnf-request-input> - ${vnfNameString} - <tenant>${MsoUtils.xmlEscape(tenantId)}</tenant> - <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region> - ${sdncVNFParamsXml} - </vnf-request-input> - </sdncadapterworkflow:SDNCRequestData> - </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" + """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.onap/so/request/types/v1" + xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1" + xmlns:sdncadapter="http://org.onap/workflow/sdnc/adapter/schema/v1"> + <sdncadapter:RequestHeader> + <sdncadapter:RequestId>${MsoUtils.xmlEscape(uuid)}</sdncadapter:RequestId> + <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstId)}</sdncadapter:SvcInstanceId> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(svcAction)}</sdncadapter:SvcAction> + <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> + <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl> + <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> + </sdncadapter:RequestHeader> + <sdncadapterworkflow:SDNCRequestData> + <request-information> + <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> + <request-action>${MsoUtils.xmlEscape(reqAction)}</request-action> + <source>${MsoUtils.xmlEscape(source)}</source> + <notification-url/> + <order-number/> + <order-version/> + </request-information> + <service-information> + <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> + <subscription-service-type>${MsoUtils.xmlEscape(subServiceType)}</subscription-service-type> + ${serviceEcompModelInformation} + <service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id> + <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id> + </service-information> + <vnf-information> + <vnf-id>${MsoUtils.xmlEscape(vnfId)}</vnf-id> + <vnf-type>${MsoUtils.xmlEscape(vnfType)}</vnf-type> + ${vnfEcompModelInformation} + </vnf-information> + <vnf-request-input> + ${vnfNameString} + <tenant>${MsoUtils.xmlEscape(tenantId)}</tenant> + <aic-cloud-region>${MsoUtils.xmlEscape(cloudSiteId)}</aic-cloud-region> + ${sdncVNFParamsXml} + </vnf-request-input> + </sdncadapterworkflow:SDNCRequestData> + </sdncadapterworkflow:SDNCAdapterWorkflowRequest>""" logger.debug("sdncRequest: " + sdncRequest) return sdncRequest } + + String buildDefaultVnfInputParams(String vnfName) { + String res = + """<vnf-input-parameters> + <param> + <name>${MsoUtils.xmlEscape(vnfName)}</name> + </param> + </vnf-input-parameters>""" + + return res + } + String buildSDNCParamsXml(DelegateExecution execution) { String params = "" StringBuilder sb = new StringBuilder() @@ -241,19 +253,19 @@ class TnNssmfUtils { } String getExecutionInputParams(DelegateExecution execution) { - String res = "msoRequestId=" + execution.getVariable("msoRequestId") + - ", modelInvariantUuid=" + execution.getVariable("modelInvariantUuid") + - ", modelUuid=" + execution.getVariable("modelUuid") + - ", serviceInstanceID=" + execution.getVariable("serviceInstanceID") + - ", operationType=" + execution.getVariable("operationType") + - ", globalSubscriberId=" + execution.getVariable("globalSubscriberId") + - ", dummyServiceId=" + execution.getVariable("dummyServiceId") + - ", nsiId=" + execution.getVariable("nsiId") + - ", networkType=" + execution.getVariable("networkType") + - ", subscriptionServiceType=" + execution.getVariable("subscriptionServiceType") + - ", jobId=" + execution.getVariable("jobId") + - ", sliceParams=" + execution.getVariable("sliceParams") + - ", servicename=" + execution.getVariable("servicename") + String res = "\n msoRequestId=" + execution.getVariable("msoRequestId") + + "\n modelInvariantUuid=" + execution.getVariable("modelInvariantUuid") + + "\n modelUuid=" + execution.getVariable("modelUuid") + + "\n serviceInstanceID=" + execution.getVariable("serviceInstanceID") + + "\n operationType=" + execution.getVariable("operationType") + + "\n globalSubscriberId=" + execution.getVariable("globalSubscriberId") + + "\n dummyServiceId=" + execution.getVariable("dummyServiceId") + + "\n nsiId=" + execution.getVariable("nsiId") + + "\n networkType=" + execution.getVariable("networkType") + + "\n subscriptionServiceType=" + execution.getVariable("subscriptionServiceType") + + "\n jobId=" + execution.getVariable("jobId") + + "\n sliceParams=" + execution.getVariable("sliceParams") + + "\n servicename=" + execution.getVariable("servicename") return res } @@ -297,7 +309,6 @@ class TnNssmfUtils { void attachLogicalLinkToAllottedResource(DelegateExecution execution, String aaiVersion, AAIResourceUri arUri, String logicalLinkId) { - String toLink = "aai/${aaiVersion}/network/logical-links/logical-link/${logicalLinkId}" Relationship relationship = new Relationship() @@ -307,4 +318,18 @@ class TnNssmfUtils { createRelationShipInAAI(execution, arUri, relationship) } + + void attachNetworkPolicyToAllottedResource(DelegateExecution execution, String aaiVersion, + AAIResourceUri aaiResourceUri, String networkPolicyId) { + + String toLink = "aai/${aaiVersion}/network/network-policies/network-policy/${networkPolicyId}" + + Relationship relationship = new Relationship() + relationship.setRelatedLink(toLink) + relationship.setRelatedTo("network-policy") + relationship.setRelationshipLabel("org.onap.relationships.inventory.Uses") + + createRelationShipInAAI(execution, aaiResourceUri, relationship) + + } } |