Merge "HA - Cache synch for Topology Manager"
[controller.git] / opendaylight / hosttracker / implementation / src / main / java / org / opendaylight / controller / hosttracker / internal / HostTracker.java
index 446f51eb04c81bd3be6f38038e1d6b33cb5fe964..6b7bac03e9bdcfc472ad3dce7cc2c10d1f8dd096 100644 (file)
@@ -212,17 +212,6 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
         inactiveStaticHosts = new ConcurrentHashMap<NodeConnector, HostNodeConnector>();
     }
 
-    @SuppressWarnings("deprecation")
-    private void destroyCache() {
-        if (this.clusterContainerService == null) {
-            logger.error("un-initialized clusterMger, can't destroy cache");
-            return;
-        }
-        logger.debug("Destroying Cache for HostTracker");
-        this.clusterContainerService.destroyCache("hostTrackerAH");
-        this.clusterContainerService.destroyCache("hostTrackerIH");
-        nonClusterObjectCreate();
-    }
 
     public void shutDown() {
     }
@@ -1018,7 +1007,6 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
         if (nc == null) {
             return new Status(StatusCode.BADREQUEST, "Invalid NodeConnector");
         }
-
         HostNodeConnector host = null;
         try {
             host = new HostNodeConnector(dataLayerAddress, networkAddr, nc, vlan);
@@ -1036,6 +1024,14 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
                 return new Status(StatusCode.CONFLICT, "Existing IP, Use PUT to update");
             }
             host.setStaticHost(true);
+            /*
+             * Check if the nc is an ISL port
+             */
+            if (topologyManager != null) {
+                if (topologyManager.isInternal(nc)) {
+                    return new Status(StatusCode.BADREQUEST, "Cannot add host on ISL port");
+                }
+            }
             /*
              * Before adding host, Check if the switch and the port have already
              * come up
@@ -1336,7 +1332,6 @@ public class HostTracker implements IfIptoHost, IfHostListener, ISwitchManagerAw
      *
      */
     void destroy() {
-        destroyCache();
     }
 
     /**