Support Allocate feature for NSMF based TN slices
[so.git] / bpmn / so-bpmn-infrastructure-common / src / main / groovy / org / onap / so / bpmn / infrastructure / scripts / DoAllocateNSSI.groovy
index 35079d2..fc873be 100644 (file)
@@ -62,8 +62,10 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
      */
     void sendCreateRequestNSSMF(DelegateExecution execution) {
         NssmfAdapterNBIRequest nbiRequest = execution.getVariable("nbiRequest") as NssmfAdapterNBIRequest
-        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, NSSMF_ALLOCATE_URL,
-                objectMapper.writeValueAsString(nbiRequest))
+        String nssmfRequest = objectMapper.writeValueAsString(nbiRequest)
+        logger.debug("sendCreateRequestNSSMF: " + nssmfRequest)
+
+        String response = nssmfAdapterUtils.sendPostRequestNSSMF(execution, NSSMF_ALLOCATE_URL, nssmfRequest)
 
         if (response != null) {
             NssiResponse nssiResponse = objectMapper.readValue(response, NssiResponse.class)
@@ -108,6 +110,9 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
 
             execution.setVariable("nssiAllocateStatus", jobStatusResponse)
             if (jobStatusResponse.getResponseDescriptor().getProgress() == 100) {
+               if (nssiId == null) {
+                nssiAllocateResult.setNssiId(jobStatusResponse.getResponseDescriptor().getNssiId())
+               }
                 execution.setVariable("jobFinished", true)
             }
         }
@@ -129,8 +134,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
         sliceTaskInfo.statusDescription = response.getStatusDescription()
         updateNssiResult(sliceParams, subnetType, sliceTaskInfo)
 
-        String paramJson = sliceParams.convertToJson()
-        execution.setVariable("CSSOT_paramJson", paramJson)
+        execution.setVariable("CSSOT_paramJson", objectMapper.writeValueAsString(sliceParams))
         execution.setVariable("CSSOT_requestMethod", requestMethod)
 
         execution.setVariable("sliceTaskParams", sliceParams)