X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fnetconf%2Fnetconf-client%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fnetconf%2Fclient%2FNetconfClientSession.java;h=004a22f6948c570e96fc880ea764b366c8cbfd94;hp=5ee89fec40ab12fe3fbd104130eef0dc31d56d8e;hb=c7ec8db7f107b5e265f4e8b2fe3dd0f7b1163b64;hpb=620d8fcdaca212c7e8ad674bd3eccf7559319831 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 5ee89fec40..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,24 +9,24 @@ package org.opendaylight.controller.netconf.client; import io.netty.channel.Channel; - import java.util.Collection; - -import org.opendaylight.controller.netconf.api.NetconfMessage; -import org.opendaylight.controller.netconf.api.NetconfSession; -import org.opendaylight.controller.netconf.api.NetconfTerminationReason; -import org.opendaylight.protocol.framework.SessionListener; +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 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()); } @@ -35,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()); + } }