Bug-6662: On connection reset by peer, sometimes re-connection attempt stops after... 66/45766/1
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:47 +0000 (19:04 +0000)
commita1b3b896930c9b0c684d76ee983692fb2f37f930
tree927403225c98b969807335f167e58d84bd1ab918
parent63cd933b76740bd76ed9120dc2a1a61f481939f1
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>
(cherry picked from commit 8b8556445b106974cb438244330e5ab68134f898)
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]