Exemple #1
0
  @Override
  public Set<Path> getPaths(ElementId src, ElementId dst, LinkWeight weight) {
    checkPermission(TOPOLOGY_READ);

    checkNotNull(src, ELEMENT_ID_NULL);
    checkNotNull(dst, ELEMENT_ID_NULL);

    // Get the source and destination edge locations
    EdgeLink srcEdge = getEdgeLink(src, true);
    EdgeLink dstEdge = getEdgeLink(dst, false);

    // If either edge is null, bail with no paths.
    if (srcEdge == null || dstEdge == null) {
      return ImmutableSet.of();
    }

    DeviceId srcDevice = srcEdge != NOT_HOST ? srcEdge.dst().deviceId() : (DeviceId) src;
    DeviceId dstDevice = dstEdge != NOT_HOST ? dstEdge.src().deviceId() : (DeviceId) dst;

    // If the source and destination are on the same edge device, there
    // is just one path, so build it and return it.
    if (srcDevice.equals(dstDevice)) {
      return edgeToEdgePaths(srcEdge, dstEdge);
    }

    // Otherwise get all paths between the source and destination edge
    // devices.
    Topology topology = topologyService.currentTopology();
    Set<Path> paths =
        weight == null
            ? topologyService.getPaths(topology, srcDevice, dstDevice)
            : topologyService.getPaths(topology, srcDevice, dstDevice, weight);

    return edgeToEdgePaths(srcEdge, dstEdge, paths);
  }
 // Floods the specified packet if permissible.
 private void flood(PacketContext context) {
   if (topologyService.isBroadcastPoint(
       topologyService.currentTopology(), context.inPacket().receivedFrom())) {
     packetOut(context, PortNumber.FLOOD);
   } else {
     context.block();
   }
 }
Exemple #3
0
 @Deactivate
 public void deactivate() {
   topologyService.removeListener(listener);
   resourceManager.removeListener(linkResourceListener);
   deviceService.removeListener(deviceListener);
   hostService.removeListener(hostListener);
   partitionService.removeListener(partitionListener);
   log.info("Stopped");
 }
Exemple #4
0
 @Activate
 public void activate() {
   topologyService.addListener(listener);
   resourceManager.addListener(linkResourceListener);
   deviceService.addListener(deviceListener);
   hostService.addListener(hostListener);
   partitionService.addListener(partitionListener);
   log.info("Started");
 }