예제 #1
0
def main():
    args = parse_arguments('receiver_first')

    cc_repo = path.join(project_root.DIR, 'third_party', 'calibrated_koho')
    recv_src = path.join(cc_repo, 'datagrump', 'receiver')
    send_src = path.join(cc_repo, 'datagrump', 'sender')

    if args.option == 'run_first':
        print 'receiver'

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

        sh_cmd = './autogen.sh && ./configure && make -j2'
        check_call(sh_cmd, shell=True, cwd=cc_repo)

    if args.option == 'setup_after_reboot':
        check_default_qdisc('calibrated_koho')

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

    if args.option == 'sender':
        cmd = [send_src, args.ip, args.port]
        check_call(cmd)
예제 #2
0
def main():
    args = parse_arguments('sender_first')

    cc_repo = path.join(project_root.DIR, 'third_party', 'verus')
    send_src = path.join(cc_repo, 'src', 'verus_server')
    recv_src = path.join(cc_repo, 'src', 'verus_client')

    if args.option == 'deps':
        print 'libtbb-dev libasio-dev libalglib-dev libboost-system-dev'

    if args.option == 'run_first':
        print 'sender'

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

        sh_cmd = './bootstrap.sh && ./configure && make -j2'
        check_call(sh_cmd, shell=True, cwd=cc_repo)

    if args.option == 'setup_after_reboot':
        check_default_qdisc('verus')

    if args.option == 'sender':
        cmd = [send_src, '-name', TMPDIR, '-p', args.port, '-t', '75']
        check_call(cmd)

    if args.option == 'receiver':
        cmd = [recv_src, args.ip, '-p', args.port]
        check_call(cmd, cwd=TMPDIR)
예제 #3
0
def main():
    args = parse_arguments('receiver_first')

    cc_repo = path.join(project_root.DIR, 'third_party', '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')

    if args.option == 'run_first':
        print 'receiver'

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

    if args.option == 'setup_after_reboot':
        check_default_qdisc('taova')

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

    if args.option == 'sender':
        rat_file = path.join(project_root.DIR, 'src', 'RemyCC-2014-100x.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)
예제 #4
0
def main():
    args = parse_arguments('receiver_first')

    cc_repo = path.join(project_root.DIR, 'third_party', 'libutp')
    src = path.join(cc_repo, 'ucat-static')

    if args.option == 'run_first':
        print 'receiver'

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

    if args.option == 'setup_after_reboot':
        check_default_qdisc('ledbat')

    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)

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

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

        if proc:
            proc.kill()
예제 #5
0
def main():
    args = parse_arguments('receiver_first')

    cc_repo = path.join(project_root.DIR, 'third_party', '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')

    if args.option == 'run_first':
        print 'receiver'

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

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

    if args.option == 'setup_after_reboot':
        check_default_qdisc('sprout')

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

    if args.option == 'sender':
        os.environ['SPROUT_MODEL_IN'] = model
        cmd = [src, args.ip, args.port]
        check_call(cmd)
예제 #6
0
def main():
    args = parse_arguments('receiver_first')

    scream_dir = path.join(project_root.DIR, 'src', 'scream')
    recv_src = path.join(scream_dir, 'ScreamServer')
    send_src = path.join(scream_dir, 'ScreamClient')

    if args.option == 'run_first':
        print 'receiver'

    if args.option == 'setup':
        sh_cmd = './autogen.sh && ./configure && make -j2'
        sourdough_dir = path.join(project_root.DIR, 'third_party', 'sourdough')
        check_call(sh_cmd, shell=True, cwd=sourdough_dir)
        check_call(sh_cmd, shell=True, cwd=scream_dir)

    if args.option == 'setup_after_reboot':
        check_default_qdisc('scream')

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

    if args.option == 'sender':
        cmd = [send_src, args.ip, args.port]
        check_call(cmd)
