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