Initial implementation of netconf monitoring module according to http://tools.ietf...
[controller.git] / opendaylight / netconf / netconf-util / src / main / java / org / opendaylight / controller / netconf / util / AbstractNetconfSessionNegotiator.java
index 3ed75a1b1684af1085347b9e822479720a5da83e..95d2feb65c482ea564bce7794d61d6360e35f379 100644 (file)
@@ -20,8 +20,8 @@ import io.netty.util.concurrent.Future;
 import io.netty.util.concurrent.GenericFutureListener;
 import io.netty.util.concurrent.Promise;
 
-import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfSession;
+import org.opendaylight.controller.netconf.api.NetconfMessage;
 import org.opendaylight.controller.netconf.api.NetconfSessionPreferences;
 import org.opendaylight.controller.netconf.util.handler.FramingMechanismHandlerFactory;
 import org.opendaylight.controller.netconf.util.handler.NetconfMessageAggregator;
@@ -130,16 +130,17 @@ public abstract class AbstractNetconfSessionNegotiator<P extends NetconfSessionP
                 channel.pipeline().addAfter("aggregator", "chunkDecoder", new NetconfMessageChunkDecoder());
             }
             changeState(State.ESTABLISHED);
-            S session = getSession(sessionListener, channel, doc);
+            S session = getSession(sessionListener, channel, netconfMessage);
             negotiationSuccessful(session);
         } else {
             final IllegalStateException cause = new IllegalStateException(
                     "Received message was not hello as expected, but was " + XmlUtil.toString(doc));
+            logger.warn("Negotiation of netconf session failed", cause);
             negotiationFailed(cause);
         }
     }
 
-    protected abstract S getSession(SessionListener sessionListener, Channel channel, Document doc);
+    protected abstract S getSession(SessionListener sessionListener, Channel channel, NetconfMessage message);
 
     private boolean isHelloMessage(Document doc) {
         try {