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