Fix closing of peers and rib 44/98444/25
authormarekzatko <Marek.Zatko@pantheon.tech>
Fri, 12 Nov 2021 10:29:45 +0000 (11:29 +0100)
committerRobert Varga <robert.varga@pantheon.tech>
Sun, 21 Nov 2021 13:34:59 +0000 (14:34 +0100)
commit2bc9a9de373e1d583258b68529f9b4c9243c2983
treea258c9993cc0aa4bc88f0b07dada977059058d95
parentfa2d01e4f63d6250587853c3aa3b500c8ef9872a
Fix closing of peers and rib

Migration to OSGi DS has the side effect that we get proper component
restarts based on their dependencies changing. This exposes the fact
we are not properly shutting down our singleton instances.

Since RibImpl has a captive RIBImpl instance, which undergoes lifecycle,
we have to synchronize all access to it. This is unfortunate, but
addressing this (as well as their naming) will be subject to a separate
effort.

Properly track peers, so we understand when we need to restart them.
While doing such restarts, wait for each peer to properly go down before
starting it up again.

While we are in the area, also improve BGPClusterSingletonService method
names so their intent is a tad more readable. The same goes for BgpPeer,
which is now a package-private abstract class to hide internal machinery
from the outside world.

Also ditch use of ClusterSingletonServiceRegistrationHelper -- it is a
remnant of a bygone era where ClusterSingletonServiceProvider was
incorrectly managing state -- that issue has been resolved a few years
ago. Cutting it out allows us to properly manage our lifecycle,
especially with regards to multiple registrations/instantiations.

JIRA: BGPCEP-988
Change-Id: Idb6748042ddb9a5765c3cea80f15ef319c13368b
Signed-off-by: marekzatko <Marek.Zatko@pantheon.tech>
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
14 files changed:
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/AbstractPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/AppPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/BGPClusterSingletonService.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpPeer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/DefaultBgpDeployer.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/PeerBean.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/config/RibImpl.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/protocol/BGPReconnectPromise.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/AppPeerTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpDeployerTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/BgpPeerTest.java
bgp/rib-impl/src/test/java/org/opendaylight/protocol/bgp/rib/impl/config/RibImplTest.java