Bug-6662: On connection reset by peer, sometimes re-connection attempt stops after... 19/45519/1
authorAjay <ajayl.bro@gmail.com>
Tue, 13 Sep 2016 02:16:23 +0000 (02:16 +0000)
committerAjay <ajayl.bro@gmail.com>
Tue, 13 Sep 2016 02:18:01 +0000 (02:18 +0000)
commite65e1378acfdef6ab6f7e2fe115e7af716237281
treee3d2d3802c2938ae906f7b4bc9ffdbbbb46a2b50
parenta47f8beb566f5af1ecc9fb99e2d3ebd87d8cf414
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: Ica4add08bc5e9e44f1321d139a56cf9157cfdd69
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
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/protocol/BGPReconnectPromise.java