Reuse attributes after apply import policy 91/79491/3
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Fri, 11 Jan 2019 23:39:48 +0000 (00:39 +0100)
committerClaudio David Gasparini <claudio.gasparini@pantheon.tech>
Mon, 14 Jan 2019 06:23:23 +0000 (06:23 +0000)
Update attributes only if there has been any
change applied by import policy. Otherwise
attibutes are the same for the route that
has been already stored.

Change-Id: I288cea16badcd81ce4d5aef21214394421bb992c
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 1b46203fdf61e87f1e85d3641d727bf1fc0c31c8..4b0bde1fdb1629d9a461a2c78d9406da5cb6ae1b 100644 (file)
@@ -395,8 +395,11 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
                 CountersUtil.increment(this.prefixesInstalled.get(tablesKey), tablesKey);
 
                 final YangInstanceIdentifier attPath = routePath.node(ribSupport.routeAttributesIdentifier());
-                final ContainerNode finalAttribute = ribSupport.attributeToContainerNode(attPath, optEffAtt.get());
-                tx.put(LogicalDatastoreType.OPERATIONAL, attPath, finalAttribute);
+                final Attributes attToStore = optEffAtt.get();
+                if(!attToStore.equals(routeAttrs)) {
+                    final ContainerNode finalAttribute = ribSupport.attributeToContainerNode(attPath, attToStore);
+                    tx.put(LogicalDatastoreType.OPERATIONAL, attPath, finalAttribute);
+                }
                 break;
             default:
                 LOG.warn("Ignoring unhandled route {}", route);