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.parser.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 * Check whether peer on provided IP address is present in this registry.
41 * @param ip address of remote peer
42 * @return true if peer is present false otherwise
44 boolean isPeerConfigured(IpAddress ip);
47 * Get configured peer after BGP session was successfully established. Called by negotiators.
49 * @param ip address of remote peer
50 * @param sourceId BGP ID of peer that initiated the session (current device or remote peer)
51 * @param remoteId BGP ID of peer that accepted the session (current device or remote peer)
52 * @return configured Peer as BGP listener
54 * @throws BGPDocumentedException if session establishment cannot be finished successfully
55 * @throws java.lang.IllegalStateException if there is no peer configured for provided ip address
57 BGPSessionListener getPeer(IpAddress ip, Ipv4Address sourceId, Ipv4Address remoteId) throws BGPDocumentedException;
60 * @param ip address of remote peer
61 * @return BGP session preferences for configured peer
63 * @throws java.lang.IllegalStateException if there is no peer configured for provided ip address
65 BGPSessionPreferences getPeerPreferences(IpAddress ip);