use of org.onosproject.ui.model.topo.UiSynthLink in project onos by opennetworkinglab.
the class Topo2Jsonifier method json.
private ObjectNode json(Set<UiSynthLink> memberSet) {
ArrayNode rollup = arrayNode();
ObjectNode node = null;
boolean first = true;
for (UiSynthLink member : memberSet) {
UiLink link = member.link();
if (first) {
node = json(link);
first = false;
}
rollup.add(json(member.original()));
}
if (node != null) {
node.set("rollup", rollup);
}
return node;
}
use of org.onosproject.ui.model.topo.UiSynthLink in project onos by opennetworkinglab.
the class Topo2Jsonifier method collateSynthLinks.
private ArrayNode collateSynthLinks(List<UiSynthLink> links) {
Map<UiLinkId, Set<UiSynthLink>> collation = new HashMap<>();
// first, group together the synthlinks into sets per ID...
for (UiSynthLink sl : links) {
UiLinkId id = sl.link().id();
Set<UiSynthLink> rollup = collation.computeIfAbsent(id, k -> new HashSet<>());
rollup.add(sl);
}
// now add json nodes per set, and return the array of them
ArrayNode array = arrayNode();
for (UiLinkId id : collation.keySet()) {
array.add(json(collation.get(id)));
}
return array;
}
use of org.onosproject.ui.model.topo.UiSynthLink in project onos by opennetworkinglab.
the class Topo2ViewMessageHandler method mkRegionMessage.
private ObjectNode mkRegionMessage(UiTopoLayout currentLayout) {
UiRegion region = topoSession.getRegion(currentLayout);
Set<UiRegion> kids = topoSession.getSubRegions(currentLayout);
List<UiSynthLink> links = topoSession.getLinks(currentLayout);
return t2json.region(region, kids, links);
}
use of org.onosproject.ui.model.topo.UiSynthLink 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