private void sendMouseData() {
   if (elementOfNote != null && elementOfNote instanceof Device) {
     DeviceId devId = (DeviceId) elementOfNote.id();
     Set<Link> links = linkService.getDeviceEgressLinks(devId);
     sendHighlights(fromLinks(links, devId));
   }
   // Note: could also process Host, if available
 }
 private void initLinkSet() {
   Set<Link> links = new HashSet<>();
   for (Link link : linkService.getActiveLinks()) {
     links.add(link);
   }
   linkSet = links.toArray(new Link[links.size()]);
   linkIndex = 0;
   log.debug("initialized link set to {}", linkSet.length);
 }
Ejemplo n.º 3
0
  @Override
  protected void execute() {
    LinkResourceService resourceService = get(LinkResourceService.class);
    LinkService linkService = get(LinkService.class);

    if (srcString == null || dstString == null) {
      print("----- Displaying all resource allocations -----");
      resourceService.getAllocations().forEach(alloc -> print("%s", alloc));
      return;
    }

    ConnectPoint src = ConnectPoint.deviceConnectPoint(srcString);
    ConnectPoint dst = ConnectPoint.deviceConnectPoint(dstString);

    Link link = linkService.getLink(src, dst);
    if (link != null) {
      resourceService.getAllocations(link).forEach(alloc -> print("%s", alloc));
    } else {
      print("No path found for endpoints: %s, %s", src, dst);
    }
  }