use of org.onosproject.routing.fpm.FpmPeerInfo 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.FpmPeerInfo 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.FpmPeerInfo 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.FpmPeerInfo in project onos by opennetworkinglab.
the class FpmWebResource method getFpmPeerRouteInfoJsonOutput.
private ObjectNode getFpmPeerRouteInfoJsonOutput() {
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 -> {
fpmPeerInfo.connections().forEach(connection -> {
ObjectNode fpmNode = mapper().createObjectNode();
fpmNode.put(PEER_ADDRESS, connection.peer().address().toString());
fpmNode.put(PEER_PORT, connection.peer().port());
fpmNode.put(ACCEPT_ROUTES, connection.isAcceptRoutes());
connectionArray.add(fpmNode);
});
});
node.put("fpm-peer-info", connectionArray);
return node;
}
use of org.onosproject.routing.fpm.FpmPeerInfo in project onos by opennetworkinglab.
the class FpmWebResource method getFpmPeerAcceptFlagInfoJsonOutput.
private ObjectNode getFpmPeerAcceptFlagInfoJsonOutput(String address) {
FpmInfoService fpmService = get(FpmInfoService.class);
ObjectNode fpmNode = mapper().createObjectNode();
Map<FpmPeer, FpmPeerInfo> fpmPeers = fpmService.peers();
IpAddress peerAddress = IpAddress.valueOf(address);
fpmPeers.entrySet().stream().filter(peer -> peer.getKey().address().equals(peerAddress)).map(Map.Entry::getValue).forEach(fpmPeerInfo -> {
fpmPeerInfo.connections().forEach(connection -> {
fpmNode.put(ACCEPT_ROUTES, connection.isAcceptRoutes());
});
});
return fpmNode;
}
Aggregations