BGPCEP-779: Fix Effective rib writer 28/70228/1
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Sat, 31 Mar 2018 22:33:15 +0000 (00:33 +0200)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Sat, 31 Mar 2018 22:36:56 +0000 (00:36 +0200)
empty table creation. Create table route
container only if its already not present.

Change-Id: Ia621e8aa8058eeb14b06bc99956efe1e7c6a9f5b
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java

index 089dec6a7fbb5226abb0d9e85cc719534743f99f..aaaae958e23412c1bed5c822491c1807585b044f 100644 (file)
@@ -259,10 +259,12 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
 
             // Create an empty table
             LOG.trace("Create Empty table", tablePath);
-            tx.put(LogicalDatastoreType.OPERATIONAL, tablePath, new TablesBuilder()
-                    .setAfi(tableKey.getAfi()).setSafi(tableKey.getSafi())
-                    .setRoutes(this.registry.getRIBSupport(tableKey).emptyRoutesContainer())
-                    .setAttributes(newTable.getAttributes()).build());
+            if (table.getDataBefore() == null) {
+                tx.put(LogicalDatastoreType.OPERATIONAL, tablePath, new TablesBuilder()
+                        .setAfi(tableKey.getAfi()).setSafi(tableKey.getSafi())
+                        .setRoutes(this.registry.getRIBSupport(tableKey).emptyRoutesContainer())
+                        .setAttributes(newTable.getAttributes()).build());
+            }
 
             final RIBSupport ribSupport = this.registry.getRIBSupport(tableKey);
             final Routes routes = newTable.getRoutes();