Beispiel #1
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'libutp')
    src = path.join(cc_repo, 'ucat-static')

    if args.option == 'setup':
        check_call(['make', '-j'], cwd=cc_repo)
        return

    if args.option == 'receiver':
        cmd = [src, '-l', '-p', args.port]
        # suppress stdout as it prints all the bytes received
        with open(os.devnull, 'w') as devnull:
            check_call(cmd, stdout=devnull)
        return

    if args.option == 'sender':
        cmd = [src, args.ip, args.port]
        proc = Popen(cmd, stdin=PIPE)

        # send at full speed
        timeout = time.time() + 75
        while True:
            proc.stdin.write(os.urandom(1024))
            proc.stdin.flush()
            if time.time() > timeout:
                break

        if proc:
            proc.kill()
        return
Beispiel #2
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'libutp')
    src = path.join(cc_repo, 'ucat-static')

    if args.option == 'setup':
        check_call(['make', '-j'], cwd=cc_repo)
        return

    if args.option == 'receiver':
        cmd = [src, '-l', '-p', args.port]
        # suppress stdout as it prints all the bytes received
        with open(os.devnull, 'w') as devnull:
            check_call(cmd, stdout=devnull)
        return

    if args.option == 'sender':
        cmd = [src, args.ip, args.port]
        proc = Popen(cmd, stdin=PIPE)

        # send at full speed
        timeout = time.time() + 120
        while True:
            proc.stdin.write(os.urandom(1024))
            proc.stdin.flush()
            if time.time() > timeout:
                break

        if proc:
            proc.kill()
        return
Beispiel #3
0
def main():
    # use 'arg_parser' to ensure a common test interface
    args = arg_parser.receiver_first()  # or 'arg_parser.sender_first()'

    # paths to the sender and receiver executables, etc.
    cc_repo = path.join(context.third_party_dir, 'example_cc_repo')
    send_src = path.join(cc_repo, 'example_sender')
    recv_src = path.join(cc_repo, 'example_receiver')

    # [optional] dependencies of Debian packages
    if args.option == 'deps':
        print ('example_dep_1 example_dep_2')
        return

    # [optional] persistent setup that only needs to be run once
    if args.option == 'setup':
        # avoid running as root here
        return

    # [optional] non-persistent setup that should be performed on every reboot
    if args.option == 'setup_after_reboot':
        # avoid running as root here
        return

    # [required] run the first side on port 'args.port'
    if args.option == 'receiver':
        cmd = [recv_src, args.port]
        check_call(cmd)
        return

    # [required] run the other side to connect to the first side on 'args.ip'
    if args.option == 'sender':
        cmd = [send_src, args.ip, args.port]
        check_call(cmd)
        return
Beispiel #4
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'fillp-sheep')
    send_dir = path.join(cc_repo, 'client')
    recv_dir = path.join(cc_repo, 'server')
    send_src = path.join(send_dir, 'client')
    recv_src = path.join(recv_dir, 'server')

    if args.option == 'receiver':
        os.environ['LD_LIBRARY_PATH'] = recv_dir
        cmd = [
            recv_src, '-s', '0.0.0.0', '-p', args.port, '-r', 'testcase001',
            '-t', '60'
        ]
        check_call(cmd, cwd=utils.tmp_dir)
        return

    if args.option == 'sender':
        os.environ['LD_LIBRARY_PATH'] = send_dir
        cmd = [
            send_src, '-c', args.ip, '-p', args.port, '-r', 'testcase001',
            '-t', '60'
        ]
        check_call(cmd, cwd=utils.tmp_dir)
        return
