summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN
diff options
context:
space:
mode:
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy1
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy71
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVFCNSResource.bpmn2
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn42
4 files changed, 103 insertions, 13 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
index 9ebd1fa0ba..72b88cb13d 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DeleteVFCNSResource.groovy
@@ -58,6 +58,7 @@ public class DeleteVFCNSResource extends AbstractServiceTaskProcessor {
}
public void postProcessRequest (DelegateExecution execution) {
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
utils.log("INFO"," ***** start postProcessRequest *****", isDebugEnabled)
utils.log("INFO"," ***** end postProcessRequest *****", isDebugEnabled)
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
index c71cb0521e..f0ecbab82c 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteVFCNetworkServiceInstance.groovy
@@ -20,7 +20,7 @@
package org.openecomp.mso.bpmn.infrastructure.scripts;
-import static org.apache.commons.lang3.StringUtils.*;
+import static org.apache.commons.lang3.StringUtils.*
import groovy.xml.XmlUtil
import groovy.json.*
import org.openecomp.mso.bpmn.common.scripts.AbstractServiceTaskProcessor
@@ -39,6 +39,10 @@ import org.springframework.web.util.UriUtils
import org.openecomp.mso.rest.RESTClient
import org.openecomp.mso.rest.RESTConfig
import org.openecomp.mso.rest.APIResponse;
+import org.openecomp.mso.rest.RESTConfig
+import org.openecomp.mso.rest.RESTClient
+
+
/**
* This groovy class supports the <class>DoDeleteVFCNetworkServiceInstance.bpmn</class> process.
@@ -99,6 +103,71 @@ public class DoDeleteVFCNetworkServiceInstance extends AbstractServiceTaskProces
}
/**
+ * unwind NS from AAI relationship
+ */
+ public void deleteNSRelationship(DelegateExecution execution) {
+ def isDebugEnabled=execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO"," ***** addNSRelationship *****", isDebugEnabled)
+ String nsInstanceId = execution.getVariable("resourceInstanceId")
+ if(nsInstanceId == null || nsInstanceId == ""){
+ utils.log("INFO"," Delete NS failed", isDebugEnabled)
+ return
+ }
+ String globalSubscriberId = execution.getVariable("globalSubscriberId")
+ String serviceType = execution.getVariable("serviceType")
+ String serviceId = execution.getVariable("serviceId")
+ String deleteRelationPayload = """<relationship xmlns="http://org.openecomp.aai.inventory/v11">
+ <related-to>service-instance</related-to>
+ <related-link>/aai/v11/business/customers/customer/${globalSubscriberId}/service-subscriptions/service-subscription/${serviceType}/service-instances/service-instance/${nsInstanceId}</related-link>
+ <relationship-data>
+ <relationship-key>customer.global-customer-id</relationship-key>
+ <relationship-value>${globalSubscriberId}</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>service-subscription.service-type</relationship-key>
+ <relationship-value>${serviceType}</relationship-value>
+ </relationship-data>
+ <relationship-data>
+ <relationship-key>service-instance.service-instance-id</relationship-key>
+ <relationship-value>${nsInstanceId}</relationship-value>
+ </relationship-data>
+ </relationship>"""
+ String endpoint = execution.getVariable("URN_aai_endpoint")
+ utils.log("INFO","Add Relationship req:\n" + deleteRelationPayload, isDebugEnabled)
+ String url = endpoint + "/aai/v11/business/customers/customer/" + globalSubscriberId + "/service-subscriptions/service-subscription/" + serviceType + "/service-instances/service-instance/" + serviceId + "/relationship-list/relationship"
+
+ APIResponse aaiRsp = executeAAIDeleteCall(execution, url, deleteRelationPayload)
+ utils.log("INFO","aai response status code:" + aaiRsp.getStatusCode(), isDebugEnabled)
+ utils.log("INFO","aai response content:" + aaiRsp.getResponseBodyAsString(), isDebugEnabled)
+ utils.log("INFO"," *****Exit addNSRelationship *****", isDebugEnabled)
+ }
+
+ public APIResponse executeAAIDeleteCall(DelegateExecution execution, String url, String payload){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ utils.log("INFO", " ======== Started Execute AAI Delete Process ======== ", isDebugEnabled)
+ APIResponse apiResponse = null
+ try{
+ String uuid = utils.getRequestID()
+ utils.log("INFO","Generated uuid is: " + uuid, isDebugEnabled)
+ utils.log("INFO","URL to be used is: " + url, isDebugEnabled)
+ String userName = execution.getVariable("URN_aai_auth")
+ String password = execution.getVariable("URN_mso_msoKey")
+ String basicAuthCred = utils.getBasicAuth(userName,password)
+ RESTConfig config = new RESTConfig(url);
+ RESTClient client = new RESTClient(config).addHeader("X-FromAppId", "MSO").addHeader("X-TransactionId", uuid).addHeader("Content-Type", "application/xml").addHeader("Accept","application/xml");
+ if (basicAuthCred != null && !"".equals(basicAuthCred)) {
+ client.addAuthorizationHeader(basicAuthCred)
+ }
+ apiResponse = client.httpDelete(payload)
+ utils.log("INFO","======== Completed Execute AAI Delete Process ======== ", isDebugEnabled)
+ }catch(Exception e){
+ utils.log("ERROR","Exception occured while executing AAI Put Call. Exception is: \n" + e, isDebugEnabled)
+ throw new BpmnError("MSOWorkflowException")
+ }
+ return apiResponse
+ }
+
+ /**
* delete NS task
*/
public void deleteNetworkService(DelegateExecution execution) {
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVFCNSResource.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVFCNSResource.bpmn
index d7a4bba1dd..280ee85128 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVFCNSResource.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/DeleteVFCNSResource.bpmn
@@ -35,6 +35,8 @@ ddsi.postProcessRequest(execution)]]></bpmn:script>
<camunda:in source="resourceInstanceId" target="resourceInstanceId" />
<camunda:in source="resourceType" target="resourceType" />
<camunda:in source="operationType" target="operationType" />
+ <camunda:out source="operationStatus" target="operationStatus" />
+ <camunda:out source="nsInstanceId" target="nsInstanceId" />
</bpmn:extensionElements>
<bpmn:incoming>SequenceFlow_00vpfm3</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1s4cyms</bpmn:outgoing>
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn
index 3cef94d6ea..41b8d2e7aa 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/subprocess/DoDeleteVFCNetworkServiceInstance.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: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: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="DoDeleteVFCNetworkServiceInstance" name="DoDeleteVFCNetworkServiceInstance" isExecutable="true">
<bpmn:startEvent id="deleteNS_StartEvent" name="deleteNS_StartEvent">
<bpmn:outgoing>SequenceFlow_1qo2pln</bpmn:outgoing>
@@ -20,7 +20,7 @@ def dcsi = new DoDeleteVFCNetworkServiceInstance()
dcsi.preProcessRequest(execution)]]></bpmn:script>
</bpmn:scriptTask>
<bpmn:scriptTask id="terminate_NSTask" name="terminate Network Service" scriptFormat="groovy">
- <bpmn:incoming>SequenceFlow_150q0fo</bpmn:incoming>
+ <bpmn:incoming>SequenceFlow_1h1c24p</bpmn:incoming>
<bpmn:outgoing>SequenceFlow_1ywe21t</bpmn:outgoing>
<bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
def dcsi = new DoDeleteVFCNetworkServiceInstance()
@@ -91,11 +91,19 @@ def dcsi = new DoDeleteVFCNetworkServiceInstance()
dcsi.timeDelay(execution)]]></bpmn:script>
</bpmn:scriptTask>
<bpmn:sequenceFlow id="SequenceFlow_1gsbpxj" sourceRef="timeDelay_Task" targetRef="queryJob_Task" />
- <bpmn:sequenceFlow id="SequenceFlow_150q0fo" sourceRef="PreprocessIncomingRequest_task" targetRef="terminate_NSTask" />
+ <bpmn:sequenceFlow id="SequenceFlow_150q0fo" sourceRef="PreprocessIncomingRequest_task" targetRef="deleteNSRelationship" />
<bpmn:sequenceFlow id="SequenceFlow_1sjop71" sourceRef="Task_09nzhwk" targetRef="ExclusiveGateway_0zfksms" />
<bpmn:sequenceFlow id="deleteNSSuccess_SequenceFlow" name="yes" sourceRef="ExclusiveGateway_0zfksms" targetRef="finishNSDelete_Task">
<bpmn:conditionExpression xsi:type="bpmn:tFormalExpression"><![CDATA[#{(execution.getVariable("operationStatus" ) == "finished")}]]></bpmn:conditionExpression>
</bpmn:sequenceFlow>
+ <bpmn:sequenceFlow id="SequenceFlow_1h1c24p" sourceRef="deleteNSRelationship" targetRef="terminate_NSTask" />
+ <bpmn:scriptTask id="deleteNSRelationship" name="Delete NS Relationship " scriptFormat="groovy">
+ <bpmn:incoming>SequenceFlow_150q0fo</bpmn:incoming>
+ <bpmn:outgoing>SequenceFlow_1h1c24p</bpmn:outgoing>
+ <bpmn:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def dcsi = new DoDeleteVFCNetworkServiceInstance()
+dcsi.deleteNSRelationship(execution)]]></bpmn:script>
+ </bpmn:scriptTask>
</bpmn:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1">
<bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="DoDeleteVFCNetworkServiceInstance">
@@ -107,19 +115,19 @@ dcsi.timeDelay(execution)]]></bpmn:script>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1qo2pln_di" bpmnElement="SequenceFlow_1qo2pln">
<di:waypoint xsi:type="dc:Point" x="211" y="129" />
- <di:waypoint xsi:type="dc:Point" x="407" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="321" y="129" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="264" y="108" width="90" height="12" />
+ <dc:Bounds x="221" y="108" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ScriptTask_1dw39hg_di" bpmnElement="Task_09nzhwk">
<dc:Bounds x="722" y="555" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_03j6ogo_di" bpmnElement="PreprocessIncomingRequest_task">
- <dc:Bounds x="407" y="89" width="100" height="80" />
+ <dc:Bounds x="321" y="89" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ScriptTask_1qmmew8_di" bpmnElement="terminate_NSTask">
- <dc:Bounds x="694" y="89" width="100" height="80" />
+ <dc:Bounds x="744" y="89" width="100" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNShape id="ExclusiveGateway_0zfksms_di" bpmnElement="ExclusiveGateway_0zfksms" isMarkerVisible="true">
<dc:Bounds x="517" y="570" width="50" height="50" />
@@ -141,10 +149,10 @@ dcsi.timeDelay(execution)]]></bpmn:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1ywe21t_di" bpmnElement="SequenceFlow_1ywe21t">
- <di:waypoint xsi:type="dc:Point" x="794" y="128" />
+ <di:waypoint xsi:type="dc:Point" x="844" y="129" />
<di:waypoint xsi:type="dc:Point" x="1034" y="130" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="869" y="108" width="90" height="12" />
+ <dc:Bounds x="894" y="108.5" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0j7xo94_di" bpmnElement="terminateFailed_SequenceFlow">
@@ -232,10 +240,10 @@ dcsi.timeDelay(execution)]]></bpmn:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_150q0fo_di" bpmnElement="SequenceFlow_150q0fo">
- <di:waypoint xsi:type="dc:Point" x="507" y="129" />
- <di:waypoint xsi:type="dc:Point" x="694" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="421" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="523" y="129" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="600.5" y="108" width="0" height="12" />
+ <dc:Bounds x="427" y="108" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_1sjop71_di" bpmnElement="SequenceFlow_1sjop71">
@@ -252,6 +260,16 @@ dcsi.timeDelay(execution)]]></bpmn:script>
<dc:Bounds x="460" y="574" width="19" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
+ <bpmndi:BPMNEdge id="SequenceFlow_1h1c24p_di" bpmnElement="SequenceFlow_1h1c24p">
+ <di:waypoint xsi:type="dc:Point" x="623" y="129" />
+ <di:waypoint xsi:type="dc:Point" x="744" y="129" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="683.5" y="108" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_11l4g48_di" bpmnElement="deleteNSRelationship">
+ <dc:Bounds x="523" y="89" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn:definitions>