Bug-6621: ModifiedNodeDoesNotExistException encountered while building Linkstate... 50/45050/2
authorAjay <ajayl.bro@gmail.com>
Fri, 2 Sep 2016 06:10:59 +0000 (06:10 +0000)
committerMilos Fabian <milfabia@cisco.com>
Mon, 5 Sep 2016 07:47:34 +0000 (07:47 +0000)
- added null check in BGP topology builder removeObject() method to
  gracefully handle issue created by BUG-6577
- when destroying operational topology to recover from a failure,
  flush the internally stored topology info as well so that both are in sync

Change-Id: Id239d74738d43dd63177aa3b2ba1d3d9136c3338
Signed-off-by: Ajay <ajayl.bro@gmail.com>
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/AbstractReachabilityTopologyBuilder.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/AbstractTopologyBuilder.java
bgp/topology-provider/src/main/java/org/opendaylight/bgpcep/bgp/topology/provider/LinkstateTopologyBuilder.java

index 2914a3ec061463c23ade98a1e1dd23f20f9f6d3c..111f48ca82b86b2091c21cafd053b7bea53297ee 100644 (file)
@@ -142,6 +142,11 @@ abstract class AbstractReachabilityTopologyBuilder<T extends Route> extends Abst
 
     @Override
     protected final void removeObject(final ReadWriteTransaction trans, final InstanceIdentifier<T> id, final T value) {
+        if (value == null) {
+            LOG.error("Empty before-data received in delete data change notification for instance id {}", id);
+            return;
+        }
+
         final NodeId ni = advertizingNode(getAttributes(value));
         if (ni == null) {
             return;
@@ -174,4 +179,9 @@ abstract class AbstractReachabilityTopologyBuilder<T extends Route> extends Abst
             }
         }
     }
+
+    @Override
+    protected void clearTopology() {
+        this.nodes.clear();
+    }
 }
index 356060becc522e2114fef5c9ed4934de9da21e1e..de1070ab8344a34c251a9c5103d62bccc8f8bbab 100644 (file)
@@ -140,6 +140,8 @@ public abstract class AbstractTopologyBuilder<T extends Route> implements AutoCl
 
     protected abstract void removeObject(ReadWriteTransaction trans, InstanceIdentifier<T> id, T value);
 
+    protected abstract void clearTopology();
+
     @Override
     public final InstanceIdentifier<Topology> getInstanceIdentifier() {
         return this.topology;
@@ -259,6 +261,7 @@ public abstract class AbstractTopologyBuilder<T extends Route> implements AutoCl
         } catch (final TransactionCommitFailedException e) {
             LOG.error("Unable to reset operational topology {} (transaction {})", this.topology, trans.getIdentifier(), e);
         }
+        clearTopology();
     }
 
     /**
index 05b727481a917a028d25c0bb2b6a6dc032fa3910..97434d79165d4823b4e1fa918a0731c8afcc6bbf 100644 (file)
@@ -925,6 +925,11 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
     @Override
     protected void removeObject(final ReadWriteTransaction trans,
             final InstanceIdentifier<LinkstateRoute> id, final LinkstateRoute value) {
+        if (value == null) {
+            LOG.error("Empty before-data received in delete data change notification for instance id {}", id);
+            return;
+        }
+
         final UriBuilder base = new UriBuilder(value);
 
         final ObjectType t = value.getObjectType();
@@ -944,4 +949,9 @@ public class LinkstateTopologyBuilder extends AbstractTopologyBuilder<LinkstateR
     protected InstanceIdentifier<LinkstateRoute> getRouteWildcard(final InstanceIdentifier<Tables> tablesId) {
         return tablesId.child((Class)LinkstateRoutes.class).child(LinkstateRoute.class);
     }
+
+    @Override
+    protected void clearTopology() {
+        this.nodes.clear();
+    }
 }