Search in sources :

Example 1 with FpmInfoService

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);
    }
}
Also used : FpmInfoService(org.onosproject.routing.fpm.FpmInfoService) AbstractShellCommand(org.onosproject.cli.AbstractShellCommand) FpmPeer(org.onosproject.routing.fpm.FpmPeer) FpmInfoService(org.onosproject.routing.fpm.FpmInfoService) FpmPeerInfo(org.onosproject.routing.fpm.FpmPeerInfo) Map(java.util.Map) Service(org.apache.karaf.shell.api.action.lifecycle.Service) Argument(org.apache.karaf.shell.api.action.Argument) Comparator(java.util.Comparator) Command(org.apache.karaf.shell.api.action.Command) IpAddress(org.onlab.packet.IpAddress) IpAddress(org.onlab.packet.IpAddress) Map(java.util.Map)

Example 2 with FpmInfoService

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);
    }
}
Also used : FpmInfoService(org.onosproject.routing.fpm.FpmInfoService) AbstractShellCommand(org.onosproject.cli.AbstractShellCommand) FpmPeer(org.onosproject.routing.fpm.FpmPeer) FpmInfoService(org.onosproject.routing.fpm.FpmInfoService) Tools(org.onlab.util.Tools) FpmPeerInfo(org.onosproject.routing.fpm.FpmPeerInfo) Map(java.util.Map) Service(org.apache.karaf.shell.api.action.lifecycle.Service) Argument(org.apache.karaf.shell.api.action.Argument) ClusterService(org.onosproject.cluster.ClusterService) Comparator(java.util.Comparator) Command(org.apache.karaf.shell.api.action.Command) IpAddress(org.onlab.packet.IpAddress) IpAddress(org.onlab.packet.IpAddress) Map(java.util.Map)

Example 3 with FpmInfoService

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();
}
Also used : FpmInfoService(org.onosproject.routing.fpm.FpmInfoService)

Example 4 with FpmInfoService

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;
}
Also used : FpmInfoService(org.onosproject.routing.fpm.FpmInfoService) FpmPeerInfo(org.onosproject.routing.fpm.FpmPeerInfo) PathParam(javax.ws.rs.PathParam) AbstractWebResource(org.onosproject.rest.AbstractWebResource) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET) LoggerFactory(org.slf4j.LoggerFactory) Path(javax.ws.rs.Path) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) FpmInfoService(org.onosproject.routing.fpm.FpmInfoService) MediaType(javax.ws.rs.core.MediaType) Consumes(javax.ws.rs.Consumes) Map(java.util.Map) Tools.nullIsIllegal(org.onlab.util.Tools.nullIsIllegal) IpAddress(org.onlab.packet.IpAddress) Logger(org.slf4j.Logger) POST(javax.ws.rs.POST) IOException(java.io.IOException) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) FpmPeer(org.onosproject.routing.fpm.FpmPeer) List(java.util.List) Response(javax.ws.rs.core.Response) FpmPeerInfo(org.onosproject.routing.fpm.FpmPeerInfo) FpmPeerAcceptRoutes(org.onosproject.routing.fpm.FpmPeerAcceptRoutes) Tools.readTreeFromStream(org.onlab.util.Tools.readTreeFromStream) Comparator(java.util.Comparator) InputStream(java.io.InputStream) ObjectNode(com.fasterxml.jackson.databind.node.ObjectNode) IpAddress(org.onlab.packet.IpAddress) ArrayNode(com.fasterxml.jackson.databind.node.ArrayNode) FpmPeer(org.onosproject.routing.fpm.FpmPeer) Map(java.util.Map)

Example 5 with FpmInfoService

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)));
}
Also used : FpmInfoService(org.onosproject.routing.fpm.FpmInfoService) FpmPeerAcceptRoutes(org.onosproject.routing.fpm.FpmPeerAcceptRoutes) IpAddress(org.onlab.packet.IpAddress) FpmPeer(org.onosproject.routing.fpm.FpmPeer)

Aggregations

FpmInfoService (org.onosproject.routing.fpm.FpmInfoService)8 IpAddress (org.onlab.packet.IpAddress)6 FpmPeer (org.onosproject.routing.fpm.FpmPeer)6 Map (java.util.Map)5 FpmPeerInfo (org.onosproject.routing.fpm.FpmPeerInfo)5 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)4 Comparator (java.util.Comparator)4 FpmPeerAcceptRoutes (org.onosproject.routing.fpm.FpmPeerAcceptRoutes)4 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)3 IOException (java.io.IOException)3 Consumes (javax.ws.rs.Consumes)3 POST (javax.ws.rs.POST)3 Path (javax.ws.rs.Path)3 Produces (javax.ws.rs.Produces)3 InputStream (java.io.InputStream)2 List (java.util.List)2 GET (javax.ws.rs.GET)2 PathParam (javax.ws.rs.PathParam)2 MediaType (javax.ws.rs.core.MediaType)2 Response (javax.ws.rs.core.Response)2