From 666b56c9241c37b22f631fb88f4a40aedefa2eac Mon Sep 17 00:00:00 2001
From: aleemraja <ar00500721@techmahindra.com>
Date: Fri, 5 Feb 2021 10:17:04 +0530
Subject: 5GCore - nssmf - non-shared allocate flow

Code changes to fix issues observed during testing for Core non-shared
nssmf Allocate api

Issue-ID: SO-3514
Signed-off-by: aleemraja <ar00500721@techmahindra.com>
Change-Id: I37ce7d21eaba8ea60a95a4561509696b2cf3a516
---
 .../infrastructure/scripts/DoAllocateCoreNSSI.groovy     |  1 -
 .../scripts/DoAllocateCoreNonSharedSlice.groovy          | 16 +++++++++-------
 2 files changed, 9 insertions(+), 8 deletions(-)

(limited to 'bpmn/so-bpmn-infrastructure-common/src/main/groovy/org')

diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
index ec97972e5d..01aefe2054 100644
--- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
+++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateCoreNSSI.groovy
@@ -123,7 +123,6 @@ class DoAllocateCoreNSSI extends AbstractServiceTaskProcessor {
         execution.setVariable("OOFResponse", OOFResponse)
         String solutions =""
         if(requestStatus.equals("completed")) {
-            solutions = jsonUtil.getJsonValue(OOFResponse, "solutions")
             List solutionsList = jsonUtil.StringArrayToList(jsonUtil.getJsonValue(OOFResponse, "solutions"))
             if(solutionsList!=null && !solutionsList.isEmpty() ) {
                 solutions = solutionsList.get(0)
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 1ca0605ac8..91599700ef 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
@@ -440,7 +440,9 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
             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")
+            String coreNssi = execution.getVariable("nssiServiceInstanceId")
+            String globalSubscriberId = execution.getVariable("globalSubscriberId")
+            String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
             Relationship relationship = new Relationship()
             String relatedLink = "aai/v21/network/network-routes/network-route/${bh_routeId}"
             relationship.setRelatedLink(relatedLink)
@@ -448,10 +450,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
             relationship.setRelationshipLabel("org.onap.relationships.inventory.ComposedOf")
             logger.debug("networkRouteUri: "+networkRouteUri+"relationship: "+relationship)
             try {
-                AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.SERVICE_INSTANCE,
-                        execution.getVariable("globalSubscriberId"),
-                        execution.getVariable("subscriptionServiceType"),
-                        coreNssi).relationshipAPI()
+                AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIFluentTypeBuilder.business().customer(globalSubscriberId).serviceSubscription(subscriptionServiceType).serviceInstance(coreNssi)).relationshipAPI()
                 logger.debug("uri: "+uri)
                 client.create(uri, relationship)
             } catch (BpmnError e) {
@@ -475,6 +474,7 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
         String serviceId = execution.getVariable("nsiId")
         String jobId = execution.getVariable("jobId")
         String nsiId = execution.getVariable("nsiId")
+        String nssiId = execution.getVariable("nssiServiceInstanceId")
         String operationType = "ALLOCATE"
         ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
         resourceOperationStatus.setServiceId(serviceId)
@@ -494,15 +494,17 @@ class DoAllocateCoreNonSharedSlice extends AbstractServiceTaskProcessor {
         String serviceId = execution.getVariable("nsiId")
         String jobId = execution.getVariable("jobId")
         String nsiId = execution.getVariable("nsiId")
-        String nssiId = execution.getVariable("nssiId")
+        String nssiId = execution.getVariable("nssiServiceInstanceId")
         String operationType = "ALLOCATE"
         //modelUuid
         String modelUuid= execution.getVariable("modelUuid")
-        logger.debug("serviceId: "+serviceId +"  "+ "jobId: "+jobId   +"  "+  "nsiId: "+nsiId +"   "+  "operationType: "+operationType)
+        logger.debug("serviceId: "+serviceId +"  "+ "jobId: "+jobId   +"  "+  "nsiId: "+nsiId +"   "+  "nssiId: "+nssiId +"   "+  "operationType: "+operationType)
         ResourceOperationStatus resourceOperationStatus = new ResourceOperationStatus()
         resourceOperationStatus.setServiceId(serviceId)
         resourceOperationStatus.setJobId(jobId)
         resourceOperationStatus.setOperationId(jobId)
+        resourceOperationStatus.setResourceTemplateUUID(nsiId)
+        resourceOperationStatus.setResourceInstanceID(nssiId)
         resourceOperationStatus.setResourceTemplateUUID(modelUuid)
         resourceOperationStatus.setOperType(operationType)
         resourceOperationStatus.setProgress("0")
-- 
cgit 1.2.3-korg