+ update(tx, changes, toUpdate);
+
+ // Now walk all updated entries
+ walkThrough(tx, toUpdate);
+
+ tx.submit();
+ }
+
+ private void walkThrough(final DOMDataWriteTransaction tx, final Map<RouteUpdateKey, AbstractRouteEntry> toUpdate) {
+ for (final Entry<RouteUpdateKey, AbstractRouteEntry> e : toUpdate.entrySet()) {
+ LOG.trace("Walking through {}", e);
+ final AbstractRouteEntry entry = e.getValue();
+ final RouteUpdateKey key = e.getKey();
+ final NormalizedNode<?, ?> value;
+
+ if (entry != null) {
+ if (!entry.selectBest(this.ourAs)) {
+ // Best path has not changed, no need to do anything else. Proceed to next route.
+ LOG.trace("Continuing");
+ continue;
+ }
+ value = entry.createValue(key.getRouteId());
+ LOG.trace("Selected best value {}", value);
+ } else {
+ value = null;
+ }
+
+ final YangInstanceIdentifier writePath = this.ribSupport.routePath(this.locRibTarget.node(Routes.QNAME), key.getRouteId());
+ if (value != null) {
+ LOG.debug("Write route to LocRib {}", value);
+ tx.put(LogicalDatastoreType.OPERATIONAL, writePath, value);
+ } else {
+ LOG.debug("Delete route from LocRib {}", entry);
+ tx.delete(LogicalDatastoreType.OPERATIONAL, writePath);
+ }
+ fillAdjRibsOut(tx, entry, value, key);
+ }
+ }
+
+ private void update(final DOMDataWriteTransaction tx, final Collection<DataTreeCandidate> changes,
+ final Map<RouteUpdateKey, AbstractRouteEntry> toUpdate) {
+