Search in sources :

Example 1 with TrafficLink

use of org.onosproject.ui.impl.topo.util.TrafficLink in project onos by opennetworkinglab.

the class ProtectedIntentMonitor method processLinks.

private void processLinks(TrafficLinkMap linkMap, Iterable<Link> links, Flavor flavor, boolean isOptical, boolean showTraffic, Set<Mod> mods) {
    if (links != null) {
        for (Link link : links) {
            TrafficLink tlink = linkMap.add(link);
            tlink.tagFlavor(flavor);
            tlink.optical(isOptical);
            if (showTraffic) {
                tlink.antMarch(true);
            }
            tlink.tagMods(mods);
        }
    }
}
Also used : TrafficLink(org.onosproject.ui.impl.topo.util.TrafficLink) Link(org.onosproject.net.Link) TrafficLink(org.onosproject.ui.impl.topo.util.TrafficLink)

Example 2 with TrafficLink

use of org.onosproject.ui.impl.topo.util.TrafficLink in project onos by opennetworkinglab.

the class Traffic2Monitor method doAggregation.

// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// -- link aggregation
@Override
protected Set<TrafficLink> doAggregation(Set<TrafficLink> linksWithTraffic) {
    log.debug("Need to aggregate {} links", linksWithTraffic.size());
    // first, retrieve from the shared topology model those synth links that
    // are part of the region currently being viewed by the user...
    Map<UiLinkId, UiSynthLink> synthLinkMap = msgHandler.retrieveRelevantSynthLinks();
    // NOTE: compute Set<TrafficLink> which represents the consolidated links
    Map<UiLinkId, TrafficLink> mappedByUiLinkId = new HashMap<>();
    for (TrafficLink tl : linksWithTraffic) {
        UiLinkId tlid = uiLinkId(tl.key());
        UiSynthLink sl = synthLinkMap.get(tlid);
        if (sl != null) {
            UiLinkId aggrid = sl.link().id();
            TrafficLink aggregated = mappedByUiLinkId.computeIfAbsent(aggrid, TrafficLink::new);
            aggregated.mergeStats(tl);
        }
    }
    Set<TrafficLink> result = new HashSet<>();
    result.addAll(mappedByUiLinkId.values());
    return result;
}
Also used : TrafficLink(org.onosproject.ui.impl.topo.util.TrafficLink) UiLinkId(org.onosproject.ui.model.topo.UiLinkId) HashMap(java.util.HashMap) UiSynthLink(org.onosproject.ui.model.topo.UiSynthLink) HashSet(java.util.HashSet)

Example 3 with TrafficLink

use of org.onosproject.ui.impl.topo.util.TrafficLink in project onos by opennetworkinglab.

the class TrafficMonitorBase method trafficSummary.

// =======================================================================
// === Methods for computing traffic on links
/**
 * Generates a {@link Highlights} object summarizing the traffic on the
 * network, ready to be transmitted back to the client for display on
 * the topology view.
 *
 * @param type the type of statistics to be displayed
 * @return highlights, representing links to be labeled/colored
 */
protected Highlights trafficSummary(TrafficLink.StatsType type) {
    Highlights highlights = new Highlights();
    // TODO: consider whether a map would be better...
    Set<TrafficLink> linksWithTraffic = computeLinksWithTraffic(type);
    Set<TrafficLink> aggregatedLinks = doAggregation(linksWithTraffic);
    for (TrafficLink tlink : aggregatedLinks) {
        highlights.add(tlink.highlight(type));
    }
    return highlights;
}
Also used : Highlights(org.onosproject.ui.topo.Highlights) TrafficLink(org.onosproject.ui.impl.topo.util.TrafficLink)

Example 4 with TrafficLink

use of org.onosproject.ui.impl.topo.util.TrafficLink in project onos by opennetworkinglab.

the class TrafficMonitorBase method processLinks.

protected void processLinks(TrafficLinkMap linkMap, Iterable<Link> links, LinkHighlight.Flavor flavor, boolean isOptical, boolean showTraffic) {
    if (links != null) {
        for (Link link : links) {
            TrafficLink tlink = linkMap.add(link);
            tlink.tagFlavor(flavor);
            tlink.optical(isOptical);
            if (showTraffic) {
                tlink.addLoad(getLinkFlowLoad(link));
                tlink.antMarch(true);
            }
        }
    }
}
Also used : TrafficLink(org.onosproject.ui.impl.topo.util.TrafficLink) DefaultEdgeLink.createEdgeLink(org.onosproject.net.DefaultEdgeLink.createEdgeLink) Link(org.onosproject.net.Link) DefaultEdgeLink(org.onosproject.net.DefaultEdgeLink) TrafficLink(org.onosproject.ui.impl.topo.util.TrafficLink)

Example 5 with TrafficLink

use of org.onosproject.ui.impl.topo.util.TrafficLink in project onos by opennetworkinglab.

the class TrafficMonitorBase method computeLinksWithTraffic.

/**
 * Generates a set of "traffic links" encapsulating information about the
 * traffic on each link (that is deemed to have traffic).
 *
 * @param type the type of statistics to be displayed
 * @return the set of links with traffic
 */
protected Set<TrafficLink> computeLinksWithTraffic(TrafficLink.StatsType type) {
    TrafficLinkMap linkMap = new TrafficLinkMap();
    compileLinks(linkMap);
    addEdgeLinks(linkMap);
    Set<TrafficLink> linksWithTraffic = new HashSet<>();
    for (TrafficLink tlink : linkMap.biLinks()) {
        if (type == TrafficLink.StatsType.FLOW_STATS) {
            attachFlowLoad(tlink);
        } else if (type == TrafficLink.StatsType.PORT_STATS) {
            attachPortLoad(tlink, BYTES);
        } else if (type == TrafficLink.StatsType.PORT_PACKET_STATS) {
            attachPortLoad(tlink, PACKETS);
        }
        // we only want to report on links deemed to have traffic
        if (tlink.hasTraffic()) {
            linksWithTraffic.add(tlink);
        }
    }
    return linksWithTraffic;
}
Also used : TrafficLink(org.onosproject.ui.impl.topo.util.TrafficLink) TrafficLinkMap(org.onosproject.ui.impl.topo.util.TrafficLinkMap) HashSet(java.util.HashSet)

Aggregations

TrafficLink (org.onosproject.ui.impl.topo.util.TrafficLink)7 Link (org.onosproject.net.Link)4 HashSet (java.util.HashSet)2 DefaultEdgeLink (org.onosproject.net.DefaultEdgeLink)2 DefaultEdgeLink.createEdgeLink (org.onosproject.net.DefaultEdgeLink.createEdgeLink)2 TrafficLinkMap (org.onosproject.ui.impl.topo.util.TrafficLinkMap)2 Highlights (org.onosproject.ui.topo.Highlights)2 HashMap (java.util.HashMap)1 Device (org.onosproject.net.Device)1 Load (org.onosproject.net.statistic.Load)1 UiLinkId (org.onosproject.ui.model.topo.UiLinkId)1 UiSynthLink (org.onosproject.ui.model.topo.UiSynthLink)1