aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy
diff options
context:
space:
mode:
authorSeshu Kumar M <seshu.kumar.m@huawei.com>2018-05-29 17:29:23 +0000
committerGerrit Code Review <gerrit@onap.org>2018-05-29 17:29:23 +0000
commit5c12ab068ae6c32b9e4e087c8323dd9170559ceb (patch)
treede1d2ed3952d610b02dcf51fefe09d396e2db899 /bpmn/MSOInfrastructureBPMN/src/main/groovy
parent00100531192f4cd80c292eec845b519b2f57a1a2 (diff)
parent8250deb396c4c7a9e7b29d98dda8115c4912e8de (diff)
Merge "Pass parameters from SDNC response to APP-C."
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/CreateVfModuleInfra.groovy59
1 files changed, 59 insertions, 0 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);
+ }
/**
*