Beispiel #5
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'aurora')
    src_dir = path.join(cc_repo, 'src')
    lib_dir = path.join(src_dir, 'core')
    app_dir = path.join(src_dir, 'app')
    send_src = path.join(app_dir, 'pccclient')
    recv_src = path.join(app_dir, 'pccserver')

    if args.option == 'setup':
        #cmd = ['git', 'checkout', 'deep-learning']
        #check_call(cmd)
        check_call(['make'], cwd=src_dir)
        return

    if args.option == 'receiver':
        os.environ['LD_LIBRARY_PATH'] = path.join(lib_dir)
        cmd = [recv_src, 'recv', args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        os.environ['LD_LIBRARY_PATH'] = path.join(lib_dir)
        arguments1 = '--pcc-rate-control=python -pyhelper=loaded_client --history-len=10 --pcc-utility-calc=linear '
        arguments2 = '-pypath=%s/src/udt-plugins/testing/ --model-path=%s' % (
            cc_repo, '../cc_repo/')
        cmd = [send_src, 'send', args.ip, args.port, arguments1, arguments2]
        check_call(cmd)
        return
Beispiel #6
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'copt')
    recv_src = path.join(cc_repo, 'server.py')
    send_src = path.join(cc_repo, 'client.py')

    if args.option == 'deps':
        print('deps for copt')
        return

    if args.option == 'setup':
        check_call(['make'])
        check_call(['sudo', 'insmod', 'tcp_pcc.ko'])
        return

    if args.option == 'receiver':
        cmd = [recv_src, args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        cmd = [send_src, args.port]
        check_call(cmd)
        return
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'pcc-experimental')
    src_dir = path.join(cc_repo, 'src')
    lib_dir = path.join(src_dir, 'core')
    app_dir = path.join(src_dir, 'app')
    send_src = path.join(app_dir, 'pccclient')
    recv_src = path.join(app_dir, 'pccserver')

    if args.option == 'setup':
        check_call(['make'], cwd=src_dir)
        return

    if args.option == 'receiver':
        os.environ['LD_LIBRARY_PATH'] = path.join(lib_dir)
        cmd = [recv_src, 'recv', args.port]
        sys.stderr.write(str(cmd))
        sys.stderr.write('\n')
        check_call(cmd)
        return

    if args.option == 'sender':
        os.environ['LD_LIBRARY_PATH'] = path.join(lib_dir)
        cmd = [send_src, 'send', args.ip, args.port]
        sys.stderr.write(str(cmd))
        sys.stderr.write('\n')
        check_call(cmd)
        return
Beispiel #8
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'taoLearn')
    recv_src = path.join(cc_repo, 'receiver')
    send_src = path.join(cc_repo, 'sender')

    if args.option == 'deps':
        print('makepp libboost-dev libprotobuf-dev protobuf-c-compiler '
              'protobuf-compiler libjemalloc-dev libboost-python-dev')
        return

    if args.option == 'setup':
        check_call(['makepp'], cwd=cc_repo)
        return

    if args.option == 'receiver':
        cmd = [recv_src, args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        rat_file = path.join(cc_repo, 'remy-link-1000x.dna')
        sh_cmd = (
            'export MIN_RTT=1000000 && %s serverip=%s serverport=%s if=%s '
            'offduration=1 onduration=1000000 traffic_params=deterministic,'
            'num_cycles=1' % (send_src, args.ip, args.port, rat_file))
        check_call(sh_cmd, shell=True)
        return
Beispiel #9
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'sprout')
    model = path.join(cc_repo, 'src', 'examples', 'sprout.model')
    src = path.join(cc_repo, 'src', 'examples', 'sproutbt2')

    if args.option == 'deps':
        print ('libboost-math-dev libssl-dev libprotobuf-dev '
               'protobuf-compiler libncurses5-dev')
        return

    if args.option == 'setup':
        # apply patch to reduce MTU size
        utils.apply_patch('sprout.patch', cc_repo)

        sh_cmd = './autogen.sh && ./configure --enable-examples && make -j'
        check_call(sh_cmd, shell=True, cwd=cc_repo)
        return

    if args.option == 'receiver':
        os.environ['SPROUT_MODEL_IN'] = model
        cmd = [src, args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        os.environ['SPROUT_MODEL_IN'] = model
        cmd = [src, args.ip, args.port]
        check_call(cmd)
        return
Beispiel #10
0
def main(delta_conf):
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'genericCC')
    recv_src = path.join(cc_repo, 'receiver')
    send_src = path.join(cc_repo, 'sender')

    if args.option == 'deps':
        print ('makepp libboost-dev libprotobuf-dev protobuf-c-compiler '
               'protobuf-compiler libjemalloc-dev libboost-python-dev')
        return

    if args.option == 'setup':
        check_call(['makepp'], cwd=cc_repo)
        return

    if args.option == 'receiver':
        cmd = [recv_src, args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        sh_cmd = (
            'export MIN_RTT=1000000 && %s serverip=%s serverport=%s '
            'offduration=1 onduration=1000000 traffic_params=deterministic,'
            'num_cycles=1 cctype=markovian delta_conf=%s'
            % (send_src, args.ip, args.port, delta_conf))

        with open(os.devnull, 'w') as devnull:
            # suppress debugging output to stdout
            check_call(sh_cmd, shell=True, stdout=devnull)
        return
Beispiel #11
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'autocc')
    send_src = path.join(cc_repo, 'pccclient')
    recv_src = path.join(cc_repo, 'pccserver')

    if args.option == 'setup':
        check_call(['sudo pip install gym'], shell=True)
        return

    if args.option == 'sender':
        # cmd = ['''export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lixu/PCC-Uspace/src/core/''']
        # check_call(cmd)
        cmd = [
            send_src, "send", args.ip, args.port,
            "--pcc-rate-control=python -pyhelper=loaded\_client -pypath=/home/lixu/PCC-RL/src/udt-plugins/auto_testing/ --history-len=10 --pcc-utility-calc=linear --model-path=/home/lixu/PCC-RL/src/udt-plugins/auto_testing/autoxxxxpb/ --preference=0.6"
        ]
        print(cmd)
        check_call(cmd)
        return

    if args.option == 'receiver':
        # cmd = ['''export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/lixu/PCC-Uspace/src/core/''']
        # check_call(cmd)
        cmd = [recv_src, "recv", args.port]
        print(cmd)
        check_call(cmd)
        return
