Merge "When a node is going down, remove edges in both directions associated with...
authorAlessandro Boch <aboch@cisco.com>
Wed, 24 Jul 2013 00:19:33 +0000 (00:19 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Wed, 24 Jul 2013 00:19:33 +0000 (00:19 +0000)
opendaylight/protocol_plugins/openflow/src/main/java/org/opendaylight/controller/protocol_plugin/openflow/internal/DiscoveryService.java

index b3cfde9..ee71203 100644 (file)
@@ -571,7 +571,16 @@ public class DiscoveryService implements IInventoryShimExternalListener, IDataPa
         }
         for (NodeConnector nodeConnector : c) {
             if (node.equals(nodeConnector.getNode())) {
-                removeSet.add(nodeConnector);
+                Edge edge1 = edgeMap.get(nodeConnector);
+                if (edge1 != null) {
+                    removeSet.add(nodeConnector);
+
+                    // check reverse direction
+                    Edge edge2 = edgeMap.get(edge1.getTailNodeConnector());
+                    if ((edge2 != null) && node.equals(edge2.getTailNodeConnector().getNode())) {
+                        removeSet.add(edge2.getHeadNodeConnector());
+                    }
+                }
             }
         }
         return removeSet;