Fix identity-ref serialization in netconf. 71/9371/6
authorMaros Marsalek <mmarsale@cisco.com>
Mon, 28 Jul 2014 08:33:33 +0000 (10:33 +0200)
committerMaros Marsalek <mmarsale@cisco.com>
Tue, 29 Jul 2014 06:45:44 +0000 (08:45 +0200)
Identity-ref attributes did not contain their namespace.

Change-Id: I1d768b2b59073d9fa322b66b002eddf39270bf17
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
opendaylight/netconf/config-netconf-connector/src/main/java/org/opendaylight/controller/netconf/confignetconfconnector/mapping/attributes/toxml/SimpleIdentityRefAttributeWritingStrategy.java
opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/xml/XmlUtil.java

index a2b8e0b..104bf4d 100644 (file)
@@ -45,6 +45,6 @@ public class SimpleIdentityRefAttributeWritingStrategy extends SimpleAttributeWr
         QName qName = QName.create(value);
         String identityValue = qName.getLocalName();
         String identityNamespace = qName.getNamespace().toString();
-        return XmlUtil.createTextElementWithNamespacedContent(doc, key, PREFIX, identityNamespace, identityValue);
+        return XmlUtil.createTextElementWithNamespacedContent(doc, key, PREFIX, identityNamespace, identityValue, namespace);
     }
 }
index 01b1c8d..9e227ee 100644 (file)
@@ -124,8 +124,14 @@ public final class XmlUtil {
     public static Element createTextElementWithNamespacedContent(Document document, String qName, String prefix,
                                                                  String namespace, String contentWithoutPrefix) {
 
+       return createTextElementWithNamespacedContent(document, qName, prefix, namespace, contentWithoutPrefix, Optional.<String>absent());
+    }
+
+    public static Element createTextElementWithNamespacedContent(Document document, String qName, String prefix,
+                                                                 String namespace, String contentWithoutPrefix, Optional<String> namespaceURI) {
+
         String content = createPrefixedValue(XmlNetconfConstants.PREFIX, contentWithoutPrefix);
-        Element element = createTextElement(document, qName, content, Optional.<String>absent());
+        Element element = createTextElement(document, qName, content, namespaceURI);
         String prefixedNamespaceAttr = createPrefixedValue(XMLNS_ATTRIBUTE_KEY, prefix);
         element.setAttributeNS(XMLNS_URI, prefixedNamespaceAttr, namespace);
         return element;

©2013 OpenDaylight, A Linux Foundation Collaborative Project. All Rights Reserved.
OpenDaylight is a registered trademark of The OpenDaylight Project, Inc.
Linux Foundation and OpenDaylight are registered trademarks of the Linux Foundation.
Linux is a registered trademark of Linus Torvalds.