From ddec5cb953086392f04d015ea561f5de4ae389c0 Mon Sep 17 00:00:00 2001 From: c00149107 Date: Wed, 25 Apr 2018 10:05:25 +0800 Subject: Update Delete Resource Flow Update Delete Resource Flow Change-Id: Ie6270d954fc1c703de4bdd0c8f1e543a155060d1 Issue-ID: SO-587 Signed-off-by: c00149107 --- .../scripts/CreateSDNCNetworkResource.groovy | 2 +- .../scripts/DeleteSDNCNetworkResource.groovy | 426 ++++++++++++--------- .../scripts/DoDeleteE2EServiceInstance.groovy | 4 +- .../scripts/DoDeleteResourcesV1.groovy | 92 +++-- .../process/CreateSDNCNetworkResource.bpmn | 2 +- .../process/DeleteSDNCNetworkResource.bpmn | 286 +++++++++----- .../subprocess/DoDeleteE2EServiceInstance.bpmn | 12 +- .../resources/subprocess/DoDeleteResourcesV1.bpmn | 109 +++++- 8 files changed, 584 insertions(+), 349 deletions(-) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy index 64b84e6b40..f265638423 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy @@ -284,7 +284,7 @@ public class CreateSDNCNetworkResource extends AbstractServiceTaskProcessor { String ServiceInstanceId = resourceInputObj.getServiceInstanceId() String operationId = resourceInputObj.getOperationId() String progress = "100" - String status = "Created" + String status = "finished" String statusDescription = "SDCN resource creation completed" execution.getVariable("operationId") diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy index 72db6f358d..73230c6f21 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy @@ -1,17 +1,15 @@ - /*- * ============LICENSE_START======================================================= - * ONAP - SO + * OPENECOMP - SO * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. - * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved. + * Copyright (C) 2018 Huawei Technologies Co., Ltd. All rights reserved. * ================================================================================ * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. @@ -19,131 +17,72 @@ * limitations under the License. * ============LICENSE_END========================================================= */ + package org.openecomp.mso.bpmn.infrastructure.scripts -import org.json.JSONArray -import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder -import org.openecomp.mso.bpmn.core.domain.ModelInfo -import org.openecomp.mso.bpmn.core.domain.Resource -import org.openecomp.mso.bpmn.core.domain.ServiceDecomposition -import org.openecomp.mso.bpmn.infrastructure.properties.BPMNProperties; -import org.apache.http.HttpResponse -import org.json.JSONArray -import org.openecomp.mso.bpmn.common.recipe.BpmnRestClient +import org.json.JSONObject +import org.json.XML; import static org.apache.commons.lang3.StringUtils.*; import groovy.xml.XmlUtil -import org.openecomp.mso.bpmn.common.scripts.CatalogDbUtils; import groovy.json.* - -import org.openecomp.mso.bpmn.core.json.JsonUtils -import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor +import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor import org.openecomp.mso.bpmn.common.scripts.ExceptionUtil +import org.openecomp.mso.bpmn.common.recipe.ResourceInput; +import org.openecomp.mso.bpmn.common.resource.ResourceRequestBuilder +import org.openecomp.mso.bpmn.core.WorkflowException +import org.openecomp.mso.bpmn.core.json.JsonUtils +import org.openecomp.mso.bpmn.infrastructure.workflow.serviceTask.client.builder.AbstractBuilder +import org.openecomp.mso.rest.APIResponse import org.openecomp.mso.bpmn.common.scripts.SDNCAdapterUtils -import org.openecomp.mso.bpmn.core.WorkflowException -import org.openecomp.mso.rest.APIResponse; -import org.openecomp.mso.rest.RESTClient -import org.openecomp.mso.rest.RESTConfig -import org.openecomp.mso.bpmn.common.recipe.ResourceInput -import com.fasterxml.jackson.databind.ObjectMapper -import java.util.List; import java.util.UUID; -import javax.xml.parsers.DocumentBuilder -import javax.xml.parsers.DocumentBuilderFactory -import org.camunda.bpm.engine.delegate.BpmnError +import org.camunda.bpm.engine.delegate.BpmnError import org.camunda.bpm.engine.delegate.DelegateExecution -import org.json.JSONObject; import org.apache.commons.lang3.* import org.apache.commons.codec.binary.Base64; -import org.springframework.web.util.UriUtils; -import org.w3c.dom.Document -import org.w3c.dom.Element -import org.w3c.dom.Node -import org.w3c.dom.NodeList -import org.xml.sax.InputSource - -import com.fasterxml.jackson.jaxrs.json.annotation.JSONP.Def; +import org.springframework.web.util.UriUtils +import org.openecomp.mso.rest.RESTClient +import org.openecomp.mso.rest.RESTConfig +import org.openecomp.mso.rest.APIResponse; +/** + * This groovy class supports the DeleteSDNCCNetworkResource.bpmn process. + * flow for SDNC Network Resource + */ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { - String Prefix="DDELSDNNS_" + String Prefix="DELSDNCRES_" + + ExceptionUtil exceptionUtil = new ExceptionUtil() - public void preProcessRequest (DelegateExecution execution) { - def isDebugEnabled = execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** preProcessSDNCDelete *****", isDebugEnabled) - String msg = "" + JsonUtils jsonUtil = new JsonUtils() - try { - ResourceInput resourceInput = new ObjectMapper().readValue(execution.getVariable("resourceInput"), ResourceInput.class) - - ModelInfo resourceModelInfo = resourceInput.getResourceModelInfo() - execution.setVariable("resourceInvariantUUID", resourceModelInfo.getModelInvariantUuid()) - execution.setVariable("modelVersion", resourceModelInfo.getModelVersion()) - execution.setVariable("resourceUUID", resourceModelInfo.getModelUuid()) - execution.setVariable("resourceType", resourceModelInfo.getModelType()) - - String serviceInstanceId = execution.getVariable("serviceInstanceId") - String serviceInstanceName = execution.getVariable("serviceInstanceName") - String callbackURL = execution.getVariable("sdncCallbackUrl") - String requestId = execution.getVariable("msoRequestId") - String subscriptionServiceType = execution.getVariable("serviceType") - String globalSubscriberId = resourceInput.getGlobalSubscriberId() + SDNCAdapterUtils sdncAdapterUtils = new SDNCAdapterUtils() + + public void preProcessRequest(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started preProcessRequest *****", isDebugEnabled) + try { + + //get bpmn inputs from resource request. + String requestId = execution.getVariable("requestId") + String requestAction = execution.getVariable("requestAction") + utils.log("INFO","The requestAction is: " + requestAction, isDebugEnabled) String recipeParamsFromRequest = execution.getVariable("recipeParams") - String serviceId = resourceInput.getServiceInstanceId() - ModelInfo serviceModelInfo = resourceInput.getServiceModelInfo() - String modelInvariantUuid = "" - String modelVersion = "" - String modelUuid = "" - String modelName = "" - - if (serviceModelInfo != null) - { - modelInvariantUuid = serviceModelInfo.getModelInvariantUuid() - modelVersion = serviceModelInfo.getModelVersion() - modelUuid = serviceModelInfo.getModelUuid() - modelName = serviceModelInfo.getModelName() - - execution.setVariable("modelInvariantUuid", serviceModelInfo.getModelInvariantUuid()) - execution.setVariable("modelVersion", serviceModelInfo.getModelVersion()) - execution.setVariable("modelUuid", serviceModelInfo.getModelUuid()) - execution.setVariable("serviceModelName", serviceModelInfo.getModelName()) - - if (modelInvariantUuid == null) { - modelInvariantUuid = "" - } - if (modelVersion == null) { - modelVersion = "" - } - if (modelUuid == null) { - modelUuid = "" - } - if (modelName == null) { - modelName = "" - } - } - if (serviceInstanceName == null) { - serviceInstanceName = "" - } - if (serviceId == null) { - serviceId = "" - } - - def siParamsXml = execution.getVariable("siParamsXml") - def serviceType = execution.getVariable("serviceType") - if (serviceType == null) - { - serviceType = "" - } - - String sdncRequestId = UUID.randomUUID().toString() - + utils.log("INFO","The recipeParams is: " + recipeParamsFromRequest, isDebugEnabled) + String resourceInput = execution.getVariable("resourceInput") + utils.log("INFO","The resourceInput is: " + resourceInput, isDebugEnabled) + //Get ResourceInput Object + ResourceInput resourceInputObj = ResourceRequestBuilder.getJsonObject(resourceInput, ResourceInput.class) + execution.setVariable(Prefix + "resourceInput", resourceInputObj) + + //Deal with recipeParams String recipeParamsFromWf = execution.getVariable("recipeParamXsd") - - String operationType = "Network" - String sdnc_svcAction = "delete" - + String resourceName = resourceInputObj.getResourceInstanceName() + //For sdnc requestAction default is "NetworkInstance" + String operationType = "Network" if(!StringUtils.isBlank(recipeParamsFromRequest)){ //the operationType from worflow(first node) is second priority. operationType = jsonUtil.getJsonValue(recipeParamsFromRequest, "operationType") @@ -152,91 +91,210 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor { //the operationType from worflow(first node) is highest priority. operationType = jsonUtil.getJsonValue(recipeParamsFromWf, "operationType") } - - operationType = "delete" + operationType + "Instance" - - if(StringUtils.containsIgnoreCase(resourceInput.getResourceModelInfo().getModelName(), "overlay")){ + + + //For sdnc, generate svc_action and request_action + String sdnc_svcAction = "delete" + if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "overlay")){ //This will be resolved in R3. sdnc_svcAction ="deactivate" - operationType = "DeActivateDCINetworkInstance" + operationType = "NCINetwork" } - if(StringUtils.containsIgnoreCase(resourceInput.getResourceModelInfo().getModelName(), "underlay")){ + if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "underlay")){ //This will be resolved in R3. - operationType ="DeleteNetworkInstance" - } - - String sdncDelete = - """ - - ${sdncRequestId} - ${serviceInstanceId} - ${sdnc_svcAction} - service-topology-operation - ${callbackURL} - ${serviceType} - - - - ${requestId} - MSO - - - - ${operationType} - - - ${serviceId} - ${subscriptionServiceType} - - ${modelInvariantUuid} - ${modelUuid} - ${modelVersion} - ${modelName} - - ${serviceInstanceId} - - ${globalSubscriberId} - - - ${serviceInstanceName} - ${siParamsXml} - - - """ - - sdncDelete = utils.formatXml(sdncDelete) - - // set operation type and resource type is required to form request body - execution.setVariable("operationType", "DELETE") - execution.setVariable("resourceType", resourceModelInfo.getModelName()) - - //def sdncRequestId2 = UUID.randomUUID().toString() - //String sdncDeactivate = sdncDelete.replace(">delete<", ">deactivate<").replace(">${sdncRequestId}<", ">${sdncRequestId2}<") - execution.setVariable("sdncDelete", sdncDelete) -// execution.setVariable("sdncDeactivate", sdncDeactivate) -// utils.log("INFO","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled) - utils.log("INFO","sdncDelete:\n" + sdncDelete, isDebugEnabled) - + operationType ="Network" + } + 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 preProcessSDNCDelete. " + ex.getMessage() - utils.log("INFO", msg, isDebugEnabled) - exceptionUtil.buildAndThrowWorkflowException(execution, 7000, "Exception Occured in preProcessSDNCDelete.\n" + ex.getMessage()) + } catch (Exception ex){ + msg = "Exception in preProcessRequest " + ex.getMessage() + utils.log("DEBUG", msg, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, msg) } - utils.log("INFO"," *****Exit preProcessSDNCDelete *****", isDebugEnabled) } + + /** + * Pre Process the BPMN Flow Request + * Inclouds: + * generate the nsOperationKey + * generate the nsParameters + */ + public void prepareSDNCRequest (DelegateExecution execution) { + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) + + try { + // get variables + 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") + + 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 serviceType = resourceInputObj.getServiceType() + String serviceModelInvariantUuid = resourceInputObj.getServiceModelInfo().getModelInvariantUuid() + String serviceModelUuid = resourceInputObj.getServiceModelInfo().getModelUuid() + String serviceModelVersion = resourceInputObj.getServiceModelInfo().getModelVersion() + String serviceModelName = resourceInputObj.getServiceModelInfo().getModelName() + String globalCustomerId = resourceInputObj.getGlobalSubscriberId() + String modelInvariantUuid = resourceInputObj.getResourceModelInfo().getModelInvariantUuid(); + String modelCustomizationUuid = resourceInputObj.getResourceModelInfo().getModelCustomizationUuid() + String modelUuid = resourceInputObj.getResourceModelInfo().getModelUuid() + String modelName = resourceInputObj.getResourceModelInfo().getModelName() + String modelVersion = resourceInputObj.getResourceModelInfo().getModelVersion() + // 1. prepare assign topology via SDNC Adapter SUBFLOW call + String sndcTopologyDeleteRequest = + """ + + ${hdrRequestId} + ${serviceInstanceId} + ${sdnc_svcAction} + network-topology-operation + sdncCallback + generic-resource + + + + ${hdrRequestId} + ${sdnc_requestAction} + ${source} + + + + + + ${serviceInstanceId} + ${serviceType} + + ${serviceModelInvariantUuid} + ${serviceModelUuid} + ${serviceModelVersion} + ${serviceModelName} + + ${serviceInstanceId} + ${globalCustomerId} + + + + ${modelInvariantUuid} + ${modelCustomizationUuid} + ${modelUuid} + ${modelVersion} + ${modelName} + + + + + + + """.trim() + + String sndcTopologyDeleteRequesAsString = utils.formatXml(sndcTopologyDeleteRequest) + utils.logAudit(sndcTopologyDeleteRequesAsString) + execution.setVariable("sdncAdapterWorkflowRequest", sndcTopologyDeleteRequesAsString) + utils.log("INFO","sdncAdapterWorkflowRequest - " + "\n" + sndcTopologyDeleteRequesAsString, isDebugEnabled) + + } catch (Exception ex) { + String exceptionMessage = " Bpmn error encountered in DeleteSDNCCNetworkResource flow. prepareSDNCRequest() - " + ex.getMessage() + utils.log("DEBUG", exceptionMessage, isDebugEnabled) + exceptionUtil.buildAndThrowWorkflowException(execution, 7000, exceptionMessage) + + } + utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) + } + 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 prepareUpdateBeforeDeleteSDNCResource(DelegateExecution execution) { + 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 = "20" + String status = "processing" + String statusDescription = "SDCN resource delete invoked" + + execution.getVariable("operationId") + + String body = """ + + + + + ${operType} + ${operationId} + ${progress} + ${resourceCustomizationUuid} + ${ServiceInstanceId} + ${status} + ${statusDescription} + + + """; + + setProgressUpdateVariables(execution, body) - public void postProcessSDNCDelete(DelegateExecution execution, String response) { + } - def isDebugEnabled=execution.getVariable("isDebugLogEnabled") - utils.log("INFO"," ***** postProcessSDNC " + " *****", isDebugEnabled) - String msg = "" - utils.log("INFO"," response " + response, isDebugEnabled) - utils.log("INFO"," *** Exit postProcessSDNC " + " ***", isDebugEnabled) + public void prepareUpdateAfterDeleteSDNCResource(execution) { + 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" + + execution.getVariable("operationId") + + String body = """ + + + + + ${operType} + ${operationId} + ${progress} + ${resourceCustomizationUuid} + ${ServiceInstanceId} + ${status} + ${statusDescription} + + + """; + + setProgressUpdateVariables(execution, body) } + public void postDeleteSDNCCall(DelegateExecution execution){ + def isDebugEnabled = execution.getVariable("isDebugLogEnabled") + utils.log("INFO"," ***** Started prepareSDNCRequest *****", isDebugEnabled) + String responseCode = execution.getVariable(Prefix + "sdncDeleteReturnCode") + String responseObj = execution.getVariable(Prefix + "SuccessIndicator") + + utils.log("INFO","response from sdnc, response code :" + responseCode + " response object :" + responseObj, isDebugEnabled) + utils.log("INFO"," ***** Exit prepareSDNCRequest *****", isDebugEnabled) + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy index 946c248059..a834431356 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy @@ -335,8 +335,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor { String serviceModelInfo = """{ "modelInvariantUuid":"${modelInvariantUuid}", - "modelUuid":"", - "modelVersion":"${modelVersionId}" + "modelUuid":"${modelVersionId}", + "modelVersion":"" }""" execution.setVariable("serviceModelInfo", serviceModelInfo) diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy index 5dd8109c74..3591243c3f 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy +++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy @@ -147,13 +147,11 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { utils.log("INFO", " ======== STARTED sequenceResource Process ======== ", isDebugEnabled) List sequencedResourceList = new ArrayList() - List wanResources = new ArrayList() + List wanResources = new ArrayList() // get delete resource list and order list List delResourceList = execution.getVariable("deleteResourceList") - // existing resource list - List existResourceList = execution.getVariable("realNSRessources") - + def resourceSequence = BPMNProperties.getResourceSequenceProp() if(resourceSequence != null) { @@ -173,29 +171,26 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { //this is defaule sequence List vnfResourceList = new ArrayList() List arResourceList = new ArrayList() - List networkResourceList = new ArrayList() - for (Resource rc : delResourceList) { if (rc instanceof VnfResource) { vnfResourceList.add(rc) } else if (rc instanceof NetworkResource) { - networkResourceList.add(rc) + wanResources.add(rc) } else if (rc instanceof AllottedResource) { arResourceList.add(rc) } } sequencedResourceList.addAll(arResourceList) - sequencedResourceList.addAll(networkResourceList) + sequencedResourceList.addAll(wanResources) sequencedResourceList.addAll(vnfResourceList) } String isContainsWanResource = wanResources.isEmpty() ? "false" : "true" execution.setVariable("isContainsWanResource", isContainsWanResource) execution.setVariable("currentResourceIndex", 0) - execution.setVariable("resourceSequence", sequencedResourceList) + execution.setVariable("sequencedResourceList", sequencedResourceList) utils.log("INFO", "resourceSequence: " + resourceSequence, isDebugEnabled) - execution.setVariable("wanResources", wanResources) utils.log("INFO", " ======== END sequenceResource Process ======== ", isDebugEnabled) } @@ -208,19 +203,17 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { utils.log("INFO", " ======== STARTED preResourceDelete Process ======== ", isDebugEnabled) - List existResourceList = execution.getVariable("resourceSequence") + List sequencedResourceList = execution.getVariable("sequencedResourceList") int currentIndex = execution.getVariable("currentResourceIndex") - Resource curResource = existResourceList.get(currentIndex); + Resource curResource = sequencedResourceList.get(currentIndex); String resourceInstanceUUID = curResource.getResourceId() String resourceTemplateUUID = curResource.getModelInfo().getModelUuid() execution.setVariable("resourceInstanceId", resourceInstanceUUID) - execution.setVariable("resourceUuid", resourceTemplateUUID) - execution.setVariable("resourceType", curResource.getModelInfo().getModelName()) execution.setVariable("currentResource", curResource) utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: " - + resourceInstanceUUID, isDebugEnabled) + + resourceInstanceUUID + " resourceModelName: " + curResource.getModelInfo().getModelName(), isDebugEnabled) utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled) } @@ -229,7 +222,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { /** * Execute delete workflow for resource */ - public void executeResourceDelete(DelegateExecution execution, String resourceName) { + public void executeResourceDelete(DelegateExecution execution) { def isDebugEnabled=execution.getVariable("isDebugLogEnabled") utils.log("INFO", "======== Start executeResourceDelete Process ======== ", isDebugEnabled) String requestId = execution.getVariable("msoRequestId") @@ -237,33 +230,23 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { String serviceType = execution.getVariable("serviceType") String resourceInstanceId = execution.getVariable("resourceInstanceId") - String resourceUuid = execution.getVariable("resourceUuid") + Resource currentResource = execution.getVariable("currentResource") String action = "deleteInstance" - JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceUuid, action) + JSONObject resourceRecipe = cutils.getResourceRecipe(execution, currentResource.getModelInfo().getModelUuid(), action) String recipeUri = resourceRecipe.getString("orchestrationUri") int recipeTimeout = resourceRecipe.getInt("recipeTimeout") - String recipeParamXsd = resourceRecipe.isNull("paramXSD") ? "" : resourceRecipe.get("paramXSD") + String recipeParamXsd = resourceRecipe.get("paramXSD") - ResourceInput resourceInput = new ResourceInput(); - - ModelInfo serviceModelInfo = execution.getVariable("serviceModelInfo") - resourceInput.setServiceModelInfo(serviceModelInfo) - Resource currentResource = execution.getVariable("currentResource") + ResourceInput resourceInput = new ResourceInput(); resourceInput.setServiceInstanceId(serviceInstanceId) resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName()) - resourceInput.setGlobalSubscriberId(execution.getVariable("globalSubscriberId")) - - ModelInfo modelInfo = new ModelInfo() - modelInfo.setModelCustomizationUuid(currentResource.getModelInfo().getModelCustomizationUuid()) - modelInfo.setModelUuid(currentResource.getModelInfo().getModelCustomizationUuid()) - modelInfo.setModelInvariantUuid(currentResource.getModelInfo().getModelInvariantUuid()) - modelInfo.setModelName(currentResource.getModelInfo().getModelName()) - modelInfo.setModelVersion(currentResource.getModelInfo().getModelVersion()) - modelInfo.setModelType(currentResource.getModelInfo().getModelType()) - modelInfo.setModelInstanceName(currentResource.getModelInfo().getModelInstanceName()) - resourceInput.setResourceModelInfo(modelInfo) + String globalSubscriberId = execution.getVariable("globalSubscriberId") + resourceInput.setGlobalSubscriberId(globalSubscriberId) + resourceInput.setResourceModelInfo(currentResource.getModelInfo()); + ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition") + resourceInput.setServiceModelInfo(serviceDecomposition.getModelInfo()); resourceInput.setServiceType(serviceType) String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri @@ -279,12 +262,47 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor { def currentIndex = execution.getVariable("currentResourceIndex") def nextIndex = currentIndex + 1 execution.setVariable("currentResourceIndex", nextIndex) - List resourceSequence = execution.getVariable("resourceSequence") - if(nextIndex >= resourceSequence.size()){ + List sequencedResourceList = execution.getVariable("sequencedResourceList") + if(nextIndex >= sequencedResourceList.size()){ execution.setVariable("allResourceFinished", "true") }else{ execution.setVariable("allResourceFinished", "false") } utils.log("INFO", "======== COMPLETED parseNextResource Process ======== ", isDebugEnabled) } + + public void prepareFinishedProgressForResource(execution) { + String serviceInstanceId = execution.getVariable("serviceInstanceId") + String serviceType = execution.getVariable("serviceType") + String resourceInstanceId = execution.getVariable("resourceInstanceId") + Resource currentResource = execution.getVariable("currentResource") + String resourceCustomizationUuid = currentResource.getModelInfo().getModelCustomizationUuid() + String resourceModelName = currentResource.getModelInfo().getModelName() + String operationType = execution.getVariable("operationType") + String progress = "100" + String status = "finished" + String statusDescription = "The resource instance does not exist for " + resourceModelName + String operationId = execution.getVariable("operationId") + + String body = """ + + + + + ${operationType} + ${operationId} + ${progress} + ${resourceCustomizationUuid} + ${ServiceInstanceId} + ${status} + ${statusDescription} + + + """; + + def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint") + execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint) + execution.setVariable("CVFMI_updateResOperStatusRequest", body) + } } diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn index dcd0b56418..46555cf2d4 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateSDNCNetworkResource.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_1qo2pln diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn index a9e3f5d807..7786299ab8 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteSDNCNetworkResource.bpmn @@ -1,156 +1,240 @@ - + - + SequenceFlow_1qo2pln - - - SequenceFlow_1ba6i0r - - - - SequenceFlow_1twf9nk - SequenceFlow_092fygq - - - - SequenceFlow_00oxyoj - - - - SequenceFlow_0k06srk - - - - - SequenceFlow_00oxyoj - SequenceFlow_0k06srk - - - - - - - SequenceFlow_01medil - SequenceFlow_1twf9nk + + + + SequenceFlow_18l3crb + SequenceFlow_0khtova +def dcsi = new DeleteSDNCNetworkResource() +dcsi.prepareSDNCRequest(execution)]]> - - SequenceFlow_092fygq - SequenceFlow_1ba6i0r + + SequenceFlow_0ow44q0 + + + + + + + + + + + + + SequenceFlow_15mvedq + SequenceFlow_1xk5xed + + + + + SequenceFlow_1vnx1pp + SequenceFlow_0ow44q0 +def dcsi = new DeleteSDNCNetworkResource() +dcsi.postDeleteSDNCCall(execution)]]> - - + + + SequenceFlow_1qo2pln - SequenceFlow_01medil - SequenceFlow_0w2es8j + + + SequenceFlow_0w2es8j + SequenceFlow_18l3crb + + + + + + SequenceFlow_0khtova + SequenceFlow_1mz0vdx + + + + SequenceFlow_1xk5xed + SequenceFlow_1jr6zi0 + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1mz0vdx + SequenceFlow_15mvedq + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_1jr6zi0 + SequenceFlow_1vnx1pp + + + - - + + - + - - + + - + - - + + + + - + + + + - - - + + - + - - - - - + + - - + + + - + - - - + + + + - + + + + - - - + + + - + - - - + + + - + - - + + + + + - - - + + + + + - + - - - + + + + + + - + - - + + - - + + - - - + + + + + + + + + - + + + + + + + + - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn index 524846f192..4d9bbe98da 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn @@ -1,5 +1,5 @@ - + SequenceFlow_0vz7cd9 @@ -166,7 +166,7 @@ dcsi.postDecomposeService(execution)]]> - + SequenceFlow_1j08ko3 SequenceFlow_1cevtpy @@ -182,11 +182,6 @@ dcsi.postDecomposeService(execution)]]> - - - @@ -405,9 +400,6 @@ csi.sendSyncResponse(execution)]]> - - - diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn index 2b9b87409d..8da0ae01cd 100644 --- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn +++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteResourcesV1.bpmn @@ -13,15 +13,15 @@ def ddrs = new DoDeleteResourcesV1() ddrs.preResourceDelete(execution)]]> - SequenceFlow_1qm7owo + SequenceFlow_098gain SequenceFlow_1ly5jrs +ddr.executeResourceDelete(execution)]]> SequenceFlow_1ly5jrs + SequenceFlow_0djplpd SequenceFlow_0i1gez5 SequenceFlow_1d5mzit - + @@ -108,6 +108,46 @@ ddrs.sequenceResource(execution)]]> def ddrs = new DoDeleteResourcesV1() ddrs.preProcessRequest(execution)]]> + + SequenceFlow_1qm7owo + SequenceFlow_098gain + SequenceFlow_19ccmqv + + + + + + + + + ${CVFMI_dbAdapterEndpoint} + + + application/soap+xml + Basic QlBFTENsaWVudDpwYXNzd29yZDEk + + + ${CVFMI_updateResOperStatusRequest} + POST + ${statusCode} + ${response} + + http-connector + + + SequenceFlow_11bgbsh + SequenceFlow_0djplpd + + + SequenceFlow_19ccmqv + SequenceFlow_11bgbsh + + + + + @@ -121,10 +161,10 @@ ddrs.preProcessRequest(execution)]]> - + - + @@ -141,23 +181,23 @@ ddrs.preProcessRequest(execution)]]> - + - + - - + + - + - + - + @@ -298,6 +338,49 @@ ddrs.preProcessRequest(execution)]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit 1.2.3-korg