Thomas Vachuska
Committed by Gerrit Code Review

GUI fixes/breaks.

Change-Id: Ic5c8b087cc32506162153b2756a677c7d9e3bdd7
......@@ -66,7 +66,7 @@ import static org.slf4j.LoggerFactory.getLogger;
public class DefaultTopologyProvider extends AbstractProvider
implements TopologyProvider {
private static final int MAX_THREADS = 8;
private static final int MAX_THREADS = 32;
private static final int DEFAULT_MAX_EVENTS = 1000;
private static final int DEFAULT_MAX_IDLE_MS = 10;
private static final int DEFAULT_MAX_BATCH_MS = 50;
......
from mininet.topo import Topo
class MyTopo( Topo ):
"10 'floating' switch topology"
def __init__( self ):
# Initialize topology
Topo.__init__( self )
sw_list = []
swC = self.addSwitch('sc', dpid = 'ffffffff00000001')
for i in range(1, 201):
switch=self.addSwitch('s'+str(i), dpid = str(i).zfill(16))
self.addLink(switch,swC)
sw_list.append(switch)
topos = { 'mytopo': ( lambda: MyTopo() ) }
......@@ -33,6 +33,7 @@ import org.onlab.onos.net.intent.PathIntent;
import org.onlab.onos.net.intent.PointToPointIntent;
import org.onlab.onos.net.link.LinkService;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
......@@ -73,15 +74,17 @@ public class TopologyViewIntentFilter {
*
* @param hosts set of hosts to query by
* @param devices set of devices to query by
* @param sourceIntents collection of intents to search
* @return set of intents that 'match' all hosts and devices given
*/
Set<Intent> findPathIntents(Set<Host> hosts, Set<Device> devices) {
List<Intent> findPathIntents(Set<Host> hosts, Set<Device> devices,
Iterable<Intent> sourceIntents) {
// Derive from this the set of edge connect points.
Set<ConnectPoint> edgePoints = getEdgePoints(hosts);
// Iterate over all intents and produce a set that contains only those
// intents that target all selected hosts or derived edge connect points.
return getIntents(hosts, devices, edgePoints);
return getIntents(hosts, devices, edgePoints, sourceIntents);
}
......@@ -94,10 +97,11 @@ public class TopologyViewIntentFilter {
return edgePoints;
}
// Produces a set of intents that target all selected hosts, devices or connect points.
private Set<Intent> getIntents(Set<Host> hosts, Set<Device> devices,
Set<ConnectPoint> edgePoints) {
Set<Intent> intents = new HashSet<>();
// Produces a list of intents that target all selected hosts, devices or connect points.
private List<Intent> getIntents(Set<Host> hosts, Set<Device> devices,
Set<ConnectPoint> edgePoints,
Iterable<Intent> sourceIntents) {
List<Intent> intents = new ArrayList<>();
if (hosts.isEmpty() && devices.isEmpty()) {
return intents;
}
......@@ -105,7 +109,7 @@ public class TopologyViewIntentFilter {
Set<OpticalConnectivityIntent> opticalIntents = new HashSet<>();
// Search through all intents and see if they are relevant to our search.
for (Intent intent : intentService.getIntents()) {
for (Intent intent : sourceIntents) {
if (intentService.getIntentState(intent.id()) == INSTALLED) {
boolean isRelevant = false;
if (intent instanceof HostToHostIntent) {
......@@ -140,7 +144,7 @@ public class TopologyViewIntentFilter {
}
// Indicates whether the specified intent involves all of the given hosts.
private boolean isIntentRelevantToHosts(HostToHostIntent intent, Set<Host> hosts) {
private boolean isIntentRelevantToHosts(HostToHostIntent intent, Iterable<Host> hosts) {
for (Host host : hosts) {
HostId id = host.id();
// Bail if intent does not involve this host.
......@@ -152,7 +156,7 @@ public class TopologyViewIntentFilter {
}
// Indicates whether the specified intent involves all of the given devices.
private boolean isIntentRelevantToDevices(Intent intent, Set<Device> devices) {
private boolean isIntentRelevantToDevices(Intent intent, Iterable<Device> devices) {
List<Intent> installables = intentService.getInstallableIntents(intent.id());
for (Device device : devices) {
if (!isIntentRelevantToDevice(installables, device)) {
......@@ -192,7 +196,8 @@ public class TopologyViewIntentFilter {
return false;
}
private boolean isIntentRelevant(PointToPointIntent intent, Set<ConnectPoint> edgePoints) {
private boolean isIntentRelevant(PointToPointIntent intent,
Iterable<ConnectPoint> edgePoints) {
for (ConnectPoint point : edgePoints) {
// Bail if intent does not involve this edge point.
if (!point.equals(intent.egressPoint()) &&
......@@ -205,7 +210,7 @@ public class TopologyViewIntentFilter {
// Indicates whether the specified intent involves all of the given edge points.
private boolean isIntentRelevant(MultiPointToSinglePointIntent intent,
Set<ConnectPoint> edgePoints) {
Iterable<ConnectPoint> edgePoints) {
for (ConnectPoint point : edgePoints) {
// Bail if intent does not involve this edge point.
if (!point.equals(intent.egressPoint()) &&
......@@ -218,7 +223,7 @@ public class TopologyViewIntentFilter {
// Indicates whether the specified intent involves all of the given edge points.
private boolean isIntentRelevant(OpticalConnectivityIntent opticalIntent,
Set<Intent> intents) {
Iterable<Intent> intents) {
Link ccSrc = getFirstLink(opticalIntent.getSrc(), false);
Link ccDst = getFirstLink(opticalIntent.getDst(), true);
......
......@@ -676,13 +676,16 @@ public abstract class TopologyViewMessages {
List<Intent> installables = intentService.getInstallableIntents(intent.id());
if (installables != null) {
for (Intent installable : installables) {
String cls = isOptical ? trafficClass.type + " optical" : trafficClass.type;
String type = isOptical ? trafficClass.type + " optical" : trafficClass.type;
if (installable instanceof PathIntent) {
classifyLinks(cls, biLinks, ((PathIntent) installable).path().links());
classifyLinks(type, biLinks, trafficClass.showTraffic,
((PathIntent) installable).path().links());
} else if (installable instanceof LinkCollectionIntent) {
classifyLinks(cls, biLinks, ((LinkCollectionIntent) installable).links());
classifyLinks(type, biLinks, trafficClass.showTraffic,
((LinkCollectionIntent) installable).links());
} else if (installable instanceof OpticalPathIntent) {
classifyLinks(cls, biLinks, ((OpticalPathIntent) installable).path().links());
classifyLinks(type, biLinks, trafficClass.showTraffic,
((OpticalPathIntent) installable).path().links());
}
}
}
......@@ -695,12 +698,14 @@ public abstract class TopologyViewMessages {
// Adds the link segments (path or tree) associated with the specified
// connectivity intent
private void classifyLinks(String type, Map<LinkKey, BiLink> biLinks,
Iterable<Link> links) {
boolean showTraffic, Iterable<Link> links) {
if (links != null) {
for (Link link : links) {
BiLink biLink = addLink(biLinks, link);
if (isInfrastructureEgress(link)) {
if (showTraffic) {
biLink.addLoad(statService.load(link));
}
biLink.addClass(type);
}
}
......@@ -862,12 +867,18 @@ public abstract class TopologyViewMessages {
// Auxiliary carrier of data for requesting traffic message.
protected class TrafficClass {
public final boolean showTraffic;
public final String type;
public final Set<Intent> intents;
public final Iterable<Intent> intents;
TrafficClass(String type, Iterable<Intent> intents) {
this(type, intents, false);
}
TrafficClass(String type, Set<Intent> intents) {
TrafficClass(String type, Iterable<Intent> intents, boolean showTraffic) {
this.type = type;
this.intents = intents;
this.showTraffic = showTraffic;
}
}
......
......@@ -145,8 +145,10 @@
P: togglePorts,
U: [unpin, 'Unpin node (hover mouse over)'],
R: [resetPanZoom, 'Reset pan / zoom'],
V: [showTrafficAction, 'Show related traffic'],
A: [showAllTrafficAction, 'Show all traffic'],
V: [showRelatedIntentsAction, 'Show all related intents'],
N: [showNextIntentAction, 'Show next related intent'],
W: [showSelectedIntentTrafficAction, 'Monitor traffic of selected intent'],
A: [showAllTrafficAction, 'Monitor all traffic'],
F: [showDeviceLinkFlowsAction, 'Show device link flows'],
X: [toggleNodeLock, 'Lock / unlock node positions'],
Z: [toggleOblique, 'Toggle oblique view (Experimental)'],
......@@ -209,10 +211,11 @@
oblique = false;
// constants
var hoverModeAll = 1,
var hoverModeNone = 0,
hoverModeAll = 1,
hoverModeFlows = 2,
hoverModeIntents = 3,
hoverMode = hoverModeFlows;
hoverMode = hoverModeNone;
// D3 selections
var svg,
......@@ -394,7 +397,7 @@
cancelSummary();
stopAntTimer();
} else {
hoverMode = hoverModeFlows;
hoverMode = hoverModeNone;
}
}
......@@ -1219,22 +1222,20 @@
}
function requestTrafficForMode() {
if (hoverMode === hoverModeAll) {
requestAllTraffic();
} else if (hoverMode === hoverModeFlows) {
if (hoverMode === hoverModeFlows) {
requestDeviceLinkFlows();
} else if (hoverMode === hoverModeIntents) {
requestSelectTraffic();
requestRelatedIntents();
}
}
function showTrafficAction() {
function showRelatedIntentsAction() {
hoverMode = hoverModeIntents;
requestSelectTraffic();
flash('Related Traffic');
requestRelatedIntents();
flash('Related intents');
}
function requestSelectTraffic() {
function requestRelatedIntents() {
function hoverValid() {
return hoverMode === hoverModeIntents &&
hovered &&
......@@ -1242,13 +1243,24 @@
}
if (validateSelectionContext()) {
sendMessage('requestTraffic', {
sendMessage('requestRelatedIntents', {
ids: selectOrder,
hover: hoverValid() ? hovered.id : ''
});
}
}
function showNextIntentAction() {
hoverMode = hoverModeNone;
sendMessage('requestNextRelatedIntent', {});
flash('Next related intent');
}
function showSelectedIntentTrafficAction() {
hoverMode = hoverModeNone;
sendMessage('requestSelectedIntentTraffic', {});
flash('Monitoring selected intent');
}
function showDeviceLinkFlowsAction() {
hoverMode = hoverModeFlows;
......@@ -2010,14 +2022,18 @@
}
function nodeMouseOver(d) {
if (hovered != d) {
hovered = d;
requestTrafficForMode();
}
}
function nodeMouseOut(d) {
if (hovered != null) {
hovered = null;
requestTrafficForMode();
}
}
function addHostIcon(node, radius, iid) {
var dim = radius * 1.5,
......@@ -2498,7 +2514,7 @@
wsTrace('rx', msg);
}
function wsTrace(rxtx, msg) {
console.log('[' + rxtx + '] ' + msg);
// console.log('[' + rxtx + '] ' + msg);
}
// NOTE: Temporary hardcoded example for showing detail pane
......@@ -2620,7 +2636,6 @@
emptySelect();
} else if (nSel === 1) {
singleSelect();
requestTrafficForMode();
} else {
multiSelect();
}
......@@ -2635,12 +2650,14 @@
function singleSelect() {
// NOTE: detail is shown from showDetails event callback
requestDetails();
cancelTraffic();
requestTrafficForMode();
}
function multiSelect() {
haveDetails = true;
populateMultiSelect();
cancelTraffic();
requestTrafficForMode();
}
......@@ -2738,7 +2755,7 @@
function addSingleSelectActions(data) {
detailPane.append('hr');
// always want to allow 'show traffic'
addAction(detailPane, 'Show Related Traffic', showTrafficAction);
addAction(detailPane, 'Show Related Traffic', showRelatedIntentsAction);
if (data.type === 'switch') {
addAction(detailPane, 'Show Device Flows', showDeviceLinkFlowsAction);
......@@ -2748,7 +2765,7 @@
function addMultiSelectActions() {
detailPane.append('hr');
// always want to allow 'show traffic'
addAction(detailPane, 'Show Related Traffic', showTrafficAction);
addAction(detailPane, 'Show Related Traffic', showRelatedIntentsAction);
// if exactly two hosts are selected, also want 'add host intent'
if (nSel() === 2 && allSelectionsClass('host')) {
addAction(detailPane, 'Create Host-to-Host Flow', addHostIntentAction);
......