use of org.onosproject.routing.fpm.FpmInfoService in project onos by opennetworkinglab.
the class FpmAcceptRoutesInfoCommand method doExecute.
@Override
protected void doExecute() {
FpmInfoService fpmInfo = get(FpmInfoService.class);
if (peerAddress != null) {
IpAddress address = IpAddress.valueOf(peerAddress);
fpmInfo.peers().entrySet().stream().filter(peer -> peer.getKey().address().equals(address)).map(Map.Entry::getValue).forEach(this::print);
} else {
fpmInfo.peers().entrySet().stream().sorted(Comparator.<Map.Entry<FpmPeer, FpmPeerInfo>, IpAddress>comparing(e -> e.getKey().address()).thenComparing(e -> e.getKey().port())).map(Map.Entry::getValue).forEach(this::print);
}
}
use of org.onosproject.routing.fpm.FpmInfoService in project onos by opennetworkinglab.
the class FpmConnectionsList method doExecute.
@Override
protected void doExecute() {
FpmInfoService fpmInfo = get(FpmInfoService.class);
print(String.format("PD Pushing is %s.", fpmInfo.isPdPushEnabled() ? "enabled" : "disabled"));
if (peerAddress != null) {
IpAddress address = IpAddress.valueOf(peerAddress);
fpmInfo.peers().entrySet().stream().filter(peer -> peer.getKey().address().equals(address)).map(Map.Entry::getValue).forEach(this::print);
} else {
fpmInfo.peers().entrySet().stream().sorted(Comparator.<Map.Entry<FpmPeer, FpmPeerInfo>, IpAddress>comparing(e -> e.getKey().address()).thenComparing(e -> e.getKey().port())).map(Map.Entry::getValue).forEach(this::print);
}
}
use of org.onosproject.routing.fpm.FpmInfoService in project onos by opennetworkinglab.
the class FpmPushRoutesCommand method doExecute.
@Override
protected void doExecute() {
FpmInfoService fpmInfo = get(FpmInfoService.class);
fpmInfo.pushFpmRoutes();
}
use of org.onosproject.routing.fpm.FpmInfoService in project onos by opennetworkinglab.
the class FpmWebResource method getFpmConnectionsJsonOutput.
private ObjectNode getFpmConnectionsJsonOutput() {
FpmInfoService fpmService = get(FpmInfoService.class);
ObjectNode node = mapper().createObjectNode();
ArrayNode connectionArray = mapper().createArrayNode();
Map<FpmPeer, FpmPeerInfo> fpmPeers = fpmService.peers();
fpmPeers.entrySet().stream().sorted(Comparator.<Map.Entry<FpmPeer, FpmPeerInfo>, IpAddress>comparing(e -> e.getKey().address()).thenComparing(e -> e.getKey().port())).map(Map.Entry::getValue).forEach(fpmPeerInfo -> connectionArray.add((new FpmCodec()).encode(fpmPeerInfo, this)));
node.put("fpm-connections", connectionArray);
return node;
}
use of org.onosproject.routing.fpm.FpmInfoService in project onos by opennetworkinglab.
the class FpmSetAcceptRoutesCommand method doExecute.
@Override
protected void doExecute() {
FpmInfoService service = AbstractShellCommand.get(FpmInfoService.class);
IpAddress peerAddress = IpAddress.valueOf(peerAddressString);
boolean isAcceptRoutes = Boolean.parseBoolean(acceptRoutesString);
int port = Integer.parseInt(peerPort);
FpmPeer peer = new FpmPeer(peerAddress, port);
service.updateAcceptRouteFlag(Collections.singleton(new FpmPeerAcceptRoutes(peer, isAcceptRoutes)));
}
Aggregations