use of org.onosproject.segmentrouting.SegmentRoutingService in project trellis-control by opennetworkinglab.
the class BlackHoleCommand method doExecute.
@Override
protected void doExecute() {
SegmentRoutingService srService = AbstractShellCommand.get(SegmentRoutingService.class);
NetworkConfigService netcfgService = AbstractShellCommand.get(NetworkConfigService.class);
SegmentRoutingAppConfig appConfig = netcfgService.getConfig(srService.appId(), SegmentRoutingAppConfig.class);
if (appConfig == null) {
JsonNode jsonNode = new ObjectMapper().createObjectNode();
netcfgService.applyConfig(srService.appId(), SegmentRoutingAppConfig.class, jsonNode);
appConfig = netcfgService.getConfig(srService.appId(), SegmentRoutingAppConfig.class);
}
Set<IpPrefix> blackHoleIps;
switch(op) {
case "list":
appConfig.blackholeIPs().forEach(prefix -> print(prefix.toString()));
break;
case "add":
blackHoleIps = Sets.newConcurrentHashSet(appConfig.blackholeIPs());
blackHoleIps.add(IpPrefix.valueOf(prefix));
appConfig.setBalckholeIps(blackHoleIps);
appConfig.apply();
break;
case "remove":
blackHoleIps = Sets.newConcurrentHashSet(appConfig.blackholeIPs());
blackHoleIps.remove(IpPrefix.valueOf(prefix));
appConfig.setBalckholeIps(blackHoleIps);
appConfig.apply();
break;
default:
throw new UnsupportedOperationException("Unknown operation " + op);
}
}
use of org.onosproject.segmentrouting.SegmentRoutingService in project trellis-control by opennetworkinglab.
the class DeviceSubnetListCommand method doExecute.
@Override
protected void doExecute() {
SegmentRoutingService srService = AbstractShellCommand.get(SegmentRoutingService.class);
printDeviceSubnetMap(srService.getDeviceSubnetMap());
}
use of org.onosproject.segmentrouting.SegmentRoutingService in project trellis-control by opennetworkinglab.
the class InvalidateNextCommand method doExecute.
@Override
protected void doExecute() {
if (please == null || !please.equals(CONFIRM_PHRASE)) {
print("WARNING: System may enter an unpredictable state if the next ID is force invalidated." + "Enter confirmation phrase to continue.");
return;
}
try {
SegmentRoutingService srService = AbstractShellCommand.get(SegmentRoutingService.class);
srService.invalidateNextObj(Integer.parseInt(nextId));
} catch (ServiceNotFoundException e) {
print("SegmentRoutingService unavailable");
}
}
use of org.onosproject.segmentrouting.SegmentRoutingService in project trellis-control by opennetworkinglab.
the class LinkStateCommand method doExecute.
@Override
protected void doExecute() {
SegmentRoutingService srService = AbstractShellCommand.get(SegmentRoutingService.class);
printLinkState(srService.getSeenLinks(), srService.getDownedPortState());
}
use of org.onosproject.segmentrouting.SegmentRoutingService in project trellis-control by opennetworkinglab.
the class McastLeaderListCommand 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<IpAddress, NodeId> keyToRole = srService.getMcastLeaders(mcastGroup);
// And print local cache
keyToRole.forEach(this::printMcastLeder);
}
Aggregations