예제 #7
0
def main():
    args = parse_arguments('receiver_first')

    cc_repo = path.join(project_root.DIR, 'third_party', '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')

    if args.option == 'run_first':
        print 'receiver'

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

    if args.option == 'setup_after_reboot':
        check_default_qdisc('taova')

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

    if args.option == 'sender':
        rat_file = path.join(project_root.DIR, 'src', 'RemyCC-2014-100x.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)
def main():
    # use 'parse_arguments()' to ensure a common test interface
    args = parse_arguments('receiver_first')  # or 'sender_first'

    # paths to the sender and receiver executables, etc.
    cc_repo = path.join(project_root.DIR, 'third_party', '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 == 'run_first':
        print 'receiver'

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

    if args.option == 'setup_after_reboot':
        # by default, check if 'pfifo_fast' is used as qdisc
        # otherwise, change the qdisc in `config.yml` (refer to BBR as example)
        check_default_qdisc('pcc_experimental')

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

    if args.option == 'sender':
        os.environ['LD_LIBRARY_PATH'] = path.join(lib_dir)
        cmd = [send_src, 'send', args.ip, args.port]
        check_call(cmd)
예제 #9
0
def main():
    args = parse_arguments('receiver_first')

    cc_repo = path.join(project_root.DIR, 'third_party', '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 == 'run_first':
        print 'receiver'

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

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

    if args.option == 'setup_after_reboot':
        check_default_qdisc('pcc')

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

    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)
예제 #10
0
def main(delta_conf):
    args = parse_arguments('receiver_first')

    cc_repo = path.join(project_root.DIR, 'third_party', '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')

    if args.option == 'run_first':
        print 'receiver'

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

    if args.option == 'setup_after_reboot':
        check_default_qdisc('copa')

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

    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)
예제 #11
0
def main():
    args = parse_arguments('receiver_first')

    cc_repo = path.join(project_root.DIR, 'third_party', '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')

    if args.option == 'run_first':
        print 'receiver'

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

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

    if args.option == 'setup_after_reboot':
        check_default_qdisc('sprout')

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

    if args.option == 'sender':
        os.environ['SPROUT_MODEL_IN'] = model
        cmd = [src, args.ip, args.port]
        check_call(cmd)
예제 #12
0
def main():
    args = parse_arguments('sender_first')

    cc_repo = path.join(project_root.DIR, 'third_party', 'webrtc')
    video = path.join(cc_repo, 'video.y4m')

    if args.option == 'deps':
        print(
            'chromium-browser xvfb xfonts-100dpi xfonts-75dpi '
            'xfonts-cyrillic xorg dbus-x11 npm nodejs nodejs-legacy')

    if args.option == 'run_first':
        print 'sender'

    if args.option == 'setup':
        setup_webrtc(cc_repo, video)

    if args.option == 'setup_after_reboot':
        check_default_qdisc('webrtc')

    if args.option == 'sender':
        if not xvfb_in_use(1):
            Popen(['Xvfb', ':1'])
        new_env = os.environ.copy()
        new_env['DISPLAY'] = ':1'

        # run signaling server on the sender side
        signaling_server_src = path.join(cc_repo, 'app.js')
        Popen(['node', signaling_server_src, args.port])

        user_data_dir = path.join(TMPDIR, 'webrtc-%s' % uuid.uuid4())
        cmd = [
            'chromium-browser',
            '--app=http://localhost:%s/sender' % args.port,
            '--use-fake-ui-for-media-stream',
            '--use-fake-device-for-media-stream',
            '--use-file-for-fake-video-capture=%s' % video,
            '--user-data-dir=%s' % user_data_dir
        ]
        Popen(cmd, env=new_env).wait()

    if args.option == 'receiver':
        if not xvfb_in_use(2):
            Popen(['Xvfb', ':2'])
        new_env = os.environ.copy()
        new_env['DISPLAY'] = ':2'

        user_data_dir = path.join(TMPDIR, 'webrtc-%s' % uuid.uuid4())
        cmd = [
            'chromium-browser',
            '--app=http://%s:%s/receiver' % (args.ip, args.port),
            '--user-data-dir=%s' % user_data_dir
        ]
        Popen(cmd, env=new_env).wait()
예제 #13
0
def main():
    args = parse_arguments('sender_first')

    cc_repo = path.join(project_root.DIR, 'third_party', 'webrtc')
    video = path.join(cc_repo, 'video.y4m')

    if args.option == 'deps':
        print ('chromium-browser xvfb xfonts-100dpi xfonts-75dpi '
               'xfonts-cyrillic xorg dbus-x11 npm nodejs')

    if args.option == 'run_first':
        print 'sender'

    if args.option == 'setup':
        setup_webrtc(cc_repo, video)

    if args.option == 'setup_after_reboot':
        check_default_qdisc('webrtc')

    if args.option == 'sender':
        if not xvfb_in_use(1):
            Popen(['Xvfb', ':1'])
        os.environ['DISPLAY'] = ':1'

        # run signaling server on the sender side
        signaling_server_src = path.join(cc_repo, 'app.js')
        Popen(['node', signaling_server_src, args.port])

        user_data_dir = path.join(TMPDIR, 'webrtc-%s' % uuid.uuid4())
        cmd = ['chromium-browser',
               '--app=http://localhost:%s/sender' % args.port,
               '--use-fake-ui-for-media-stream',
               '--use-fake-device-for-media-stream',
               '--use-file-for-fake-video-capture=%s' % video,
               '--user-data-dir=%s' % user_data_dir]
        check_call(cmd)

    if args.option == 'receiver':
        if not xvfb_in_use(2):
            Popen(['Xvfb', ':2'])
        os.environ['DISPLAY'] = ':2'

        user_data_dir = path.join(TMPDIR, 'webrtc-%s' % uuid.uuid4())
        cmd = ['chromium-browser',
               '--app=http://%s:%s/receiver' % (args.ip, args.port),
               '--user-data-dir=%s' % user_data_dir]
        check_call(cmd)
예제 #14
0
def setup_vegas():
    # enable tcp_vegas kernel module
    sh_cmd = 'sudo modprobe tcp_vegas'
    check_call(sh_cmd, shell=True)

    # add vegas to kernel-allowed congestion control list
    sh_cmd = 'sysctl net.ipv4.tcp_allowed_congestion_control'
    allowed_cc = check_output(sh_cmd, shell=True)
    allowed_cc = allowed_cc.split('=')[-1].split()

    if 'vegas' not in allowed_cc:
        allowed_cc.append('vegas')

        sh_cmd = 'sudo sysctl -w net.ipv4.tcp_allowed_congestion_control="%s"'
        check_call(sh_cmd % ' '.join(allowed_cc), shell=True)

    check_default_qdisc('vegas')
예제 #15
0
def setup_bbr():
    # enable tcp_bbr kernel module (only available since Linux Kernel 4.9)
    sh_cmd = 'sudo modprobe tcp_bbr'
    if call(sh_cmd, shell=True) != 0:
        sys.exit('Error: BBR is only available since Linux Kernel 4.9')

    # add bbr to kernel-allowed congestion control list
    sh_cmd = 'sysctl net.ipv4.tcp_allowed_congestion_control'
    allowed_cc = get_kernel_attr(sh_cmd, debug=False)

    if 'bbr' not in allowed_cc:
        allowed_cc.append('bbr')

        sh_cmd = 'sudo sysctl -w net.ipv4.tcp_allowed_congestion_control="%s"'
        check_call(sh_cmd % ' '.join(allowed_cc), shell=True)

    check_default_qdisc('bbr')
예제 #16
0
def main():
    args = parse_arguments('receiver_first')

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

    if args.option == 'run_first':
        print 'receiver'

    if args.option == 'setup_after_reboot':
        check_default_qdisc('default_tcp')

    if args.option == 'receiver':
        cmd = ['iperf', '-s', '-p', args.port]
        wait_and_kill_iperf(Popen(cmd))

    if args.option == 'sender':
        cmd = ['iperf', '-c', args.ip, '-p', args.port, '-t', '75']
        wait_and_kill_iperf(Popen(cmd))
예제 #17
0
def main():
    args = parse_arguments('sender_first')

    cc_repo = path.join(project_root.DIR, 'third_party', 'proto-quic')
    send_src = path.join(cc_repo, 'src', 'out', 'Default', 'quic_server')
    recv_src = path.join(cc_repo, 'src', 'out', 'Default', 'quic_client')

    cert_dir = path.join(project_root.DIR, 'src', 'quic-certs')
    html_dir = path.join(cc_repo, 'www.example.org')
    make_sure_path_exists(html_dir)

    if args.option == 'deps':
        print 'libnss3-tools libgconf-2-4'

    if args.option == 'run_first':
        print 'sender'

    if args.option == 'setup':
        setup_quic(cc_repo, cert_dir, html_dir)

    if args.option == 'setup_after_reboot':
        check_default_qdisc('quic')

    if args.option == 'sender':
        cmd = [
            send_src,
            '--port=%s' % args.port,
            '--quic_response_cache_dir=%s' % html_dir,
            '--certificate_file=%s' % path.join(cert_dir, 'leaf_cert.pem'),
            '--key_file=%s' % path.join(cert_dir, 'leaf_cert.pkcs8')
        ]
        check_call(cmd)

    if args.option == 'receiver':
        cmd = [
            recv_src,
            '--host=%s' % args.ip,
            '--port=%s' % args.port, 'https://www.example.org/'
        ]
        # suppress stdout as it prints the huge web page received
        with open(os.devnull, 'w') as devnull:
            check_call(cmd, stdout=devnull)
예제 #18
0
def main():
    # use 'parse_arguments()' to ensure a common test interface
    args = parse_arguments('receiver_first')  # or 'sender_first'

    # paths to the sender and receiver executables, etc.
    cc_repo = path.join(project_root.DIR, 'third_party', 'example_cc')
    setup_src = path.join(cc_repo, 'example_setup')
    send_src = path.join(cc_repo, 'example_sender')
    recv_src = path.join(cc_repo, 'example_receiver')

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

    # [required] order to run: 'receiver_first' or 'sender_first'
    if args.option == 'run_first':
        print 'receiver_first'

    # [optional] persistent setup
    if args.option == 'setup':
        # avoid running anything as root here
        check_call([setup_src])

    # [required] setup performed after every reboot: check qdisc at least
    if args.option == 'setup_after_reboot':
        # by default, check if 'pfifo_fast' is used as qdisc
        # otherwise, change the qdisc in `config.yml` (refer to BBR as example)
        check_default_qdisc('example_cc')

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

    # [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)
예제 #19
0
def main():
    # use 'parse_arguments()' to ensure a common test interface
    args = parse_arguments('receiver_first')  # or 'sender_first'

    # paths to the sender and receiver executables, etc.
    cc_repo = path.join(project_root.DIR, 'third_party', 'example_cc')
    setup_src = path.join(cc_repo, 'example_setup')
    send_src = path.join(cc_repo, 'example_sender')
    recv_src = path.join(cc_repo, 'example_receiver')

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

    # [required] order to run: 'receiver' or 'sender'
    if args.option == 'run_first':
        print 'receiver'

    # [optional] persistent setup
    if args.option == 'setup':
        # avoid running anything as root here
        check_call([setup_src])

    # [required] setup performed after every reboot: check qdisc at least
    if args.option == 'setup_after_reboot':
        # by default, check if 'pfifo_fast' is used as qdisc
        # otherwise, change the qdisc in `config.yml` (refer to BBR as example)
        check_default_qdisc('example_cc')

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

    # [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)
예제 #20
0
def main():
    args = parse_arguments('receiver_first')
    cc_repo = path.join(project_root.DIR, 'third_party', 'fillp')
    send_src = path.join(cc_repo, 'client', 'client')
    recv_src = path.join(cc_repo, 'server', 'server')
    send_path = path.join(cc_repo, 'client')
    recv_path = path.join(cc_repo, 'server')

    if args.option == 'run_first':
        print 'receiver'

    if args.option == 'setup_after_reboot':
        check_default_qdisc('fillp')

    if args.option == 'sender':
        os.environ['LD_LIBRARY_PATH'] = send_path
        cmd = [send_src, '-d', args.ip, '-p', args.port, '-t']
        check_call(cmd)

    if args.option == 'receiver':
        os.environ['LD_LIBRARY_PATH'] = recv_path
        cmd = [recv_src, '-s', '0.0.0.0', '-p', args.port, '-t']
        check_call(cmd)
예제 #21
0
def main():
    args = parse_arguments('sender_first')

    cc_repo = path.join(project_root.DIR, 'third_party', 'indigo')
    send_src = path.join(cc_repo, 'dagger', 'run_sender.py')
    recv_src = path.join(cc_repo, 'env', 'run_receiver.py')

    if args.option == 'run_first':
        print 'sender'

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

    if args.option == 'setup_after_reboot':
        check_default_qdisc('indigo')

    if args.option == 'sender':
        cmd = [send_src, args.port]
        check_call(cmd)

    if args.option == 'receiver':
        cmd = [recv_src, args.ip, args.port]
        check_call(cmd)
예제 #22
0
def main():
    args = parse_arguments('sender_first')

    cc_repo = path.join(project_root.DIR, 'third_party', 'proto-quic')
    send_src = path.join(cc_repo, 'src', 'out', 'Default', 'quic_server')
    recv_src = path.join(cc_repo, 'src', 'out', 'Default', 'quic_client')

    cert_dir = path.join(project_root.DIR, 'src', 'quic-certs')
    html_dir = path.join(cc_repo, 'www.example.org')
    make_sure_path_exists(html_dir)

    if args.option == 'deps':
        print 'libnss3-tools libgconf-2-4'

    if args.option == 'run_first':
        print 'sender'

    if args.option == 'setup':
        setup_quic(cc_repo, cert_dir, html_dir)

    if args.option == 'setup_after_reboot':
        check_default_qdisc('quic')

    if args.option == 'sender':
        cmd = [send_src, '--port=%s' % args.port,
               '--quic_response_cache_dir=%s' % html_dir,
               '--certificate_file=%s' % path.join(cert_dir, 'leaf_cert.pem'),
               '--key_file=%s' % path.join(cert_dir, 'leaf_cert.pkcs8')]
        check_call(cmd)

    if args.option == 'receiver':
        cmd = [recv_src, '--host=%s' % args.ip, '--port=%s' % args.port,
               'https://www.example.org/']
        # suppress stdout as it prints the huge web page received
        with open(os.devnull, 'w') as devnull:
            check_call(cmd, stdout=devnull)
예제 #23
0
def main():
    args = parse_arguments('receiver_first')

    cc_repo = path.join(project_root.DIR, 'third_party', 'vivace')
    recv_dir = path.join(cc_repo, 'receiver')
    send_dir = path.join(cc_repo, 'sender')
    recv_src = path.join(recv_dir, 'appserver')
    send_src = path.join(send_dir, 'gradient_descent_pcc_client')

    if args.option == 'run_first':
        print 'receiver'

    if args.option == 'setup_after_reboot':
        check_default_qdisc('vivace_loss')

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

    if args.option == 'sender':
        os.environ['LD_LIBRARY_PATH'] = path.join(send_dir)
        cmd = [send_src, args.ip, '9000', '0']
        check_call(cmd)
예제 #24
0
파일: ppc_rl.py 프로젝트: z6833/pantheon
def main():

    # 返回命令行指定的参数
    args = parse_arguments('receiver_first')

    # 第三方库pcc-rl源码所在地址
    cc_repo = path.join(project_root.DIR, 'third_party', 'pcc-rl')

    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')

    # # 确定安装路径,若算法有需要安装其他东西的,可通过此接口指定路径
    # setup_src = path.join(cc_repo, 'example_setup')

    # 可选,安装算法需要的特定环境,例如要求TensorFlow?pytorch?填上代码
    # if args.option == 'deps':
    #     # 添加执行pcc-rl所需依赖环境的代码
    #     print("test for pcc")

    # 必选,指定哪个先运行
    if args.option == 'run_first':

        print 'reveiver'

    # 可选,确定以非root用户运行
    if args.option == 'setup':
        # avoid running anything as root here
        # 可添加一下安装时,加以控制的代码
        # 添加运行编译的代码
        # check_call([setup_src])
        check_call(['make'], cwd=src_dir)

    # 可选,指定队列大小,默认值就好
    if args.option == 'setup_after_reboot':
        check_default_qdisc('pcc_rl')

    # 必选,指定接收端IP和端口
    if args.option == 'receiver':
        # 添加指定端口和ip的代码,如果run_first为receiver,指定其端口和IP
        # cd src export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:pwd/core/ ./app/pccserver recv 9000

        # cd ../pcc-rl/src  # 进入编译文件所在目录
        # make  # 编译并生成两个app,client和server
        # LD_LIBRARY_PATH =$LD_LIBRARY_PATH:pwd/core # 设置当路径
        # ./app/pccserver recv 9000  # 启动reveiver并监听9000端口

        os.environ['LD_LIBRARY_PATH'] = path.join(lib_dir)
        cmd = [recv_src, 'recv', args.port]  # 要不要改成9000?
        check_call(cmd)
        print("testing ...")

    # 必选,指定发送端IP和端口
    if args.option == 'sender':
        # ./app/pccclient send 127.0.0.1 9000
        # --pcc-rate-control=python
        # -pyhelper=loaded_client
        #
        # -pypath=/path/to/pcc-rl/src/udt-plugins/testing/
        # /home/tky/zhao/pantheon/third_party/pcc-rl/src/udt-plugins/testing /
        #
        # --history-len=10
        # --pcc-utility-calc=linear
        #
        # --model-path=/path/to/your/model/
        # /home/tky/zhao/pantheon/third_party/pcc-rl/model

        os.environ['LD_LIBRARY_PATH'] = path.join(lib_dir)
        # 指定端口和IP(要不要换成具体值,待测试)
        cmd = [send_src, 'send', args.ip, args.port]
        # 指定速率控制(参数含义待测试)
        cmd += ['--pcc-rate-control=python']

        cmd += ['-pyhelper=loaded_client']
        cmd += ['-pypath={}'.format(src_dir) + '/udt-plugins/testing/']
        cmd += ['--history-len=10']
        cmd += ['--pcc-utility-calc=linear']

        # 指定模型路径参数
        cmd += ['--model-path={}'.format(cc_repo) + '/model']
        check_call(cmd)