コード例 #1
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);
    }
  }