Search in sources :

Example 11 with Highlights

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());
}
Also used : Highlights(org.onosproject.ui.topo.Highlights)

Example 12 with 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;
}
Also used : Highlights(org.onosproject.ui.topo.Highlights)

Example 13 with 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;
}
Also used : Highlights(org.onosproject.ui.topo.Highlights) Bandwidth(org.onlab.util.Bandwidth) DiscreteResourceId(org.onosproject.net.resource.DiscreteResourceId) PortNumber(org.onosproject.net.PortNumber) ContinuousResource(org.onosproject.net.resource.ContinuousResource)

Example 14 with 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);
    }
}
Also used : Highlights(org.onosproject.ui.topo.Highlights) Device(org.onosproject.net.Device) DeviceId(org.onosproject.net.DeviceId) Link(org.onosproject.net.Link)

Example 15 with 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;
}
Also used : Highlights(org.onosproject.ui.topo.Highlights)

Aggregations

Highlights (org.onosproject.ui.topo.Highlights)19 Link (org.onosproject.net.Link)7 Device (org.onosproject.net.Device)6 DeviceId (org.onosproject.net.DeviceId)5 FlowRuleIntent (org.onosproject.net.intent.FlowRuleIntent)4 Intent (org.onosproject.net.intent.Intent)4 OpticalConnectivityIntent (org.onosproject.net.intent.OpticalConnectivityIntent)4 HashSet (java.util.HashSet)3 List (java.util.List)3 FlowObjectiveIntent (org.onosproject.net.intent.FlowObjectiveIntent)3 HostToHostIntent (org.onosproject.net.intent.HostToHostIntent)3 LinkCollectionIntent (org.onosproject.net.intent.LinkCollectionIntent)3 OpticalPathIntent (org.onosproject.net.intent.OpticalPathIntent)3 PathIntent (org.onosproject.net.intent.PathIntent)3 TrafficLink (org.onosproject.ui.impl.topo.util.TrafficLink)3 ImmutableList (com.google.common.collect.ImmutableList)2 Lists (com.google.common.collect.Lists)2 Collection (java.util.Collection)2 Set (java.util.Set)2 TrafficLinkMap (org.onosproject.ui.impl.topo.util.TrafficLinkMap)2