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 typeL- 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 ClassesModifier and TypeClassDescriptionprotected static enumPossible states for Finite State Machine.Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final @NonNull io.netty.channel.Channelstatic final @org.checkerframework.checker.index.qual.NonNegative intDefault upper bound on the size of an individual chunk. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedNetconfSessionNegotiator(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 TypeMethodDescriptionfinal voidchannelActive(io.netty.channel.ChannelHandlerContext ctx) final voidchannelRead(io.netty.channel.ChannelHandlerContext ctx, Object msg) voidexceptionCaught(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) protected abstract SgetSession(L sessionListener, io.netty.channel.Channel channel, HelloMessage message) protected final SgetSessionForHelloMessage(HelloMessage netconfMessage) protected abstract voidprotected final booleanprotected final @NonNull HelloMessageprotected voidnegotiationFailed(Throwable cause) protected final voidnegotiationSuccessful(S session) protected final voidreplaceHelloMessageInboundHandler(S session) Remove special inbound handler for hello message.protected final voidMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelInactive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerAdded, handlerRemoved, isSharableMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods 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_SIZEDefault 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
-
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
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
-
negotiationFailed
-
channelActive
public final void channelActive(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
channelActivein interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelActivein classio.netty.channel.ChannelInboundHandlerAdapter
-
channelRead
- Specified by:
channelReadin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
channelReadin classio.netty.channel.ChannelInboundHandlerAdapter
-
exceptionCaught
- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelHandler- Specified by:
exceptionCaughtin interfaceio.netty.channel.ChannelInboundHandler- Overrides:
exceptionCaughtin classio.netty.channel.ChannelInboundHandlerAdapter
-
handleMessage
- Throws:
Exception
-