summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-04-25 05:19:26 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-25 05:19:26 +0000
commit46fb3092fe5bb518f220a6b38650d08cb4fda20d (patch)
treed035be272b48740866619e036b4a0ada64c4f417 /bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp
parent949b8d290a6625130dd0bd9f02bc1187699a77a0 (diff)
parentddec5cb953086392f04d015ea561f5de4ae389c0 (diff)
Merge "Update Delete Resource Flow"
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateSDNCNetworkResource.groovy2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy426
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy4
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy92
4 files changed, 300 insertions, 224 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 <class>DeleteSDNCCNetworkResource.bpmn</class> 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 =
- """<sdncadapterworkflow:SDNCAdapterWorkflowRequest xmlns:ns5="http://org.openecomp/mso/request/types/v1"
- xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1"
- xmlns:sdncadapter="http://org.openecomp/workflow/sdnc/adapter/schema/v1">
- <sdncadapter:RequestHeader>
- <sdncadapter:RequestId>${sdncRequestId}</sdncadapter:RequestId>
- <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
- <sdncadapter:SvcAction>${sdnc_svcAction}</sdncadapter:SvcAction>
- <sdncadapter:SvcOperation>service-topology-operation</sdncadapter:SvcOperation>
- <sdncadapter:CallbackUrl>${callbackURL}</sdncadapter:CallbackUrl>
- <sdncadapter:MsoAction>${serviceType}</sdncadapter:MsoAction>
- </sdncadapter:RequestHeader>
- <sdncadapterworkflow:SDNCRequestData>
- <request-information>
- <request-id>${requestId}</request-id>
- <source>MSO</source>
- <notification-url/>
- <order-number/>
- <order-version/>
- <request-action>${operationType}</request-action>
- </request-information>
- <service-information>
- <service-id>${serviceId}</service-id>
- <subscription-service-type>${subscriptionServiceType}</subscription-service-type>
- <onap-model-information>
- <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
- <model-uuid>${modelUuid}</model-uuid>
- <model-version>${modelVersion}</model-version>
- <model-name>${modelName}</model-name>
- </onap-model-information>
- <service-instance-id>${serviceInstanceId}</service-instance-id>
- <subscriber-name/>
- <global-customer-id>${globalSubscriberId}</global-customer-id>
- </service-information>
- <service-request-input>
- <service-instance-name>${serviceInstanceName}</service-instance-name>
- ${siParamsXml}
- </service-request-input>
- </sdncadapterworkflow:SDNCRequestData>
- </sdncadapterworkflow:SDNCAdapterWorkflowRequest>"""
-
- 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 =
+ """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.openecomp/mso/workflow/schema/v1"
+ xmlns:sdncadapter="http://org.openecomp.mso/workflow/sdnc/adapter/schema/v1"
+ xmlns:sdncadapterworkflow="http://org.openecomp/mso/workflow/schema/v1">
+ <sdncadapter:RequestHeader>
+ <sdncadapter:RequestId>${hdrRequestId}</sdncadapter:RequestId>
+ <sdncadapter:SvcInstanceId>${serviceInstanceId}</sdncadapter:SvcInstanceId>
+ <sdncadapter:SvcAction>${sdnc_svcAction}</sdncadapter:SvcAction>
+ <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
+ <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
+ <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
+ </sdncadapter:RequestHeader>
+ <sdncadapterworkflow:SDNCRequestData>
+ <request-information>
+ <request-id>${hdrRequestId}</request-id>
+ <request-action>${sdnc_requestAction}</request-action>
+ <source>${source}</source>
+ <notification-url></notification-url>
+ <order-number></order-number>
+ <order-version></order-version>
+ </request-information>
+ <service-information>
+ <service-id>${serviceInstanceId}</service-id>
+ <subscription-service-type>${serviceType}</subscription-service-type>
+ <onap-model-information>
+ <model-invariant-uuid>${serviceModelInvariantUuid}</model-invariant-uuid>
+ <model-uuid>${serviceModelUuid}</model-uuid>
+ <model-version>${serviceModelVersion}</model-version>
+ <model-name>${serviceModelName}</model-name>
+ </onap-model-information>
+ <service-instance-id>${serviceInstanceId}</service-instance-id>
+ <global-customer-id>${globalCustomerId}</global-customer-id>
+ </service-information>
+ <network-information>
+ <onap-model-information>
+ <model-invariant-uuid>${modelInvariantUuid}</model-invariant-uuid>
+ <model-customization-uuid>${modelCustomizationUuid}</model-customization-uuid>
+ <model-uuid>${modelUuid}</model-uuid>
+ <model-version>${modelVersion}</model-version>
+ <model-name>${modelName}</model-name>
+ </onap-model-information>
+ </network-information>
+ <network-request-input>
+ <network-input-parameters></network-input-parameters>
+ </network-request-input>
+ </sdncadapterworkflow:SDNCRequestData>
+ </aetgt:SDNCAdapterWorkflowRequest>""".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 = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateResourceOperationStatus>
+ <operType>${operType}</operType>
+ <operationId>${operationId}</operationId>
+ <progress>${progress}</progress>
+ <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID>
+ <serviceId>${ServiceInstanceId}</serviceId>
+ <status>${status}</status>
+ <statusDescription>${statusDescription}</statusDescription>
+ </ns:updateResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>""";
+
+ 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 = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateResourceOperationStatus>
+ <operType>${operType}</operType>
+ <operationId>${operationId}</operationId>
+ <progress>${progress}</progress>
+ <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID>
+ <serviceId>${ServiceInstanceId}</serviceId>
+ <status>${status}</status>
+ <statusDescription>${statusDescription}</statusDescription>
+ </ns:updateResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>""";
+
+ 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<Resource> sequencedResourceList = new ArrayList<Resource>()
- List<String> wanResources = new ArrayList<String>()
+ List<Resource> wanResources = new ArrayList<Resource>()
// get delete resource list and order list
List<Resource> delResourceList = execution.getVariable("deleteResourceList")
- // existing resource list
- List<ServiceInstance> 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<VnfResource> vnfResourceList = new ArrayList<VnfResource>()
List<AllottedResource> arResourceList = new ArrayList<AllottedResource>()
- List<NetworkResource> networkResourceList = new ArrayList<NetworkResource>()
-
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<Resource> existResourceList = execution.getVariable("resourceSequence")
+ List<Resource> 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<String> resourceSequence = execution.getVariable("resourceSequence")
- if(nextIndex >= resourceSequence.size()){
+ List<String> 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 = """
+ <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+ xmlns:ns="http://org.openecomp.mso/requestsdb">
+ <soapenv:Header/>
+ <soapenv:Body>
+ <ns:updateResourceOperationStatus>
+ <operType>${operationType}</operType>
+ <operationId>${operationId}</operationId>
+ <progress>${progress}</progress>
+ <resourceTemplateUUID>${resourceCustomizationUuid}</resourceTemplateUUID>
+ <serviceId>${ServiceInstanceId}</serviceId>
+ <status>${status}</status>
+ <statusDescription>${statusDescription}</statusDescription>
+ </ns:updateResourceOperationStatus>
+ </soapenv:Body>
+ </soapenv:Envelope>""";
+
+ def dbAdapterEndpoint = execution.getVariable("URN_mso_adapters_openecomp_db_endpoint")
+ execution.setVariable("CVFMI_dbAdapterEndpoint", dbAdapterEndpoint)
+ execution.setVariable("CVFMI_updateResOperStatusRequest", body)
+ }
}