Adding linkVanished to NullLinkProvider when topology changes

ONOS-1287

Change-Id: Iffd19723be4c5b88dd0e3025d729ba2cc3f3faa8
diff --git a/providers/null/link/src/main/java/org/onosproject/provider/nil/link/impl/NullLinkProvider.java b/providers/null/link/src/main/java/org/onosproject/provider/nil/link/impl/NullLinkProvider.java
index 38c5a57..9e9f286 100644
--- a/providers/null/link/src/main/java/org/onosproject/provider/nil/link/impl/NullLinkProvider.java
+++ b/providers/null/link/src/main/java/org/onosproject/provider/nil/link/impl/NullLinkProvider.java
@@ -19,7 +19,6 @@
 import com.google.common.collect.Lists;
 import com.google.common.collect.Maps;
 import com.google.common.collect.Sets;
-
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -27,6 +26,7 @@
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Reference;
 import org.apache.felix.scr.annotations.ReferenceCardinality;
+import org.onlab.util.Tools;
 import org.onosproject.cfg.ComponentConfigService;
 import org.onosproject.cluster.ClusterService;
 import org.onosproject.cluster.NodeId;
@@ -48,6 +48,11 @@
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 
+import java.io.BufferedReader;
+import java.io.FileReader;
+import java.io.IOException;
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Dictionary;
 import java.util.List;
 import java.util.Set;
@@ -55,11 +60,6 @@
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
 
 import static com.google.common.base.Strings.isNullOrEmpty;
 import static org.onlab.util.Tools.groupedThreads;
@@ -280,12 +280,18 @@
                 log.warn("Could not close topology file: {}", e);
             }
         }
+        Set<LinkDescription> removedLinks = null;
         synchronized (linkDescrs) {
             if (!read.isEmpty()) {
+                removedLinks = Sets.difference(Sets.newHashSet(linkDescrs), read);
                 linkDescrs.clear();
                 linkDescrs.addAll(read);
             }
         }
+        if (!Tools.isNullOrEmpty(removedLinks)) {
+            log.info("Removing {} old link(s)", removedLinks.size());
+            removedLinks.forEach(providerService::linkVanished);
+        }
     }
 
     // parses a link descriptor to make a LinkDescription