use of org.onosproject.net.LinkKey in project onos by opennetworkinglab.
the class OpticalOduIntentCompiler method findTributarySlots.
private Map<LinkKey, Set<TributarySlot>> findTributarySlots(OpticalOduIntent intent, Set<LinkKey> links) {
OduSignalType oduSignalType = OduSignalUtils.mappingCltSignalTypeToOduSignalType(intent.getSignalType());
int requestedTsNum = oduSignalType.tributarySlots();
Map<LinkKey, Set<TributarySlot>> slotsMap = new HashMap<>();
for (LinkKey link : links) {
Set<TributarySlot> common = findCommonTributarySlotsOnCps(link.src(), link.dst());
if (common.isEmpty() || (common.size() < requestedTsNum)) {
log.debug("Failed to find TributarySlots on link {} requestedTsNum={}", link, requestedTsNum);
// failed to find enough available TributarySlots on a link
return Collections.emptyMap();
}
slotsMap.put(link, common.stream().limit(requestedTsNum).collect(Collectors.toSet()));
}
return slotsMap;
}
Aggregations