Search in sources :

Example 6 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 7 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)

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