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=bd91af5bcc95ba7f691d6880bbabe9483a865d2a;hb=d6f1e7790157461553b26ec82d246e68b62aad6b;hp=3de70afc51c74169ca50074a7f46de8283f5e913;hpb=d82b96055d2c0d471c85c2b2b3cb30e52fff1c69;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 3de70afc51..bd91af5bcc 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,34 @@ 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 org.slf4j.Logger; -import org.slf4j.LoggerFactory; import java.util.Collection; -public class NetconfClientSession extends NetconfSession { +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 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, - Collection capabilities) { - super(sessionListener,channel,sessionId); + /** + * Construct a new session. + * + * @param sessionListener + * @param channel + * @param sessionId + * @param capabilities set of advertised capabilities. Expected to be immutable. + */ + public NetconfClientSession(final NetconfClientSessionListener sessionListener, final Channel channel, final long sessionId, + final Collection capabilities) { + super(sessionListener, channel, sessionId); this.capabilities = capabilities; logger.debug("Client Session {} created", toString()); } @@ -32,8 +45,22 @@ public class NetconfClientSession extends NetconfSession { return capabilities; } - public Channel getChannel(){ - return channel; + @Override + protected NetconfClientSession thisInstance() { + return this; + } + + @Override + protected void addExiHandlers(final 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()); + } }