import java.util.Set;
import java.util.concurrent.ExecutionException;
import org.checkerframework.checker.lock.qual.GuardedBy;
-import org.opendaylight.mdsal.binding.api.DataBroker;
-import org.opendaylight.mdsal.binding.api.Transaction;
-import org.opendaylight.mdsal.binding.api.TransactionChain;
-import org.opendaylight.mdsal.binding.api.TransactionChainListener;
import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.mdsal.dom.api.DOMDataBroker;
import org.slf4j.LoggerFactory;
// This class is thread-safe
-public final class RIBImpl extends BGPRibStateImpl implements RIB, TransactionChainListener,
- DOMTransactionChainListener, AutoCloseable {
+public final class RIBImpl extends BGPRibStateImpl implements RIB, DOMTransactionChainListener, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(RIBImpl.class);
private static final QName RIB_ID_QNAME = QName.create(Rib.QNAME, "id").intern();
private final Set<BgpTableType> localTables;
private final Set<TablesKey> localTablesKeys;
private final DOMDataBroker domDataBroker;
- private final DataBroker dataBroker;
private final RIBExtensionConsumerContext extensions;
private final YangInstanceIdentifier yangRibId;
private final RIBSupportContextRegistryImpl ribContextRegistry;
final BGPDispatcher dispatcher,
final CodecsRegistry codecsRegistry,
final DOMDataBroker domDataBroker,
- final DataBroker dataBroker,
final BGPRibRoutingPolicy ribPolicies,
final List<BgpTableType> localTables,
final Map<TablesKey, PathSelectionMode> bestPathSelectionStrategies
this.localTables = ImmutableSet.copyOf(localTables);
this.localTablesKeys = new HashSet<>();
this.domDataBroker = requireNonNull(domDataBroker);
- this.dataBroker = requireNonNull(dataBroker);
this.domService = this.domDataBroker.getExtensions().get(DOMDataTreeChangeService.class);
this.extensions = requireNonNull(extensions);
this.ribPolicies = requireNonNull(ribPolicies);
return this.dispatcher;
}
- @Override
- public synchronized void onTransactionChainFailed(final TransactionChain chain,
- final Transaction transaction, final Throwable cause) {
- LOG.error("Broken chain in RIB {} transaction {}",
- getInstanceIdentifier(), transaction != null ? transaction.getIdentifier() : null, cause);
- }
-
@Override
public synchronized void onTransactionChainFailed(final DOMTransactionChain chain,
final DOMDataTreeTransaction transaction, final Throwable cause) {
}
}
- @Override
- public void onTransactionChainSuccessful(final TransactionChain chain) {
- LOG.info("RIB {} closed successfully", getInstanceIdentifier());
- }
-
@Override
public void onTransactionChainSuccessful(final DOMTransactionChain chain) {
LOG.info("RIB {} closed successfully", getInstanceIdentifier());
return (DOMDataTreeChangeService) this.domService;
}
- @Override
- public DataBroker getDataBroker() {
- return this.dataBroker;
- }
-
@Override
public YangInstanceIdentifier getYangRibId() {
return this.yangRibId;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
-import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.common.api.CommitInfo;
import org.opendaylight.mdsal.dom.api.DOMDataBroker;
import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeService;
private Ipv4AddressNoZone routerId;
private ClusterIdentifier clusterId;
- private final DataBroker dataBroker;
public RibImpl(
final RIBExtensionConsumerContext contextProvider,
final BGPDispatcher dispatcher,
final BGPRibRoutingPolicyFactory policyProvider,
final CodecsRegistry codecsRegistry,
- final DOMDataBroker domBroker,
- final DataBroker dataBroker
+ final DOMDataBroker domBroker
) {
this.extensions = contextProvider;
this.dispatcher = dispatcher;
this.codecsRegistry = codecsRegistry;
this.domBroker = domBroker;
- this.dataBroker = dataBroker;
this.policyProvider = policyProvider;
}
return this.ribImpl.getService();
}
- @Override
- public DataBroker getDataBroker() {
- return this.ribImpl.getDataBroker();
- }
-
FluentFuture<? extends CommitInfo> closeServiceInstance() {
if (this.ribImpl != null) {
return this.ribImpl.closeServiceInstance();
this.dispatcher,
codecsRegistry,
this.domBroker,
- this.dataBroker,
ribPolicy,
toTableTypes(this.afiSafi, tableTypeRegistry),
pathSelectionModes);
import java.util.Set;
import org.eclipse.jdt.annotation.NonNull;
-import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.dom.api.DOMDataTreeChangeService;
import org.opendaylight.mdsal.dom.api.DOMTransactionChain;
import org.opendaylight.mdsal.dom.api.DOMTransactionChainListener;
*/
DOMDataTreeChangeService getService();
- /**
- * Return DataBroker.
- *
- * @return DataBroker
- */
- DataBroker getDataBroker();
-
/**
* Returns true if RIB supports table.
*
<argument ref="policiesProvider"/>
<argument ref="codecRegistry"/>
<argument ref="domDataBroker"/>
- <argument ref="dataBroker"/>
</bean>
<bean id="bgpPeer" class="org.opendaylight.protocol.bgp.rib.impl.config.BgpPeer" scope="prototype">
doReturn(mock(ClusterSingletonServiceRegistration.class)).when(this.clusterSingletonServiceProvider)
.registerClusterSingletonService(any(ClusterSingletonService.class));
this.rib = new RIBImpl(this.tableRegistry, new RibId("test"), new AsNumber(Uint32.valueOf(5)), RIB_ID, context,
- this.dispatcher, new ConstantCodecsRegistry(serializer), this.dom, getDataBroker(), this.policies,
+ this.dispatcher, new ConstantCodecsRegistry(serializer), this.dom, this.policies,
localTables, Collections.singletonMap(KEY,
BasePathSelectionModeFactory.createBestPathSelectionStrategy()));
}
this.ribImpl = new RIBImpl(this.tableRegistry, new RibId("test-rib"), AS_NUMBER, BGP_ID,
this.ribExtension, this.serverDispatcher, this.codecsRegistry,
- getDomBroker(), getDataBroker(), this.policies, TABLES_TYPE, pathTables);
+ getDomBroker(), this.policies, TABLES_TYPE, pathTables);
this.ribImpl.instantiateServiceInstance();
final ChannelFuture channelFuture = this.serverDispatcher.createServer(
this.ribImpl = new RIBImpl(this.tableRegistry, new RibId("test-rib"), AS_NUMBER, new BgpId(RIB_ID),
this.ribExtension,
- this.serverDispatcher, this.codecsRegistry, getDomBroker(), getDataBroker(), this.policies,
+ this.serverDispatcher, this.codecsRegistry, getDomBroker(), this.policies,
TABLES_TYPE, pathTables);
this.ribImpl.instantiateServiceInstance();
final ChannelFuture channelFuture = this.serverDispatcher.createServer(
this.ribImpl = new RIBImpl(this.tableRegistry, new RibId("test-rib"), AS_NUMBER, new BgpId(RIB_ID),
this.ribExtension,
- this.serverDispatcher, this.codecsRegistry, getDomBroker(), getDataBroker(), this.policies,
+ this.serverDispatcher, this.codecsRegistry, getDomBroker(), this.policies,
TABLES_TYPE, pathTables);
this.ribImpl.instantiateServiceInstance();
tableTypes.add(new BgpTableTypeImpl(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class));
this.ribImpl = new RIBImpl(this.tableRegistry, RIBID, AS_NUMBER, BGP_ID, this.ribExtension,
this.serverDispatcher, this.codecsRegistry,
- getDomBroker(), getDataBroker(), this.policies, tableTypes, pathTables);
+ getDomBroker(), this.policies, tableTypes, pathTables);
this.ribImpl.instantiateServiceInstance();
final ChannelFuture channelFuture = this.serverDispatcher.createServer(
LinkstateSubsequentAddressFamily.class));
final RIBImpl rib = new RIBImpl(this.tableRegistry, new RibId(TEST_RIB_ID), AS_NUMBER, BGP_ID, this.ext2,
- this.dispatcher, this.codecsRegistry, getDomBroker(), getDataBroker(), this.policies,
+ this.dispatcher, this.codecsRegistry, getDomBroker(), this.policies,
tables, Collections.singletonMap(TABLE_KEY, BasePathSelectionModeFactory
.createBestPathSelectionStrategy()));
rib.instantiateServiceInstance();
final List<BgpTableType> tables = ImmutableList.of(new BgpTableTypeImpl(Ipv4AddressFamily.class,
UnicastSubsequentAddressFamily.class));
final RIBImpl rib = new RIBImpl(this.tableRegistry, new RibId(TEST_RIB_ID), AS_NUMBER, BGP_ID, this.ext1,
- this.dispatcher, this.codecsRegistry, getDomBroker(), getDataBroker(), this.policies,
+ this.dispatcher, this.codecsRegistry, getDomBroker(), this.policies,
tables, Collections.singletonMap(TABLE_KEY,
BasePathSelectionModeFactory.createBestPathSelectionStrategy()));
rib.instantiateServiceInstance();
BasePathSelectionModeFactory.createBestPathSelectionStrategy());
final RIBImpl ribImpl = new RIBImpl(this.tableRegistry, new RibId(RIB_ID), AS_NUMBER, new BgpId(RIB_ID),
this.ribExtension,
- this.serverDispatcher, this.codecsRegistry, this.domBroker, getDataBroker(), this.policies,
+ this.serverDispatcher, this.codecsRegistry, this.domBroker, this.policies,
ImmutableList.of(this.ipv4tt), pathTables);
ribImpl.instantiateServiceInstance();
BasePathSelectionModeFactory.createBestPathSelectionStrategy());
final RIBImpl ribImpl = new RIBImpl(this.tableRegistry, new RibId(RIB_ID), AS_NUMBER, new BgpId(RIB_ID),
this.ribExtension,
- this.serverDispatcher, this.codecsRegistry, this.domBroker, getDataBroker(), this.policies,
+ this.serverDispatcher, this.codecsRegistry, this.domBroker, this.policies,
ImmutableList.of(this.ipv4tt), pathTables);
ribImpl.instantiateServiceInstance();
.getInstanceIdentifier();
doReturn(this.domTx).when(this.rib).createPeerDOMChain(any(DOMTransactionChainListener.class));
- doReturn(getDataBroker()).when(this.rib).getDataBroker();
doReturn(AS).when(this.rib).getLocalAs();
doReturn(mock(RIBSupportContextRegistry.class)).when(this.rib).getRibSupportContext();
doReturn(Collections.emptySet()).when(this.rib).getLocalTablesKeys();
doNothing().when(serviceRegistration).close();
final RibImpl ribImpl = new RibImpl(extension, mock(BGPDispatcher.class), this.policyProvider,
- mock(CodecsRegistry.class), getDomBroker(), getDataBroker());
+ mock(CodecsRegistry.class), getDomBroker());
doReturn(ribImpl).when(this.blueprintContainer).getComponentInstance(eq("ribImpl"));
doReturn(new BgpPeer(mock(RpcProviderService.class))).when(this.blueprintContainer)
this.dispatcher,
this.policyProvider,
this.codecsRegistry,
- this.domDataBroker,
- getDataBroker());
+ this.domDataBroker);
ribImpl.setServiceRegistration(this.serviceRegistration);
ribImpl.start(createGlobal(), "rib-test", this.tableTypeRegistry);
verify(this.domDataBroker).getExtensions();