示例#1
0
    print("Launching", args.node_num, "nodes (", clusters, "clusters of", node_per_loc, "nodes)")

    if args.virtual_locs > 1:
        cmd = ["python3", "virtual_network_builder.py", "-i", args.ifname, "-n", str(clusters), '-l', str(args.loss), '-d', str(args.delay)]
        if not args.disable_ipv4:
            cmd.append('-4')
        if not args.disable_ipv6:
            cmd.append('-6')
        print(cmd)
        p = subprocess.Popen(cmd, stdout=subprocess.PIPE)
        output, err = p.communicate()
        print(output.decode())

    bootstrap = DhtNetwork(iface='br'+args.ifname, first_bootstrap=False if args.bootstrap else True, bootstrap=[(args.bootstrap, "5000")] if args.bootstrap else [])
    bootstrap.resize(1)

    procs = [None for _ in range(clusters)]

    try:
        for i in range(clusters):
            start_cluster(i)

        if args.gets:
            getsTimesTest()

    except Exception as e:
        print(e)
    finally:
        for p in procs:
            if p: