ceb3270469a00238626a6e597503ab5e169a2128
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / spi / RIB.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.impl.spi;
9
10 import java.util.Set;
11 import javax.annotation.Nonnull;
12 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
13 import org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService;
14 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
15 import org.opendaylight.protocol.bgp.rib.RibReference;
16 import org.opendaylight.protocol.bgp.rib.spi.BGPPeerTracker;
17 import org.opendaylight.protocol.bgp.rib.spi.ExportPolicyPeerTracker;
18 import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext;
19 import org.opendaylight.protocol.bgp.rib.spi.entry.AttributeBindingCodecSerializer;
20 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey;
23 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
24 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
25
26 /**
27  * Internal reference to a RIB instance.
28  */
29 public interface RIB extends AttributeBindingCodecSerializer, RibReference {
30     /**
31      * RIB AS.
32      *
33      * @return AS
34      */
35     AsNumber getLocalAs();
36
37     BgpId getBgpIdentifier();
38
39     /**
40      * Return the set of table identifiers which are accepted and advertised
41      * by this RIB instance.
42      *
43      * @return A set of identifiers.
44      */
45     @Nonnull
46     Set<? extends BgpTableType> getLocalTables();
47
48     BGPDispatcher getDispatcher();
49
50     /**
51      * Allocate a new transaction chain for use with a peer.
52      *
53      * @param listener {@link TransactionChainListener} handling recovery
54      * @return A new transaction chain.
55      */
56     DOMTransactionChain createPeerChain(TransactionChainListener listener);
57
58     /**
59      * Return the RIB extensions available to the RIB instance.
60      *
61      * @return RIB extensions handle.
62      */
63     RIBExtensionConsumerContext getRibExtensions();
64
65     /**
66      * Return the RIB extensions available to the RIB instance
67      * with additional RIB specific context such as
68      * translation between DOM and Binding.
69      *
70      * @return RIB extensions handle.
71      */
72     RIBSupportContextRegistry getRibSupportContext();
73
74     /**
75      * Return YangInstanceIdentifier of BGP Rib with its RibId.
76      *
77      * @return YangInstanceIdentifier
78      */
79     YangInstanceIdentifier getYangRibId();
80
81     CodecsRegistry getCodecsRegistry();
82
83     /**
84      * Return instance of DOMDataTreeChangeService, where consumer can register to
85      * listen on DOM data changes.
86      *
87      * @return DOMDataTreeChangeService
88      */
89     DOMDataTreeChangeService getService();
90
91     ImportPolicyPeerTracker getImportPolicyPeerTracker();
92
93     /**
94      * Returns ExportPolicyPeerTracker for specific tableKey, where peer can register himself
95      * as supporting the table. Same export policy can be used to check which peers support respective
96      * table and announce then routes if required.
97      *
98      * @param tablesKey supported table
99      * @return ExportPolicyPeerTracker
100      */
101     ExportPolicyPeerTracker getExportPolicyPeerTracker(TablesKey tablesKey);
102
103     /**
104      * Returns true if RIB supports table.
105      *
106      * @param tableKey table
107      * @return true if supported
108      */
109     boolean supportsTable(TablesKey tableKey);
110
111     Set<TablesKey> getLocalTablesKeys();
112
113     /**
114      * Returns peer tracker for the rib.
115      *
116      * @return peer tracker
117      */
118     BGPPeerTracker getPeerTracker();
119 }