Bug-6662: On connection reset by peer, sometimes re-connection attempt stops after... 13/45713/2
authorAjay <ajayl.bro@gmail.com>
Fri, 16 Sep 2016 05:07:32 +0000 (05:07 +0000)
committerMilos Fabian <milfabia@cisco.com>
Sat, 17 Sep 2016 19:04:38 +0000 (19:04 +0000)
commit8b8556445b106974cb438244330e5ab68134f898
tree44ba9efcaad7eefec0250a18d0f67860a46aeff7
parent7bcbd7eeb2355284d6963ed86538b902c08c313e
Bug-6662: On connection reset by peer, sometimes re-connection attempt stops after HoldTimer expired error

This issue happens when the neighbor config is removed from peer router while retaining the BGP router config.
Under this scenario, since BGP router config is still present, router is listening on BGP port. So when ODL
tries to connect, the connection succeeds. However the BGP negotiation fails as neighbor config has been removed
from router.

BGPReconnectPromise.ClosedChannelHandler#channelInactive triggers the reconnect, but the actual connection
retries as per the connection stragegy are done from BGPProtocolSessionPromise.BootstrapConnectListener#operationComplete

In failure scenario, since connection succeeds but negotiation fails, failure is not detected in BGPProtocolSessionPromise.BootstrapConnectListener#operationComplete
and so no reconnection attempts are made.

When negotiation fails, AbstractBGPSessionNegotiator#negotiationFailedCloseChannel is called, which causes BGPReconnectPromise.ClosedChannelHandler#channelInactive
to get called. Fix involves detecting negotiation failure here, and calling BGPProtocolSessionPromise#reconnect.

The scheduled job in AbstractBGPSessionNegotiator to detect hold-timer expiry during negotiation is also being cancelled
from AbstractBGPSessionNegotiator#negotiationFailedCloseChannel as the job is not needed when channel is closed.

Change-Id: Ie4aecd1f99312476abd75f008c0a3ee4ce1d44a6
Signed-off-by: Ajay <ajayl.bro@gmail.com>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/AbstractBGPSessionNegotiator.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/protocol/BGPProtocolSessionPromise.java [changed mode: 0755->0644]
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/protocol/BGPReconnectPromise.java [changed mode: 0755->0644]