Fixed GUI pulsing due to PORT_STATS_UPDATE event.

Change-Id: I18b7e8b300f0af6f6cbf453f346808bb1c6d0d3c
diff --git a/core/api/src/main/java/org/onosproject/net/device/DeviceEvent.java b/core/api/src/main/java/org/onosproject/net/device/DeviceEvent.java
index 92366b8..18ab046 100644
--- a/core/api/src/main/java/org/onosproject/net/device/DeviceEvent.java
+++ b/core/api/src/main/java/org/onosproject/net/device/DeviceEvent.java
@@ -74,7 +74,7 @@
          */
         PORT_REMOVED,
 
-        /*
+        /**
          * Signifies that port statistics has been updated.
          */
         PORT_STATS_UPDATED
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
index 211058a..e3fa674 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandler.java
@@ -72,8 +72,7 @@
 import static org.onosproject.cluster.ClusterEvent.Type.INSTANCE_ADDED;
 import static org.onosproject.net.DeviceId.deviceId;
 import static org.onosproject.net.HostId.hostId;
-import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_ADDED;
-import static org.onosproject.net.device.DeviceEvent.Type.DEVICE_UPDATED;
+import static org.onosproject.net.device.DeviceEvent.Type.*;
 import static org.onosproject.net.host.HostEvent.Type.HOST_ADDED;
 import static org.onosproject.net.link.LinkEvent.Type.LINK_ADDED;
 
@@ -344,10 +343,10 @@
             HostId two = hostId(string(payload, "two"));
 
             HostToHostIntent intent = HostToHostIntent.builder()
-                            .appId(appId)
-                            .one(one)
-                            .two(two)
-                            .build();
+                    .appId(appId)
+                    .one(one)
+                    .two(two)
+                    .build();
 
             intentService.submit(intent);
             startMonitoringIntent(intent);
@@ -774,8 +773,10 @@
     private class InternalDeviceListener implements DeviceListener {
         @Override
         public void event(DeviceEvent event) {
-            sendMessage(deviceMessage(event));
-            eventAccummulator.add(event);
+            if (event.type() != PORT_STATS_UPDATED) {
+                sendMessage(deviceMessage(event));
+                eventAccummulator.add(event);
+            }
         }
     }
 
diff --git a/web/gui/src/main/webapp/app/view/topo/topoForce.js b/web/gui/src/main/webapp/app/view/topo/topoForce.js
index 7910ee0..0bc0d5c 100644
--- a/web/gui/src/main/webapp/app/view/topo/topoForce.js
+++ b/web/gui/src/main/webapp/app/view/topo/topoForce.js
@@ -263,17 +263,19 @@
             online = ldata.online(),
             delay = immediate ? 0 : 1000;
 
-        // TODO: understand why el is sometimes undefined on addLink events...
-        el.classed('link', true);
-        el.classed('inactive', !online);
-        el.classed(allLinkTypes, false);
-        if (type) {
-            el.classed(type, true);
+        // FIXME: understand why el is sometimes undefined on addLink events...
+        if (el) {
+            el.classed('link', true);
+            el.classed('inactive', !online);
+            el.classed(allLinkTypes, false);
+            if (type) {
+                el.classed(type, true);
+            }
+            el.transition()
+                .duration(delay)
+                .attr('stroke-width', linkScale(lw))
+                .attr('stroke', linkConfig[th].baseColor);
         }
-        el.transition()
-            .duration(delay)
-            .attr('stroke-width', linkScale(lw))
-            .attr('stroke', linkConfig[th].baseColor);
     }
 
     function removeLinkElement(d) {