summaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src
diff options
context:
space:
mode:
authorElena Kuleshov <ek1439@att.com>2018-05-29 09:25:41 -0400
committerElena Kuleshov <ek1439@att.com>2018-05-29 09:49:06 -0400
commit8250deb396c4c7a9e7b29d98dda8115c4912e8de (patch)
tree253d3f8dfe1f2a9bca8197e9318c9a061f25b5ab /bpmn/MSOInfrastructureBPMN/src
parentc28f12b8fee6918fd622467be7cc8a0b5ab083ce (diff)
Pass parameters from SDNC response to APP-C.
Change-Id: I7d83ee933361ca16d9b05639bfb84b9c1466887c Issue-ID: SO-602 Signed-off-by: Elena Kuleshov <ek1439@att.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy59
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn57
2 files changed, 97 insertions, 19 deletions
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
index 797086b125..ca0bb53dc1 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
+++ b/bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy
@@ -23,6 +23,15 @@ package org.openecomp.mso.bpmn.infrastructure.scripts;
import groovy.json.JsonSlurper
import groovy.json.JsonOutput
+import javax.xml.parsers.DocumentBuilder
+import javax.xml.parsers.DocumentBuilderFactory
+
+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 org.camunda.bpm.engine.delegate.BpmnError
import org.camunda.bpm.engine.delegate.DelegateExecution
import org.onap.appc.client.lcm.model.Action
@@ -42,6 +51,12 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
ExceptionUtil exceptionUtil = new ExceptionUtil()
JsonUtils jsonUtil = new JsonUtils()
+
+ private AbstractServiceTaskProcessor taskProcessor
+
+ public SDNCAdapterUtils(AbstractServiceTaskProcessor taskProcessor) {
+ this.taskProcessor = taskProcessor
+ }
/**
* Validates the request message and sets up the workflow.
@@ -308,6 +323,50 @@ public class CreateVfModuleInfra extends AbstractServiceTaskProcessor {
}
}
}
+
+ /**
+ * Retrieve data for ConfigScaleOut from SDNC topology
+ */
+
+ public void retreiveConfigScaleOutData(DelegateExecution execution){
+ def isDebugEnabled = execution.getVariable("isDebugLogEnabled")
+ def vfModuleName = execution.getVariable("CVFMI_vfModuleName")
+ String ipAddress = "";
+ String oamIpAddress = "";
+ String vnfHostIpAddress = "";
+
+ String vnfGetSDNC = execution.getVariable("DCVFM_getSDNCAdapterResponse");
+
+ String data = utils.getNodeXml(vnfGetSDNC, "response-data")
+ data = data.replaceAll("&lt;", "<")
+ data = data.replaceAll("&gt;", ">")
+
+ InputSource source = new InputSource(new StringReader(data));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ docFactory.setNamespaceAware(true)
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document responseXml = docBuilder.parse(source)
+
+ NodeList paramsList = responseXml.getElementsByTagNameNS("*", "vnf-parameters")
+ for (int z = 0; z < paramsList.getLength(); z++) {
+ Node node = paramsList.item(z)
+ Element eElement = (Element) node
+ String vnfParameterName = utils.getElementText(eElement, "vnf-parameter-name")
+ String vnfParameterValue = utils.getElementText(eElement, "vnf-parameter-value")
+ if (vnfParameterName.equals("vlb_private_ip_1")) {
+ vnfHostIpAddress = vnfParameterValue
+ }
+ else if (vnfParameterName.equals("vdns_private_ip_0")) {
+ ipAddress = vnfParameterValue
+ }
+ else if (vnfParameterName.equals("vdns_private_ip_1")) {
+ oamIpAddress = vnfParameterValue
+ }
+ }
+
+ String payload = "{\"request-parameters\":{\"vnf-host-ip-address\":" + vnfHostIpAddress + ",\"vf-module-id\":" + vfModuleName + "},\"configuration-parameters\":{\"ip-addr\":" + ipAddress +", \"oam-ip-addr\":"+ oamIpAddress +",\"enabled\":\"true\"}}"
+ execution.setVariable("payload", payload);
+ }
/**
*
diff --git a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn
index f882094851..b04220957e 100644
--- a/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn
+++ b/bpmn/MSOInfrastructureBPMN/src/main/resources/process/CreateVfModuleInfra.bpmn
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_pNTO8MRhEeWv36YLr7PC3Q" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.10.0" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
+<bpmn2:definitions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bpmn2="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:camunda="http://camunda.org/schema/1.0/bpmn" xmlns:dc="http://www.omg.org/spec/DD/20100524/DC" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="_pNTO8MRhEeWv36YLr7PC3Q" targetNamespace="http://camunda.org/schema/1.0/bpmn" exporter="Camunda Modeler" exporterVersion="1.8.2" xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd">
<bpmn2:process id="CreateVfModuleInfra" name="CreateVfModuleInfra" isExecutable="true">
<bpmn2:startEvent id="StartEvent_1" name="Start">
<bpmn2:outgoing>SequenceFlow_1</bpmn2:outgoing>
@@ -38,6 +38,7 @@
<camunda:in source="CVFMI_usePreload" target="usePreload" />
<camunda:in source="CVFMI_vfModuleInputParams" target="vfModuleInputParams" />
<camunda:in source="CVFMI_aLaCarte" target="aLaCarte" />
+ <camunda:out source="DCVFM_getSDNCAdapterResponse" target="DCVFM_getSDNCAdapterResponse" />
</bpmn2:extensionElements>
<bpmn2:incoming>SequenceFlow_1y7d5qk</bpmn2:incoming>
<bpmn2:incoming>SequenceFlow_1vx081s</bpmn2:incoming>
@@ -255,7 +256,7 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script>
<camunda:out source="failedActivity" target="failedActivity" />
<camunda:in source="CVFMI_vfModuleId" target="vfModuleId" />
</bpmn2:extensionElements>
- <bpmn2:incoming>SequenceFlow_020dbkp</bpmn2:incoming>
+ <bpmn2:incoming>SequenceFlow_09i6f7t</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_1tk5ru7</bpmn2:outgoing>
</bpmn2:callActivity>
<bpmn2:sequenceFlow id="SequenceFlow_1crl7uf" sourceRef="ServiceTask_1" targetRef="UpdateInfraRequestResponseCheck" />
@@ -287,7 +288,7 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script>
<bpmn2:outgoing>SequenceFlow_020dbkp</bpmn2:outgoing>
<bpmn2:outgoing>SequenceFlow_0u8zesf</bpmn2:outgoing>
</bpmn2:exclusiveGateway>
- <bpmn2:sequenceFlow id="SequenceFlow_020dbkp" name="yes" sourceRef="ExclusiveGateway_0c8x2mq" targetRef="CallActivity_17ukiqm">
+ <bpmn2:sequenceFlow id="SequenceFlow_020dbkp" name="yes" sourceRef="ExclusiveGateway_0c8x2mq" targetRef="Task_09om99x">
<bpmn2:conditionExpression xsi:type="bpmn2:tFormalExpression" language="groovy"><![CDATA[execution.getVariable("runConfigScaleOut")]]></bpmn2:conditionExpression>
</bpmn2:sequenceFlow>
<bpmn2:sequenceFlow id="SequenceFlow_0u8zesf" name="no" sourceRef="ExclusiveGateway_0c8x2mq" targetRef="PrepareMSOCompletionHandler" />
@@ -299,6 +300,14 @@ exceptionUtil.processJavaException(execution)]]></bpmn2:script>
def createVfModule = new CreateVfModuleInfra()
createVfModule.queryAAIForVnfOrchestrationStatus(execution)]]></bpmn2:script>
</bpmn2:scriptTask>
+ <bpmn2:sequenceFlow id="SequenceFlow_09i6f7t" sourceRef="Task_09om99x" targetRef="CallActivity_17ukiqm" />
+ <bpmn2:scriptTask id="Task_09om99x" name="Retreive Data for Config ScaleOut" scriptFormat="groovy">
+ <bpmn2:incoming>SequenceFlow_020dbkp</bpmn2:incoming>
+ <bpmn2:outgoing>SequenceFlow_09i6f7t</bpmn2:outgoing>
+ <bpmn2:script><![CDATA[import org.openecomp.mso.bpmn.infrastructure.scripts.*
+def createVfModule = new CreateVfModuleInfra()
+createVfModule.retreiveConfigScaleOutData(execution)]]></bpmn2:script>
+ </bpmn2:scriptTask>
</bpmn2:process>
<bpmn2:error id="Error_1" name="MSOWorkflowException" errorCode="MSOWorkflowException" />
<bpmn2:error id="Error_2" name="REST Fault" errorCode="RESTFault" />
@@ -582,7 +591,7 @@ createVfModule.queryAAIForVnfOrchestrationStatus(execution)]]></bpmn2:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="CallActivity_17ukiqm_di" bpmnElement="CallActivity_17ukiqm">
- <dc:Bounds x="472" y="189" width="145" height="80" />
+ <dc:Bounds x="472" y="120" width="145" height="80" />
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1crl7uf_di" bpmnElement="SequenceFlow_1crl7uf">
<di:waypoint xsi:type="dc:Point" x="377" y="367" />
@@ -592,36 +601,36 @@ createVfModule.queryAAIForVnfOrchestrationStatus(execution)]]></bpmn2:script>
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_1hncvjy_di" bpmnElement="ExclusiveGateway_1hncvjy" isMarkerVisible="true">
- <dc:Bounds x="675" y="204" width="50" height="50" />
+ <dc:Bounds x="675" y="135" width="50" height="50" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="657" y="170" width="86" height="24" />
+ <dc:Bounds x="659" y="101" width="82" height="24" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_1tk5ru7_di" bpmnElement="SequenceFlow_1tk5ru7">
- <di:waypoint xsi:type="dc:Point" x="617" y="229" />
- <di:waypoint xsi:type="dc:Point" x="675" y="229" />
+ <di:waypoint xsi:type="dc:Point" x="617" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="675" y="160" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="601" y="208" width="90" height="12" />
+ <dc:Bounds x="601" y="139" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0td7d9m_di" bpmnElement="SequenceFlow_0td7d9m">
- <di:waypoint xsi:type="dc:Point" x="700" y="254" />
- <di:waypoint xsi:type="dc:Point" x="701" y="327" />
+ <di:waypoint xsi:type="dc:Point" x="700" y="185" />
+ <di:waypoint xsi:type="dc:Point" x="702" y="327" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="706.5002014596164" y="260.46992001430345" width="15" height="12" />
+ <dc:Bounds x="708" y="122" width="12" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="EndEvent_0a97jcr_di" bpmnElement="EndEvent_0a97jcr">
- <dc:Bounds x="773" y="211" width="36" height="36" />
+ <dc:Bounds x="773" y="142" width="36" height="36" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="701" y="252" width="90" height="12" />
+ <dc:Bounds x="701" y="183" width="90" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_0h5cld9_di" bpmnElement="SequenceFlow_0h5cld9">
- <di:waypoint xsi:type="dc:Point" x="725" y="229" />
- <di:waypoint xsi:type="dc:Point" x="773" y="229" />
+ <di:waypoint xsi:type="dc:Point" x="725" y="160" />
+ <di:waypoint xsi:type="dc:Point" x="773" y="160" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="729" y="235" width="20" height="12" />
+ <dc:Bounds x="730" y="166" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNShape id="ExclusiveGateway_1qozral_di" bpmnElement="ExclusiveGateway_1qozral" isMarkerVisible="true">
@@ -652,9 +661,9 @@ createVfModule.queryAAIForVnfOrchestrationStatus(execution)]]></bpmn2:script>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge id="SequenceFlow_020dbkp_di" bpmnElement="SequenceFlow_020dbkp">
<di:waypoint xsi:type="dc:Point" x="545" y="342" />
- <di:waypoint xsi:type="dc:Point" x="545" y="269" />
+ <di:waypoint xsi:type="dc:Point" x="545" y="309" />
<bpmndi:BPMNLabel>
- <dc:Bounds x="550" y="307" width="20" height="12" />
+ <dc:Bounds x="515" y="321.9537912405942" width="18" height="12" />
</bpmndi:BPMNLabel>
</bpmndi:BPMNEdge>
<bpmndi:BPMNEdge id="SequenceFlow_0u8zesf_di" bpmnElement="SequenceFlow_0u8zesf">
@@ -674,6 +683,16 @@ createVfModule.queryAAIForVnfOrchestrationStatus(execution)]]></bpmn2:script>
<bpmndi:BPMNShape id="ScriptTask_19vqej7_di" bpmnElement="Task_1o3z68c">
<dc:Bounds x="460" y="-6" width="100" height="80" />
</bpmndi:BPMNShape>
+ <bpmndi:BPMNEdge id="SequenceFlow_09i6f7t_di" bpmnElement="SequenceFlow_09i6f7t">
+ <di:waypoint xsi:type="dc:Point" x="545" y="229" />
+ <di:waypoint xsi:type="dc:Point" x="545" y="200" />
+ <bpmndi:BPMNLabel>
+ <dc:Bounds x="560" y="208.5" width="0" height="12" />
+ </bpmndi:BPMNLabel>
+ </bpmndi:BPMNEdge>
+ <bpmndi:BPMNShape id="ScriptTask_1s0bky7_di" bpmnElement="Task_09om99x">
+ <dc:Bounds x="495" y="229" width="100" height="80" />
+ </bpmndi:BPMNShape>
</bpmndi:BPMNPlane>
</bpmndi:BPMNDiagram>
</bpmn2:definitions>