Create two new interfaces for Export policies
[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 com.google.common.base.Optional;
11 import java.util.Set;
12 import javax.annotation.Nonnull;
13 import org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener;
14 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
15 import org.opendaylight.protocol.bgp.openconfig.spi.BGPOpenConfigProvider;
16 import org.opendaylight.protocol.bgp.rib.spi.CacheDisconnectedPeers;
17 import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext;
18 import org.opendaylight.protocol.framework.ReconnectStrategyFactory;
19 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.AsNumber;
20 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
21 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
22 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
23 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
24
25 /**
26  * Internal reference to a RIB instance.
27  */
28 public interface RIB {
29     AsNumber getLocalAs();
30
31     Ipv4Address getBgpIdentifier();
32
33     /**
34      * Return the set of table identifiers which are accepted and advertised
35      * by this RIB instance.
36      *
37      * @return A set of identifiers.
38      */
39     @Nonnull Set<? extends BgpTableType> getLocalTables();
40
41     BGPDispatcher getDispatcher();
42
43     ReconnectStrategyFactory getTcpStrategyFactory();
44
45     ReconnectStrategyFactory getSessionStrategyFactory();
46
47     long getRoutesCount(TablesKey key);
48
49     /**
50      * Allocate a new transaction chain for use with a peer.
51      *
52      * @param listener {@link TransactionChainListener} handling recovery
53      * @return A new transaction chain.
54      */
55     DOMTransactionChain createPeerChain(TransactionChainListener listener);
56
57     /**
58      * Return the RIB extensions available to the RIB instance.
59      *
60      * @return RIB extensions handle.
61      */
62     RIBExtensionConsumerContext getRibExtensions();
63
64     /**
65      * Return the RIB extensions available to the RIB instance
66      * with additional RIB specific context such as
67      * translation between DOM and Binding.
68      *
69      * @return RIB extensions handle.
70      */
71     RIBSupportContextRegistry getRibSupportContext();
72
73     /**
74      * Return YangInstanceIdentifier of BGP Rib with its RibId.
75      *
76      * @return YangInstanceIdentifier
77      */
78     YangInstanceIdentifier getYangRibId();
79
80     CodecsRegistry getCodecsRegistry();
81
82     /**
83      * Optionally returns OpenConfigProvider, which brings an access to
84      * BGP OpenConfig mappers.
85      * @return An Optional of BGPOpenConfigProvider or Absent if provider is
86      * not available.
87      */
88     Optional<BGPOpenConfigProvider> getOpenConfigProvider();
89
90     /**
91      * Return cache disconnected peers which allows us to avoid update
92      * DS from a peer already disconnected, when multiple peers are disconnected
93      * at the same time and their own exportPolicy has not been updated yet.
94      * @return
95      */
96     CacheDisconnectedPeers getCacheDisconnectedPeers();
97 }