BUG-2383 : wired cluster id with effective RIB 30/17430/1
authorDana Kutenicsova <dkutenic@cisco.com>
Tue, 31 Mar 2015 11:07:40 +0000 (13:07 +0200)
committerDana Kutenicsova <dkutenic@cisco.com>
Tue, 31 Mar 2015 11:08:55 +0000 (13:08 +0200)
- added some logging along happy path

Change-Id: I4918aa9e107d143b2a09138294c5109aad827f98
Signed-off-by: Dana Kutenicsova <dkutenic@cisco.com>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/RIBImpl.java

index 53f183b892c26a9dc8625c2b7aa65a4f07c024ca..8b25aea06f5f2f74407fa3be09e884a2295b2ff2 100644 (file)
@@ -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<DataTreeCandidate> changes) {
+            LOG.trace("Data changed called to effective RIB. Change : {}", changes);
             final DOMDataWriteTransaction tx = this.chain.newWriteOnlyTransaction();
 
             for (final DataTreeCandidate tc : changes) {
index a4615e91a715f7faee35a781088a512427c732d7..ac3dd2e85c05192286e23773204a7b1fd45e1270 100644 (file)
@@ -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<BgpTableType> localTables;
     private final RIBTables tables;
     private final BlockingQueue<Peer> 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<BgpTableType> localTables, GeneratedClassLoadingStrategy classStrategy) {
+        final ReconnectStrategyFactory sessionStrategyFactory, final DataBroker dps, final DOMDataBroker domDataBroker, final List<BgpTableType> 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(),