Class NetconfSessionNegotiator<S extends AbstractNetconfSession<S,L>,L extends NetconfSessionListener<S>>

java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
org.opendaylight.netconf.nettyutil.NetconfSessionNegotiator<S,L>
Type Parameters:
S - Session type
L - Session listener type
All Implemented Interfaces:
io.netty.channel.ChannelHandler, io.netty.channel.ChannelInboundHandler

public abstract class NetconfSessionNegotiator<S extends AbstractNetconfSession<S,L>,L extends NetconfSessionListener<S>> extends io.netty.channel.ChannelInboundHandlerAdapter
A negotiator of a NETCONF session. It is responsible for message handling while the exact session parameters are not known. Once the session parameters are finalized, the negotiator replaces itself in the channel pipeline with the session.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    protected static enum 
    Possible states for Finite State Machine.

    Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler

    io.netty.channel.ChannelHandler.Sharable
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected final @NonNull io.netty.channel.Channel
     
    static final @org.checkerframework.checker.index.qual.NonNegative int
    Default upper bound on the size of an individual chunk.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
    NetconfSessionNegotiator(HelloMessage hello, io.netty.util.concurrent.Promise<S> promise, io.netty.channel.Channel channel, org.opendaylight.netconf.common.NetconfTimer timer, L sessionListener, long connectionTimeoutMillis, @org.checkerframework.checker.index.qual.NonNegative int maximumIncomingChunkSize)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    final void
    channelActive(io.netty.channel.ChannelHandlerContext ctx)
     
    final void
    channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
     
    void
    exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
     
    protected abstract S
    getSession(L sessionListener, io.netty.channel.Channel channel, HelloMessage message)
     
    protected final S
     
    protected abstract void
     
    protected final boolean
     
    protected final @NonNull HelloMessage
     
    protected void
     
    protected final void
     
    protected final void
    Remove special inbound handler for hello message.
    protected final void
     

    Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter

    channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered

    Methods inherited from class io.netty.channel.ChannelHandlerAdapter

    ensureNotSharable, handlerAdded, handlerRemoved, isSharable

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface io.netty.channel.ChannelHandler

    handlerAdded, handlerRemoved
  • Field Details

    • DEFAULT_MAXIMUM_INCOMING_CHUNK_SIZE

      @Beta public static final @org.checkerframework.checker.index.qual.NonNegative int DEFAULT_MAXIMUM_INCOMING_CHUNK_SIZE
      Default upper bound on the size of an individual chunk. This value can be controlled through "org.opendaylight.netconf.default.maximum.chunk.size" system property and defaults to 16777216 bytes.
    • channel

      protected final @NonNull io.netty.channel.Channel channel
  • Constructor Details

    • NetconfSessionNegotiator

      protected NetconfSessionNegotiator(HelloMessage hello, io.netty.util.concurrent.Promise<S> promise, io.netty.channel.Channel channel, org.opendaylight.netconf.common.NetconfTimer timer, L sessionListener, long connectionTimeoutMillis, @org.checkerframework.checker.index.qual.NonNegative int maximumIncomingChunkSize)
  • Method Details

    • localHello

      protected final @NonNull HelloMessage localHello()
    • startNegotiation

      protected final void startNegotiation()
    • ifNegotiatedAlready

      protected final boolean ifNegotiatedAlready()
    • getSessionForHelloMessage

      protected final S getSessionForHelloMessage(HelloMessage netconfMessage) throws NetconfDocumentedException
      Throws:
      NetconfDocumentedException
    • getSession

      protected abstract S getSession(L sessionListener, io.netty.channel.Channel channel, HelloMessage message) throws NetconfDocumentedException
      Throws:
      NetconfDocumentedException
    • replaceHelloMessageInboundHandler

      protected final void replaceHelloMessageInboundHandler(S session)
      Remove special inbound handler for hello message. Insert regular netconf xml message (en|de)coders.

      Inbound hello message handler should be kept until negotiation is successful It caches any non-hello messages while negotiation is still in progress

    • negotiationSuccessful

      protected final void negotiationSuccessful(S session)
    • negotiationFailed

      protected void negotiationFailed(Throwable cause)
    • channelActive

      public final void channelActive(io.netty.channel.ChannelHandlerContext ctx)
      Specified by:
      channelActive in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelActive in class io.netty.channel.ChannelInboundHandlerAdapter
    • channelRead

      public final void channelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg)
      Specified by:
      channelRead in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      channelRead in class io.netty.channel.ChannelInboundHandlerAdapter
    • exceptionCaught

      public void exceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause)
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelHandler
      Specified by:
      exceptionCaught in interface io.netty.channel.ChannelInboundHandler
      Overrides:
      exceptionCaught in class io.netty.channel.ChannelInboundHandlerAdapter
    • handleMessage

      protected abstract void handleMessage(HelloMessage msg) throws Exception
      Throws:
      Exception