2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
9 package org.opendaylight.protocol.bgp.rib.impl.spi;
11 import org.opendaylight.protocol.bgp.parser.BGPDocumentedException;
12 import org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.IpAddress;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
18 * Registry that contains configured bgp peers ready for when a bgp session is established with remote peer.
19 * IP address is uses as a key for configured peers. TODO Is IP sufficient ID for peers ?
21 public interface BGPPeerRegistry extends AutoCloseable {
24 * Add configured peer, its IP address and preferences. To be used when a BGP session is established.
26 * @param ip address of remote peer
27 * @param peer configured peer as ReusableBGPPeer
28 * @param prefs session preferences for configured peer
30 void addPeer(IpAddress ip, ReusableBGPPeer peer, BGPSessionPreferences prefs);
33 * Remove configured peer from registry.
35 * @param ip address of remote peer
37 void removePeer(IpAddress ip);
40 * Remove peer session from registry.
42 * @param ip address of remote peer
44 void removePeerSession(IpAddress ip);
47 * Check whether peer on provided IP address is present in this registry.
49 * @param ip address of remote peer
50 * @return true if peer is present false otherwise
52 boolean isPeerConfigured(IpAddress ip);
55 * Get configured peer after BGP session was successfully established. Called by negotiators.
57 * @param ip address of remote peer
58 * @param sourceId BGP ID of peer that initiated the session (current device or remote peer)
59 * @param remoteId BGP ID of peer that accepted the session (current device or remote peer)
60 * @param asNumber remote AS number
61 * @return BGPSessionListener configured Peer as BGP listener
63 * @throws BGPDocumentedException if session establishment cannot be finished successfully
64 * @throws java.lang.IllegalStateException if there is no peer configured for provided ip address
66 BGPSessionListener getPeer(IpAddress ip, Ipv4Address sourceId, Ipv4Address remoteId, AsNumber asNumber) throws BGPDocumentedException;
69 * @param ip address of remote peer
70 * @return BGP session preferences for configured peer
72 * @throws java.lang.IllegalStateException if there is no peer configured for provided ip address
74 BGPSessionPreferences getPeerPreferences(IpAddress ip);