BGPCEP-574: Remove old ImportPolicyPeerTracker
[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.TablesKey;
17 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
18
19 /**
20  * Exposes information required from peer to PeerTracker.
21  */
22 public interface PeerTrackerInformation {
23
24     /**
25      * Returns PeerID
26      *
27      * @return PeerID
28      */
29     @Nonnull
30     PeerId getPeerId();
31
32     /**
33      * Returns if peer supports Additional Path for specific table.
34      *
35      * @param tableKey table
36      * @return true if Additional Path is supported for defined table
37      */
38     default boolean supportsAddPathSupported(@Nonnull TablesKey tableKey) {
39         final SendReceive sendReceive = getSupportedAddPathTables(tableKey);
40         return sendReceive != null && (sendReceive.equals(SendReceive.Both) || sendReceive.equals(SendReceive.Receive));
41     }
42
43     /**
44      * Returns AddPath support configuration if supported, otherwise null.
45      *
46      * @param tableKey table
47      * @return AddPath support configuration if supported, otherwise null
48      */
49     @Nullable
50     SendReceive getSupportedAddPathTables(@Nonnull TablesKey tableKey);
51
52     /**
53      * Returns if peer supports table.
54      *
55      * @param tableKey table
56      * @return true if Additional Path is supported for defined table
57      */
58     boolean supportsTable(@Nonnull TablesKey tableKey);
59
60     /**
61      * Returns YangInstanceIdentifier pointing peer under specific rib.
62      *
63      * @return Peer YangInstanceIdentifier
64      */
65     @Nonnull
66     YangInstanceIdentifier getPeerRibInstanceIdentifier();
67
68     /**
69      * Returns Peer Role.
70      *
71      * @return PeerRole
72      */
73     @Nonnull
74     PeerRole getRole();
75 }