Merge "BUG-2383: refactor RIBSupportRegistry"
[bgpcep.git] / bgp / rib-spi / src / main / java / org / opendaylight / protocol / bgp / rib / spi / BGPSession.java
1 /*
2  * Copyright (c) 2013 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.protocol.bgp.rib.spi;
9
10 import java.util.Set;
11
12 import org.opendaylight.protocol.framework.ProtocolSession;
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.Ipv4Address;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
16 import org.opendaylight.yangtools.yang.binding.Notification;
17
18 /**
19  * BGP Session represents the finite state machine in BGP, including timers and its purpose is to create a BGP
20  * connection between BGP speakers. Session is automatically started, when TCP connection is created, but can be stopped
21  * manually via close method of the {@link java.io.Closeable} interface.
22  *
23  * If the session is up, it has to redirect messages to/from user. Handles also malformed messages and unknown requests.
24  */
25 public interface BGPSession extends ProtocolSession<Notification> {
26     /**
27      * Return the list of tables which the peer has advertised to support.
28      *
29      * @return Set of tables which it supports.
30      */
31     Set<BgpTableType> getAdvertisedTableTypes();
32
33     /**
34      * Return the BGP router ID advertised by the peer.
35      *
36      * @return Peer's BGP Router ID.
37      */
38     Ipv4Address getBgpId();
39
40     /**
41      * Return the AS number which the peer advertises.
42      *
43      * @return Peer's AS Number
44      */
45     AsNumber getAsNumber();
46 }