use of org.onosproject.routing.fpm.FpmPeer 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.FpmPeer 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