From a7a18b796333fecd39ca06c6f4d901407fc08b14 Mon Sep 17 00:00:00 2001 From: Yevgeny Khodorkovsky Date: Tue, 21 Jan 2014 15:13:08 -0800 Subject: [PATCH] Minor bugfix in Topology Manager - This fixes an incorrect assumption that subsequent edge-ADDED updates will always have equal edge properties Change-Id: Ib124a4c260d7fce6bb8464f267c2e88cf0b35384 Signed-off-by: Yevgeny Khodorkovsky --- .../internal/TopologyManagerImpl.java | 40 ++++++++++--------- 1 file changed, 21 insertions(+), 19 deletions(-) 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 45a8a5880b..b0570fb7f9 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 @@ -574,36 +574,38 @@ public class TopologyManagerImpl implements private TopoEdgeUpdate edgeUpdate(Edge e, UpdateType type, Set props) { switch (type) { case ADDED: - // Avoid redundant update as notifications trigger expensive tasks - if (edgesDB.containsKey(e)) { - log.trace("Skipping redundant edge addition: {}", e); - return null; - } - - // Ensure that head node connector exists - if (!headNodeConnectorExist(e)) { - log.warn("Ignore edge that contains invalid node connector: {}", e); - return null; - } - - // Check if nodeConnectors of the edge were correctly categorized - // by OF plugin - crossCheckNodeConnectors(e); - // Make sure the props are non-null + // Make sure the props are non-null or create a copy if (props == null) { props = new HashSet(); } else { props = new HashSet(props); } - //in case of node switch-over to a different cluster controller, - //let's retain edge props Set currentProps = this.edgesDB.get(e); - if (currentProps != null){ + if (currentProps != null) { + + if (currentProps.equals(props)) { + // Avoid redundant updates as notifications trigger expensive tasks + log.trace("Skipping redundant edge addition: {}", e); + return null; + } + + // In case of node switch-over to a different cluster controller, + // let's retain edge props (e.g. creation time) props.addAll(currentProps); } + // Ensure that head node connector exists + if (!headNodeConnectorExist(e)) { + log.warn("Ignore edge that contains invalid node connector: {}", e); + return null; + } + + // Check if nodeConnectors of the edge were correctly categorized + // by protocol plugin + crossCheckNodeConnectors(e); + // Now make sure there is the creation timestamp for the // edge, if not there, stamp with the first update boolean found_create = false; -- 2.36.6