aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/so-bpmn-infrastructure-common
diff options
context:
space:
mode:
authorzm330 <zhangminyj@chinamobile.com>2020-12-04 00:13:14 +0800
committerzm330 <zhangminyj@chinamobile.com>2020-12-04 00:13:26 +0800
commit17b8976e39ae4d45652c56857f57b6bb55692560 (patch)
tree66684d3c21d25261dd4fee6038e934c70666aaf2 /bpmn/so-bpmn-infrastructure-common
parent4f1415c20fa50d41b1955bbbd713e1127a4525bd (diff)
Add Endpoint and relationships
Issue-ID: SO-2963 Signed-off-by: zm330 <zhangminyj@chinamobile.com> Change-Id: Ib745ab2587e63a598a47b433d58cee317858dead
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/DoAllocateNSIandNSSI.groovy101
-rw-r--r--bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy3
2 files changed, 96 insertions, 8 deletions
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 1f3cf6ed52..8b452d310b 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,7 @@
package org.onap.so.bpmn.infrastructure.scripts
+import org.onap.aai.domain.yang.NetworkRoute
import org.onap.so.beans.nsmf.ConnectionLink
import org.onap.so.beans.nsmf.EndPoint
import org.onap.so.beans.nsmf.NsiInfo
@@ -310,6 +311,57 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
execution.setVariable("sliceTaskParams", sliceParams)
}
+ void createANEndpoint(DelegateExecution execution){
+ logger.debug("Enter createANEndpoint in DoAllocateNSIandNSSI()")
+ SliceTaskParamsAdapter sliceParams =
+ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+ SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.anSliceTaskInfo
+
+ NetworkRoute route = new NetworkRoute()
+ String routeId = UUID.randomUUID().toString()
+ route.setRouteId(routeId)
+ route.setType("endpoint")
+ route.setRole("an")
+ route.setFunction("3gppTransportEP")
+ route.setIpAddress( sliceTaskInfo.sliceProfile.ipAddress)
+ route.setNextHop(sliceTaskInfo.sliceProfile.nextHopInfo)
+ route.setAddressFamily("ipv4")
+ route.setPrefixLength(24)
+ sliceTaskInfo.setEndPointId(routeId)
+
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkRoute(routeId))
+ client.create(uri, route)
+ execution.setVariable("sliceTaskParams", sliceParams)
+ logger.info("an endpointId:" + sliceParams.anSliceTaskInfo.endPointId)
+ }
+
+
+ void createCNEndpoint(DelegateExecution execution){
+ logger.debug("Enter createCNNetworkRoute in DoAllocateNSIandNSSI()")
+ SliceTaskParamsAdapter sliceParams =
+ execution.getVariable("sliceTaskParams") as SliceTaskParamsAdapter
+ SliceTaskInfo<SliceProfileAdapter> sliceTaskInfo = sliceParams.cnSliceTaskInfo
+
+ NetworkRoute route = new NetworkRoute()
+ String routeId = UUID.randomUUID().toString()
+ route.setRouteId(routeId)
+ route.setType("endpoint")
+ route.setRole("cn")
+ route.setFunction("3gppTransportEP")
+ route.setIpAddress( sliceTaskInfo.sliceProfile.ipAddress)
+ route.setNextHop(sliceTaskInfo.sliceProfile.nextHopInfo)
+ route.setAddressFamily("ipv4")
+ route.setPrefixLength(24)
+
+ sliceTaskInfo.setEndPointId(routeId)
+ AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkRoute(routeId))
+ client.create(uri, route)
+
+ execution.setVariable("cnEndpointId", routeId)
+ execution.setVariable("sliceTaskParams", sliceParams)
+ logger.info("cn endpointId:" + sliceParams.cnSliceTaskInfo.endPointId)
+ }
+
/**
* prepare AllocateAnNssi
* @param execution
@@ -330,6 +382,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
allocateAnNssi.nssiName = sliceTaskInfo.NSSTInfo.name
NsiInfo nsiInfo = new NsiInfo()
nsiInfo.nsiId = sliceParams.suggestNsiId
+ nsiInfo.nsiName = sliceParams.suggestNsiName
allocateAnNssi.nsiInfo = nsiInfo
//endPoint
EndPoint endPoint = new EndPoint()
@@ -450,6 +503,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
allocateCnNssi.sliceProfile = sliceTaskInfo.sliceProfile.trans2CnProfile()
NsiInfo nsiInfo = new NsiInfo()
nsiInfo.nsiId = sliceParams.suggestNsiId
+ nsiInfo.nsiName = sliceParams.suggestNsiName
allocateCnNssi.nsiInfo = nsiInfo
// endPoint
EndPoint endPoint = new EndPoint()
@@ -631,17 +685,21 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
String nsiId = sliceParams.getSuggestNsiId()
String sliceProfileInstanceId = sliceParams.anSliceTaskInfo.sliceInstanceId
String serviceProfileInstanceId = sliceParams.serviceId
+ String epId = sliceParams.anSliceTaskInfo.endPointId
//nsi id
//todo: aai -> nssi -> relationship -> endPointId -> set into tn
- String endPointId = getEndpointIdFromAAI(execution, nssiId)
- execution.setVariable("endPointIdAn", endPointId)
-
+ //String endPointId = getEndpointIdFromAAI(execution, nssiId)
+ //execution.setVariable("endPointIdAn", endPointId)
updateRelationship(execution, nsiId, nssiId)
updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId)
updateRelationship(execution, sliceProfileInstanceId, nssiId)
+ updateEPRelationship(execution, nssiId, epId)
+
+ updateEPRelationship(execution, sliceProfileInstanceId, epId)
+
sliceParams.anSliceTaskInfo.suggestNssiId = nssiId
execution.setVariable("sliceTaskParams", sliceParams)
}
@@ -665,16 +723,21 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
String nsiId = sliceParams.getSuggestNsiId()
String sliceProfileInstanceId = sliceParams.cnSliceTaskInfo.sliceInstanceId
String serviceProfileInstanceId = sliceParams.serviceId
+ String epId = sliceParams.cnSliceTaskInfo.endPointId
//nsi id
//todo: aai -> nssi -> relationship -> endPointId -> set into tn
- String endPointId = getEndpointIdFromAAI(execution, nssiId)
- execution.setVariable("endPointIdCn", endPointId)
+// String endPointId = getEndpointIdFromAAI(execution, nssiId)
+// execution.setVariable("endPointIdCn", endPointId)
updateRelationship(execution, nsiId, nssiId)
updateRelationship(execution, serviceProfileInstanceId, sliceProfileInstanceId)
- updateRelationship(execution,sliceProfileInstanceId, nssiId)
+ updateRelationship(execution, sliceProfileInstanceId, nssiId)
+
+ updateEPRelationship(execution, nssiId, epId)
+
+ updateEPRelationship(execution, sliceProfileInstanceId, epId)
sliceParams.cnSliceTaskInfo.suggestNssiId = nssiId
execution.setVariable("sliceTaskParams", sliceParams)
@@ -779,7 +842,7 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
.serviceSubscription(execution.getVariable("subscriptionServiceType"))
.serviceInstance(targetId))
- logger.info("Creating relationship, targetInstanceUri: " + targetInstanceUri)
+ logger.debug("Creating relationship, targetInstanceUri: " + targetInstanceUri)
relationship.setRelatedLink(targetInstanceUri.build().toString())
@@ -791,6 +854,30 @@ class DoAllocateNSIandNSSI extends AbstractServiceTaskProcessor{
client.create(sourceInstanceUri, relationship)
}
+ /**
+ * update endpoint relationship
+ * @param execution
+ * @param sourceId
+ * @param targetId
+ */
+ void updateEPRelationship(DelegateExecution execution, String sourceId, String endpointId) {
+ //relation ship
+ Relationship relationship = new Relationship()
+
+ AAIResourceUri endpointUri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.network().networkRoute(endpointId))
+
+ logger.debug("Creating relationship, endpoint Uri: " + endpointUri + ",endpointId: " + endpointId)
+
+ relationship.setRelatedLink(endpointUri.build().toString())
+
+ 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()
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
index e5c1b56d55..35079d2e58 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy
@@ -97,6 +97,8 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
String response =
nssmfAdapterUtils.sendPostRequestNSSMF(execution, endpoint, objectMapper.writeValueAsString(nbiRequest))
+ logger.debug("nssmf response nssiAllocateStatus:" + response)
+
if (response != null) {
JobStatusResponse jobStatusResponse = objectMapper.readValue(response, JobStatusResponse.class)
if (StringUtils.isBlank(nssiId)) {
@@ -125,7 +127,6 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
sliceTaskInfo.progress = response.getProgress()
sliceTaskInfo.status = response.getStatus().toLowerCase()
sliceTaskInfo.statusDescription = response.getStatusDescription()
- sliceTaskInfo.endPointId = response.getEndPointId()
updateNssiResult(sliceParams, subnetType, sliceTaskInfo)
String paramJson = sliceParams.convertToJson()