05e3cd1f37d77b42d3f1ec8845e22c65048b672f
[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.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.SendReceive;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier;
19 import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
20
21 /**
22  * Exposes information required from peer to PeerTracker.
23  */
24 public interface PeerTrackerInformation {
25
26     /**
27      * Returns Peer id.
28      *
29      * @return PeerID
30      */
31     @Nonnull
32     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(@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
52     SendReceive getSupportedAddPathTables(@Nonnull TablesKey tableKey);
53
54     /**
55      * Returns if peer supports table.
56      *
57      * @param tableKey table
58      * @return true if Additional Path is supported for defined table
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
69     KeyedInstanceIdentifier<Tables, TablesKey> getRibOutIId(@Nonnull TablesKey tablekey);
70
71     /**
72      * Returns Peer Role.
73      *
74      * @return PeerRole
75      */
76     @Nonnull
77     PeerRole getRole();
78
79     /**
80      * Returns Cluster Id.
81      *
82      * @return Cluster Id
83      */
84     @Nullable
85     ClusterIdentifier getClusterId();
86 }