Class BGPSessionImpl
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.SimpleChannelInboundHandler<org.opendaylight.yangtools.yang.binding.Notification<?>>
org.opendaylight.protocol.bgp.rib.impl.BGPSessionImpl
- All Implemented Interfaces:
io.netty.channel.ChannelHandler
,io.netty.channel.ChannelInboundHandler
,AutoCloseable
,BGPSessionStateProvider
,BGPSession
public class BGPSessionImpl
extends io.netty.channel.SimpleChannelInboundHandler<org.opendaylight.yangtools.yang.binding.Notification<?>>
implements BGPSession, BGPSessionStateProvider, AutoCloseable
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable
-
Constructor Summary
ConstructorDescriptionBGPSessionImpl
(BGPSessionListener listener, io.netty.channel.Channel channel, Open remoteOpen, int localHoldTimer, BGPPeerRegistry peerRegistry) BGPSessionImpl
(BGPSessionListener listener, io.netty.channel.Channel channel, Open remoteOpen, BGPSessionPreferences localPreferences, BGPPeerRegistry peerRegistry) -
Method Summary
Modifier and TypeMethodDescription<T extends PeerConstraint>
voidaddDecoderConstraint
(Class<T> constraintClass, T constraint) Add peer constraint to session pipeline decoder.protected com.google.common.base.MoreObjects.ToStringHelper
addToStringAttributes
(com.google.common.base.MoreObjects.ToStringHelper toStringHelper) final void
channelInactive
(io.netty.channel.ChannelHandlerContext ctx) protected final void
channelRead0
(io.netty.channel.ChannelHandlerContext ctx, org.opendaylight.yangtools.yang.binding.Notification<?> msg) void
close()
void
Close peer session without sending Notification message.void
exceptionCaught
(io.netty.channel.ChannelHandlerContext ctx, Throwable cause) Return a list with Add Path tables supported advertised and corresponding SendReceive mode.Return advertised graceful capability containing the list of tables which the peer has advertised to support, restart time and restarting flags.Return advertised long-lived graceful capability containing the list of tables with stale time which the peer has advertised to support.Return the list of tables which the peer has advertised to support.final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber
Return the AS number which the peer advertises.final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address
getBgpId()
Return the BGP router ID advertised by the peer.BGP Operational Session State.BGP Operational Timers State.BGP Operational Transport State.getState()
final void
handlerAdded
(io.netty.channel.ChannelHandlerContext ctx) void
registerMessagesCounter
(BGPMessagesListener bgpMessagesListener) Register BGP Operational Messages State Listener.io.netty.util.concurrent.ScheduledFuture<?>
Schedule a task to be executed in the context of the session handling thread.void
setChannelExtMsgCoder
(Open remoteOpen) Set the extend message coder for current channel.final String
toString()
Methods inherited from class io.netty.channel.SimpleChannelInboundHandler
acceptInboundMessage, channelRead
Methods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
Methods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, handlerRemoved, isSharable
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface io.netty.channel.ChannelHandler
handlerRemoved
Methods inherited from interface io.netty.channel.ChannelInboundHandler
channelActive, channelRead, channelReadComplete, channelRegistered, channelUnregistered, channelWritabilityChanged, userEventTriggered
-
Constructor Details
-
BGPSessionImpl
public BGPSessionImpl(BGPSessionListener listener, io.netty.channel.Channel channel, Open remoteOpen, BGPSessionPreferences localPreferences, BGPPeerRegistry peerRegistry) -
BGPSessionImpl
public BGPSessionImpl(BGPSessionListener listener, io.netty.channel.Channel channel, Open remoteOpen, int localHoldTimer, BGPPeerRegistry peerRegistry)
-
-
Method Details
-
setChannelExtMsgCoder
Set the extend message coder for current channel. The reason for separating this part from constructor is, in #channel.pipeline().replace(..), the invokeChannelRead() will be invoked after the original message coder handler got removed. And there is chance that before the session instance is fully initiated (constructor returns), a KeepAlive message arrived already in the channel buffer. Thus #AbstractBGPSessionNegotiator.handleMessage(..) gets invoked again and a deadlock is caused. A BGP final state machine error will happen as BGP negotiator is still in OPEN_SENT state as the session constructor hasn't returned yet. -
close
public void close()- Specified by:
close
in interfaceAutoCloseable
-
closeWithoutMessage
public void closeWithoutMessage()Description copied from interface:BGPSession
Close peer session without sending Notification message.- Specified by:
closeWithoutMessage
in interfaceBGPSession
-
toString
-
addToStringAttributes
protected com.google.common.base.MoreObjects.ToStringHelper addToStringAttributes(com.google.common.base.MoreObjects.ToStringHelper toStringHelper) -
getAdvertisedTableTypes
Description copied from interface:BGPSession
Return the list of tables which the peer has advertised to support.- Specified by:
getAdvertisedTableTypes
in interfaceBGPSession
- Returns:
- Set of tables which it supports.
-
getAdvertisedAddPathTableTypes
Description copied from interface:BGPSession
Return a list with Add Path tables supported advertised and corresponding SendReceive mode.- Specified by:
getAdvertisedAddPathTableTypes
in interfaceBGPSession
- Returns:
- AddPathTables supported
-
getAdvertisedGracefulRestartCapability
Description copied from interface:BGPSession
Return advertised graceful capability containing the list of tables which the peer has advertised to support, restart time and restarting flags.- Specified by:
getAdvertisedGracefulRestartCapability
in interfaceBGPSession
- Returns:
- Advertised graceful restart capability.
-
getAdvertisedLlGracefulRestartCapability
Description copied from interface:BGPSession
Return advertised long-lived graceful capability containing the list of tables with stale time which the peer has advertised to support.- Specified by:
getAdvertisedLlGracefulRestartCapability
in interfaceBGPSession
- Returns:
- Advertised long-lived graceful restart capability.
-
getState
-
getBgpId
public final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address getBgpId()Description copied from interface:BGPSession
Return the BGP router ID advertised by the peer.- Specified by:
getBgpId
in interfaceBGPSession
- Returns:
- Peer's BGP Router ID.
-
getAsNumber
public final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber getAsNumber()Description copied from interface:BGPSession
Return the AS number which the peer advertises.- Specified by:
getAsNumber
in interfaceBGPSession
- Returns:
- Peer's AS Number
-
getLimiter
-
channelInactive
- Specified by:
channelInactive
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
channelInactive
in classio.netty.channel.ChannelInboundHandlerAdapter
- Throws:
Exception
-
channelRead0
protected final void channelRead0(io.netty.channel.ChannelHandlerContext ctx, org.opendaylight.yangtools.yang.binding.Notification<?> msg) - Specified by:
channelRead0
in classio.netty.channel.SimpleChannelInboundHandler<org.opendaylight.yangtools.yang.binding.Notification<?>>
-
handlerAdded
public final void handlerAdded(io.netty.channel.ChannelHandlerContext ctx) - Specified by:
handlerAdded
in interfaceio.netty.channel.ChannelHandler
- Overrides:
handlerAdded
in classio.netty.channel.ChannelHandlerAdapter
-
exceptionCaught
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelHandler
- Specified by:
exceptionCaught
in interfaceio.netty.channel.ChannelInboundHandler
- Overrides:
exceptionCaught
in classio.netty.channel.ChannelInboundHandlerAdapter
-
getBGPSessionState
Description copied from interface:BGPSessionStateProvider
BGP Operational Session State.- Specified by:
getBGPSessionState
in interfaceBGPSessionStateProvider
- Returns:
- BGPSessionState
-
getBGPTimersState
Description copied from interface:BGPSessionStateProvider
BGP Operational Timers State.- Specified by:
getBGPTimersState
in interfaceBGPSessionStateProvider
- Returns:
- BGPTimersState
-
getBGPTransportState
Description copied from interface:BGPSessionStateProvider
BGP Operational Transport State.- Specified by:
getBGPTransportState
in interfaceBGPSessionStateProvider
- Returns:
- BGPTransportState
-
registerMessagesCounter
Description copied from interface:BGPSessionStateProvider
Register BGP Operational Messages State Listener.- Specified by:
registerMessagesCounter
in interfaceBGPSessionStateProvider
- Parameters:
bgpMessagesListener
- BGPMessagesListener
-
addDecoderConstraint
Description copied from interface:BGPSession
Add peer constraint to session pipeline decoder.- Specified by:
addDecoderConstraint
in interfaceBGPSession
-
schedule
public io.netty.util.concurrent.ScheduledFuture<?> schedule(Runnable command, long delay, TimeUnit unit) Description copied from interface:BGPSession
Schedule a task to be executed in the context of the session handling thread.- Specified by:
schedule
in interfaceBGPSession
- Parameters:
command
- the task to executedelay
- the time from now to delay executionunit
- the time unit of the delay parameter- Returns:
- Future representing the scheduled task.
-