use of org.onosproject.ui.topo.Highlights in project onos by opennetworkinglab.
the class ProtectedIntentMonitor method sendClearHighlights.
private void sendClearHighlights() {
log.debug("sendClearHighlights");
msgHandler.sendHighlights(new Highlights());
}
use of org.onosproject.ui.topo.Highlights in project onos by opennetworkinglab.
the class LinkPropsTopovMessageHandler method getTotalBytes.
/**
* Gets the links connected to the highlighted device.
* Uses PortStatisticsService to get a load object of
* the links and find the total number of bytes sent out
* of the device via that link (src) and into the device
* via that link (dst), because dlink.two() gives a
* NullPointerException. Creates a label which displays
* the src and dst total bytes for the link.
*/
private Highlights getTotalBytes(Set<Link> links, DeviceId devId) {
LpLinkMap linkMap = new LpLinkMap();
if (links != null) {
log.debug("Processing {} links", links.size());
links.forEach(linkMap::add);
} else {
log.debug("No egress links found for device {}", devId);
}
Highlights highlights = new Highlights();
for (LpLink dlink : linkMap.biLinks()) {
String bytes = "Out: " + getBytesString(portStatisticsService.load(dlink.one().src()).latest()) + " | In: " + getBytesString(portStatisticsService.load(dlink.one().dst()).latest());
dlink.makeImportant().setLabel(bytes);
highlights.add(dlink.highlight(null));
}
return highlights;
}
use of org.onosproject.ui.topo.Highlights in project onos by opennetworkinglab.
the class LinkPropsTopovMessageHandler method getBandwidth.
/**
* Gets the links connected to the highlighted device.
* Creates a ContinuousResource object for each link
* and gets the bandwidth of the link from the query
* and sets the label of the link as the bandwidth value.
*/
private Highlights getBandwidth(Set<Link> links, DeviceId devId) {
LpLinkMap linkMap = new LpLinkMap();
Highlights highlights = new Highlights();
if (links != null) {
log.debug("Processing {} links", links.size());
links.forEach(linkMap::add);
PortNumber portnum = PortNumber.portNumber((int) links.iterator().next().src().port().toLong());
for (LpLink dlink : linkMap.biLinks()) {
DiscreteResourceId parent = Resources.discrete(devId, portnum).id();
ContinuousResource continuousResource = (ContinuousResource) resourceQueryService.getAvailableResources(parent, Bandwidth.class).iterator().next();
double availBandwidth = continuousResource.value();
dlink.makeImportant().setLabel(Double.toString(availBandwidth) + " bytes/s");
highlights.add(dlink.highlight(null));
}
} else {
log.debug("No egress links found for device {}", devId);
}
return highlights;
}
use of org.onosproject.ui.topo.Highlights in project onos by opennetworkinglab.
the class LinkPropsTopovMessageHandler method sendRateData.
private void sendRateData() {
if (elementOfNote != null && elementOfNote instanceof Device) {
DeviceId devId = (DeviceId) elementOfNote.id();
Set<Link> links = linkService.getDeviceEgressLinks(devId);
Highlights highlights = getLinkSpeed(links, devId);
sendHighlights(highlights);
}
}
use of org.onosproject.ui.topo.Highlights in project onos by opennetworkinglab.
the class LinkPropsTopovMessageHandler method getLinkSpeed.
/**
* Gets the links connected to the highlighted device.
* Uses PortStatisticsService to get a load object of
* the links and find the rate of data flow out of the
* device via that link (src) and into the device via
* that link (dst), because dlink.two() gives a
* NullPointerException. Creates a label which displays
* the src and dst rates for the link.
*/
private Highlights getLinkSpeed(Set<Link> links, DeviceId devId) {
LpLinkMap linkMap = new LpLinkMap();
if (links != null) {
log.debug("Processing {} links", links.size());
links.forEach(linkMap::add);
} else {
log.debug("No egress links found for device {}", devId);
}
Highlights highlights = new Highlights();
for (LpLink dlink : linkMap.biLinks()) {
String rate = "Out: " + getSpeedString((portStatisticsService.load(dlink.one().src()).rate())) + " | In: " + getSpeedString((portStatisticsService.load(dlink.one().dst()).rate()));
dlink.makeImportant().setLabel(rate);
highlights.add(dlink.highlight(null));
}
return highlights;
}
Aggregations