Thomas Vachuska
Committed by Gerrit Code Review

Fixing various GUI traffic/usage issues.

Reduced key help font.

Change-Id: I273f840aec85c13763688dfee8b3f26c8d1d5233
......@@ -33,7 +33,6 @@
<modules>
<module>bundle</module>
<!--module>web-bundle</module-->
</modules>
</project>
......
/*
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sample.bundle;
import org.apache.felix.scr.annotations.Activate;
import org.apache.felix.scr.annotations.Component;
import org.apache.felix.scr.annotations.Deactivate;
import org.apache.felix.scr.annotations.Service;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Skeletal ONOS application component.
*/
@Component(immediate = true)
@Service
public class AppComponent implements AppService {
private static Logger log = LoggerFactory.getLogger(AppComponent.class);
@Activate
protected void activate() {
log.info("Started");
}
@Deactivate
protected void deactivate() {
log.info("Stopped");
}
}
/*
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sample.bundle;
/**
* Skeletal ONOS application API.
*/
public interface AppService {
}
/*
* Copyright 2014 Open Networking Laboratory
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package sample.bundle;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
/**
* Set of tests of the ONOS application component.
*/
public class AppComponentTest {
private AppComponent component;
@Before
public void setUp() {
component = new AppComponent();
component.activate();
}
@After
public void tearDown() {
component.deactivate();
}
@Test
public void basics() {
}
}
......@@ -213,6 +213,7 @@ public class TopologyViewWebSocket
processMessage((ObjectNode) mapper.reader().readTree(data));
} catch (Exception e) {
log.warn("Unable to parse GUI request {} due to {}", data, e);
log.warn("Boom!!!", e);
}
}
......@@ -384,7 +385,6 @@ public class TopologyViewWebSocket
}
private Set<ConnectPoint> getHostLocations(Set<HostId> hostIds) {
Set<ConnectPoint> points = new HashSet<>();
for (HostId hostId : hostIds) {
......@@ -459,21 +459,19 @@ public class TopologyViewWebSocket
// Cancel any other traffic monitoring mode.
stopTrafficMonitoring();
// Get the set of selected hosts and their intents.
ArrayNode ids = (ArrayNode) payload.path("ids");
selectedHosts = getHosts(ids);
selectedDevices = getDevices(ids);
selectedIntents = intentFilter.findPathIntents(selectedHosts, selectedDevices,
intentService.getIntents());
currentIntentIndex = -1;
String hover = string(payload, "hover");
if (haveSelectedIntents()) {
// Get the set of selected hosts and their intents.
ArrayNode ids = (ArrayNode) payload.path("ids");
selectedHosts = getHosts(ids);
selectedDevices = getDevices(ids);
selectedIntents = intentFilter.findPathIntents(selectedHosts, selectedDevices,
intentService.getIntents());
currentIntentIndex = -1;
// Send a message to highlight all links of all monitored intents.
sendMessage(trafficMessage(sid, new TrafficClass("primary", selectedIntents)));
}
if (!isNullOrEmpty(hover)) {
} else if (!isNullOrEmpty(hover)) {
// If there is a hover node, include it in the selection and find intents.
processExtendedSelection(sid, hover);
}
......@@ -484,19 +482,21 @@ public class TopologyViewWebSocket
}
private void processExtendedSelection(long sid, String hover) {
Set<Host> hoverSelHosts = new HashSet<>(selectedHosts);
Set<Device> hoverSelDevices = new HashSet<>(selectedDevices);
addHover(hoverSelHosts, hoverSelDevices, hover);
if (haveSelectedIntents()) {
Set<Host> hoverSelHosts = new HashSet<>(selectedHosts);
Set<Device> hoverSelDevices = new HashSet<>(selectedDevices);
addHover(hoverSelHosts, hoverSelDevices, hover);
List<Intent> primary =
intentFilter.findPathIntents(hoverSelHosts, hoverSelDevices,
selectedIntents);
Set<Intent> secondary = new HashSet<>(selectedIntents);
secondary.removeAll(primary);
List<Intent> primary =
intentFilter.findPathIntents(hoverSelHosts, hoverSelDevices,
selectedIntents);
Set<Intent> secondary = new HashSet<>(selectedIntents);
secondary.removeAll(primary);
// Send a message to highlight all links of all monitored intents.
sendMessage(trafficMessage(sid, new TrafficClass("primary", primary),
new TrafficClass("secondary", secondary)));
// Send a message to highlight all links of all monitored intents.
sendMessage(trafficMessage(sid, new TrafficClass("primary", primary),
new TrafficClass("secondary", secondary)));
}
}
// Requests next of the related intents.
......@@ -522,6 +522,9 @@ public class TopologyViewWebSocket
// Requests monitoring of traffic for the selected intent.
private void requestSelectedIntentTraffic(ObjectNode event) {
if (haveSelectedIntents()) {
if (currentIntentIndex < 0) {
currentIntentIndex = 0;
}
Intent selectedIntent = selectedIntents.get(currentIntentIndex);
log.info("Requested traffic for selected {}", selectedIntent.id());
......
......@@ -36,7 +36,7 @@
}
#quickhelp svg text.title {
font-size: 10pt;
font-size: 8pt;
font-style: italic;
text-anchor: middle;
fill: #999;
......@@ -52,17 +52,17 @@
}
#quickhelp svg text {
font-size: 7pt;
font-size: 5pt;
alignment-baseline: middle;
}
#quickhelp svg text.key {
font-size: 7pt;
font-size: 5pt;
fill: #add;
}
#quickhelp svg text.desc {
font-size: 7pt;
font-size: 5pt;
fill: #ddd;
}
......
......@@ -74,7 +74,7 @@
// layout configuration
var pad = 8,
offy = 45,
dy = 14,
dy = 10,
offDesc = 8;
// D3 magic
......