f270a757bbc0a88f99b1faba040d621cd9d63cc5
[bgpcep.git] / bgp / rib-spi / src / main / java / org / opendaylight / protocol / bgp / rib / spi / PeerTrackerInformation.java
1 /*
2  * Copyright (c) 2018 AT&T Intellectual Property. 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
9 package org.opendaylight.protocol.bgp.rib.spi;
10
11 import org.eclipse.jdt.annotation.NonNull;
12 import org.eclipse.jdt.annotation.Nullable;
13 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.SendReceive;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.PeerId;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.PeerRole;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev180329.ClusterIdentifier;
20 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
21
22 /**
23  * Exposes information required from peer to PeerTracker.
24  */
25 public interface PeerTrackerInformation {
26
27     /**
28      * Returns Peer id.
29      *
30      * @return PeerID
31      */
32     @NonNull PeerId getPeerId();
33
34     /**
35      * Returns if peer supports Additional Path for specific table.
36      *
37      * @param tableKey table
38      * @return true if Additional Path is supported for defined table
39      */
40     default boolean supportsAddPathSupported(final @NonNull TablesKey tableKey) {
41         final SendReceive sendReceive = getSupportedAddPathTables(tableKey);
42         return sendReceive != null && (sendReceive.equals(SendReceive.Both) || sendReceive.equals(SendReceive.Receive));
43     }
44
45     /**
46      * Returns AddPath support configuration if supported, otherwise null.
47      *
48      * @param tableKey table
49      * @return AddPath support configuration if supported, otherwise null
50      */
51     @Nullable SendReceive getSupportedAddPathTables(@NonNull TablesKey tableKey);
52
53     /**
54      * Returns true if we have advertized support for a table, i.e. any prefix from this table should
55      * be subject to export towards the peer.
56      *
57      * @param tableKey table
58      * @return true if the table is being advertized to the peer.
59      */
60     boolean supportsTable(@NonNull TablesKey tableKey);
61
62     /**
63      * Creates Table Adj Rib Out Instance identifier.
64      *
65      * @param tablekey table key
66      * @return instance identifier.
67      */
68     @NonNull KeyedInstanceIdentifier<Tables, TablesKey> getRibOutIId(@NonNull TablesKey tablekey);
69
70     /**
71      * Returns Peer Role.
72      *
73      * @return PeerRole
74      */
75     @NonNull PeerRole getRole();
76
77     /**
78      * Returns Cluster Id.
79      *
80      * @return Cluster Id
81      */
82     @Nullable ClusterIdentifier getClusterId();
83
84     /**
85      * Returns Local AS.
86      *
87      * @return AS
88      */
89     @Nullable AsNumber getLocalAs();
90 }