link provider cleanup

Change-Id: Ifeedfbfc20e3d75b140ee73f7479cd18bcb84adf
diff --git a/providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LLDPLinkProvider.java b/providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LLDPLinkProvider.java
index 023940e..f4ab71d 100644
--- a/providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LLDPLinkProvider.java
+++ b/providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LLDPLinkProvider.java
@@ -8,6 +8,7 @@
 import org.onlab.onos.net.ConnectPoint;
 import org.onlab.onos.net.Device;
 import org.onlab.onos.net.DeviceId;
+import org.onlab.onos.net.Port;
 import org.onlab.onos.net.device.DeviceEvent;
 import org.onlab.onos.net.device.DeviceListener;
 import org.onlab.onos.net.device.DeviceService;
@@ -90,53 +91,50 @@
         public void event(DeviceEvent event) {
             LinkDiscovery ld = null;
             Device device = event.subject();
-            // it's not a switch so leave.
-            if (device.type() != Device.Type.SWITCH) {
-                return;
-            }
+            Port port = event.port();
             switch (event.type()) {
                 case DEVICE_ADDED:
-                    discoverers.put(event.subject().id(),
-                                    new LinkDiscovery(event.subject(), packetSevice,
+                    discoverers.put(device.id(),
+                                    new LinkDiscovery(device, packetSevice,
                                                       providerService, useBDDP));
                     break;
                 case PORT_ADDED:
                 case PORT_UPDATED:
                     if (event.port().isEnabled()) {
-                        ld = discoverers.get(event.subject().id());
+                        ld = discoverers.get(device.id());
                         if (ld == null) {
                             return;
                         }
-                        ld.addPort(event.port());
+                        ld.addPort(port);
                     } else {
-                        ConnectPoint point = new ConnectPoint(event.subject().id(),
-                                                              event.port().number());
+                        ConnectPoint point = new ConnectPoint(device.id(),
+                                                              port.number());
                         providerService.linksVanished(point);
                     }
                     break;
                 case PORT_REMOVED:
-                    ConnectPoint point = new ConnectPoint(event.subject().id(),
-                                                          event.port().number());
+                    ConnectPoint point = new ConnectPoint(device.id(),
+                                                          port.number());
                     providerService.linksVanished(point);
                     break;
                 case DEVICE_REMOVED:
                 case DEVICE_SUSPENDED:
-                    ld = discoverers.get(event.subject().id());
+                    ld = discoverers.get(device.id());
                     if (ld == null) {
                         return;
                     }
                     ld.stop();
-                    providerService.linksVanished(event.subject().id());
+                    providerService.linksVanished(device.id());
                     break;
                 case DEVICE_AVAILABILITY_CHANGED:
-                    ld = discoverers.get(event.subject().id());
+                    ld = discoverers.get(device.id());
                     if (ld == null) {
                         return;
                     }
-                    if (deviceService.isAvailable(event.subject().id())) {
+                    if (deviceService.isAvailable(device.id())) {
                         ld.start();
                     } else {
-                        providerService.linksVanished(event.subject().id());
+                        providerService.linksVanished(device.id());
                         ld.stop();
                     }
                     break;
diff --git a/providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LinkDiscovery.java b/providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LinkDiscovery.java
index fc0a0f4..6ad6124 100644
--- a/providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LinkDiscovery.java
+++ b/providers/lldp/src/main/java/org/onlab/onos/provider/lldp/impl/LinkDiscovery.java
@@ -184,14 +184,13 @@
                 this.slowPorts.remove(portNumber);
                 this.fastPorts.add(portNumber);
                 this.portProbeCount.put(portNumber, new AtomicInteger(0));
-            } else {
-                if (this.fastPorts.contains(portNumber)) {
+            } else if (this.fastPorts.contains(portNumber)) {
                     this.portProbeCount.get(portNumber).set(0);
-                } else {
+            } else {
                     this.log.debug(
                             "Got ackProbe for non-existing port: {}",
                             portNumber);
-                }
+
             }
         }
     }
@@ -256,7 +255,7 @@
                     //fastIterator.remove();
                     //this.slowPorts.add(portNumber);
                     //this.portProbeCount.remove(portNumber);
-
+                    this.portProbeCount.get(portNumber).set(0);
 
                     ConnectPoint cp = new ConnectPoint(
                             device.id(),