Do not always update eff-rib-in attributes 75/78475/6
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 17:58:59 +0000 (17:58 +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>
bgp/rib-impl/src/main/java/org/opendaylight/protocol/bgp/rib/impl/EffectiveRibInWriter.java

index f990fc7802fabf9ae9225287dd60cdc334f7c678..ba776ea818f9e58634a98490504e1c954d1953a8 100644 (file)
@@ -189,9 +189,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());