Class StrictBGPPeerRegistry
java.lang.Object
org.opendaylight.protocol.bgp.rib.impl.StrictBGPPeerRegistry
- All Implemented Interfaces:
AutoCloseable,BGPPeerRegistry
@Singleton
@MetaInfServices
public final class StrictBGPPeerRegistry
extends Object
implements BGPPeerRegistry, AutoCloseable
BGP peer registry that allows only 1 session per BGP peer. If a second session with peer is established, one of
the sessions will be dropped. The session with lower source BGP id will be dropped. This class is thread-safe.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddPeer(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone oldIp, BGPSessionListener peer, BGPSessionPreferences preferences) Add configured peer, its IP address and preferences.voidclose()static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZonegetIpAddress(SocketAddress socketAddress) Creates IpAddress from SocketAddress.getPeer(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone ip, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone sourceId, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone remoteId, Open openObj) Get configured peer after BGP session was successfully established.getPeerPreferences(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone ip) Get preferences for a remote peer.booleanisPeerConfigured(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone oldIp) Check whether peer on provided IP address is present in this registry.org.opendaylight.yangtools.concepts.RegistrationRegister PeerRegistryListener, which listens to the changes in peer registry (add peer, remove peer).org.opendaylight.yangtools.concepts.RegistrationRegister PeerRegistrySessionListener, which listens to the changes in sessions of peers in peer registry (create session, remove session).voidremovePeer(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone oldIp) Remove configured peer from registry.voidremovePeerSession(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone oldIp) Remove peer session from registry.toString()voidupdatePeerPreferences(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone address, BGPSessionPreferences preferences) Set new preferences.
-
Constructor Details
-
StrictBGPPeerRegistry
@Inject public StrictBGPPeerRegistry()
-
-
Method Details
-
addPeer
public void addPeer(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone oldIp, BGPSessionListener peer, BGPSessionPreferences preferences) Description copied from interface:BGPPeerRegistryAdd configured peer, its IP address and preferences. To be used when a BGP session is established.- Specified by:
addPeerin interfaceBGPPeerRegistry- Parameters:
oldIp- address of remote peerpeer- configured peer as BGPSessionListenerpreferences- session preferences for configured peer
-
removePeer
public void removePeer(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone oldIp) Description copied from interface:BGPPeerRegistryRemove configured peer from registry.- Specified by:
removePeerin interfaceBGPPeerRegistry- Parameters:
oldIp- address of remote peer
-
removePeerSession
public void removePeerSession(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone oldIp) Description copied from interface:BGPPeerRegistryRemove peer session from registry.- Specified by:
removePeerSessionin interfaceBGPPeerRegistry- Parameters:
oldIp- address of remote peer
-
isPeerConfigured
public boolean isPeerConfigured(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone oldIp) Description copied from interface:BGPPeerRegistryCheck whether peer on provided IP address is present in this registry.- Specified by:
isPeerConfiguredin interfaceBGPPeerRegistry- Parameters:
oldIp- address of remote peer- Returns:
- true if peer is present false otherwise
-
getPeer
public BGPSessionListener getPeer(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone ip, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone sourceId, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone remoteId, Open openObj) throws BGPDocumentedException Description copied from interface:BGPPeerRegistryGet configured peer after BGP session was successfully established. Called by negotiators.- Specified by:
getPeerin interfaceBGPPeerRegistry- Parameters:
ip- address of remote peersourceId- BGP ID of peer that initiated the session (current device or remote peer)remoteId- BGP ID of peer that accepted the session (current device or remote peer)openObj- remote Open message- Returns:
- BGPSessionListener configured Peer as BGP listener
- Throws:
BGPDocumentedException- if session establishment cannot be finished successfully
-
getPeerPreferences
public BGPSessionPreferences getPeerPreferences(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone ip) Description copied from interface:BGPPeerRegistryGet preferences for a remote peer.- Specified by:
getPeerPreferencesin interfaceBGPPeerRegistry- Parameters:
ip- address of remote peer- Returns:
- BGP session preferences for configured peer
-
getIpAddress
public static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone getIpAddress(SocketAddress socketAddress) Creates IpAddress from SocketAddress. Only InetSocketAddress is accepted with inner address: Inet4Address and Inet6Address.- Parameters:
socketAddress- socket address to transform- Returns:
- IpAddress equivalent to given socket address
- Throws:
IllegalArgumentException- if submitted socket address is not InetSocketAddress[ipv4 | ipv6]
-
close
@PreDestroy public void close()- Specified by:
closein interfaceAutoCloseable
-
toString
-
registerPeerRegisterListener
public org.opendaylight.yangtools.concepts.Registration registerPeerRegisterListener(PeerRegistryListener listener) Description copied from interface:BGPPeerRegistryRegister PeerRegistryListener, which listens to the changes in peer registry (add peer, remove peer). After registration, an initial drop is provided by calling onPeerAdded().- Specified by:
registerPeerRegisterListenerin interfaceBGPPeerRegistry- Parameters:
listener- The PeerRegistryListener to be registered.- Returns:
- Registration ticked, used for closing of registration.
-
registerPeerSessionListener
public org.opendaylight.yangtools.concepts.Registration registerPeerSessionListener(PeerRegistrySessionListener listener) Description copied from interface:BGPPeerRegistryRegister PeerRegistrySessionListener, which listens to the changes in sessions of peers in peer registry (create session, remove session). After registration, an initial drop is provided by calling onSessionCreated().- Specified by:
registerPeerSessionListenerin interfaceBGPPeerRegistry- Parameters:
listener- The PeerRegistrySessionListener to be registered.- Returns:
- Registration ticked, used for closing of registration.
-
updatePeerPreferences
public void updatePeerPreferences(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone address, BGPSessionPreferences preferences) Description copied from interface:BGPPeerRegistrySet new preferences. In case of graceful restart execution we need to send updated GracefulRestartCapability when sesison re-establish, information which tables where preserved during restart will change. Note that this method only updates preferences of already registered peer. To add new peer to registry use addPeer().- Specified by:
updatePeerPreferencesin interfaceBGPPeerRegistry- Parameters:
address- of neighborpreferences- to send in OPEN message
-