Fix bugs found in TN Slicing integration involving OOF
[so.git] / bpmn / so-bpmn-infrastructure-common / src / main / groovy / org / onap / so / bpmn / infrastructure / scripts / DoAllocateNSSI.groovy
index e5c1b56..6981d94 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)
@@ -97,6 +99,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)) {
@@ -106,6 +110,7 @@ class DoAllocateNSSI extends AbstractServiceTaskProcessor {
 
             execution.setVariable("nssiAllocateStatus", jobStatusResponse)
             if (jobStatusResponse.getResponseDescriptor().getProgress() == 100) {
+                nssiAllocateResult.setNssiId(jobStatusResponse.getResponseDescriptor().getNssiId())
                 execution.setVariable("jobFinished", true)
             }
         }
@@ -125,11 +130,9 @@ 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()
-        execution.setVariable("CSSOT_paramJson", paramJson)
+        execution.setVariable("CSSOT_paramJson", objectMapper.writeValueAsString(sliceParams))
         execution.setVariable("CSSOT_requestMethod", requestMethod)
 
         execution.setVariable("sliceTaskParams", sliceParams)