BUG-2837 Check netconf base 1.1 capability correctly 20/16920/1
authorMaros Marsalek <mmarsale@cisco.com>
Fri, 20 Mar 2015 14:19:06 +0000 (15:19 +0100)
committerMaros Marsalek <mmarsale@cisco.com>
Fri, 20 Mar 2015 14:19:06 +0000 (15:19 +0100)
Check the entire URI for netconf base 1.1 presence in hello message

Change-Id: Ida5f9bf3445b24c2945c2ac583f53806f4c1e01f
Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
opendaylight/netconf/netconf-netty-util/src/main/java/org/opendaylight/controller/netconf/nettyutil/AbstractNetconfSessionNegotiator.java

index 6d4c1067b8455e377c47dd3e3de84abae15b4785..9e1edc337661fc808f1dc50e549b0bdeb3e6ae68 100644 (file)
@@ -27,6 +27,7 @@ import org.opendaylight.controller.netconf.api.NetconfDocumentedException;
 import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfSessionListener;
 import org.opendaylight.controller.netconf.api.NetconfSessionPreferences;
+import org.opendaylight.controller.netconf.api.xml.XmlNetconfConstants;
 import org.opendaylight.controller.netconf.nettyutil.handler.FramingMechanismHandlerFactory;
 import org.opendaylight.controller.netconf.nettyutil.handler.NetconfChunkAggregator;
 import org.opendaylight.controller.netconf.nettyutil.handler.NetconfMessageToXMLEncoder;
@@ -229,9 +230,9 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
     }
 
     private boolean containsBase11Capability(final Document doc) {
-        final NodeList nList = doc.getElementsByTagName("capability");
+        final NodeList nList = doc.getElementsByTagName(XmlNetconfConstants.CAPABILITY);
         for (int i = 0; i < nList.getLength(); i++) {
-            if (nList.item(i).getTextContent().contains("base:1.1")) {
+            if (nList.item(i).getTextContent().contains(XmlNetconfConstants.URN_IETF_PARAMS_NETCONF_BASE_1_1)) {
                 return true;
             }
         }