Add relationship to AllocateResource 32/107732/1
authorzm330 <zhangminyj@chinamobile.com>
Fri, 15 May 2020 12:14:06 +0000 (20:14 +0800)
committerzm330 <zhangminyj@chinamobile.com>
Fri, 15 May 2020 12:14:31 +0000 (20:14 +0800)
Issue-ID: SO-2919

Signed-off-by: zm330 <zhangminyj@chinamobile.com>
Change-Id: I3165b9e3310ccbe0c44a0aa37c39169afd9dac8f

bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSIandNSSI.groovy
bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoAllocateNSSI.groovy

index b75fa67..04cf7bc 100644 (file)
@@ -91,13 +91,11 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
     }
 
     void updateRelationship(DelegateExecution execution) {
-        logger.trace("Enter update relationship in DoAllocateNSIandNSSI()")
-        String nsiServiceInstanceId = execution.getVariable("nsiServiceInstanceId")
+        logger.debug("Enter update relationship in DoAllocateNSIandNSSI()")
         String allottedResourceId = execution.getVariable("allottedResourceId")
         //Need to check whether nsi exist : Begin
         org.onap.aai.domain.yang.ServiceInstance nsiServiceInstance = new org.onap.aai.domain.yang.ServiceInstance()
         SliceTaskParams sliceParams = execution.getVariable("sliceParams")
-
         String nsiServiceInstanceID = sliceParams.getSuggestNsiId()
 
         AAIResourcesClient resourceClient = new AAIResourcesClient()
@@ -116,14 +114,8 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
 //                exceptionUtil.buildAndThrowWorkflowException(execution, 2500, "Service instance was not found in aai to " +
 //                        "associate for service :"+serviceInstanceId)
 //            }
-        }catch(BpmnError e) {
-            throw e;
-        }catch (Exception ex){
-            String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID
-            logger.debug(msg)
-            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
-        }
-        AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("serviceType"), nsiServiceInstanceId, allottedResourceId)
+
+        AAIResourceUri allottedResourceUri = AAIUriFactory.createResourceUri(AAIObjectType.ALLOTTED_RESOURCE, execution.getVariable("globalSubscriberId"), execution.getVariable("subscriptionServiceType"), execution.getVariable("sliceServiceInstanceId"), allottedResourceId)
         getAAIClient().connect(allottedResourceUri,nsiServiceuri)
 
         List<String> nssiAssociated = new ArrayList<>()
@@ -140,7 +132,14 @@ class DoAllocateNSIandNSSI extends org.onap.so.bpmn.common.scripts.AbstractServi
         }
         execution.setVariable("nssiAssociated",nssiAssociated)
         execution.setVariable("nsiServiceInstanceName",nsiServiceInstance.getServiceInstanceName())
-        logger.trace("Exit update relationship in DoAllocateNSIandNSSI()")
+        }catch(BpmnError e) {
+            throw e
+        }catch (Exception ex){
+            String msg = "NSI suggested in the option doesn't exist. " + nsiServiceInstanceID
+            logger.debug(msg)
+            exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
+        }
+        logger.debug("Exit update relationship in DoAllocateNSIandNSSI()")
     }
 
     void prepareNssiModelInfo(DelegateExecution execution){
index 9d40274..4ab6647 100644 (file)
@@ -227,7 +227,7 @@ class DoAllocateNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTask
     }
 
     void updateRelationship(DelegateExecution execution) {
-        logger.trace("Enter updateRelationship in DoAllocateNSSI()")
+        logger.debug("Enter updateRelationship in DoAllocateNSSI()")
         String nssiInstanceId = execution.getVariable("nssiInstanceId")
         String nsiInstanceId = execution.getVariable("nsiServiceInstanceId")
         try{
@@ -239,7 +239,7 @@ class DoAllocateNSSI extends org.onap.so.bpmn.common.scripts.AbstractServiceTask
             logger.info(msg)
             exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg)
         }
-        logger.trace("Exit updateRelationship in DoAllocateNSSI()")
+        logger.debug("Exit updateRelationship in DoAllocateNSSI()")
     }