ad7949953b6ff8baa0d342c9331de8e04a232067
[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 javax.annotation.Nonnull;
12 import javax.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.rev171207.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.rev130919.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
33     PeerId getPeerId();
34
35     /**
36      * Returns if peer supports Additional Path for specific table.
37      *
38      * @param tableKey table
39      * @return true if Additional Path is supported for defined table
40      */
41     default boolean supportsAddPathSupported(@Nonnull TablesKey tableKey) {
42         final SendReceive sendReceive = getSupportedAddPathTables(tableKey);
43         return sendReceive != null && (sendReceive.equals(SendReceive.Both) || sendReceive.equals(SendReceive.Receive));
44     }
45
46     /**
47      * Returns AddPath support configuration if supported, otherwise null.
48      *
49      * @param tableKey table
50      * @return AddPath support configuration if supported, otherwise null
51      */
52     @Nullable
53     SendReceive getSupportedAddPathTables(@Nonnull TablesKey tableKey);
54
55     /**
56      * Returns if peer supports table.
57      *
58      * @param tableKey table
59      * @return true if Additional Path is supported for defined table
60      */
61     boolean supportsTable(@Nonnull TablesKey tableKey);
62
63     /**
64      * Creates Table Adj Rib Out Instance identifier.
65      *
66      * @param tablekey table key
67      * @return instance identifier.
68      */
69     @Nonnull
70     KeyedInstanceIdentifier<Tables, TablesKey> getRibOutIId(@Nonnull TablesKey tablekey);
71
72     /**
73      * Returns Peer Role.
74      *
75      * @return PeerRole
76      */
77     @Nonnull
78     PeerRole getRole();
79
80     /**
81      * Returns Cluster Id.
82      *
83      * @return Cluster Id
84      */
85     @Nullable
86     ClusterIdentifier getClusterId();
87
88     /**
89      * Returns Local AS.
90      *
91      * @return AS
92      */
93     @Nullable
94     AsNumber getLocalAs();
95 }