From 8be314c9ee5a67763370a1619ea4e4d7dcfe277c Mon Sep 17 00:00:00 2001 From: subhash kumar singh Date: Wed, 19 Sep 2018 12:27:51 +0530 Subject: Update bpmn and groovy files for ccvpn usecase Update bpmn and groovy files for ccvpn usecase. Change-Id: Ib992d3577c9805b0d5e09afc2d8a6be6ded5b7b3 Signed-off-by: subhash kumar singh Issue-ID: SO-689 --- .../scripts/ActivateSDNCNetworkResource.groovy | 294 ++++++++----- .../scripts/CreateSDNCNetworkResource.groovy | 482 ++++++++++++++------- .../scripts/DeActivateSDNCNetworkResource.groovy | 269 +++++++----- .../scripts/DeleteSDNCNetworkResource.groovy | 358 ++++++++------- .../process/ActivateSDNCNetworkResource.bpmn | 174 ++++++++ .../process/CreateSDNCNetworkResource.bpmn | 161 +++---- .../process/DeActivateSDNCNetworkResource.bpmn | 183 ++++++++ .../process/DeleteSDNCNetworkResource.bpmn | 251 ++++++----- .../subprocess/ActivateSDNCNetworkResource.bpmn | 177 -------- .../subprocess/DeActivateSDNCNetworkResource.bpmn | 177 -------- 10 files changed, 1405 insertions(+), 1121 deletions(-) create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn create mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn delete mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn delete mode 100644 bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DeActivateSDNCNetworkResource.bpmn (limited to 'bpmn') diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy index 545cba7f8c..c48d000ab3 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/ActivateSDNCNetworkResource.groovy @@ -32,14 +32,16 @@ import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.logger.MsoLogger +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.logger.MsoLogger /** * This groovy class supports the ActivateSDNCCNetworkResource.bpmn process. * flow for SDNC Network Resource Activate */ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class); - + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, ActivateSDNCNetworkResource.class); + String Prefix = "ACTSDNCRES_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -48,18 +50,19 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + MsoUtils msoUtils = new MsoUtils() + + public void preProcessRequest(DelegateExecution execution) { - msoLogger.trace("Started preProcessRequest ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) @@ -78,9 +81,41 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - // TODO: based on the resource type decide action and operation type String sdnc_svcAction = "activate" - operationType = "SOTNConnectivity" + switch (resourceInputObj.getResourceModelInfo().getModelName()) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + break + + default: + break + } String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" execution.setVariable(Prefix + "svcAction", sdnc_svcAction) @@ -92,38 +127,39 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + msoLogger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } public void prepareUpdateAfterActivateSDNCResource(DelegateExecution execution) { - msoLogger.trace("started prepareUpdateAfterActivateSDNCResource ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info("started prepareUpdateAfterActivateSDNCResource ") ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() String ServiceInstanceId = resourceInputObj.getServiceInstanceId() String operationId = resourceInputObj.getOperationId() - String progress = "100" - String status = "finished" - String statusDescription = "SDCN resource creation completed" + String progress = "80" + String status = "activated" + String statusDescription = "SDCN resource activation completed" execution.getVariable("operationId") String body = """ + xmlns:ns="http://org.openecomp.mso/requestsdb"> - ${MsoUtils.xmlEscape(operType)} - ${MsoUtils.xmlEscape(operationId)} - ${MsoUtils.xmlEscape(progress)} - ${MsoUtils.xmlEscape(resourceCustomizationUuid)} - ${MsoUtils.xmlEscape(ServiceInstanceId)} - ${MsoUtils.xmlEscape(status)} - ${MsoUtils.xmlEscape(statusDescription)} + ${msoUtils.xmlEncode(operType)} + ${msoUtils.xmlEncode(operationId)} + ${msoUtils.xmlEncode(progress)} + ${msoUtils.xmlEncode(resourceCustomizationUuid)} + ${msoUtils.xmlEncode(ServiceInstanceId)} + ${msoUtils.xmlEncode(status)} + ${msoUtils.xmlEncode(statusDescription)} """; @@ -131,8 +167,32 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { setProgressUpdateVariables(execution, body) } + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + + String customizeResourceParam(String networkInputParametersJson) { + List> paramList = new ArrayList(); + JSONObject jsonObject = new JSONObject(networkInputParametersJson); + Iterator iterator = jsonObject.keys(); + while (iterator.hasNext()) { + String key = iterator.next(); + HashMap hashMap = new HashMap(); + hashMap.put("name", key); + hashMap.put("value", jsonObject.get(key)) + paramList.add(hashMap) + } + Map>> paramMap = new HashMap(); + paramMap.put("param", paramList); + + return new JSONObject(paramMap).toString(); + } + public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.trace("Started prepareSDNCRequest ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info("Started prepareSDNCRequest ") try { // get variables @@ -141,11 +201,13 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") String hdrRequestId = execution.getVariable("mso-request-id") String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String networkInstanceId = execution.getVariable("networkInstanceId") String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() @@ -165,172 +227,169 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdncTopologyActivateRequest = "" switch (modelName) { - case ~/^Site$/: - sdncTopologyActivateRequest = - """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} - network-topology-operation + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} + vnf-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} + ${msoUtils.xmlEncode(globalCustomerId)} - + ${msoUtils.xmlEncode(networkInstanceId)} - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} - - ${MsoUtils.xmlEscape(netowrkInputParameters)} - - - - - - - - - - - - - + + $netowrkInputParameters + + + + + + """.trim() break - case ~/^SOTNAttachment$/: + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/: sdncTopologyActivateRequest = """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} - network-topology-operation + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} + connection-attachment-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} - + ${msoUtils.xmlEncode(networkInstanceId)} - + $parentServiceInstanceId - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} - ${MsoUtils.xmlEscape(netowrkInputParameters)} + $netowrkInputParameters """.trim() break + // for SDWANConnectivity and SOTN Connectivity default: sdncTopologyActivateRequest = """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} network-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} - + ${msoUtils.xmlEncode(networkInstanceId)} - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} - ${MsoUtils.xmlEscape(netowrkInputParameters)} + $netowrkInputParameters """.trim() @@ -338,21 +397,20 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } String sdncTopologyActivateRequesAsString = utils.formatXml(sdncTopologyActivateRequest) - msoLogger.debug(sdncTopologyActivateRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyActivateRequesAsString) - msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyActivateRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in CreateSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + msoLogger.debug( exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.trace("Exit prepareSDNCRequest ") + msoLogger.info(" ***** Exit prepareSDNCRequest *****") } - public void postCreateSDNCCall(DelegateExecution execution) { - msoLogger.trace("started postCreateSDNCCall ") + public void postActivateSDNCCall(DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info("started postCreateSDNCCall ") String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") @@ -361,24 +419,22 @@ public class ActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void sendSyncResponse(DelegateExecution execution) { - msoLogger.trace("started sendSyncResponse ") - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) + msoLogger.dubug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" // RESTResponse for main flow String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) + msoLogger.dubug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) sendWorkflowResponse(execution, 202, resourceOperationResp) execution.setVariable("sentSyncResponse", true) } catch (Exception ex) { String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) + msoLogger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) + msoLogger.dubug(" ***** Exit sendSyncResopnse *****") } } \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index c819da4be4..5255b37bb0 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -20,40 +20,54 @@ package org.onap.so.bpmn.infrastructure.scripts +import org.json.JSONObject +import org.json.XML +import org.onap.so.bpmn.infrastructure.pnf.implementation.AaiResponse; + import static org.apache.commons.lang3.StringUtils.*; +import groovy.xml.XmlUtil +import groovy.json.* +import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.onap.so.bpmn.common.recipe.ResourceInput; +import org.onap.so.bpmn.common.resource.ResourceRequestBuilder +import org.onap.so.bpmn.core.WorkflowException +import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder +import org.onap.so.rest.APIResponse +import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.bpmn.common.scripts.AaiUtil -import org.apache.commons.lang3.* -import org.camunda.bpm.engine.delegate.BpmnError +import java.util.UUID; + +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject -import org.json.XML; -import org.onap.so.bpmn.common.recipe.ResourceInput; -import org.onap.so.bpmn.common.resource.ResourceRequestBuilder -import org.onap.so.bpmn.common.scripts.AbstractServiceTaskProcessor -import org.onap.so.bpmn.common.scripts.ExceptionUtil +import org.apache.commons.lang3.* import org.onap.so.bpmn.common.scripts.MsoUtils -import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.logger.MsoLogger -import groovy.json.* - /** * This groovy class supports the CreateSDNCCNetworkResource.bpmn process. * flow for SDNC Network Resource Create */ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class); + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, CreateSDNCNetworkResource.class); String Prefix="CRESDNCRES_" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() - + + MsoUtils msoUtils = new MsoUtils() + public void preProcessRequest(DelegateExecution execution){ - msoLogger.trace("Started preProcessRequest ") - try { - + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") + try { + //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") @@ -65,12 +79,12 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) - + //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceName = resourceInputObj.getResourceInstanceName() + String resourceName = resourceInputObj.getResourceInstanceName() //For sdnc requestAction default is "createNetworkInstance" - String operationType = "Network" + String operationType = "Network" if(!StringUtils.isBlank(recipeParamsFromRequest)){ //the operationType from worflow(first node) is second priority. operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") @@ -79,27 +93,70 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { //the operationType from worflow(first node) is highest priority. operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - - + + //For sdnc, generate svc_action and request_action String sdnc_svcAction = "create" - if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "overlay")){ - //This will be resolved in R3. - sdnc_svcAction ="activate" - operationType = "NCINetwork" + switch (resourceInputObj.getResourceInstanceName()) { + + case ~/[\w\s\W]*overlay[\w\s\W]*/ : + //This will be resolved in R3. + sdnc_svcAction ="activate" + operationType = "NCINetwork" + break + + case ~/[\w\s\W]*underlay[\w\s\W]*/ : + //This will be resolved in R3. + operationType ="Network" + break + + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + execution.setVariable("isActivateRequired", "true") + break + + default: + break } - if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "underlay")){ - //This will be resolved in R3. - operationType ="Network" - } - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" - execution.setVariable(Prefix + "svcAction", sdnc_svcAction) + + String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" + execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) //TODO Here build networkrequest - + } catch (BpmnError e) { throw e; } catch (Exception ex){ @@ -108,7 +165,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - + String customizeResourceParam(String networkInputParametersJson) { List> paramList = new ArrayList(); JSONObject jsonObject = new JSONObject(networkInputParametersJson); @@ -125,7 +182,65 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { return new JSONObject(paramMap).toString(); } - + + /** + * This method updates the resource input by collecting required info from AAI + * @param execution + */ + public void updateResourceInput(DelegateExecution execution) { + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + + switch (modelName) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/: + + def resourceInput = resourceInputObj.getResourceParameters() + String incomingRequest = resourceInputObj.getRequestsInputs() + String serviceParameters = JsonUtils.getJsonValue(incomingRequest, "service.parameters") + String requestInputs = JsonUtils.getJsonValue(serviceParameters, "requestInputs") + JSONObject inputParameters = new JSONObject(requestInputs) + if(inputParameters.has("local-access-provider-id")) { + String uResourceInput = jsonUtil.addJsonValue(resourceInput, "requestInputs.access-provider-id", inputParameters.get("local-access-provider-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-client-id", inputParameters.get("local-access-client-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-topology-id", inputParameters.get("local-access-topology-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-ltp-id", inputParameters.get("local-access-ltp-id")) + uResourceInput = jsonUtil.addJsonValue(uResourceInput, "requestInputs.access-node-id", inputParameters.get("local-access-node-id")) + resourceInputObj.setResourceParameters(uResourceInput) + execution.setVariable(Prefix + "resourceInput", resourceInputObj) + } + + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + // fill attachment TP in networkInputParamJson + String customer = resourceInputObj.getGlobalSubscriberId() + String serviceType = resourceInputObj.getServiceType() + + def vpnName = StringUtils.containsIgnoreCase(modelName, "sotnvpnattachment") ? "sotnvpnattachmentvf_sotncondition_sotnVpnName" : "sdwanvpnattachmentvf_sdwancondition_sdwanVpnName" + String parentServiceName = jsonUtil.getJsonValueForKey(resourceInputObj.getRequestsInputs(), vpnName) + + AaiUtil aaiUtil = new AaiUtil(this) + String aai_endpoint = execution.getVariable("URN_aai_endpoint") + String customerUri = aaiUtil.getBusinessCustomerUri(execution) + "/" + customer + String aai_service_query_url = aai_endpoint + customerUri + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances?service-instance-name=" + parentServiceName + + APIResponse aaiResponse = aaiUtil.executeAAIGetCall(execution, aai_service_query_url) + def parentServiceInstanceId = getParentServiceInstnaceId(aaiResponse) + execution.setVariable("parentServiceInstanceId", parentServiceInstanceId) + break + + default: + break + } + } + + private String getParentServiceInstnaceId(APIResponse aaiResponse) { + String response = aaiResponse.getResponseBodyAsString() + def xmlResp = new XmlParser().parseText(response) + return "${xmlResp?."service-instance"[0]?."service-instance-id"[0]?.text()}" + } + /** * Pre Process the BPMN Flow Request * Inclouds: @@ -133,15 +248,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { * generate the nsParameters */ public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.trace("Started prepareSDNCRequest ") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") try { // get variables - String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") + String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") String sdnc_requestAction = execution.getVariable(Prefix + "requestAction") String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") String createNetworkInput = execution.getVariable(Prefix + "networkRequest") + String parentServiceInstanceId = execution.getVariable("parentServiceInstanceId") String hdrRequestId = execution.getVariable("mso-request-id") String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") @@ -166,176 +283,173 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String sdncTopologyCreateRequest = "" switch (modelName) { - case ~/^Site$/: + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteVF[\w\s\W]*/: sdncTopologyCreateRequest = """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} - network-topology-operation + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} + vnf-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} + ${msoUtils.xmlEncode(globalCustomerId)} - ${MsoUtils.xmlEscape(globalCustomerId)} - - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} - - - ${MsoUtils.xmlEscape(netowrkInputParameters)} - + - - - - - - - - - - - - + + $netowrkInputParameters + + + + + + """.trim() break - case ~/^SOTNAttachment$/: + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : sdncTopologyCreateRequest = """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} - network-topology-operation + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} + connection-attachment-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} + ${msoUtils.xmlEncode(globalCustomerId)} - ${MsoUtils.xmlEscape(globalCustomerId)} + - + $parentServiceInstanceId - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} - ${MsoUtils.xmlEscape(netowrkInputParameters)} + $netowrkInputParameters """.trim() break + // for SDWANConnectivity and SOTNConnectivity: default: sdncTopologyCreateRequest = """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} + ${hdrRequestId} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} network-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} - ${MsoUtils.xmlEscape(netowrkInputParameters)} + $netowrkInputParameters """.trim() } - + String sndcTopologyCreateRequesAsString = utils.formatXml(sdncTopologyCreateRequest) - msoLogger.debug(sndcTopologyCreateRequesAsString) + utils.logAudit(sndcTopologyCreateRequesAsString) execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyCreateRequesAsString) msoLogger.debug("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyCreateRequesAsString) @@ -345,8 +459,8 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } - msoLogger.trace("Exit prepareSDNCRequest ") - } + msoLogger.info(" ***** Exit prepareSDNCRequest *****") + } private void setProgressUpdateVariables(DelegateExecution execution, String body) { def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") @@ -368,17 +482,17 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String body = """ + xmlns:ns="http://org.openecomp.mso/requestsdb"> - ${MsoUtils.xmlEscape(operType)} - ${MsoUtils.xmlEscape(operationId)} - ${MsoUtils.xmlEscape(progress)} - ${MsoUtils.xmlEscape(resourceCustomizationUuid)} - ${MsoUtils.xmlEscape(ServiceInstanceId)} - ${MsoUtils.xmlEscape(status)} - ${MsoUtils.xmlEscape(statusDescription)} + ${msoUtils.xmlEncode(operType)} + ${msoUtils.xmlEncode(operationId)} + ${msoUtils.xmlEncode(progress)} + ${msoUtils.xmlEncode(resourceCustomizationUuid)} + ${msoUtils.xmlEncode(ServiceInstanceId)} + ${msoUtils.xmlEncode(status)} + ${msoUtils.xmlEncode(statusDescription)} """; @@ -395,23 +509,23 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String operationId = resourceInputObj.getOperationId() String progress = "100" String status = "finished" - String statusDescription = "SDCN resource creation completed" + String statusDescription = "SDCN resource creation and activation completed" execution.getVariable("operationId") String body = """ + xmlns:ns="http://org.openecomp.mso/requestsdb"> - ${MsoUtils.xmlEscape(operType)} - ${MsoUtils.xmlEscape(operationId)} - ${MsoUtils.xmlEscape(progress)} - ${MsoUtils.xmlEscape(resourceCustomizationUuid)} - ${MsoUtils.xmlEscape(ServiceInstanceId)} - ${MsoUtils.xmlEscape(status)} - ${MsoUtils.xmlEscape(statusDescription)} + ${msoUtils.xmlEncode(operType)} + ${msoUtils.xmlEncode(operationId)} + ${msoUtils.xmlEncode(progress)} + ${msoUtils.xmlEncode(resourceCustomizationUuid)} + ${msoUtils.xmlEncode(ServiceInstanceId)} + ${msoUtils.xmlEncode(status)} + ${msoUtils.xmlEncode(statusDescription)} """; @@ -419,32 +533,70 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { setProgressUpdateVariables(execution, body) } - public void postCreateSDNCCall(DelegateExecution execution){ - msoLogger.trace("Started prepareSDNCRequest ") + public void afterCreateSDNCCall(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncCreateReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") - + + def isActivateRequried = execution.getVariable("isActivateRequired") + if (StringUtils.equalsIgnoreCase(isActivateRequried, "true")) { + def instnaceId = getInstnaceId(execution) + execution.setVariable("networkInstanceId", instnaceId) + } + msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) - msoLogger.trace("Exit prepareSDNCRequest ") + msoLogger.info(" ***** Exit prepareSDNCRequest *****") + } + + private def getInstnaceId(DelegateExecution execution) { + def responce = new XmlSlurper().parseText(execution.getVariable("CRENWKI_createSDNCResponse")) + def data = responce.toString() + data = data.substring(data.indexOf("<")) + + def resp = new XmlSlurper().parseText(data) + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + def val = "" + + switch (modelName) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + val = resp."network-response-information"."instance-id" + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*Site[\w\s\W]*/: + val = resp."vnf-response-information"."instance-id" + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/: + val = resp."connection-attachment-response-information"."instance-id" + break + } + + return val.toString() + } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.debug(" *** sendSyncResponse *** ") + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + msoLogger.debug(" sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug(msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.debug(" ***** Exit sendSyncResopnse *****") } - - public void sendSyncResponse (DelegateExecution execution) { - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("DEBUG", " *** sendSyncResponse *** ", isDebugEnabled) - - try { - String operationStatus = "finished" - // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, resourceOperationResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - utils.log("DEBUG", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - utils.log("DEBUG"," ***** Exit sendSyncResopnse *****", isDebugEnabled) - } } diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy index a63aad14a2..b6ea9f3fef 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeActivateSDNCNetworkResource.groovy @@ -32,14 +32,15 @@ import org.camunda.bpm.engine.delegate.DelegateExecution import org.onap.so.bpmn.core.json.JsonUtils import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.logger.MsoLogger /** * This groovy class supports the ActivateSDNCCNetworkResource.bpmn process. * flow for SDNC Network Resource Activate */ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - CreateSDNCNetworkResource.class); + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeActivateSDNCNetworkResource.class); String Prefix = "DEACTSDNCRES_" ExceptionUtil exceptionUtil = new ExceptionUtil() @@ -48,21 +49,22 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + MsoUtils msoUtils = new MsoUtils() + public void preProcessRequest(DelegateExecution execution) { - msoLogger.info(" ***** started preProcessRequest*****") + + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") try { //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") - msoLogger.info("The requestAction is: " + requestAction) String recipeParamsFromRequest = execution.getVariable("recipeParams") - msoLogger.info("The recipeParams is: " + recipeParamsFromRequest) String resourceInput = execution.getVariable("resourceInput") - msoLogger.info("The resourceInput is: " + resourceInput) //Get ResourceInput Object - org.onap.so.bpmn.common.recipe.ResourceInput resourceInputObj = org.onap.so.bpmn.common.resource.ResourceRequestBuilder.getJsonObject(resourceInput, org.onap.so.bpmn.common.recipe.ResourceInput.class) + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) //Deal with recipeParams @@ -82,7 +84,40 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor // TODO: based on the resource type decide action and operation type String sdnc_svcAction = "deactivate" - operationType = "SOTNConnectivity" + switch (resourceInputObj.getResourceModelInfo().getModelName()) { + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + default: + break + } String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" execution.setVariable(Prefix + "svcAction", sdnc_svcAction) @@ -102,7 +137,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void prepareSDNCRequest(DelegateExecution execution) { - msoLogger.info(" ***** started prepareSDNCRequest *****") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") try { // get variables @@ -115,7 +151,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor String serviceInstanceId = execution.getVariable(Prefix + "serviceInstanceId") String source = execution.getVariable("source") String sdnc_service_id = execution.getVariable(Prefix + "sdncServiceId") - org.onap.so.bpmn.common.recipe.ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") + ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") String serviceType = resourceInputObj.getServiceType() String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() @@ -127,175 +163,164 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() String modelName = resourceInputObj.getResourceModelInfo().getModelName() String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid() // 1. prepare assign topology via SDNC Adapter SUBFLOW call String sdncTopologyDeleteRequest = "" switch (modelName) { - case ~/^Site$/: + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + case ~/[\w\s\W]*SiteVF[\w\s\W]*/: sdncTopologyDeleteRequest = """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} - network-topology-operation + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} + vnf-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} - + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} + ${msoUtils.xmlEncode(globalCustomerId)} - - + $resourceInstnaceId - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} - + - - - - - - - - - - - - - - - - + + + + + - - - - + """.trim() break - case ~/^SOTNAttachment$/: + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : sdncTopologyDeleteRequest = """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} - network-topology-operation + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} + connection-attachment-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} - - + $resourceInstnaceId - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} - """.trim() break + default: sdncTopologyDeleteRequest = """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} network-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} + $resourceInstnaceId - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} @@ -305,10 +330,10 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor """.trim() } - String sndcTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) - msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) + utils.logAudit(sdncTopologyDeleteRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString) + msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() @@ -320,32 +345,30 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void prepareUpdateAfterDeActivateSDNCResource(DelegateExecution execution) { - msoLogger.info("***** started prepareUpdateAfterDeActivateSDNCResource *****") - ResourceInput resourceInputObj = execution.getVariable(Prefix + "resourceInput") String operType = resourceInputObj.getOperationType() String resourceCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() String serviceInstanceId = resourceInputObj.getServiceInstanceId() String operationId = resourceInputObj.getOperationId() - String progress = "100" - String status = "finished" - String statusDescription = "SDCN resource delete completed" + String progress = "50" + String status = "deactivated" + String statusDescription = "SDCN resource deactivation completed" //String operationId = execution.getVariable("operationId") String body = """ + xmlns:ns="http://org.openecomp.mso/requestsdb"> - ${MsoUtils.xmlEscape(operType)} - ${MsoUtils.xmlEscape(operationId)} - ${MsoUtils.xmlEscape(progress)} - ${MsoUtils.xmlEscape(resourceCustomizationUuid)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(status)} - ${MsoUtils.xmlEscape(statusDescription)} + ${msoUtils.xmlEncode(operType)} + ${msoUtils.xmlEncode(operationId)} + ${msoUtils.xmlEncode(progress)} + ${msoUtils.xmlEncode(resourceCustomizationUuid)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(status)} + ${msoUtils.xmlEncode(statusDescription)} """; @@ -353,9 +376,15 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor setProgressUpdateVariables(execution, body) } + private void setProgressUpdateVariables(DelegateExecution execution, String body) { + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } + public void postDeactivateSDNCCall(DelegateExecution execution) { - msoLogger.info(" ***** started postDeactivateSDNCCall *****") - String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) @@ -363,8 +392,8 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor } public void sendSyncResponse(DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - msoLogger.info(" ***** started sendSyncResponse *****") + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.debug(" *** sendSyncResponse *** ") try { String operationStatus = "finished" @@ -379,7 +408,7 @@ public class DeActivateSDNCNetworkResource extends AbstractServiceTaskProcessor msoLogger.debug(msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - msoLogger.debug(" ***** Exit sendSyncResopnse *****") + msoLogger("DEBUG"," ***** Exit sendSyncResopnse *****") } } \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 04b62d7f73..192788a4ca 100644 --- a/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/so-bpmn-infrastructure-common/src/main/groovy/org/onap/so/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -34,6 +34,8 @@ import org.onap.so.bpmn.common.scripts.ExceptionUtil import org.onap.so.bpmn.common.scripts.MsoUtils import org.onap.so.bpmn.common.scripts.SDNCAdapterUtils import org.onap.so.bpmn.core.json.JsonUtils +import org.onap.so.bpmn.common.scripts.MsoUtils +import org.onap.so.logger.MsoLogger import groovy.json.* @@ -42,21 +44,23 @@ import groovy.json.* * flow for SDNC Network Resource */ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { - private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, - CreateSDNCNetworkResource.class); + private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, DeleteSDNCNetworkResource.class); String Prefix="DELSDNCRES_" - + ExceptionUtil exceptionUtil = new ExceptionUtil() JsonUtils jsonUtil = new JsonUtils() SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() - + + MsoUtils msoUtils = new MsoUtils() + public void preProcessRequest(DelegateExecution execution){ - msoLogger.info("***** Started preProcessRequest *****") - try { - + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started preProcessRequest *****") + try { + //get bpmn inputs from resource request. String requestId = execution.getVariable("mso-request-id") String requestAction = execution.getVariable("requestAction") @@ -68,12 +72,12 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { //Get ResourceInput Object ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) execution.setVariable(Prefix + "resourceInput", resourceInputObj) - + //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName() + String resourceModelName = resourceInputObj.getResourceModelInfo().getModelName() //For sdnc requestAction default is "NetworkInstance" - String operationType = "Network" + String operationType = "Network" if(!StringUtils.isBlank(recipeParamsFromRequest) && "null" != recipeParamsFromRequest){ //the operationType from worflow(first node) is second priority. operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") @@ -82,36 +86,78 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { //the operationType from worflow(first node) is highest priority. operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - - + + //For sdnc, generate svc_action and request_action String sdnc_svcAction = "delete" - if(StringUtils.containsIgnoreCase(resourceModelName, "overlay")){ - //This will be resolved in R3. - sdnc_svcAction ="deactivate" - operationType = "NCINetwork" + switch (resourceInputObj.getResourceModelInfo().getModelName()) { + + case ~/[\w\s\W]*overlay[\w\s\W]*/ : + ///This will be resolved in R3. + sdnc_svcAction ="deactivate" + operationType = "NCINetwork" + break + + case ~/[\w\s\W]*underlay[\w\s\W]*/ : + //This will be resolved in R3. + operationType ="Network" + break + + case ~/[\w\s\W]*SOTNConnectivity[\w\s\W]*/ : + operationType = "SOTNConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sotnvpnattachment[\w\s\W]*/ : + operationType = "SOTNAttachment" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteVF[\w\s\W]*/ : + operationType = "Site" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*deviceVF[\w\s\W]*/ : + operationType = "SDWANDevice" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SDWANConnectivity[\w\s\W]*/ : + operationType = "SDWANConnectivity" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*sdwanvpnattachment[\w\s\W]*/ : + operationType = "SDWANAttachment" + execution.setVariable("isActivateRequired", "true") + break + + case ~/[\w\s\W]*SiteWANVF[\w\s\W]*/ : + operationType = "SDWANPort" + execution.setVariable("isActivateRequired", "true") + break + + default: + break } - if(StringUtils.containsIgnoreCase(resourceModelName, "underlay")){ - //This will be resolved in R3. - operationType ="Network" - } - String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" - execution.setVariable(Prefix + "svcAction", sdnc_svcAction) + String sdnc_requestAction = StringUtils.capitalize(sdnc_svcAction) + operationType +"Instance" + execution.setVariable(Prefix + "svcAction", sdnc_svcAction) execution.setVariable(Prefix + "requestAction", sdnc_requestAction) execution.setVariable(Prefix + "serviceInstanceId", resourceInputObj.getServiceInstanceId()) execution.setVariable("mso-request-id", requestId) execution.setVariable("mso-service-instance-id", resourceInputObj.getServiceInstanceId()) //TODO Here build networkrequest - + } catch (BpmnError e) { throw e; } catch (Exception ex){ msg = "Exception in preProcessRequest " + ex.getMessage() - msoLogger.debug(msg) + msoLogger.debug( msg) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } } - + /** * Pre Process the BPMN Flow Request * Inclouds: @@ -119,11 +165,12 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { * generate the nsParameters */ public void prepareSDNCRequest (DelegateExecution execution) { - msoLogger.info("***** Started prepareSDNCRequest *****") + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + msoLogger.info(" ***** Started prepareSDNCRequest *****") try { // get variables - String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") + String sdnc_svcAction = execution.getVariable(Prefix + "svcAction") String sdnc_requestAction = execution.getVariable(Prefix + "requestAction") String sdncCallback = execution.getVariable("URN_mso_workflow_sdncadapter_callback") String deleteNetworkInput = execution.getVariable(Prefix + "networkRequest") @@ -144,177 +191,164 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() String modelName = resourceInputObj.getResourceModelInfo().getModelName() String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + String resourceInstnaceId = resourceInputObj.getResourceInstancenUuid() // 1. prepare assign topology via SDNC Adapter SUBFLOW call - String sndcTopologyDeleteRequest = "" + String sdncTopologyDeleteRequest = "" switch (modelName) { - case ~/^Site$/: - sndcTopologyDeleteRequest = """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} - network-topology-operation + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} + vnf-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} - + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} + ${msoUtils.xmlEncode(globalCustomerId)} - - + $resourceInstnaceId - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} - - - - - - - - - - - - - - - - + + + + + - - - - + """.trim() break - case ~/^SOTNAttachment$/: - sndcTopologyDeleteRequest = """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} - network-topology-operation + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} + connection-attachment-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} - + $resourceInstnaceId - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} - """.trim() break default: - sndcTopologyDeleteRequest = """ - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(sdnc_svcAction)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(sdnc_svcAction)} network-topology-operation sdncCallback generic-resource - ${MsoUtils.xmlEscape(hdrRequestId)} - ${MsoUtils.xmlEscape(sdnc_requestAction)} - ${MsoUtils.xmlEscape(source)} + ${msoUtils.xmlEncode(hdrRequestId)} + ${msoUtils.xmlEncode(sdnc_requestAction)} + ${msoUtils.xmlEncode(source)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(serviceType)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(serviceType)} - ${MsoUtils.xmlEscape(serviceModelInvariantUuid)} - ${MsoUtils.xmlEscape(serviceModelUuid)} - ${MsoUtils.xmlEscape(serviceModelVersion)} - ${MsoUtils.xmlEscape(serviceModelName)} + ${msoUtils.xmlEncode(serviceModelInvariantUuid)} + ${msoUtils.xmlEncode(serviceModelUuid)} + ${msoUtils.xmlEncode(serviceModelVersion)} + ${msoUtils.xmlEncode(serviceModelName)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(globalCustomerId)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(globalCustomerId)} - - + $resourceInstnaceId - ${MsoUtils.xmlEscape(modelInvariantUuid)} - ${MsoUtils.xmlEscape(modelCustomizationUuid)} - ${MsoUtils.xmlEscape(modelUuid)} - ${MsoUtils.xmlEscape(modelVersion)} - ${MsoUtils.xmlEscape(modelName)} + ${msoUtils.xmlEncode(modelInvariantUuid)} + ${msoUtils.xmlEncode(modelCustomizationUuid)} + ${msoUtils.xmlEncode(modelUuid)} + ${msoUtils.xmlEncode(modelVersion)} + ${msoUtils.xmlEncode(modelName)} @@ -324,19 +358,19 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { """.trim() } - String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) - utils.logAudit(sndcTopologyDeleteRequesAsString) - execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) - msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString) + String sdncTopologyDeleteRequesAsString = utils.formatXml(sdncTopologyDeleteRequest) + utils.logAudit(sdncTopologyDeleteRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sdncTopologyDeleteRequesAsString) + msoLogger.info("sdncAdapterWorkflowRequest - " + "\n" + sdncTopologyDeleteRequesAsString) } catch (Exception ex) { String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() - msoLogger.debug(exceptionMessage) + msoLogger.debug( exceptionMessage) exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) } msoLogger.info(" ***** Exit prepareSDNCRequest *****") - } + } private void setProgressUpdateVariables(DelegateExecution execution, String body) { def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") @@ -358,17 +392,17 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String body = """ + xmlns:ns="http://org.openecomp.mso/requestsdb"> - ${MsoUtils.xmlEscape(operType)} - ${MsoUtils.xmlEscape(operationId)} - ${MsoUtils.xmlEscape(progress)} - ${MsoUtils.xmlEscape(resourceCustomizationUuid)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(status)} - ${MsoUtils.xmlEscape(statusDescription)} + ${msoUtils.xmlEncode(operType)} + ${msoUtils.xmlEncode(operationId)} + ${msoUtils.xmlEncode(progress)} + ${msoUtils.xmlEncode(resourceCustomizationUuid)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(status)} + ${msoUtils.xmlEncode(statusDescription)} """; @@ -385,23 +419,23 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { String operationId = resourceInputObj.getOperationId() String progress = "100" String status = "finished" - String statusDescription = "SDCN resource delete completed" + String statusDescription = "SDCN resource delete and deactivation completed" //String operationId = execution.getVariable("operationId") String body = """ + xmlns:ns="http://org.openecomp.mso/requestsdb"> - ${MsoUtils.xmlEscape(operType)} - ${MsoUtils.xmlEscape(operationId)} - ${MsoUtils.xmlEscape(progress)} - ${MsoUtils.xmlEscape(resourceCustomizationUuid)} - ${MsoUtils.xmlEscape(serviceInstanceId)} - ${MsoUtils.xmlEscape(status)} - ${MsoUtils.xmlEscape(statusDescription)} + ${msoUtils.xmlEncode(operType)} + ${msoUtils.xmlEncode(operationId)} + ${msoUtils.xmlEncode(progress)} + ${msoUtils.xmlEncode(resourceCustomizationUuid)} + ${msoUtils.xmlEncode(serviceInstanceId)} + ${msoUtils.xmlEncode(status)} + ${msoUtils.xmlEncode(statusDescription)} """; @@ -410,6 +444,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { } public void postDeleteSDNCCall(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") msoLogger.info(" ***** Started prepareSDNCRequest *****") String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") String responseObj = execution.getVariable(Prefix + "SuccessIndicator") @@ -417,23 +452,24 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { msoLogger.info("response from sdnc, response code :" + responseCode + " response object :" + responseObj) msoLogger.info(" ***** Exit prepareSDNCRequest *****") } - - public void sendSyncResponse (DelegateExecution execution) { - msoLogger.info(" *** sendSyncResponse *** ") - - try { - String operationStatus = "finished" - // RESTResponse for main flow - String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() - utils.log("DEBUG", " sendSyncResponse to APIH:" + "\n" + resourceOperationResp, isDebugEnabled) - sendWorkflowResponse(execution, 202, resourceOperationResp) - execution.setVariable("sentSyncResponse", true) - - } catch (Exception ex) { - String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() - msoLogger.debug(msg) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) - } - msoLogger.info(" ***** Exit sendSyncResopnse *****") - } + + public void sendSyncResponse (DelegateExecution execution) { + def isDebugEnabled=execution.getVariable("isDebugLogEnabled") + msoLogger.debug( " *** sendSyncResponse *** ") + + try { + String operationStatus = "finished" + // RESTResponse for main flow + String resourceOperationResp = """{"operationStatus":"${operationStatus}"}""".trim() + msoLogger.debug( " sendSyncResponse to APIH:" + "\n" + resourceOperationResp) + sendWorkflowResponse(execution, 202, resourceOperationResp) + execution.setVariable("sentSyncResponse", true) + + } catch (Exception ex) { + String msg = "Exceptuion in sendSyncResponse:" + ex.getMessage() + msoLogger.debug( msg) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) + } + msoLogger.debug(" ***** Exit sendSyncResopnse *****") + } } diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn new file mode 100644 index 0000000000..e3b5e7997e --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/ActivateSDNCNetworkResource.bpmn @@ -0,0 +1,174 @@ + + + + + SequenceFlow_1c92ks3_activate + + + SequenceFlow_17md60u_activate + + + + SequenceFlow_1vnx1pp_activate + SequenceFlow_0ow44q0_activate + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new ActivateSDNCNetworkResource() +dcsi.postActivateSDNCCall(execution) + + + + SequenceFlow_1c92ks3_activate + SequenceFlow_18l3crb_activate + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new ActivateSDNCNetworkResource() +dcsi.preProcessRequest(execution) + + + SequenceFlow_13ee4rf + SequenceFlow_1jr6zi0_activate + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new ActivateSDNCNetworkResource() +dcsi.prepareUpdateAfterActivateSDNCResource(execution) + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1jr6zi0_activate + SequenceFlow_1vnx1pp_activate + + + + + SequenceFlow_0ow44q0_activate + SequenceFlow_17md60u_activate + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new ActivateSDNCNetworkResource() +csi.sendSyncResponse(execution) + + + + + SequenceFlow_18l3crb_activate + SequenceFlow_0sjrnv5_activate + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new ActivateSDNCNetworkResource() +dcsi.prepareSDNCRequest(execution) + + + + + + + + + + + + + + SequenceFlow_0sjrnv5_activate + SequenceFlow_13ee4rf + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn index a4e7ae1b1a..a94569c29b 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/CreateSDNCNetworkResource.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1qo2pln @@ -7,7 +7,7 @@ - SequenceFlow_18l3crb + SequenceFlow_0svppaq SequenceFlow_0khtova import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new CreateSDNCNetworkResource() @@ -18,27 +18,19 @@ dcsi.prepareSDNCRequest(execution) - - + SequenceFlow_15mvedq - SequenceFlow_1ex9ov6 + SequenceFlow_0u8d8j5 - - SequenceFlow_1ex9ov6 - SequenceFlow_1kzj1j5 - import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new CreateSDNCNetworkResource() -dcsi.postCreateSDNCCall(execution) - - + SequenceFlow_1qo2pln SequenceFlow_0w2es8j @@ -103,27 +95,24 @@ dcsi.prepareUpdateBeforeCreateSDNCResource(execution) http-connector - SequenceFlow_1kzj1j5 - SequenceFlow_0o7h0ag + SequenceFlow_1cd8ujq + SequenceFlow_0drbyvd - SequenceFlow_1cd8ujq + SequenceFlow_0drbyvd SequenceFlow_0auvfvm import org.onap.so.bpmn.infrastructure.scripts.* def csi = new CreateSDNCNetworkResource() csi.sendSyncResponse(execution) - - SequenceFlow_0o7h0ag + + SequenceFlow_0oqe2oa SequenceFlow_1dww8ye SequenceFlow_05m2j56 #{(execution.getVariable("isActivateRequired") == "true")} - - - SequenceFlow_05m2j56 SequenceFlow_05niqbf @@ -134,7 +123,7 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution) - + @@ -148,36 +137,55 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution) + + SequenceFlow_1dww8ye SequenceFlow_05niqbf + + + SequenceFlow_18l3crb + SequenceFlow_0svppaq + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateSDNCNetworkResource() +dcsi.updateResourceInput(execution) + + + + + + SequenceFlow_0u8d8j5 + SequenceFlow_0oqe2oa + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new CreateSDNCNetworkResource() +dcsi.afterCreateSDNCCall(execution) + - + - + - - + + - - - + + - + @@ -188,33 +196,28 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution) - - - - - + + - - + + - + - + - - - + @@ -225,75 +228,85 @@ dcsi.prepareUpdateAfterCreateSDNCResource(execution) - + - + - + - + - + - - - + + + - + - - - - - - - - - - - - - + - - + + - + - - - + + + - - + + - + + + + + + + + + + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn new file mode 100644 index 0000000000..09d8e35258 --- /dev/null +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeActivateSDNCNetworkResource.bpmn @@ -0,0 +1,183 @@ + + + + + SequenceFlow_1qo2pln + + + + SequenceFlow_18l3crb + SequenceFlow_1fjtgq7 + SequenceFlow_0nmt8ph + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeActivateSDNCNetworkResource() +dcsi.prepareSDNCRequest(execution) + + + SequenceFlow_15wux6a + + + + SequenceFlow_13gl3wv + SequenceFlow_0ow44q0 + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeActivateSDNCNetworkResource() +dcsi.postDeactivateSDNCCall(execution) + + + + SequenceFlow_1qo2pln + SequenceFlow_18l3crb + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeActivateSDNCNetworkResource() +dcsi.preProcessRequest(execution) + + + SequenceFlow_0rn8vky + SequenceFlow_1pzm7qx + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeActivateSDNCNetworkResource() +dcsi.prepareUpdateAfterDeActivateSDNCResource(execution) + + + SequenceFlow_0ow44q0 + SequenceFlow_15wux6a + import org.onap.so.bpmn.infrastructure.scripts.* +def csi = new DeActivateSDNCNetworkResource() +csi.sendSyncResponse(execution) + + + + + SequenceFlow_1fjtgq7 + SequenceFlow_0c58p9k + + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1pzm7qx + SequenceFlow_13gl3wv + + + + + + + + + + + + + + SequenceFlow_1fjtgq7 + SequenceFlow_0nmt8ph + SequenceFlow_0rn8vky + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn index 00c0288246..da17fee16e 100644 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn +++ b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/process/DeleteSDNCNetworkResource.bpmn @@ -1,78 +1,56 @@ - + - - SequenceFlow_1qo2pln + + SequenceFlow_1qo2pln_delete - - - - SequenceFlow_0jh88qw - SequenceFlow_00vqgvt - SequenceFlow_0khtova - import org.openecomp.mso.bpmn.infrastructure.scripts.* + + + + SequenceFlow_0jh88qw_delete + SequenceFlow_00vqgvt_delete + SequenceFlow_0khtova_delete + import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.prepareSDNCRequest(execution) - - SequenceFlow_15wux6a + + SequenceFlow_15wux6a_delete - - - - - - - - - - - - SequenceFlow_15mvedq - SequenceFlow_1xk5xed - - - - - SequenceFlow_0ds04u5 - SequenceFlow_0ow44q0 - import org.openecomp.mso.bpmn.infrastructure.scripts.* + + + SequenceFlow_0ds04u5_delete + SequenceFlow_0ow44q0_delete + import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.postDeleteSDNCCall(execution) - - - - SequenceFlow_1qo2pln - SequenceFlow_0w2es8j + + + + SequenceFlow_1qo2pln_delete + SequenceFlow_0w2es8j_delete String recipeParamXsdDemo="""{"operationType":"GRE"}""" String recipeParamXsd="" execution.setVariable("recipeParamXsd", recipeParamXsd) - - SequenceFlow_0w2es8j - SequenceFlow_18l3crb - import org.openecomp.mso.bpmn.infrastructure.scripts.* + + SequenceFlow_0w2es8j_delete + SequenceFlow_18l3crb_delete + import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.preProcessRequest(execution) - - - - SequenceFlow_0khtova - SequenceFlow_1mz0vdx - import org.openecomp.mso.bpmn.infrastructure.scripts.* + + + + SequenceFlow_0khtova_delete + SequenceFlow_1mz0vdx_delete + import org.onap.so.bpmn.infrastructure.scripts.* def dcsi = new DeleteSDNCNetworkResource() dcsi.prepareUpdateBeforeDeleteSDNCResource(execution) - - SequenceFlow_1xk5xed - SequenceFlow_1jr6zi0 - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DeleteSDNCNetworkResource() -dcsi.prepareUpdateAfterDeleteSDNCResource(execution) - - + @@ -91,10 +69,10 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution) http-connector - SequenceFlow_1mz0vdx - SequenceFlow_15mvedq + SequenceFlow_1mz0vdx_delete + SequenceFlow_15mvedq_delete - + @@ -113,178 +91,181 @@ dcsi.prepareUpdateAfterDeleteSDNCResource(execution) http-connector - SequenceFlow_1jr6zi0 - SequenceFlow_0ds04u5 + SequenceFlow_0yooswe_delete + SequenceFlow_0ds04u5_delete - - - SequenceFlow_0ow44q0 - SequenceFlow_15wux6a - import org.openecomp.mso.bpmn.infrastructure.scripts.* + + SequenceFlow_0ow44q0_delete + SequenceFlow_15wux6a_delete + import org.onap.so.bpmn.infrastructure.scripts.* def csi = new DeleteSDNCNetworkResource() csi.sendSyncResponse(execution) - - - - SequenceFlow_18l3crb - SequenceFlow_0jh88qw - SequenceFlow_0h3klf0 + + + + SequenceFlow_18l3crb_delete + SequenceFlow_0jh88qw_delete + SequenceFlow_0h3klf0_delete - - + + #{(execution.getVariable("isActivateRequired") != "true")} + + #{(execution.getVariable("isActivateRequired") == "true")} - - + + - - SequenceFlow_0h3klf0 - SequenceFlow_00vqgvt + SequenceFlow_0h3klf0_delete + SequenceFlow_00vqgvt_delete + + + SequenceFlow_0lplazm + SequenceFlow_0yooswe_delete + import org.onap.so.bpmn.infrastructure.scripts.* +def dcsi = new DeleteSDNCNetworkResource() +dcsi.prepareUpdateAfterDeleteSDNCResource(execution) + + + + + + + + + + + + + + SequenceFlow_15mvedq_delete + SequenceFlow_0lplazm + - + - + - + - + - + - + - - - - - - - - - - - + - + - + - + - + - + - + - + - - - - + + + + - + - - - - + - + - - - - - - - - + - + - + - + - + - + @@ -292,13 +273,27 @@ csi.sendSyncResponse(execution) - + - + + + + + + + + + + + + + + + - + \ No newline at end of file diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn deleted file mode 100644 index 6b3641b235..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/ActivateSDNCNetworkResource.bpmn +++ /dev/null @@ -1,177 +0,0 @@ - - - - - SequenceFlow_1c92ks3 - - - SequenceFlow_17md60u - - - - - - - - - - - - - SequenceFlow_0sjrnv5 - SequenceFlow_1xk5xed - - - - - SequenceFlow_1vnx1pp - SequenceFlow_0ow44q0 - import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new ActivateSDNCNetworkResource() -dcsi.postCreateSDNCCall(execution) - - - - SequenceFlow_1c92ks3 - SequenceFlow_18l3crb - import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new ActivateSDNCNetworkResource() -dcsi.preProcessRequest(execution) - - - SequenceFlow_1xk5xed - SequenceFlow_1jr6zi0 - import org.onap.so.bpmn.infrastructure.scripts.* -def dcsi = new ActivateSDNCNetworkResource() -dcsi.prepareUpdateAfterActivateSDNCResource(execution) - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1jr6zi0 - SequenceFlow_1vnx1pp - - - - - SequenceFlow_0ow44q0 - SequenceFlow_17md60u - import org.onap.so.bpmn.infrastructure.scripts.* -def csi = new ActivateSDNCNetworkResource() -csi.sendSyncResponse(execution) - - - - - SequenceFlow_18l3crb - SequenceFlow_0sjrnv5 - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new ActivateSDNCNetworkResource() -dcsi.prepareSDNCRequest(execution) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DeActivateSDNCNetworkResource.bpmn b/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DeActivateSDNCNetworkResource.bpmn deleted file mode 100644 index 3442d68c45..0000000000 --- a/bpmn/so-bpmn-infrastructure-flows/src/main/resources/subprocess/DeActivateSDNCNetworkResource.bpmn +++ /dev/null @@ -1,177 +0,0 @@ - - - - - SequenceFlow_1qo2pln - - - - - SequenceFlow_18l3crb - SequenceFlow_0khtova - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DeActivateSDNCNetworkResource() -dcsi.prepareSDNCRequest(execution) - - - SequenceFlow_15wux6a - - - - - - - - - - - - - SequenceFlow_0khtova - SequenceFlow_0uig0sx - - - - SequenceFlow_0x5f1o7 - SequenceFlow_0ow44q0 - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DeActivateSDNCNetworkResource() -dcsi.postDeactivateSDNCCall(execution) - - - - SequenceFlow_1qo2pln - SequenceFlow_18l3crb - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DeleteSDNDeActivateSDNCNetworkResourceCNetworkResource() -dcsi.preProcessRequest(execution) - - - - SequenceFlow_0uig0sx - SequenceFlow_1mz0vdx - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def dcsi = new DeActivateSDNCNetworkResource() -dcsi.prepareUpdateAfterDeActivateSDNCResource(execution) - - - - - - ${CVFMI_dbAdapterEndpoint} - - - application/soap+xml - Basic QlBFTENsaWVudDpwYXNzd29yZDEk - - - ${CVFMI_updateResOperStatusRequest} - POST - ${statusCode} - ${response} - - http-connector - - - SequenceFlow_1mz0vdx - SequenceFlow_0x5f1o7 - - - SequenceFlow_0ow44q0 - SequenceFlow_15wux6a - import org.openecomp.mso.bpmn.infrastructure.scripts.* -def csi = new DeActivateSDNCNetworkResource() -csi.sendSyncResponse(execution) - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -- cgit 1.2.3-korg