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.IpAddress;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
17 * Registry that contains configured bgp peers ready for when a bgp session is established with remote peer.
18 * IP address is uses as a key for configured peers. TODO Is IP sufficient ID for peers ?
20 public interface BGPPeerRegistry extends AutoCloseable {
23 * Add configured peer, its IP address and preferences. To be used when a BGP session is established.
25 * @param ip address of remote peer
26 * @param peer configured peer as ReusableBGPPeer
27 * @param prefs session preferences for configured peer
29 void addPeer(IpAddress ip, ReusableBGPPeer peer, BGPSessionPreferences prefs);
32 * Remove configured peer from registry.
34 * @param ip address of remote peer
36 void removePeer(IpAddress ip);
39 * Remove peer session from registry.
41 * @param ip address of remote peer
43 void removePeerSession(IpAddress ip);
46 * Check whether peer on provided IP address is present in this registry.
48 * @param ip address of remote peer
49 * @return true if peer is present false otherwise
51 boolean isPeerConfigured(IpAddress ip);
54 * Get configured peer after BGP session was successfully established. Called by negotiators.
56 * @param ip address of remote peer
57 * @param sourceId BGP ID of peer that initiated the session (current device or remote peer)
58 * @param remoteId BGP ID of peer that accepted the session (current device or remote peer)
59 * @return configured Peer as BGP listener
61 * @throws BGPDocumentedException if session establishment cannot be finished successfully
62 * @throws java.lang.IllegalStateException if there is no peer configured for provided ip address
64 BGPSessionListener getPeer(IpAddress ip, Ipv4Address sourceId, Ipv4Address remoteId) throws BGPDocumentedException;
67 * @param ip address of remote peer
68 * @return BGP session preferences for configured peer
70 * @throws java.lang.IllegalStateException if there is no peer configured for provided ip address
72 BGPSessionPreferences getPeerPreferences(IpAddress ip);