summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-04-24 14:36:09 +0000
committerGerrit Code Review <gerrit@onap.org>2018-04-24 14:36:09 +0000
commit7f20a3c7cabe00510ae12d261b7094a4b5b477e3 (patch)
treea58444c1aef62ecc3457232fa2a6838efd030dea /bpmn/MSOInfrastructureBPMN/src/main
parent21fec06da3dfd9fddccf48906260aa3fcdeb5213 (diff)
parentbd78fe1b448e5bd0128ef42f700f5f11acb25092 (diff)
Merge "Fix SDNC resource deletion for E2E service"
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy38
-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.groovy16
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn8
4 files changed, 47 insertions, 19 deletions
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 9358537448..72db6f358d 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
@@ -23,6 +23,7 @@ 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;
@@ -75,26 +76,39 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
String msg = ""
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 serviceId = execution.getVariable("productFamilyId")
- String subscriptionServiceType = execution.getVariable("subscriptionServiceType")
- String globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
+ String subscriptionServiceType = execution.getVariable("serviceType")
+ String globalSubscriberId = resourceInput.getGlobalSubscriberId()
String recipeParamsFromRequest = execution.getVariable("recipeParams")
- String serviceModelInfo = execution.getVariable("serviceModelInfo")
+ String serviceId = resourceInput.getServiceInstanceId()
+ ModelInfo serviceModelInfo = resourceInput.getServiceModelInfo()
String modelInvariantUuid = ""
String modelVersion = ""
String modelUuid = ""
String modelName = ""
- if (!isBlank(serviceModelInfo))
+ if (serviceModelInfo != null)
{
- modelInvariantUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelInvariantUuid")
- modelVersion = jsonUtil.getJsonValue(serviceModelInfo, "modelVersion")
- modelUuid = jsonUtil.getJsonValue(serviceModelInfo, "modelUuid")
- modelName = jsonUtil.getJsonValue(serviceModelInfo, "modelName")
+ 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 = ""
@@ -141,7 +155,6 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
operationType = "delete" + operationType + "Instance"
- ResourceInput resourceInput = new ObjectMapper().readValue(execution.getVariable("resourceInput"), ResourceInput.class)
if(StringUtils.containsIgnoreCase(resourceInput.getResourceModelInfo().getModelName(), "overlay")){
//This will be resolved in R3.
sdnc_svcAction ="deactivate"
@@ -194,6 +207,11 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
</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)
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 ec7370fea3..946c248059 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
@@ -354,6 +354,10 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
utils.log("DEBUG", " ***** Inside processDecomposition() of delete generic e2e service flow ***** ", isDebugEnabled)
try {
ServiceDecomposition serviceDecomposition = execution.getVariable("serviceDecomposition")
+
+ // service model info
+ execution.setVariable("serviceModelInfo", serviceDecomposition.getModelInfo())
+
List<Resource> deleteResourceList = serviceDecomposition.getServiceResources()
String serviceRelationShip = execution.getVariable("serviceRelationShip")
def jsonSlurper = new JsonSlurper()
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 0fcc41c58e..46dd7d6128 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
@@ -202,7 +202,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
/**
* prepare delete parameters
*/
- public void preResourceDelete(DelegateExecution execution, String resourceName){
+ public void preResourceDelete(DelegateExecution execution){
def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
@@ -220,7 +220,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
execution.setVariable("resourceType", curResource.getModelInfo().getModelName())
execution.setVariable("currentResource", curResource)
utils.log("INFO", "Delete Resource Info resourceTemplate Id :" + resourceTemplateUUID + " resourceInstanceId: "
- + resourceInstanceUUID + " resourceType: " + resourceName, isDebugEnabled)
+ + resourceInstanceUUID, isDebugEnabled)
utils.log("INFO", " ======== END preResourceDelete Process ======== ", isDebugEnabled)
}
@@ -245,12 +245,16 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
int recipeTimeout = resourceRecipe.getInt("recipeTimeout")
String recipeParamXsd = resourceRecipe.isNull("paramXSD") ? "" : resourceRecipe.get("paramXSD")
- Resource currentResource = execution.getVariable("currentResource")
-
ResourceInput resourceInput = new ResourceInput();
+
+ ModelInfo serviceModelInfo = execution.getVariable("serviceModelInfo")
+ resourceInput.setServiceModelInfo(serviceModelInfo)
+
+ Resource currentResource = execution.getVariable("currentResource")
resourceInput.setServiceInstanceId(serviceInstanceId)
resourceInput.setResourceInstanceName(currentResource.getResourceInstanceName())
- resourceInput.setGlobalSubscriberId("globalSubscriberId")
+ resourceInput.setGlobalSubscriberId(execution.getVariable("globalSubscriberId"))
+
ModelInfo modelInfo = new ModelInfo()
modelInfo.setModelCustomizationUuid(currentResource.getModelInfo().getModelCustomizationUuid())
modelInfo.setModelUuid(currentResource.getModelInfo().getModelCustomizationUuid())
@@ -264,7 +268,7 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
String recipeURL = BPMNProperties.getProperty("bpelURL", "http://mso:8080") + recipeUri
- HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, requestAction, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
+ HttpResponse resp = BpmnRestClient.post(recipeURL, requestId, recipeTimeout, action, serviceInstanceId, serviceType, resourceInput.toString(), recipeParamXsd)
utils.log("INFO", " ======== END executeResourceDelete Process ======== ", isDebugEnabled)
}
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
index 8a3d441a8e..524846f192 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0">
+<bpmn:definitions xmlns:bpmn="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" id="Definitions_1" targetNamespace="http://bpmn.io/schema/bpmn" exporter="Camunda Modeler" exporterVersion="1.11.3">
<bpmn:process id="DoDeleteE2EServiceInstance" name="All Resources Deleted" isExecutable="true">
<bpmn:startEvent id="StartEvent_0212h2r" name="Start Flow">
<bpmn:outgoing>SequenceFlow_0vz7cd9</bpmn:outgoing>
@@ -166,6 +166,7 @@ dcsi.postDecomposeService(execution)]]></bpmn:script>
<camunda:in source="resourceInstanceIDs" target="resourceInstanceIDs" />
<camunda:in source="operationType" target="operationType" />
<camunda:in source="operationId" target="operationId" />
+ <camunda:in source="serviceModelInfo" target="serviceModelInfo" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_1j08ko3</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1cevtpy</bpmn:outgoing>
@@ -181,10 +182,11 @@ dcsi.postDecomposeService(execution)]]></bpmn:script>
<bpmn:linkEventDefinition name="DecomposeService" />
</bpmn:intermediateThrowEvent>
<bpmn:sequenceFlow id="SequenceFlow_0vi0sv6" sourceRef="ScriptTask_1rtnsh8" targetRef="StartEvent_1qh5a34" />
- <bpmn:scriptTask id="ScriptTask_08a4vhm" name="Send Sync Ack Response" scriptFormat="groovy"> <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+ <bpmn:scriptTask id="ScriptTask_08a4vhm" name="Send Sync Ack Response" scriptFormat="groovy">
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
def csi = new CompareModelofE2EServiceInstance()
csi.sendSyncResponse(execution)]]></bpmn:script>
-</bpmn:scriptTask>
+ </bpmn:scriptTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteE2EServiceInstance">