BUG-5685: Register BGP Rib to Cluster Singleton Service Provider
[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.DOMDataTreeChangeService;
15 import org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain;
16 import org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceProvider;
17 import org.opendaylight.mdsal.singleton.common.api.ServiceGroupIdentifier;
18 import org.opendaylight.protocol.bgp.openconfig.spi.BGPOpenConfigProvider;
19 import org.opendaylight.protocol.bgp.rib.RibReference;
20 import org.opendaylight.protocol.bgp.rib.impl.stats.rib.impl.BGPRenderStats;
21 import org.opendaylight.protocol.bgp.rib.spi.CacheDisconnectedPeers;
22 import org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext;
23 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.BgpTableType;
25 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey;
26 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId;
27 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
28
29 /**
30  * Internal reference to a RIB instance.
31  */
32 public interface RIB  extends RibReference, ClusterSingletonServiceProvider {
33     AsNumber getLocalAs();
34
35     BgpId getBgpIdentifier();
36
37     /**
38      * Return the set of table identifiers which are accepted and advertised
39      * by this RIB instance.
40      *
41      * @return A set of identifiers.
42      */
43     @Nonnull Set<? extends BgpTableType> getLocalTables();
44
45     BGPDispatcher getDispatcher();
46
47     /**
48      * Allocate a new transaction chain for use with a peer.
49      *
50      * @param listener {@link TransactionChainListener} handling recovery
51      * @return A new transaction chain.
52      */
53     DOMTransactionChain createPeerChain(TransactionChainListener listener);
54
55     /**
56      * Return the RIB extensions available to the RIB instance.
57      *
58      * @return RIB extensions handle.
59      */
60     RIBExtensionConsumerContext getRibExtensions();
61
62     /**
63      * Return the RIB extensions available to the RIB instance
64      * with additional RIB specific context such as
65      * translation between DOM and Binding.
66      *
67      * @return RIB extensions handle.
68      */
69     RIBSupportContextRegistry getRibSupportContext();
70
71     /**
72      * Return YangInstanceIdentifier of BGP Rib with its RibId.
73      *
74      * @return YangInstanceIdentifier
75      */
76     YangInstanceIdentifier getYangRibId();
77
78     CodecsRegistry getCodecsRegistry();
79
80     /**
81      * Optionally returns OpenConfigProvider, which brings an access to
82      * BGP OpenConfig mappers.
83      * @return An Optional of BGPOpenConfigProvider or Absent if provider is
84      * not available.
85      */
86     Optional<BGPOpenConfigProvider> getOpenConfigProvider();
87
88     /**
89      * Return cache disconnected peers which allows us to avoid update
90      * DS from a peer already disconnected, when multiple peers are disconnected
91      * at the same time and their own exportPolicy has not been updated yet.
92      * @return
93      */
94     CacheDisconnectedPeers getCacheDisconnectedPeers();
95
96     /**
97      * Return instance of DOMDataTreeChangeService, where consumer can register to
98      * listen on DOM data changes.
99      * @return DOMDataTreeChangeService
100      */
101     DOMDataTreeChangeService getService();
102
103     BGPRenderStats getRenderStats();
104
105     ImportPolicyPeerTracker getImportPolicyPeerTracker();
106
107     Set<TablesKey> getLocalTablesKeys();
108
109     /**
110      * Return common ServiceGroupIdentifier to be used between same group cluster service
111      * @return ServiceGroupIdentifier
112      */
113     ServiceGroupIdentifier getRibIServiceGroupIdentifier();
114 }