ff6811ec6cc29e77c4aa5546008f470509b0a6a1
[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 io.netty.channel.ChannelInboundHandler;
11 import java.util.List;
12 import java.util.Set;
13 import javax.annotation.Nonnull;
14 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
15 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.add.path.capability.AddressFamilies;
18
19 /**
20  * BGP Session represents the finite state machine in BGP, including timers and its purpose is to create a BGP
21  * connection between BGP speakers. Session is automatically started, when TCP connection is created,
22  * but can be stopped manually via close method of the {@link java.io.Closeable} interface.
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 AutoCloseable, ChannelInboundHandler {
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     @Nonnull
32     Set<BgpTableType> getAdvertisedTableTypes();
33
34     /**
35      * Return the BGP router ID advertised by the peer.
36      *
37      * @return Peer's BGP Router ID.
38      */
39     @Nonnull
40     Ipv4Address getBgpId();
41
42     /**
43      * Return the AS number which the peer advertises.
44      *
45      * @return Peer's AS Number
46      */
47     @Nonnull
48     AsNumber getAsNumber();
49
50     /**
51      * Return a list with Add Path tables supported advertised and corresponding SendReceive mode.
52      *
53      * @return AddPathTables supported
54      */
55     @Nonnull
56     List<AddressFamilies> getAdvertisedAddPathTableTypes();
57
58     /**
59      * Return the list of tables which the peer has advertised to support.
60      * Graceful Restart.
61      *
62      * @return Set of tables which it supports.
63      */
64     @Nonnull
65     List<BgpTableType> getAdvertisedGracefulRestartTableTypes();
66
67 }