X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=bgp%2Frib-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fbgp%2Frib%2Fimpl%2FRIBImpl.java;h=cbe5f6dd676c38c8cb1c7bdd05271590e530f64e;hb=3c78808fd410ca5f4801614c395a1324b84ae5f6;hp=ac3dd2e85c05192286e23773204a7b1fd45e1270;hpb=9742c3a72adaca699ed07e22f64cb6c285f11be5;p=bgpcep.git diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBImpl.java b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBImpl.java index ac3dd2e85c..cbe5f6dd67 100644 --- a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBImpl.java +++ b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBImpl.java @@ -83,6 +83,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib. import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.TablesKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily; import org.opendaylight.yangtools.binding.data.codec.api.BindingCodecTreeFactory; import org.opendaylight.yangtools.sal.binding.generator.impl.GeneratedClassLoadingStrategy; @@ -136,6 +137,8 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable, private final RIBExtensionConsumerContext extensions; private final YangInstanceIdentifier yangRibId; private final RIBSupportContextRegistryImpl ribContextRegistry; + private final EffectiveRibInWriter efWriter; + private final Runnable scheduler = new Runnable() { @Override public void run() { @@ -191,13 +194,6 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable, final WriteTransaction trans = this.chain.newWriteOnlyTransaction(); - final PolicyDatabase pd = new PolicyDatabase(localAs.getValue(), localBgpId, this.clusterId); - - final DOMDataBrokerExtension service = this.domDataBroker.getSupportedExtensions().get(DOMDataTreeChangeService.class); - final DOMTransactionChain domChain = this.createPeerChain(this); - EffectiveRibInWriter.create((DOMDataTreeChangeService) service, domChain, getYangRibId(), pd, this.ribContextRegistry); - LOG.debug("Effective RIB created."); - // put empty BgpRib if not exists trans.put(LogicalDatastoreType.OPERATIONAL, getInstanceIdentifier(), new RibBuilder().setKey(new RibKey(ribId)).setPeer(Collections. emptyList()).setId(ribId).setLocRib( @@ -208,13 +204,6 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable, if (this.tables.create(trans, this, key) == null) { LOG.debug("Did not create local table for unhandled table type {}", t); } - - // reusing the for cycle - // create locRibWriter for each table - // FIXME: temporary create writer only for Ipv4 - if (key.getAfi().equals(Ipv4AddressFamily.class)) { - LocRibWriter.create(this.ribContextRegistry.getRIBSupportContext(key).getRibSupport(), domChain, getYangRibId(), localAs, (DOMDataTreeChangeService) service, pd); - } } Futures.addCallback(trans.submit(), new FutureCallback() { @@ -229,12 +218,30 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable, } }); + + final PolicyDatabase pd = new PolicyDatabase(localAs.getValue(), localBgpId, this.clusterId); + + final DOMDataBrokerExtension service = this.domDataBroker.getSupportedExtensions().get(DOMDataTreeChangeService.class); + final DOMTransactionChain domChain = this.createPeerChain(this); + this.efWriter = EffectiveRibInWriter.create((DOMDataTreeChangeService) service, this.createPeerChain(this), getYangRibId(), pd, this.ribContextRegistry); + LOG.debug("Effective RIB created."); + + for (final BgpTableType t : localTables) { + final TablesKey key = new TablesKey(t.getAfi(), t.getSafi()); + // create locRibWriter for each table + // FIXME: temporary create writer only for Ipv4 + if (key.getAfi().equals(Ipv4AddressFamily.class) || key.getAfi().equals(Ipv6AddressFamily.class)) { + LocRibWriter.create(this.ribContextRegistry, key, this.createPeerChain(this), getYangRibId(), localAs, (DOMDataTreeChangeService) service, pd); + } + } } + @Deprecated synchronized void initTables(final byte[] remoteBgpId) { } @Override + @Deprecated public synchronized void updateTables(final Peer peer, final Update message) { final AdjRIBsTransactionImpl trans = new AdjRIBsTransactionImpl(this.ribOuts, this.comparator, this.chain.newWriteOnlyTransaction()); @@ -346,6 +353,7 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable, }); } + @Deprecated @Override public synchronized void clearTable(final Peer peer, final TablesKey key) { final AdjRIBsIn ari = this.tables.get(key); @@ -377,6 +385,7 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable, } @SuppressWarnings("unchecked") + @Deprecated protected AdjRIBsIn getTable(final TablesKey key) { return (AdjRIBsIn) this.tables.get(key); } @@ -419,6 +428,7 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable, return this.dispatcher; } + @Deprecated @Override public void initTable(final Peer bgpPeer, final TablesKey key) { // FIXME: BUG-196: support graceful restart