GUI -- Fixed traffic visualization broken due to change in intent framework.

Change-Id: Icc0b02e1c9a0d336830651bf0792baf2a549b7a0
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 e3fa674..02b94eb 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
@@ -108,12 +108,7 @@
     private static final long SUMMARY_FREQUENCY = 30000;
 
     private static final Comparator<? super ControllerNode> NODE_COMPARATOR =
-            new Comparator<ControllerNode>() {
-                @Override
-                public int compare(ControllerNode o1, ControllerNode o2) {
-                    return o1.id().toString().compareTo(o2.id().toString());
-                }
-            };
+            (o1, o2) -> o1.id().toString().compareTo(o2.id().toString());
 
 
     private final Timer timer = new Timer("topology-view");
diff --git a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
index f87ad7e..c7ebf35 100644
--- a/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
+++ b/web/gui/src/main/java/org/onosproject/ui/impl/TopologyViewMessageHandlerBase.java
@@ -19,6 +19,7 @@
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fasterxml.jackson.databind.node.ArrayNode;
 import com.fasterxml.jackson.databind.node.ObjectNode;
+import com.google.common.collect.ImmutableList;
 import org.onlab.osgi.ServiceDirectory;
 import org.onlab.packet.IpAddress;
 import org.onosproject.cluster.ClusterEvent;
@@ -40,6 +41,7 @@
 import org.onosproject.net.HostLocation;
 import org.onosproject.net.Link;
 import org.onosproject.net.LinkKey;
+import org.onosproject.net.NetworkResource;
 import org.onosproject.net.PortNumber;
 import org.onosproject.net.device.DeviceEvent;
 import org.onosproject.net.device.DeviceService;
@@ -50,6 +52,7 @@
 import org.onosproject.net.flow.instructions.Instructions.OutputInstruction;
 import org.onosproject.net.host.HostEvent;
 import org.onosproject.net.host.HostService;
+import org.onosproject.net.intent.FlowRuleIntent;
 import org.onosproject.net.intent.Intent;
 import org.onosproject.net.intent.IntentService;
 import org.onosproject.net.intent.LinkCollectionIntent;
@@ -651,6 +654,9 @@
                         if (installable instanceof PathIntent) {
                             classifyLinks(type, biLinks, trafficClass.showTraffic,
                                           ((PathIntent) installable).path().links());
+                        } else if (installable instanceof FlowRuleIntent) {
+                            classifyLinks(type, biLinks, trafficClass.showTraffic,
+                                          linkResources(installable));
                         } else if (installable instanceof LinkCollectionIntent) {
                             classifyLinks(type, biLinks, trafficClass.showTraffic,
                                           ((LinkCollectionIntent) installable).links());
@@ -665,6 +671,17 @@
         return biLinks;
     }
 
+    // Extracts links from the specified flow rule intent resources
+    private Collection<Link> linkResources(Intent installable) {
+        ImmutableList.Builder<Link> builder = ImmutableList.builder();
+        for (NetworkResource r : installable.resources()) {
+            if (r instanceof Link) {
+                builder.add((Link) r);
+            }
+        }
+        return builder.build();
+    }
+
 
     // Adds the link segments (path or tree) associated with the specified
     // connectivity intent