From 9742c3a72adaca699ed07e22f64cb6c285f11be5 Mon Sep 17 00:00:00 2001 From: Dana Kutenicsova Date: Tue, 31 Mar 2015 13:07:40 +0200 Subject: [PATCH] BUG-2383 : wired cluster id with effective RIB - added some logging along happy path Change-Id: I4918aa9e107d143b2a09138294c5109aad827f98 Signed-off-by: Dana Kutenicsova --- .../bgp/rib/impl/EffectiveRibInWriter.java | 2 ++ .../protocol/bgp/rib/impl/RIBImpl.java | 16 +++++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java index 53f183b892..8b25aea06f 100644 --- a/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java +++ b/bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java @@ -77,6 +77,7 @@ final class EffectiveRibInWriter implements AutoCloseable { } private void processRoute(final DOMDataWriteTransaction tx, final RIBSupport ribSupport, final AbstractImportPolicy policy, final YangInstanceIdentifier routesPath, final DataTreeCandidateNode route) { + LOG.debug("Process route {}", route); switch (route.getModificationType()) { case DELETE: // Delete has already been affected by the store in caller, so this is a no-op. @@ -190,6 +191,7 @@ final class EffectiveRibInWriter implements AutoCloseable { @Override public void onDataTreeChanged(final Collection changes) { + LOG.trace("Data changed called to effective RIB. Change : {}", changes); final DOMDataWriteTransaction tx = this.chain.newWriteOnlyTransaction(); for (final DataTreeCandidate tc : changes) { 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 a4615e91a7..ac3dd2e85c 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 @@ -127,7 +127,7 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable, private final BindingTransactionChain chain; private final AsNumber localAs; private final Ipv4Address bgpIdentifier; - private final Ipv4Address clusterId; + private final ClusterIdentifier clusterId; private final Set localTables; private final RIBTables tables; private final BlockingQueue peers; @@ -168,13 +168,13 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable, public RIBImpl(final RibId ribId, final AsNumber localAs, final Ipv4Address localBgpId, final Ipv4Address clusterId, final RIBExtensionConsumerContext extensions, final BGPDispatcher dispatcher, final ReconnectStrategyFactory tcpStrategyFactory, final BindingCodecTreeFactory codecFactory, - final ReconnectStrategyFactory sessionStrategyFactory, final DataBroker dps, final DOMDataBroker domDataBroker, final List localTables, GeneratedClassLoadingStrategy classStrategy) { + final ReconnectStrategyFactory sessionStrategyFactory, final DataBroker dps, final DOMDataBroker domDataBroker, final List localTables, final GeneratedClassLoadingStrategy classStrategy) { super(InstanceIdentifier.create(BgpRib.class).child(Rib.class, new RibKey(Preconditions.checkNotNull(ribId)))); this.chain = dps.createTransactionChain(this); this.localAs = Preconditions.checkNotNull(localAs); this.comparator = new BGPObjectComparator(localAs); this.bgpIdentifier = Preconditions.checkNotNull(localBgpId); - this.clusterId = clusterId == null ? localBgpId : clusterId; + this.clusterId = (clusterId == null) ? new ClusterIdentifier(localBgpId) : new ClusterIdentifier(clusterId); this.dispatcher = Preconditions.checkNotNull(dispatcher); this.sessionStrategyFactory = Preconditions.checkNotNull(sessionStrategyFactory); this.tcpStrategyFactory = Preconditions.checkNotNull(tcpStrategyFactory); @@ -191,18 +191,12 @@ public final class RIBImpl extends DefaultRibReference implements AutoCloseable, final WriteTransaction trans = this.chain.newWriteOnlyTransaction(); - final PolicyDatabase pd = new PolicyDatabase(localAs.getValue(), localBgpId, new ClusterIdentifier(localBgpId)); - /*if (clusterId == null) { - clusterId is not present, fallback to bgpId - pd = new PolicyDatabase(localAs.getValue(), localBgpId, new ClusterIdentifier(localBgpId)); - } else { - pd = new PolicyDatabase(as, bgpId, clusterId); - } */ + 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); - // put clusterId 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(), -- 2.36.6