Merge "Add message to update the schema context of the InMemoryDOMDataStore"
[controller.git] / opendaylight / netconf / netconf-client / src / main / java / org / opendaylight / controller / netconf / client / NetconfClientSession.java
index 2d07dd58332ea6bd8b5c030a6408be876aae0278..004a22f6948c570e96fc880ea764b366c8cbfd94 100644 (file)
@@ -9,21 +9,24 @@
 package org.opendaylight.controller.netconf.client;
 
 import io.netty.channel.Channel;
-
 import java.util.Collection;
-
-import org.opendaylight.controller.netconf.api.AbstractNetconfSession;
+import org.opendaylight.controller.netconf.nettyutil.AbstractNetconfSession;
+import org.opendaylight.controller.netconf.nettyutil.handler.NetconfEXICodec;
+import org.opendaylight.controller.netconf.nettyutil.handler.NetconfEXIToMessageDecoder;
+import org.opendaylight.controller.netconf.nettyutil.handler.NetconfMessageToEXIEncoder;
+import org.opendaylight.controller.netconf.nettyutil.handler.NetconfMessageToXMLEncoder;
+import org.opendaylight.controller.netconf.nettyutil.handler.NetconfXMLToMessageDecoder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public final class NetconfClientSession extends AbstractNetconfSession<NetconfClientSession, NetconfClientSessionListener> {
+public class NetconfClientSession extends AbstractNetconfSession<NetconfClientSession, NetconfClientSessionListener> {
 
     private static final Logger logger = LoggerFactory.getLogger(NetconfClientSession.class);
     private final Collection<String> capabilities;
 
     public NetconfClientSession(NetconfClientSessionListener sessionListener, Channel channel, long sessionId,
             Collection<String> capabilities) {
-        super(sessionListener,channel,sessionId);
+        super(sessionListener, channel, sessionId);
         this.capabilities = capabilities;
         logger.debug("Client Session {} created", toString());
     }
@@ -36,4 +39,18 @@ public final class NetconfClientSession extends AbstractNetconfSession<NetconfCl
     protected NetconfClientSession thisInstance() {
         return this;
     }
+
+    @Override
+    protected void addExiHandlers(NetconfEXICodec exiCodec) {
+        // TODO used only in negotiator, client supports only auto start-exi
+        replaceMessageDecoder(new NetconfEXIToMessageDecoder(exiCodec));
+        replaceMessageEncoder(new NetconfMessageToEXIEncoder(exiCodec));
+    }
+
+    @Override
+    public void stopExiCommunication() {
+        // TODO never used, Netconf client does not support stop-exi
+        replaceMessageDecoder(new NetconfXMLToMessageDecoder());
+        replaceMessageEncoder(new NetconfMessageToXMLEncoder());
+    }
 }