aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOInfrastructureBPMN/src/main/groovy
diff options
context:
space:
mode:
authorsubhash kumar singh <subhash.kumar.singh@huawei.com>2018-04-13 14:50:06 +0000
committersubhash kumar singh <subhash.kumar.singh@huawei.com>2018-04-13 14:50:06 +0000
commit5b82bcab5593479a28649fd82d30f18d12d09771 (patch)
tree5e822a817b489805d0eee25b0f79f2b87b0adf8d /bpmn/MSOInfrastructureBPMN/src/main/groovy
parent41812cbe7947732a414eda62998fa66716f86b21 (diff)
Fix parsing from AAI response
Fix parsing from AAI response Change-Id: Ie9020148a5ca6d3e434f2d2acc42b61f3f797a78 Issue-ID: SO-422 Signed-off-by: subhash kumar singh <subhash.kumar.singh@huawei.com>
Diffstat (limited to 'bpmn/MSOInfrastructureBPMN/src/main/groovy')
-rw-r--r--bpmn/MSOInfrastructureBPMN/src/main/groovy/org/openecomp/mso/bpmn/infrastructure/scripts/DoDeleteE2EServiceInstance.groovy30
1 files changed, 19 insertions, 11 deletions
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 1c8a5e70fe..003210f602 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
@@ -187,6 +187,11 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
}
else
{
+ InputSource source = new InputSource(new StringReader(siData));
+ DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
+ Document serviceXml = docBuilder.parse(source)
+ serviceXml.getDocumentElement().normalize()
// get model invariant id
// Get Template uuid and version
if (utils.nodeExists(siData, "model-invariant-id") && utils.nodeExists(siData, "model-version-id") ) {
@@ -203,13 +208,8 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
//Confirm there are no related service instances (vnf/network or volume)
if (utils.nodeExists(siData, "relationship-list")) {
utils.log("INFO", "SI Data relationship-list exists:", isDebugEnabled)
- InputSource source = new InputSource(new StringReader(siData));
- DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance();
- DocumentBuilder docBuilder = docFactory.newDocumentBuilder()
- Document serviceXml = docBuilder.parse(source)
- serviceXml.getDocumentElement().normalize()
//test(siData)
- NodeList nodeList = serviceXml.getElementsByTagName("relationship")
+ NodeList nodeList = serviceXml.getElementsByTagName("relationship").item(0).getChildNodes()
JSONArray jArray = new JSONArray()
for (int x = 0; x < nodeList.getLength(); x++) {
Node node = nodeList.item(x)
@@ -225,12 +225,20 @@ public class DoDeleteE2EServiceInstance extends AbstractServiceTaskProcessor {
for (int i = 0; i < dataList.getLength(); i++) {
Node dNode = dataList.item(i)
if(dNode.getNodeName() == "relationship-data") {
- Element rDataEle = (Element)dNode
- def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
- def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
- if(eKey.equals("service-instance.service-instance-id")){
- jObj.put("resourceInstanceId", eValue)
+
+ NodeList rdNodes = dNode.getChildNodes()
+ for(int j = 0; j < rdNodes.getLength(); j++) {
+ Node rdNode = rdNodes.item(j);
+ if (rdNode instanceof Element) {
+ Element rDataEle = (Element) rdNode
+ def eKey = rDataEle.getElementsByTagName("relationship-key").item(0).getTextContent()
+ def eValue = rDataEle.getElementsByTagName("relationship-value").item(0).getTextContent()
+ if (eKey.equals("service-instance.service-instance-id")) {
+ jObj.put("resourceInstanceId", eValue)
+ }
+ }
}
+
}
else if(dNode.getNodeName() == "related-to-property"){
Element rDataEle = (Element)dNode