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