From 001a5425a9ccce5d1ac0919d39ccdeb137f438e8 Mon Sep 17 00:00:00 2001 From: hyu2010 Date: Thu, 15 Oct 2020 17:28:23 -0400 Subject: [PATCH] Fixes for bugs found in Transport Slicing integration This update contains for the fixes for the following JIRAs: SO-3308: Transport Slicing integration: MSOWorkflowException: mso-request-id not provided SO-3309: Transport Slicing integration: unable to get prefix environment variable from execution in TnNssmfUntils SO-3310: Transport Slicing Integration: null pointer exception in saving SDNC rollback data Issue-ID: SO-3308 Issue-ID: SO-3309 Issue-ID: SO-3310 Signed-off-by: hyu2010 Change-Id: I0c9ed038454b309914ddee6ea2366db58f248f9f Signed-off-by: hyu2010 --- .../scripts/DoDeallocateTnNssi.groovy | 2 +- .../infrastructure/scripts/TnNssmfUtils.groovy | 38 ++++++++++++++++++---- .../subprocess/DoActivateTransportNSSI.bpmn | 4 +-- .../subprocess/DoCreateTnNssiInstance.bpmn | 4 +-- .../subprocess/DoDeallocateTransportNSSI.bpmn | 4 +-- 5 files changed, 39 insertions(+), 13 deletions(-) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy index baf0333a19..fbb2b00854 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoDeallocateTnNssi.groovy @@ -93,7 +93,7 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { try { String serviceInstanceId = execution.getVariable("serviceInstanceID") - String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "deallocate") + String sdncRequest = tnNssmfUtils.buildSDNCRequest(execution, serviceInstanceId, "delete") execution.setVariable("TNNSSMF_SDNCRequest", sdncRequest) logger.debug("Outgoing SDNCRequest is: \n" + sdncRequest) diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy index 1bb0e8aca7..92953fd60b 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/TnNssmfUtils.groovy @@ -66,7 +66,29 @@ class TnNssmfUtils { } } - String buildSDNCRequest(DelegateExecution execution, String svcInstId, String action) { + String buildSDNCRequest(DelegateExecution execution, String svcInstId, String svcAction) { + String reqAction + switch (svcAction) { + case "create": + reqAction = "AllocateTransportSliceInstance" + break + case "delete": + reqAction = "DeleteTransportSliceInstance" + break + case "activate": + reqAction = "ActivateTransportSliceInstance" + break + case "deactivate": + reqAction = "DeactivateTransportSliceInstance" + break + default: + reqAction = svcAction + } + + buildSDNCRequest(execution, svcInstId, svcAction, reqAction) + } + + String buildSDNCRequest(DelegateExecution execution, String svcInstId, String svcAction, String reqAction) { String uuid = execution.getVariable('testReqId') // for junits if (uuid == null) { @@ -105,7 +127,7 @@ class TnNssmfUtils { ${MsoUtils.xmlEscape(uuid)} ${MsoUtils.xmlEscape(svcInstId)} - ${MsoUtils.xmlEscape(action)} + ${MsoUtils.xmlEscape(svcAction)} vnf-topology-operation ${MsoUtils.xmlEscape(callbackURL)} generic-resource @@ -113,7 +135,7 @@ class TnNssmfUtils { ${MsoUtils.xmlEscape(requestId)} - AllocateTnNssi + ${MsoUtils.xmlEscape(reqAction)} ${MsoUtils.xmlEscape(source)} @@ -168,7 +190,7 @@ class TnNssmfUtils { String msg - String prefix = execution.setVariable("prefix") + String prefix = execution.getVariable("prefix") if (isBlank(prefix)) { if (exceptionOnErr) { msg = "validateSDNCResponse: prefix is null" @@ -181,7 +203,8 @@ class TnNssmfUtils { WorkflowException workflowException = execution.getVariable("WorkflowException") boolean successIndicator = execution.getVariable("SDNCA_SuccessIndicator") - logger.debug("workflowException: " + workflowException) + logger.debug("TnNssmfUtils.validateSDNCResponse: SDNCResponse: " + response) + logger.debug("TnNssmfUtils.validateSDNCResponse: workflowException: " + workflowException) sdncAdapterUtils.validateSDNCResponse(execution, response, workflowException, successIndicator) @@ -189,6 +212,9 @@ class TnNssmfUtils { if (execution.getVariable(prefix + 'sdncResponseSuccess') == true) { logger.debug("Received a Good Response from SDNC Adapter for " + method + " SDNC Call. Response is: \n" + sdncResponse) RollbackData rollbackData = execution.getVariable("rollbackData") + if (rollbackData == null) { + rollbackData = new RollbackData() + } if (method.equals("allocate")) { rollbackData.put("VNFMODULE", "rollbackSDNCRequestAllocate", "true") @@ -204,7 +230,7 @@ class TnNssmfUtils { execution.setVariable("rollbackData", rollbackData) } else { if (exceptionOnErr) { - msg = "validateSDNCResponse: bad Response from SDNC Adapter for " + method + " SDNC Call." + msg = "TnNssmfUtils.validateSDNCResponse: bad Response from SDNC Adapter for " + method + " SDNC Call." logger.error(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 500, msg) } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn index 8ecce46ac0..4447b32f4a 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoActivateTransportNSSI.bpmn @@ -56,8 +56,8 @@ runScript.preprocessSdncActOrDeactTnNssiRequest(execution) - - + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn index e9cbbb77cc..55adbe3698 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoCreateTnNssiInstance.bpmn @@ -45,8 +45,8 @@ dcsi.preprocessSdncAllocateTnNssiRequest(execution) - - + + diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn index a800289aaa..94279b7fe8 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DoDeallocateTransportNSSI.bpmn @@ -55,8 +55,8 @@ runScript.preprocessSdncDeallocateTnNssiRequest(execution) - - + + -- 2.16.6