use of org.onosproject.segmentrouting.SegmentRoutingService in project trellis-control by opennetworkinglab.
the class McastRoleListCommand method doExecute.
@Override
protected void doExecute() {
// Verify mcast group
IpAddress mcastGroup = null;
// We want to use source cp only for a specific group
ConnectPoint sourcecp = null;
if (!isNullOrEmpty(gAddr)) {
mcastGroup = IpAddress.valueOf(gAddr);
if (!isNullOrEmpty(source)) {
sourcecp = ConnectPoint.deviceConnectPoint(source);
}
}
// Get SR service, the roles and the groups
SegmentRoutingService srService = get(SegmentRoutingService.class);
Map<McastRoleStoreKey, McastRole> keyToRole = srService.getMcastRoles(mcastGroup, sourcecp);
Set<IpAddress> mcastGroups = keyToRole.keySet().stream().map(McastRoleStoreKey::mcastIp).collect(Collectors.toSet());
// Print the trees for each group
mcastGroups.forEach(group -> {
// Create a new map for the group
Map<ConnectPoint, Multimap<McastRole, DeviceId>> roleDeviceIdMap = Maps.newHashMap();
keyToRole.entrySet().stream().filter(entry -> entry.getKey().mcastIp().equals(group)).forEach(entry -> roleDeviceIdMap.compute(entry.getKey().source(), (gsource, map) -> {
map = map == null ? ArrayListMultimap.create() : map;
map.put(entry.getValue(), entry.getKey().deviceId());
return map;
}));
roleDeviceIdMap.forEach((gsource, map) -> {
// Print the map
printMcastRole(group, gsource, map.get(McastRole.INGRESS), map.get(McastRole.TRANSIT), map.get(McastRole.EGRESS));
});
});
}
use of org.onosproject.segmentrouting.SegmentRoutingService in project trellis-control by opennetworkinglab.
the class NextMacVlanCommand method doExecute.
@Override
protected void doExecute() {
SegmentRoutingService srService = AbstractShellCommand.get(SegmentRoutingService.class);
print(srService.getMacVlanNextObjStore());
}
use of org.onosproject.segmentrouting.SegmentRoutingService in project trellis-control by opennetworkinglab.
the class NextVlanCommand method doExecute.
@Override
protected void doExecute() {
SegmentRoutingService srService = AbstractShellCommand.get(SegmentRoutingService.class);
print(srService.getVlanNextObjStore());
}
use of org.onosproject.segmentrouting.SegmentRoutingService in project trellis-control by opennetworkinglab.
the class PseudowireAddCommand method doExecute.
@Override
protected void doExecute() {
SegmentRoutingService srService = AbstractShellCommand.get(SegmentRoutingService.class);
L2Tunnel tun;
L2TunnelPolicy policy;
try {
tun = new DefaultL2Tunnel(parseMode(mode), parseVlan(sDTag), parsePwId(pwId), parsePWLabel(pwLabel));
} catch (IllegalArgumentException e) {
log.error("Exception while parsing L2Tunnel : \n\t %s", e.getMessage());
print("Exception while parsing L2Tunnel : \n\t %s", e.getMessage());
return;
}
try {
policy = new DefaultL2TunnelPolicy(parsePwId(pwId), ConnectPoint.deviceConnectPoint(cP1), parseVlan(cP1InnerVlan), parseVlan(cP1OuterVlan), ConnectPoint.deviceConnectPoint(cP2), parseVlan(cP2InnerVlan), parseVlan(cP2OuterVlan));
} catch (IllegalArgumentException e) {
log.error("Exception while parsing L2TunnelPolicy : \n\t %s", e.getMessage());
print("Exception while parsing L2TunnelPolicy : \n\t %s", e.getMessage());
return;
}
L2TunnelDescription pw = new DefaultL2TunnelDescription(tun, policy);
L2TunnelHandler.Result res = srService.addPseudowire(pw);
log.info("Deploying pseudowire {} via the command line.", pw);
switch(res) {
case WRONG_PARAMETERS:
print("Pseudowire could not be added , error in the parameters : \n\t%s", res.getSpecificError());
break;
case CONFIGURATION_ERROR:
print("Pseudowire could not be added, configuration error : \n\t%s", res.getSpecificError());
break;
case PATH_NOT_FOUND:
print("Pseudowire path not found : \n\t%s", res.getSpecificError());
break;
case INTERNAL_ERROR:
print("Pseudowire could not be added, internal error : \n\t%s", res.getSpecificError());
break;
case SUCCESS:
break;
default:
break;
}
}
use of org.onosproject.segmentrouting.SegmentRoutingService in project trellis-control by opennetworkinglab.
the class PseudowireListCommand method doExecute.
@Override
protected void doExecute() {
SegmentRoutingService srService = AbstractShellCommand.get(SegmentRoutingService.class);
srService.getL2TunnelDescriptions(false).forEach(pw -> printPseudowire(pw, false));
srService.getL2TunnelDescriptions(true).forEach(pw -> printPseudowire(pw, true));
}
Aggregations