summaryrefslogtreecommitdiffstats
path: root/bpmn
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteSDNCNetworkResource.groovy68
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy10
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteResourcesV1.groovy24
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteE2EServiceInstance.bpmn8
4 files changed, 72 insertions, 38 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 479e091345..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,13 +23,13 @@ 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.openecomp.mso.bpmn.common.recipe.ResourceInput;
import static org.apache.commons.lang3.StringUtils.*;
import groovy.xml.XmlUtil
@@ -44,6 +44,8 @@ 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;
@@ -74,26 +76,39 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
String msg = ""
try {
- serviceInstanceId = execution.getVariable("serviceInstanceId")
- serviceInstanceName = execution.getVariable("serviceInstanceName")
- callbackURL = execution.getVariable("sdncCallbackUrl")
- requestId = execution.getVariable("msoRequestId")
- serviceId = execution.getVariable("productFamilyId")
- subscriptionServiceType = execution.getVariable("subscriptionServiceType")
- globalSubscriberId = execution.getVariable("globalSubscriberId") //globalCustomerId
+ 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()
String recipeParamsFromRequest = execution.getVariable("recipeParams")
- String serviceModelInfo = execution.getVariable("serviceModelInfo")
- modelInvariantUuid = ""
- modelVersion = ""
- modelUuid = ""
- modelName = ""
-
- if (!isBlank(serviceModelInfo))
+ String serviceId = resourceInput.getServiceInstanceId()
+ ModelInfo serviceModelInfo = resourceInput.getServiceModelInfo()
+ String modelInvariantUuid = ""
+ String modelVersion = ""
+ String modelUuid = ""
+ String modelName = ""
+
+ 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 = ""
@@ -122,7 +137,7 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
serviceType = ""
}
- sdncRequestId = UUID.randomUUID().toString()
+ String sdncRequestId = UUID.randomUUID().toString()
String recipeParamsFromWf = execution.getVariable("recipeParamXsd")
@@ -140,12 +155,12 @@ public class DeleteSDNCNetworkResource extends AbstractServiceTaskProcessor {
operationType = "delete" + operationType + "Instance"
- if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "overlay")){
+ if(StringUtils.containsIgnoreCase(resourceInput.getResourceModelInfo().getModelName(), "overlay")){
//This will be resolved in R3.
sdnc_svcAction ="deactivate"
operationType = "DeActivateDCINetworkInstance"
}
- if(StringUtils.containsIgnoreCase(resourceInputObj.getResourceInstanceName(), "underlay")){
+ if(StringUtils.containsIgnoreCase(resourceInput.getResourceModelInfo().getModelName(), "underlay")){
//This will be resolved in R3.
operationType ="DeleteNetworkInstance"
}
@@ -192,11 +207,16 @@ 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)
- execution.setVariable("sdncDeactivate", sdncDeactivate)
- utils.log("INFO","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled)
+// execution.setVariable("sdncDeactivate", sdncDeactivate)
+// utils.log("INFO","sdncDeactivate:\n" + sdncDeactivate, isDebugEnabled)
utils.log("INFO","sdncDelete:\n" + sdncDelete, isDebugEnabled)
} catch (BpmnError e) {
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 2efd86eb99..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
@@ -332,11 +332,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
utils.log("DEBUG", " ***** Inside prepareDecomposeService of create generic e2e service ***** ", isDebugEnabled)
String modelInvariantUuid = execution.getVariable("model-invariant-id-original")
String modelVersionId = execution.getVariable("model-version-id-original")
- //here modelVersion is not set, we use modelUuid to decompose the service.
+
String serviceModelInfo = """{
"modelInvariantUuid":"${modelInvariantUuid}",
- "modelUuid":"${modelVersionId}",
- "modelVersion":""
+ "modelUuid":"",
+ "modelVersion":"${modelVersionId}"
}"""
execution.setVariable("serviceModelInfo", serviceModelInfo)
@@ -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 a7f461b973..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)
}
@@ -243,24 +243,32 @@ public class DoDeleteResourcesV1 extends AbstractServiceTaskProcessor {
JSONObject resourceRecipe = cutils.getResourceRecipe(execution, resourceUuid, action)
String recipeUri = resourceRecipe.getString("orchestrationUri")
int recipeTimeout = resourceRecipe.getInt("recipeTimeout")
- String recipeParamXsd = resourceRecipe.get("paramXSD")
-
- Resource currentResource = execution.getVariable("currentResource")
+ String recipeParamXsd = resourceRecipe.isNull("paramXSD") ? "" : resourceRecipe.get("paramXSD")
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())
modelInfo.setModelInvariantUuid(currentResource.getModelInfo().getModelInvariantUuid())
- resourceInput.setServiceModelInfo(modelInfo)
+ modelInfo.setModelName(currentResource.getModelInfo().getModelName())
+ modelInfo.setModelVersion(currentResource.getModelInfo().getModelVersion())
+ modelInfo.setModelType(currentResource.getModelInfo().getModelType())
+ modelInfo.setModelInstanceName(currentResource.getModelInfo().getModelInstanceName())
+ resourceInput.setResourceModelInfo(modelInfo)
resourceInput.setServiceType(serviceType)
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">