From 72fae1984afe741a93435269545f0346671cf305 Mon Sep 17 00:00:00 2001 From: Giovanni Meo Date: Tue, 1 Oct 2013 17:39:11 +0200 Subject: [PATCH] Newcomers that register with TopologyManager should get all the existing edges - When an application wants to get topology updates by topology manager, it may come after the topology manager has started to push them around, in that case the app should retrieve the exisiting topology. Some applications may not do that so topology manager can still take care of this lazy one by pushing a snapshot of the existing edges as soon as the listener is registered. Change-Id: I919350b2ddfddfaa9186e09bd5167d7d810e3bcd Signed-off-by: Giovanni Meo --- .../internal/TopologyManagerImpl.java | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/opendaylight/topologymanager/implementation/src/main/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImpl.java b/opendaylight/topologymanager/implementation/src/main/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImpl.java index b905a8982e..5a38ecd4a6 100644 --- a/opendaylight/topologymanager/implementation/src/main/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImpl.java +++ b/opendaylight/topologymanager/implementation/src/main/java/org/opendaylight/controller/topologymanager/internal/TopologyManagerImpl.java @@ -20,6 +20,7 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; import java.util.Map; +import java.util.Map.Entry; import java.util.Set; import java.util.concurrent.BlockingQueue; import java.util.concurrent.ConcurrentHashMap; @@ -115,6 +116,14 @@ public class TopologyManagerImpl implements if (this.topologyManagerAware != null) { log.debug("Adding ITopologyManagerAware: {}", s); this.topologyManagerAware.add(s); + // Reply all the known edges + if (this.edgesDB != null) { + List existingEdges = new ArrayList(); + for (Entry> entry : this.edgesDB.entrySet()) { + existingEdges.add(new TopoEdgeUpdate(entry.getKey(), entry.getValue(), UpdateType.ADDED)); + } + s.edgeUpdate(existingEdges); + } } } @@ -129,6 +138,14 @@ public class TopologyManagerImpl implements if (this.topologyManagerClusterWideAware != null) { log.debug("Adding ITopologyManagerClusterWideAware: {}", s); this.topologyManagerClusterWideAware.add(s); + // Reply all the known edges + if (this.edgesDB != null) { + List existingEdges = new ArrayList(); + for (Entry> entry : this.edgesDB.entrySet()) { + existingEdges.add(new TopoEdgeUpdate(entry.getKey(), entry.getValue(), UpdateType.ADDED)); + } + s.edgeUpdate(existingEdges); + } } } -- 2.36.6