Do not always update eff-rib-in attributes 23/78523/1
authorRobert Varga <robert.varga@pantheon.tech>
Wed, 5 Dec 2018 19:08:56 +0000 (20:08 +0100)
committerClaudio David Gasparini <claudio.gasparini@pantheon.tech>
Thu, 6 Dec 2018 19:36:56 +0000 (19:36 +0000)
Check if the attributes changed before propagating the change,
reducing the number of operations executed.

Change-Id: I6435a50aefbaefabec86f8d6d7f220c9a1bfaa20
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
(cherry picked from commit 46f0711945e64a0184704aafded51e7576d32ddd)

bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java

index b5fdc3f02e23613c59c2b25b8968c3f2ca70b4bc..41e451e4f41a9851e4ba30fd2aafa90584ded8b8 100644 (file)
@@ -186,9 +186,16 @@ final class EffectiveRibInWriter implements PrefixesReceivedCounters, PrefixesIn
                     if (ribSupport == null) {
                         break;
                     }
-                    tx.put(LogicalDatastoreType.OPERATIONAL,
+
+                    final DataObjectModification<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
+                        .rib.rev180329.rib.tables.Attributes> adjRibAttrsChanged = table.getModifiedChildContainer(
+                            org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329
+                                .rib.tables.Attributes.class);
+                    if (adjRibAttrsChanged != null) {
+                        tx.put(LogicalDatastoreType.OPERATIONAL,
                             tablePath.child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp
-                                    .rib.rev180329.rib.tables.Attributes.class), after.getAttributes());
+                                .rib.rev180329.rib.tables.Attributes.class), adjRibAttrsChanged.getDataAfter());
+                    }
 
                     final DataObjectModification routesChangesContainer = table.getModifiedChildContainer(
                         ribSupport.routesCaseClass(), ribSupport.routesContainerClass());