X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fclient%2FNetconfClientSession.java;h=004a22f6948c570e96fc880ea764b366c8cbfd94;hb=eda0ef295a7c6aac904da33132885cd86bfcb855;hp=c57487f70b8d12779d88b68c7e20fe879739790a;hpb=0a23c5e6383fe72e6c5f59aa727ae2b27bb966f5;p=controller.git diff --git a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSession.java b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSession.java index c57487f70b..004a22f694 100644 --- a/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSession.java +++ b/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSession.java @@ -9,21 +9,24 @@ package org.opendaylight.controller.netconf.client; import io.netty.channel.Channel; -import org.opendaylight.controller.netconf.api.NetconfSession; -import org.opendaylight.protocol.framework.SessionListener; +import java.util.Collection; +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; -import java.util.Collection; - -public class NetconfClientSession extends NetconfSession { +public class NetconfClientSession extends AbstractNetconfSession { private static final Logger logger = LoggerFactory.getLogger(NetconfClientSession.class); private final Collection capabilities; - public NetconfClientSession(SessionListener sessionListener, Channel channel, long sessionId, + public NetconfClientSession(NetconfClientSessionListener sessionListener, Channel channel, long sessionId, Collection capabilities) { - super(sessionListener,channel,sessionId); + super(sessionListener, channel, sessionId); this.capabilities = capabilities; logger.debug("Client Session {} created", toString()); } @@ -32,4 +35,22 @@ public class NetconfClientSession extends NetconfSession { return capabilities; } + @Override + 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()); + } }