Beispiel #12
0
def main():
    # use 'arg_parser' to ensure a common test interface
    args = arg_parser.receiver_first()  # or 'arg_parser.sender_first()'

    # paths to the sender and receiver executables, etc.
    cc_repo = path.join(context.third_party_dir, 'example_cc_repo')
    send_src = path.join(cc_repo, 'example_sender')
    recv_src = path.join(cc_repo, 'example_receiver')

    # [optional] dependencies of Debian packages
    if args.option == 'deps':
        print 'example_dep_1 example_dep_2'
        return

    # [optional] persistent setup that only needs to be run once
    if args.option == 'setup':
        # avoid running as root here
        return

    # [optional] non-persistent setup that should be performed on every reboot
    if args.option == 'setup_after_reboot':
        # avoid running as root here
        return

    # [required] run the first side on port 'args.port'
    if args.option == 'receiver':
        cmd = [recv_src, args.port]
        check_call(cmd)
        return

    # [required] run the other side to connect to the first side on 'args.ip'
    if args.option == 'sender':
        cmd = [send_src, args.ip, args.port]
        check_call(cmd)
        return
Beispiel #13
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'pcc')
    recv_dir = path.join(cc_repo, 'receiver')
    send_dir = path.join(cc_repo, 'sender')
    recv_src = path.join(recv_dir, 'app', 'appserver')
    send_src = path.join(send_dir, 'app', 'appclient')

    if args.option == 'setup':
        # apply patch to reduce MTU size
        utils.apply_patch('pcc.patch', cc_repo)

        check_call(['make'], cwd=recv_dir)
        check_call(['make'], cwd=send_dir)
        return

    if args.option == 'receiver':
        os.environ['LD_LIBRARY_PATH'] = path.join(recv_dir, 'src')
        cmd = [recv_src, args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        os.environ['LD_LIBRARY_PATH'] = path.join(send_dir, 'src')
        cmd = [send_src, args.ip, args.port]
        # suppress debugging output to stderr
        with open(os.devnull, 'w') as devnull:
            check_call(cmd, stderr=devnull)
        return
Beispiel #14
0
def main(delta_conf):
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'genericCC')
    recv_src = path.join(cc_repo, 'receiver')
    send_src = path.join(cc_repo, 'sender')

    if args.option == 'deps':
        print ('makepp libboost-dev libprotobuf-dev protobuf-c-compiler '
               'protobuf-compiler libjemalloc-dev libboost-python-dev')
        return

    if args.option == 'setup':
        check_call(['makepp'], cwd=cc_repo)
        return

    if args.option == 'receiver':
        cmd = [recv_src, args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        sh_cmd = (
            'export MIN_RTT=1000000 && %s serverip=%s serverport=%s '
            'offduration=1 onduration=1000000 traffic_params=deterministic,'
            'num_cycles=1 cctype=markovian delta_conf=%s'
            % (send_src, args.ip, args.port, delta_conf))

        with open(os.devnull, 'w') as devnull:
            # suppress debugging output to stdout
            check_call(sh_cmd, shell=True, stdout=devnull)
        return
Beispiel #15
0
def main():
    args = arg_parser.receiver_first()

    if args.option == 'deps':
        print 'iperf'
        return

    if args.option == 'receiver':
        cmd = ['iperf', '-Z', 'tcp_ss', '-s', '-p', args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        if args.flowsize:
            cmd = [
                'iperf', '-Z', 'tcp_ss', '-c', args.ip, '-p', args.port, '-n',
                args.flowsize
            ]
        else:
            cmd = [
                'iperf', '-Z', 'tcp_ss', '-c', args.ip, '-p', args.port, '-t',
                '75'
            ]
        check_call(cmd)
        return
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'pcc-experimental')
    src_dir = path.join(cc_repo, 'src')
    lib_dir = path.join(src_dir, 'core')
    app_dir = path.join(src_dir, 'app')
    send_src = path.join(app_dir, 'pccclient')
    recv_src = path.join(app_dir, 'pccserver')

    if args.option == 'setup':
        check_call(['make'], cwd=src_dir)
        return

    if args.option == 'receiver':
        os.environ['LD_LIBRARY_PATH'] = path.join(lib_dir)
        cmd = [recv_src, 'recv', args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        os.environ['LD_LIBRARY_PATH'] = path.join(lib_dir)
        cmd = [send_src, 'send', args.ip, args.port]
        check_call(cmd)
        return
Beispiel #17
0
def main(delta_conf):
    args = arg_parser.receiver_first(http_reversed=True)

    cc_repo = path.join(context.third_party_dir, 'genericCC')
    recv_src = path.join(cc_repo, 'receiver')
    send_src = path.join(cc_repo, 'sender')

    if args.option == 'deps':
        print(
            'makepp libboost-dev libprotobuf-dev protobuf-c-compiler '
            'protobuf-compiler libjemalloc-dev libboost-python-dev')
        return

    if args.option == 'setup':
        check_call(['makepp'], cwd=cc_repo)
        return

    if args.option == 'receiver':
        cmd = [recv_src, args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        sh_cmd = (
            'export MIN_RTT=1000000 && %s serverip=%s serverport=%s '
            'offduration=1 onduration=1000000 traffic_params=deterministic,'
            'num_cycles=1 cctype=markovian delta_conf=%s' %
            (send_src, args.ip, args.port, delta_conf))

        with open(os.devnull, 'w') as devnull:
            # suppress debugging output to stdout
            check_call(sh_cmd, shell=True, stdout=devnull)
        return

    if args.option == 'http_server':
        sys.path.append(cc_repo)
        import pygenericcc
        sender = pygenericcc.COPASender('do_ss:auto:0.1', args.ip,
                                        int(args.port), 0)
        with open(os.path.join(cc_repo, 'index.html'), 'r') as f:
            line = f.read()
            # pay attention to the type conversions between python and c++
            sender.send(line, len(line), 1)

    if args.option == 'http_client':
        sys.path.append(cc_repo)
        import pygenericcc

        receiver = pygenericcc.Receiver(int(args.port))
        filename = os.path.join(utils.tmp_dir, 'copa_index.html')
        try:
            p = Process(target=recvfrom, args=(receiver, filename))
            p.start()
            p.join()
        except:
            print traceback.format_exc()
            utils.kill_proc_group(p, signal.SIGTERM)
Beispiel #18
0
def main():
    args = arg_parser.receiver_first()

    if args.option == 'deps':
        print 'iperf'
        return

    if args.option == 'setup_after_reboot':
        setup_bbr()
        return

    if args.option == 'receiver':
        cmd = ['iperf', '-Z', 'bbr', '-s', '-p', args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        cmd = [
            'iperf', '-Z', 'bbr', '-c', args.ip, '-p', args.port, '-t', '75'
        ]
        check_call(cmd)
        return

    if args.option == 'http_server':
        cur_cc = kernel_ctl.get_congestion_control()
        kernel_ctl.set_congestion_control('bbr')
        server = HTTPServer(('0.0.0.0', int(args.port)), HTTPRequestHandler)

        def stop_signal_handler(signum, frame):
            server.server_close()
            sys.stderr.write("HTTP Server Stops: caught signal %s\n" % signum)
            kernel_ctl.set_congestion_control(cur_cc)

        signal.signal(signal.SIGTERM, stop_signal_handler)
        signal.signal(signal.SIGINT, stop_signal_handler)
        sys.stderr.write("HTTP Server Starts\n")
        server.serve_forever()

    if args.option == 'http_client':
        cur_cc = kernel_ctl.get_congestion_control()
        kernel_ctl.set_congestion_control('bbr')
        url = 'http://%s:%s/' % (args.ip, int(args.port))
        filename = os.path.join(utils.tmp_dir, 'index.html')
        if os.path.isfile(filename):
            os.remove(filename)
        try:
            start_time = time.time()
            urllib.urlretrieve(url, filename)
            sys.stderr.write("File transfer succeed in %.2fs\n" %
                             (time.time() - start_time))
        finally:
            kernel_ctl.set_congestion_control(cur_cc)
Beispiel #19
0
def main():
    args = arg_parser.receiver_first()

    if args.option == 'deps':
        print 'iperf'
        return

    if args.option == 'receiver':
        cmd = ['iperf', '-Z', 'cubic', '-s', '-p', args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        cmd = ['iperf', '-Z', 'cubic', '-c', args.ip, '-p', args.port,
               '-t', '75']
        check_call(cmd)
        return
Beispiel #20
0
def main():
    args = arg_parser.receiver_first()

    if args.option == 'deps':
        print ('iperf')
        return

    if args.option == 'receiver':
        cmd = ['iperf', '-Z', 'cubic', '-s', '-p', args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        cmd = ['iperf', '-Z', 'cubic', '-c', args.ip, '-p', args.port,
               '-t', '75']
        check_call(cmd)
        return
Beispiel #21
0
def main():
    # use 'arg_parser' to ensure a common test interface
    args = arg_parser.receiver_first()  # or 'arg_parser.sender_first()'

    # paths to the sender and receiver executables, etc.
    cc_repo = path.join(context.third_party_dir, 'pacen')
    send_src = path.join(cc_repo, 'kernel', 'test_client.py')
    recv_src = path.join(cc_repo, 'kernel', 'test_server.py')

    # [optional] dependencies of Debian packages
    if args.option == 'deps':
        print('iperf')
        return

    # [optional] persistent setup that only needs to be run once
    if args.option == 'setup':
        # avoid running as root here
        return

    # [optional] non-persistent setup that should be performed on every reboot
    if args.option == 'setup_after_reboot':
        # avoid running as root here
        return

    # [required] run the first side on port 'args.port'
    if args.option == 'receiver':
        cmd = ['iperf', '-Z', 'pacen', '-s', '-p', args.port]
        print(recv_src)
        print('Prima di cmd')
        #cmd = ['PYTHONPATH=' + cc_repo, 'python3', recv_src]
        check_call(cmd)
        return

    # [required] run the other side to connect to the first side on 'args.ip'
    if args.option == 'sender':
        cmd = [
            'iperf', '-Z', 'pacen', '-c', args.ip, '-p', args.port, '-t', '75'
        ]
        #cmd = ['PYTHONPATH=' + cc_repo, 'python3', send_src, '-a', args.ip, '-sim_time', '75']
        print(cmd)
        check_call(cmd)
        return
Beispiel #22
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'fillp')
    send_dir = path.join(cc_repo, 'client')
    recv_dir = path.join(cc_repo, 'server')
    send_src = path.join(send_dir, 'client')
    recv_src = path.join(recv_dir, 'server')

    if args.option == 'receiver':
        os.environ['LD_LIBRARY_PATH'] = recv_dir
        cmd = [recv_src, '-s', '0.0.0.0', '-p', args.port, '-r', 'testcase001']
        check_call(cmd, cwd=utils.tmp_dir)
        return

    if args.option == 'sender':
        os.environ['LD_LIBRARY_PATH'] = send_dir
        cmd = [send_src, '-c', args.ip, '-p', args.port, '-r', 'testcase001']
        check_call(cmd, cwd=utils.tmp_dir)
        return
Beispiel #23
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'vivace')
    recv_dir = path.join(cc_repo, 'receiver')
    send_dir = path.join(cc_repo, 'sender')
    recv_src = path.join(recv_dir, 'vivace_receiver')
    send_src = path.join(send_dir, 'vivace_sender')

    if args.option == 'receiver':
        os.environ['LD_LIBRARY_PATH'] = path.join(recv_dir)
        cmd = [recv_src, args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        os.environ['LD_LIBRARY_PATH'] = path.join(send_dir)
        cmd = [send_src, args.ip, args.port]
        check_call(cmd)
        return
Beispiel #24
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'scream-reproduce')
    recv_src = path.join(cc_repo, 'src', 'ScreamServer')
    send_src = path.join(cc_repo, 'src', 'ScreamClient')

    if args.option == 'setup':
        sh_cmd = './autogen.sh && ./configure && make -j'
        check_call(sh_cmd, shell=True, cwd=cc_repo)
        return

    if args.option == 'receiver':
        cmd = [recv_src, args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        cmd = [send_src, args.ip, args.port]
        check_call(cmd)
        return
Beispiel #25
0
def main():
    args = arg_parser.receiver_first()

    if args.option == 'deps':
        print 'iperf'
        return

    if args.option == 'setup_after_reboot':
        setup_bbr()
        return

    if args.option == 'receiver':
        cmd = ['iperf', '-Z', 'bbr', '-s', '-p', args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        cmd = ['iperf', '-Z', 'bbr', '-c', args.ip, '-p', args.port,
               '-t', '75']
        check_call(cmd)
        return
Beispiel #26
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'genericCC')
    recv_src = path.join(cc_repo, 'receiver')
    send_src = path.join(cc_repo, 'sender')

    if args.option == 'deps':
        print('makepp libboost-dev libprotobuf-dev protobuf-c-compiler '
              'protobuf-compiler libjemalloc-dev libboost-python-dev')
        return

    if args.option == 'setup':
        check_call(['makepp'], cwd=cc_repo)
        return

    if args.option == 'receiver':
        cmd = [recv_src, args.port]
        check_call(cmd)
        return

    if args.option == 'sender':
        rat_file = path.join(cc_repo, 'RemyCC-2014-100x.dna')
        if args.flowsize:
            sh_cmd = (
                'export MIN_RTT=1000000 && %s serverip=%s serverport=%s if=%s '
                'offduration=0 onduration=%s traffic_params=byte_switched,deterministic,'
                'num_cycles=1' %
                (send_src, args.ip, args.port, rat_file, args.flowsize))
        else:
            sh_cmd = (
                'export MIN_RTT=1000000 && %s serverip=%s serverport=%s if=%s '
                'offduration=1 onduration=1000000 traffic_params=deterministic,'
                'num_cycles=1' % (send_src, args.ip, args.port, rat_file))
        sys.stderr.write(str(sh_cmd))
        sys.stderr.write('\n')
        check_call(sh_cmd, shell=True)
        return
Beispiel #27
0
def main():
    args = arg_parser.receiver_first()

    cc_repo = path.join(context.third_party_dir, 'aurora')
    src_dir = path.join(cc_repo, 'src')
    lib_dir = path.join(src_dir, 'core')
    app_dir = path.join(src_dir, 'app')
    send_src = path.join(app_dir, 'pccclient')
    recv_src = path.join(app_dir, 'pccserver')

    if args.option == 'deps':
        print('python3-dev')
        return

    if args.option == 'setup':
        # check_call(['sudo', 'apt', '-y', 'install', 'python3-pip'])
        check_call(['pip3', 'install', 'numpy'])
        check_call(['pip3', 'install', 'tensorflow==1.14.0'])
        check_call(['pip3', 'install', 'gym'])
        check_call(['pip3', 'install', 'stable-baselines[mpi]'])
        check_call(['make'], cwd=src_dir)
        return

    if args.option == 'receiver':
        if not os.path.exists(args.aurora_save_dir):
            os.makedirs(args.aurora_save_dir)
        os.environ['LD_LIBRARY_PATH'] = path.join(lib_dir)
        cmd = [recv_src, 'recv', args.port]
        check_call(
            cmd,
            stdout=open(path.join(args.aurora_save_dir, "server_stdout.log"),
                        'w', 1),
            stderr=open(path.join(args.aurora_save_dir, "server_stderr.log"),
                        "w", 1))
        return

    if args.option == 'sender':
        if not os.path.exists(args.aurora_save_dir):
            os.makedirs(args.aurora_save_dir)
        os.environ['LD_LIBRARY_PATH'] = path.join(lib_dir)
        cmd = [
            send_src,
            'send',
            args.ip,
            args.port,
            path.join(args.aurora_save_dir, "client.log"),
            "--pcc-rate-control=python",
            "-pyprogram={}".format(args.pyprogram),
            # "-pyprogram=/home/zxxia/.virtualenvs/aurora/bin/python",
            "-pyhelper=udt_plugins.testing.loaded_client",
            "-pypath=../PCC-RL/src",
            "--history-len=10",
            "--pcc-utility-calc=linear",
            "--model-path={}".format(args.model_path),
            "--save-dir={}".format(args.aurora_save_dir)
        ]
        check_call(cmd,
                   stderr=open(
                       path.join(args.aurora_save_dir, "client_stderr.log"),
                       'w', 1))
        return