diff options
Diffstat (limited to 'bpmn/so-bpmn-infrastructure-common')
3 files changed, 41 insertions, 16 deletions
diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy index e5c9514fa5..05996d3671 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DoActivateTnNssi.groovy @@ -25,11 +25,9 @@ import groovy.json.JsonSlurper import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.aai.domain.yang.ServiceInstance -import org.onap.aaiclient.client.aai.AAIObjectType import org.onap.aaiclient.client.aai.AAIResourcesClient import org.onap.aaiclient.client.aai.entities.uri.AAIResourceUri import org.onap.aaiclient.client.aai.entities.uri.AAIUriFactory -import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder import org.onap.aaiclient.client.generated.fluentbuilders.AAIFluentTypeBuilder.Types import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor import org.onap.so.bpmn.common.scripts.ExceptionUtil @@ -39,7 +37,6 @@ import org.onap.so.db.request.beans.ResourceOperationStatus import org.slf4j.Logger import org.slf4j.LoggerFactory - public class DoActivateTnNssi extends AbstractServiceTaskProcessor { String Prefix = "TNACT_" @@ -114,13 +111,14 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor { void validateSDNCResponse(DelegateExecution execution, String response) { - tnNssmfUtils.validateSDNCResponse(execution, response, method) + String actionType = execution.getVariable("actionType") + tnNssmfUtils.validateSDNCResponse(execution, response, actionType) } void updateAAIOrchStatus(DelegateExecution execution) { logger.debug("Start updateAAIOrchStatus") - String tnNssiId = execution.getVariable("tnNssiId") + String tnNssiId = execution.getVariable("sliceServiceInstanceId") String orchStatus = execution.getVariable("orchestrationStatus") try { @@ -144,7 +142,7 @@ public class DoActivateTnNssi extends AbstractServiceTaskProcessor { String status, String progress, String statusDescription) { - String serviceId = execution.getVariable("serviceInstanceID") + String serviceId = execution.getVariable("sliceServiceInstanceId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") String operType = execution.getVariable("actionType") 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..c817eaad61 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) @@ -126,7 +126,7 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { public void updateAAIOrchStatus(DelegateExecution execution) { logger.debug("Start updateAAIOrchStatus") - String tnNssiId = execution.getVariable("serviceInstanceID") + String tnNssiId = execution.getVariable("sliceServiceInstanceId") String orchStatus = execution.getVariable("orchestrationStatus") try { @@ -150,7 +150,7 @@ class DoDeallocateTnNssi extends AbstractServiceTaskProcessor { String status, String progress, String statusDescription) { - String serviceId = execution.getVariable("serviceInstanceID") + String serviceId = execution.getVariable("sliceServiceInstanceId") String jobId = execution.getVariable("jobId") String nsiId = execution.getVariable("nsiId") 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..869b55b5d2 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) { @@ -76,6 +98,7 @@ class TnNssmfUtils { def callbackURL = execution.getVariable("sdncCallbackUrl") def requestId = execution.getVariable("msoRequestId") def serviceId = execution.getVariable("sliceServiceInstanceId") + def subServiceType = execution.getVariable("subscriptionServiceType") def vnfType = execution.getVariable("serviceType") def vnfName = execution.getVariable("sliceServiceInstanceName") def tenantId = execution.getVariable("sliceServiceInstanceId") @@ -105,7 +128,7 @@ class TnNssmfUtils { <sdncadapter:RequestHeader> <sdncadapter:RequestId>${MsoUtils.xmlEscape(uuid)}</sdncadapter:RequestId> <sdncadapter:SvcInstanceId>${MsoUtils.xmlEscape(svcInstId)}</sdncadapter:SvcInstanceId> - <sdncadapter:SvcAction>${MsoUtils.xmlEscape(action)}</sdncadapter:SvcAction> + <sdncadapter:SvcAction>${MsoUtils.xmlEscape(svcAction)}</sdncadapter:SvcAction> <sdncadapter:SvcOperation>vnf-topology-operation</sdncadapter:SvcOperation> <sdncadapter:CallbackUrl>${MsoUtils.xmlEscape(callbackURL)}</sdncadapter:CallbackUrl> <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction> @@ -113,7 +136,7 @@ class TnNssmfUtils { <sdncadapterworkflow:SDNCRequestData> <request-information> <request-id>${MsoUtils.xmlEscape(requestId)}</request-id> - <request-action>AllocateTnNssi</request-action> + <request-action>${MsoUtils.xmlEscape(reqAction)}</request-action> <source>${MsoUtils.xmlEscape(source)}</source> <notification-url/> <order-number/> @@ -121,7 +144,7 @@ class TnNssmfUtils { </request-information> <service-information> <service-id>${MsoUtils.xmlEscape(serviceId)}</service-id> - <subscription-service-type>${MsoUtils.xmlEscape(serviceId)}</subscription-service-type> + <subscription-service-type>${MsoUtils.xmlEscape(subServiceType)}</subscription-service-type> ${serviceEcompModelInformation} <service-instance-id>${MsoUtils.xmlEscape(svcInstId)}</service-instance-id> <global-customer-id>${MsoUtils.xmlEscape(globalSubscriberId)}</global-customer-id> @@ -168,7 +191,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 +204,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 +213,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 +231,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) } |