Revert "Changed TopologyManager to ignore edges that contain invalid node connectors."
[controller.git] / opendaylight / topologymanager / implementation / src / main / java / org / opendaylight / controller / topologymanager / internal / TopologyManagerImpl.java
index b905a8982e83113e10b23261ab2d3045f1142c54..5ecddcfc88bd501e65164303e946a29ef36ec46e 100644 (file)
@@ -53,7 +53,6 @@ import org.opendaylight.controller.sal.utils.ObjectReader;
 import org.opendaylight.controller.sal.utils.ObjectWriter;
 import org.opendaylight.controller.sal.utils.Status;
 import org.opendaylight.controller.sal.utils.StatusCode;
-import org.opendaylight.controller.switchmanager.ISwitchManager;
 import org.opendaylight.controller.topologymanager.ITopologyManager;
 import org.opendaylight.controller.topologymanager.ITopologyManagerAware;
 import org.opendaylight.controller.topologymanager.ITopologyManagerClusterWideAware;
@@ -82,7 +81,6 @@ public class TopologyManagerImpl implements
     private static final Logger log = LoggerFactory.getLogger(TopologyManagerImpl.class);
     private ITopologyService topoService;
     private IClusterContainerServices clusterContainerService;
-    private ISwitchManager switchManager;
     // DB of all the Edges with properties which constitute our topology
     private ConcurrentMap<Edge, Set<Property>> edgesDB;
     // DB of all NodeConnector which are part of ISL Edges, meaning they
@@ -163,18 +161,6 @@ public class TopologyManagerImpl implements
         }
     }
 
-    void setSwitchManager(ISwitchManager s) {
-        log.debug("Adding ISwitchManager: {}", s);
-        this.switchManager = s;
-    }
-
-    void unsetSwitchManager(ISwitchManager s) {
-        if (this.switchManager == s) {
-            log.debug("Removing ISwitchManager: {}", s);
-            this.switchManager = null;
-        }
-    }
-
     /**
      * Function called by the dependency manager when all the required
      * dependencies are satisfied
@@ -521,22 +507,9 @@ public class TopologyManagerImpl implements
         }
     }
 
-    private boolean nodeConnectorsExist(Edge e) {
-        NodeConnector head = e.getHeadNodeConnector();
-        NodeConnector tail = e.getTailNodeConnector();
-        return (switchManager.doesNodeConnectorExist(head) &&
-                switchManager.doesNodeConnectorExist(tail));
-    }
-
     private TopoEdgeUpdate edgeUpdate(Edge e, UpdateType type, Set<Property> props) {
         switch (type) {
         case ADDED:
-            // Ensure that both tail and head node connectors exist.
-            if (!nodeConnectorsExist(e)) {
-                log.warn("Ignore edge that contains invalid node connector: {}", e);
-                return null;
-            }
-
             // Make sure the props are non-null
             if (props == null) {
                 props = new HashSet<Property>();
@@ -658,21 +631,18 @@ public class TopologyManagerImpl implements
             Set<Property> p = topoedgeupdateList.get(i).getProperty();
             UpdateType type = topoedgeupdateList.get(i).getUpdateType();
             TopoEdgeUpdate teu = edgeUpdate(e, type, p);
-            if (teu != null) {
-                teuList.add(teu);
-            }
+            teuList.add(teu);
         }
 
-        if (!teuList.isEmpty()) {
-            // Now update the listeners
-            for (ITopologyManagerAware s : this.topologyManagerAware) {
-                try {
-                    s.edgeUpdate(teuList);
-                } catch (Exception exc) {
-                    log.error("Exception on edge update:", exc);
-                }
+        // Now update the listeners
+        for (ITopologyManagerAware s : this.topologyManagerAware) {
+            try {
+                s.edgeUpdate(teuList);
+            } catch (Exception exc) {
+                log.error("Exception on edge update:", exc);
             }
         }
+
     }
 
     private Edge getReverseLinkTuple(TopologyUserLinkConfig link) {
@@ -722,14 +692,7 @@ public class TopologyManagerImpl implements
         Edge linkTuple = getLinkTuple(userLink);
         if (linkTuple != null) {
             if (!isProductionLink(linkTuple)) {
-                TopoEdgeUpdate teu = edgeUpdate(linkTuple, UpdateType.ADDED,
-                                                new HashSet<Property>());
-                if (teu == null) {
-                    userLinksDB.remove(userLink.getName());
-                    return new Status(StatusCode.NOTFOUND,
-                           "Link configuration contains invalid node connector: "
-                           + userLink);
-                }
+                edgeUpdate(linkTuple, UpdateType.ADDED, new HashSet<Property>());
             }
 
             linkTuple = getReverseLinkTuple(userLink);