Thomas Vachuska
Committed by Gerrit Code Review

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

Change-Id: Icc0b02e1c9a0d336830651bf0792baf2a549b7a0
...@@ -108,12 +108,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase { ...@@ -108,12 +108,7 @@ public class TopologyViewMessageHandler extends TopologyViewMessageHandlerBase {
108 private static final long SUMMARY_FREQUENCY = 30000; 108 private static final long SUMMARY_FREQUENCY = 30000;
109 109
110 private static final Comparator<? super ControllerNode> NODE_COMPARATOR = 110 private static final Comparator<? super ControllerNode> NODE_COMPARATOR =
111 - new Comparator<ControllerNode>() { 111 + (o1, o2) -> o1.id().toString().compareTo(o2.id().toString());
112 - @Override
113 - public int compare(ControllerNode o1, ControllerNode o2) {
114 - return o1.id().toString().compareTo(o2.id().toString());
115 - }
116 - };
117 112
118 113
119 private final Timer timer = new Timer("topology-view"); 114 private final Timer timer = new Timer("topology-view");
......
...@@ -19,6 +19,7 @@ import com.fasterxml.jackson.databind.JsonNode; ...@@ -19,6 +19,7 @@ import com.fasterxml.jackson.databind.JsonNode;
19 import com.fasterxml.jackson.databind.ObjectMapper; 19 import com.fasterxml.jackson.databind.ObjectMapper;
20 import com.fasterxml.jackson.databind.node.ArrayNode; 20 import com.fasterxml.jackson.databind.node.ArrayNode;
21 import com.fasterxml.jackson.databind.node.ObjectNode; 21 import com.fasterxml.jackson.databind.node.ObjectNode;
22 +import com.google.common.collect.ImmutableList;
22 import org.onlab.osgi.ServiceDirectory; 23 import org.onlab.osgi.ServiceDirectory;
23 import org.onlab.packet.IpAddress; 24 import org.onlab.packet.IpAddress;
24 import org.onosproject.cluster.ClusterEvent; 25 import org.onosproject.cluster.ClusterEvent;
...@@ -40,6 +41,7 @@ import org.onosproject.net.HostId; ...@@ -40,6 +41,7 @@ import org.onosproject.net.HostId;
40 import org.onosproject.net.HostLocation; 41 import org.onosproject.net.HostLocation;
41 import org.onosproject.net.Link; 42 import org.onosproject.net.Link;
42 import org.onosproject.net.LinkKey; 43 import org.onosproject.net.LinkKey;
44 +import org.onosproject.net.NetworkResource;
43 import org.onosproject.net.PortNumber; 45 import org.onosproject.net.PortNumber;
44 import org.onosproject.net.device.DeviceEvent; 46 import org.onosproject.net.device.DeviceEvent;
45 import org.onosproject.net.device.DeviceService; 47 import org.onosproject.net.device.DeviceService;
...@@ -50,6 +52,7 @@ import org.onosproject.net.flow.instructions.Instruction; ...@@ -50,6 +52,7 @@ import org.onosproject.net.flow.instructions.Instruction;
50 import org.onosproject.net.flow.instructions.Instructions.OutputInstruction; 52 import org.onosproject.net.flow.instructions.Instructions.OutputInstruction;
51 import org.onosproject.net.host.HostEvent; 53 import org.onosproject.net.host.HostEvent;
52 import org.onosproject.net.host.HostService; 54 import org.onosproject.net.host.HostService;
55 +import org.onosproject.net.intent.FlowRuleIntent;
53 import org.onosproject.net.intent.Intent; 56 import org.onosproject.net.intent.Intent;
54 import org.onosproject.net.intent.IntentService; 57 import org.onosproject.net.intent.IntentService;
55 import org.onosproject.net.intent.LinkCollectionIntent; 58 import org.onosproject.net.intent.LinkCollectionIntent;
...@@ -651,6 +654,9 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { ...@@ -651,6 +654,9 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler {
651 if (installable instanceof PathIntent) { 654 if (installable instanceof PathIntent) {
652 classifyLinks(type, biLinks, trafficClass.showTraffic, 655 classifyLinks(type, biLinks, trafficClass.showTraffic,
653 ((PathIntent) installable).path().links()); 656 ((PathIntent) installable).path().links());
657 + } else if (installable instanceof FlowRuleIntent) {
658 + classifyLinks(type, biLinks, trafficClass.showTraffic,
659 + linkResources(installable));
654 } else if (installable instanceof LinkCollectionIntent) { 660 } else if (installable instanceof LinkCollectionIntent) {
655 classifyLinks(type, biLinks, trafficClass.showTraffic, 661 classifyLinks(type, biLinks, trafficClass.showTraffic,
656 ((LinkCollectionIntent) installable).links()); 662 ((LinkCollectionIntent) installable).links());
...@@ -665,6 +671,17 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler { ...@@ -665,6 +671,17 @@ public abstract class TopologyViewMessageHandlerBase extends UiMessageHandler {
665 return biLinks; 671 return biLinks;
666 } 672 }
667 673
674 + // Extracts links from the specified flow rule intent resources
675 + private Collection<Link> linkResources(Intent installable) {
676 + ImmutableList.Builder<Link> builder = ImmutableList.builder();
677 + for (NetworkResource r : installable.resources()) {
678 + if (r instanceof Link) {
679 + builder.add((Link) r);
680 + }
681 + }
682 + return builder.build();
683 + }
684 +
668 685
669 // Adds the link segments (path or tree) associated with the specified 686 // Adds the link segments (path or tree) associated with the specified
670 // connectivity intent 687 // connectivity intent
......