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);
}
}
}
}
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;
}
Aggregations