use of org.onosproject.segmentrouting.SegmentRoutingService in project trellis-control by opennetworkinglab.
the class McastNextListCommand method doExecute.
@Override
protected void doExecute() {
// Verify mcast group
IpAddress mcastGroup = null;
if (!isNullOrEmpty(gAddr)) {
mcastGroup = IpAddress.valueOf(gAddr);
}
// Get SR service
SegmentRoutingService srService = get(SegmentRoutingService.class);
// Get the mapping
Map<McastStoreKey, Integer> keyToNextId = srService.getMcastNextIds(mcastGroup);
// Reduce to the set of mcast groups
Set<IpAddress> mcastGroups = keyToNextId.keySet().stream().map(McastStoreKey::mcastIp).collect(Collectors.toSet());
// Print the nextids for each group
mcastGroups.forEach(group -> {
// Create a new map for the group
Map<Pair<DeviceId, VlanId>, Integer> deviceIdNextMap = Maps.newHashMap();
keyToNextId.entrySet().stream().filter(entry -> entry.getKey().mcastIp().equals(group)).forEach(entry -> deviceIdNextMap.put(Pair.of(entry.getKey().deviceId(), entry.getKey().vlanId()), entry.getValue()));
// Print the map
printMcastNext(group, deviceIdNextMap);
});
}
Aggregations