Class StrictBGPPeerRegistry

  • All Implemented Interfaces:
    AutoCloseable, BGPPeerRegistry

    public final class StrictBGPPeerRegistry
    extends Object
    implements BGPPeerRegistry
    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.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void addPeer​(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.
      void close()  
      static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone getIpAddress​(SocketAddress socketAddress)
      Creates IpAddress from SocketAddress.
      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)
      Get configured peer after BGP session was successfully established.
      BGPSessionPreferences getPeerPreferences​(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone ip)
      Get preferences for a remote peer.
      static BGPPeerRegistry instance()  
      boolean isPeerConfigured​(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.Registration registerPeerRegisterListener​(PeerRegistryListener listener)
      Register PeerRegistryListener, which listens to the changes in peer registry (add peer, remove peer).
      org.opendaylight.yangtools.concepts.Registration registerPeerSessionListener​(PeerRegistrySessionListener listener)
      Register PeerRegistrySessionListener, which listens to the changes in sessions of peers in peer registry (create session, remove session).
      void removePeer​(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone oldIp)
      Remove configured peer from registry.
      void removePeerSession​(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone oldIp)
      Remove peer session from registry.
      String toString()  
      void updatePeerPreferences​(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressNoZone address, BGPSessionPreferences preferences)
      Set new preferences.
    • Constructor Detail

      • StrictBGPPeerRegistry

        public StrictBGPPeerRegistry()
    • Method Detail

      • 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: BGPPeerRegistry
        Add configured peer, its IP address and preferences. To be used when a BGP session is established.
        Specified by:
        addPeer in interface BGPPeerRegistry
        Parameters:
        oldIp - address of remote peer
        peer - configured peer as BGPSessionListener
        preferences - 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: BGPPeerRegistry
        Remove configured peer from registry.
        Specified by:
        removePeer in interface BGPPeerRegistry
        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: BGPPeerRegistry
        Remove peer session from registry.
        Specified by:
        removePeerSession in interface BGPPeerRegistry
        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: BGPPeerRegistry
        Check whether peer on provided IP address is present in this registry.
        Specified by:
        isPeerConfigured in interface BGPPeerRegistry
        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: BGPPeerRegistry
        Get configured peer after BGP session was successfully established. Called by negotiators.
        Specified by:
        getPeer in interface BGPPeerRegistry
        Parameters:
        ip - address of remote peer
        sourceId - 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: BGPPeerRegistry
        Get preferences for a remote peer.
        Specified by:
        getPeerPreferences in interface BGPPeerRegistry
        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]
      • registerPeerRegisterListener

        public org.opendaylight.yangtools.concepts.Registration registerPeerRegisterListener​(PeerRegistryListener listener)
        Description copied from interface: BGPPeerRegistry
        Register 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:
        registerPeerRegisterListener in interface BGPPeerRegistry
        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: BGPPeerRegistry
        Register 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:
        registerPeerSessionListener in interface BGPPeerRegistry
        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: BGPPeerRegistry
        Set 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:
        updatePeerPreferences in interface BGPPeerRegistry
        Parameters:
        address - of neighbor
        preferences - to send in OPEN message