Esempio n. 1
0
def main():
    usage.check_args(sys.argv, os.path.basename(__file__), 'receiver_first')
    option = sys.argv[1]
    src_dir = os.path.abspath(os.path.dirname(__file__))
    submodule_dir = os.path.abspath(
        os.path.join(src_dir, '../third_party/sprout'))
    src_file = os.path.join(submodule_dir, 'src/examples/sproutbt2')

    # build dependencies
    if option == 'deps':
        deps_list = ('libboost-math-dev libssl-dev '
                     'libprotobuf-dev protobuf-compiler libncurses5-dev')
        print deps_list

    # build
    if option == 'build':
        # apply patch to reduce MTU size
        patch = os.path.join(src_dir, 'sprout_mtu.patch')
        cmd = 'cd %s && git apply %s' % (submodule_dir, patch)
        try:
            check_call(cmd, shell=True)
        except CalledProcessError:
            sys.stderr.write('patch apply failed but assuming things okay '
                             '(patch applied previously?)\n')

        # make alone sufficient if autogen.sh and configure already run
        cmd = 'cd %s && make -j4' % submodule_dir
        if call(cmd, shell=True) is not 0:
            cmd = ('cd %s && ./autogen.sh && ./configure --enable-examples && '
                   'make -j4' % submodule_dir)
            check_call(cmd, shell=True)

    # commands to be run after building and before running
    if option == 'init':
        pass

    # who goes first
    if option == 'who_goes_first':
        print 'Receiver first'

    # friendly name
    if option == 'friendly_name':
        print 'Sprout'

    # receiver
    if option == 'receiver':
        os.environ['SPROUT_MODEL_IN'] = os.path.join(
            submodule_dir, 'src/examples/sprout.model')
        # sproutbt2 prints the 'listening on port' message to stdout
        cmd = [src_file]
        check_call(cmd)

    # sender
    if option == 'sender':
        os.environ['SPROUT_MODEL_IN'] = os.path.join(
            submodule_dir, 'src/examples/sprout.model')
        ip = sys.argv[2]
        port = sys.argv[3]
        cmd = [src_file, ip, port]
        check_call(cmd)
Esempio n. 2
0
def main():
    usage.check_args(sys.argv, os.path.basename(__file__), 'receiver_first')
    option = sys.argv[1]
    src_dir = os.path.abspath(os.path.dirname(__file__))
    submodule_dir = os.path.abspath(
        os.path.join(src_dir, '../third_party/new_koho'))
    send_file = os.path.join(submodule_dir, 'datagrump/sender')
    recv_file = os.path.join(submodule_dir, 'datagrump/receiver')

    # build dependencies
    if option == 'deps':
        pass

    # build
    if option == 'build':
        # apply patch to reduce MTU size
        patch = os.path.join(src_dir, 'new_koho_mtu.patch')
        cmd = 'cd %s && git apply %s' % (submodule_dir, patch)
        try:
            check_call(cmd, shell=True)
        except CalledProcessError:
            sys.stderr.write('patch apply failed but assuming things okay '
                             '(patch applied previously?)\n')

        # make alone sufficient if autogen.sh and configure already run
        cmd = 'cd %s && make -j4' % submodule_dir
        if call(cmd, shell=True) is not 0:
            cmd = ('cd %s && ./autogen.sh && ./configure && make -j4' %
                   submodule_dir)
            check_call(cmd, shell=True)

    # commands to be run after building and before running
    if option == 'init':
        pass

    # who goes first
    if option == 'who_goes_first':
        print 'Receiver first'

    # friendly name
    if option == 'friendly_name':
        print 'NewKoho'

    # receiver
    if option == 'receiver':
        port = get_open_udp_port()
        print 'Listening on port: %s' % port
        sys.stdout.flush()
        cmd = [recv_file, port]
        check_call(cmd)

    # sender
    if option == 'sender':
        ip = sys.argv[2]
        port = sys.argv[3]
        cmd = [send_file, ip, port]
        check_call(cmd)
Esempio n. 3
0
def main():
    usage.check_args(sys.argv, os.path.basename(__file__), 'receiver_first')
    option = sys.argv[1]
    src_dir = os.path.abspath(os.path.dirname(__file__))
    submodule_dir = os.path.abspath(os.path.join(src_dir,
                                                 '../third_party/pcc'))
    recv_dir = os.path.join(submodule_dir, 'receiver')
    send_dir = os.path.join(submodule_dir, 'sender')
    DEVNULL = open(os.devnull, 'w')

    # build dependencies
    if option == 'deps':
        pass

    # build
    if option == 'build':
        # apply patch to reduce MTU size
        patch = os.path.join(src_dir, 'pcc_mtu.patch')
        cmd = 'cd %s && git apply %s' % (submodule_dir, patch)
        try:
            check_call(cmd, shell=True)
        except CalledProcessError:
            sys.stderr.write('patch apply failed but assuming things okay '
                             '(patch applied previously?)\n')

        cmd = 'cd %s && make && cd %s && make' % (send_dir, recv_dir)
        check_call(cmd, shell=True)

    # commands to be run after building and before running
    if option == 'init':
        pass

    # who goes first
    if option == 'who_goes_first':
        print 'Receiver first'

    # friendly name
    if option == 'friendly_name':
        print 'PCC'

    # receiver
    if option == 'receiver':
        port = get_open_udp_port()
        print 'Listening on port: %s' % port
        sys.stdout.flush()
        os.environ['LD_LIBRARY_PATH'] = os.path.join(recv_dir, 'src')
        cmd = [os.path.join(recv_dir, 'app/appserver'), port]
        check_call(cmd)

    # sender
    if option == 'sender':
        ip = sys.argv[2]
        port = sys.argv[3]
        os.environ['LD_LIBRARY_PATH'] = os.path.join(send_dir, 'src')
        cmd = [os.path.join(send_dir, 'app/appclient'), ip, port]
        check_call(cmd, stderr=DEVNULL)
Esempio n. 4
0
def main():
    usage.check_args(sys.argv, os.path.basename(__file__), 'sender_first')
    option = sys.argv[1]
    src_dir = os.path.abspath(os.path.dirname(__file__))
    submodule_dir = os.path.abspath(
        os.path.join(src_dir, '../third_party/verus'))
    send_file = os.path.join(submodule_dir, 'src/verus_server')
    recv_file = os.path.join(submodule_dir, 'src/verus_client')

    # build dependencies
    if option == 'deps':
        deps_list = 'libtbb-dev libasio-dev libalglib-dev libboost-system-dev'
        print deps_list

    # build
    if option == 'build':
        # apply patch to reduce MTU size
        patch = os.path.join(src_dir, 'verus_mtu.patch')
        cmd = 'cd %s && git apply %s' % (submodule_dir, patch)
        try:
            check_call(cmd, shell=True)
        except CalledProcessError:
            sys.stderr.write('patch apply failed but assuming things okay '
                             '(patch applied previously?)\n')

        cmd = ('cd %s && ./bootstrap.sh && ./configure && make -j4' %
               submodule_dir)
        check_call(cmd, shell=True)

    # commands to be run after building and before running
    if option == 'init':
        pass

    # who goes first
    if option == 'who_goes_first':
        print 'Sender first'

    # friendly name
    if option == 'friendly_name':
        print 'Verus'

    # sender
    if option == 'sender':
        port = get_open_udp_port()
        print 'Listening on port: %s' % port
        sys.stdout.flush()
        cmd = [send_file, '-name', 'verus_tmp', '-p', port, '-t', '75']
        check_call(cmd)

    # receiver
    if option == 'receiver':
        ip = sys.argv[2]
        port = sys.argv[3]
        cmd = [recv_file, ip, '-p', port]
        check_call(cmd)
Esempio n. 5
0
def main():
    usage.check_args(sys.argv, os.path.basename(__file__), 'receiver_first')
    option = sys.argv[1]
    src_dir = os.path.abspath(os.path.dirname(__file__))
    submodule_dir = os.path.abspath(
        os.path.join(src_dir, '../third_party/libutp'))
    src_file = os.path.join(submodule_dir, 'ucat-static')
    DEVNULL = open(os.devnull, 'w')

    # build dependencies
    if option == 'deps':
        pass

    # build commands
    if option == 'build':
        cmd = 'cd %s && make -j4' % submodule_dir
        check_call(cmd, shell=True)

    # commands to be run after building and before running
    if option == 'init':
        pass

    # who goes first
    if option == 'who_goes_first':
        print 'Receiver first'

    # friendly name
    if option == 'friendly_name':
        print 'LEDBAT'

    # receiver
    if option == 'receiver':
        port = get_open_udp_port()
        print 'Listening on port: %s' % port
        sys.stdout.flush()
        cmd = [src_file, '-l', '-p', port]
        # suppress stdout as it prints all the bytes received
        check_call(cmd, stdout=DEVNULL)

    # sender
    if option == 'sender':
        ip = sys.argv[2]
        port = sys.argv[3]
        cmd = [src_file, ip, port]
        proc = Popen(cmd, stdin=PIPE)

        timeout = time.time() + 75
        while True:
            proc.stdin.write(os.urandom(1024 * 1024))
            if time.time() > timeout:
                break
        proc.stdin.close()

    DEVNULL.close()
Esempio n. 6
0
def main():
    usage.check_args(sys.argv, os.path.basename(__file__), 'receiver_first')
    option = sys.argv[1]
    src_dir = os.path.abspath(os.path.dirname(__file__))
    recv_file = os.path.join(src_dir, 'scream/ScreamServer')
    send_file = os.path.join(src_dir, 'scream/ScreamClient')
    submodule_dir = os.path.abspath(
        os.path.join(src_dir, '../third_party/sourdough'))
    code_dir = os.path.abspath(os.path.join(src_dir, 'scream/'))

    # build dependencies
    if option == 'deps':
        print 'dh-autoreconf'

    # build
    if option == 'build':
        for d in [submodule_dir, code_dir]:
            # make alone sufficient if autogen.sh and configure already run
            cmd = 'cd %s && make -j4' % d
            if call(cmd, shell=True) is not 0:
                cmd = 'cd %s && ./autogen.sh && ./configure && make -j4' % d
                check_call(cmd, shell=True)

    # commands to be run after building and before running
    if option == 'init':
        pass

    # who goes first
    if option == 'who_goes_first':
        print 'Receiver first'

    # friendly name
    if option == 'friendly_name':
        print 'SCReAM'

    # receiver
    if option == 'receiver':
        port = get_open_udp_port()
        print 'Listening on port: %s' % port
        sys.stdout.flush()
        cmd = [recv_file, port]
        check_call(cmd)

    # sender
    if option == 'sender':
        ip = sys.argv[2]
        port = sys.argv[3]
        cmd = [send_file, ip, port]
        check_call(cmd)
Esempio n. 7
0
def main():
    usage.check_args(sys.argv, os.path.basename(__file__), 'receiver_first')
    option = sys.argv[1]
    src_dir = os.path.abspath(os.path.dirname(__file__))
    submodule_dir = os.path.abspath(
        os.path.join(src_dir, '../third_party/genericCC'))

    # build dependencies
    if option == 'deps':
        print(
            'makepp libboost-dev libprotobuf-dev protobuf-c-compiler '
            'protobuf-compiler libjemalloc-dev')

    # build commands
    if option == 'build':
        cmd = 'cd %s && makepp' % (submodule_dir)
        check_call(cmd, shell=True)

    # commands to be run after building and before running
    if option == 'init':
        pass

    # who goes first
    if option == 'who_goes_first':
        print 'Receiver first'

    # friendly name
    if option == 'friendly_name':
        print 'Copa'

    # receiver
    if option == 'receiver':
        port = get_open_tcp_port()
        print 'Listening on port: %s' % port
        sys.stdout.flush()
        cmd = [os.path.join(submodule_dir, 'receiver'), port]
        check_call(cmd)

    # sender
    if option == 'sender':
        ip = sys.argv[2]
        port = sys.argv[3]
        sender_file = os.path.join(submodule_dir, 'sender')
        cmd = ('export MIN_RTT=1000000 && %s serverip=%s serverport=%s '
               'offduration=1 onduration=1000000 traffic_params=deterministic,'
               'num_cycles=1 cctype=markovian delta_conf=constant_delta:1' %
               (sender_file, ip, port))
        print cmd
        check_call(cmd, shell=True)
Esempio n. 8
0
def main():
    usage.check_args(sys.argv, os.path.basename(__file__), 'receiver_first')
    option = sys.argv[1]
    src_dir = os.path.abspath(os.path.dirname(__file__))
    submodule_dir = os.path.abspath(
        os.path.join(src_dir, '../third_party/pantheon-stimuli'))
    send_file = os.path.join(submodule_dir, 'greg_capacity_stimulus/sender')
    recv_file = os.path.join(submodule_dir, 'greg_capacity_stimulus/receiver')

    # build dependencies
    if option == 'deps':
        pass

    # build
    if option == 'build':
        # make alone sufficient if autogen.sh and configure already run
        cmd = 'cd %s && make -j4' % submodule_dir
        if call(cmd, shell=True) is not 0:
            cmd = ('cd %s && ./autogen.sh && ./configure && make -j4' %
                   submodule_dir)
            check_call(cmd, shell=True)

    # commands to be run after building and before running
    if option == 'init':
        pass

    # who goes first
    if option == 'who_goes_first':
        print 'Receiver first'

    # friendly name
    if option == 'friendly_name':
        print 'Greg\'s Saturator'

    # receiver
    if option == 'receiver':
        port = get_open_udp_port()
        print 'Listening on port: %s' % port
        sys.stdout.flush()
        cmd = [recv_file, port]
        check_call(cmd)

    # sender
    if option == 'sender':
        ip = sys.argv[2]
        port = sys.argv[3]
        cmd = [send_file, ip, port]
        check_call(cmd)
Esempio n. 9
0
def main():
    usage.check_args(sys.argv, os.path.basename(__file__), 'receiver_first')
    option = sys.argv[1]
    src_dir = os.path.abspath(os.path.dirname(__file__))
    src_file = 'iperf'

    # build dependencies
    if option == 'deps':
        print 'iperf'

    # build
    if option == 'build':
        pass

    # commands to be run after building and before running
    if option == 'init':
        cmd = 'sudo modprobe tcp_vegas'
        check_call(cmd, shell=True)
        cmd = ('echo "vegas" | '
               'sudo tee /proc/sys/net/ipv4/tcp_allowed_congestion_control')
        check_call(cmd, shell=True)

    # who goes first
    if option == 'who_goes_first':
        print 'Receiver first'

    # friendly name
    if option == 'friendly_name':
        print 'TCP Vegas'

    # receiver
    if option == 'receiver':
        port = get_open_tcp_port()
        print 'Listening on port: %s' % port
        sys.stdout.flush()
        cmd = [src_file, '-Z', 'vegas', '-s', '-p', port]
        check_call(cmd)

    # sender
    if option == 'sender':
        ip = sys.argv[2]
        port = sys.argv[3]
        cmd = [src_file, '-Z', 'vegas', '-c', ip, '-p', port, '-t', '75']
        check_call(cmd)
Esempio n. 10
0
def main():
    usage.check_args(sys.argv, os.path.basename(__file__), 'receiver_first')
    option = sys.argv[1]
    src_dir = os.path.abspath(os.path.dirname(__file__))
    src_file = 'iperf'

    # build dependencies
    if option == 'deps':
        print 'iperf'

    # build commands
    if option == 'build':
        pass

    # commands to be run after building and before running
    if option == 'init':
        pass

    # who goes first
    if option == 'who_goes_first':
        print 'Receiver first'

    # friendly name
    if option == 'friendly_name':
        print 'TCP Cubic'

    # receiver
    if option == 'receiver':
        port = get_open_tcp_port()
        print 'Listening on port: %s' % port
        sys.stdout.flush()
        cmd = [src_file, '-s', '-p', port]
        check_call(cmd)

    # sender
    if option == 'sender':
        ip = sys.argv[2]
        port = sys.argv[3]
        cmd = [src_file, '-c', ip, '-p', port, '-t', '75']
        check_call(cmd)
Esempio n. 11
0
def main():
    usage.check_args(sys.argv, os.path.basename(__file__), 'sender_first')
    option = sys.argv[1]
    src_dir = os.path.abspath(os.path.dirname(__file__))
    submodule_dir = os.path.abspath(
        os.path.join(src_dir, '../third_party/webrtc'))
    src_file = os.path.join(submodule_dir, 'app.js')
    video_file = os.path.join(submodule_dir, 'video.y4m')
    video_md5 = 'a4ef8836e546bbef4276346d0b86e81b'

    # build dependencies
    if option == 'deps':
        deps_list = ('chromium-browser nodejs npm xvfb xfonts-100dpi '
                     'xfonts-75dpi xfonts-cyrillic xorg dbus-x11')
        print deps_list

    # build
    if option == 'build':
        cmd = 'cd %s && npm install' % submodule_dir
        check_call(cmd, shell=True)

    # commands to be run after building and before running
    if option == 'init':
        # check if video already exists and if its md5 checksum is correct
        cmd = ['md5sum', video_file]
        md5_proc = Popen(cmd, stdout=PIPE)
        md5_out = md5_proc.communicate()[0]

        if md5_proc.returncode != 0 or md5_out.split()[0] != video_md5:
            video_url = (
                'https://media.xiph.org/video/derf/y4m/blue_sky_1080p25.y4m')
            cmd = ['wget', '-O', video_file, video_url]
            check_call(cmd)

            cmd = ['md5sum', video_file]
            assert (check_output(cmd).split()[0] == video_md5)
        else:
            sys.stderr.write('video already exists\n')

    # who goes first
    if option == 'who_goes_first':
        print 'Sender first'

    # friendly name
    if option == 'friendly_name':
        print 'WebRTC media'

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

        port = get_open_udp_port()
        cmd = ['nodejs', src_file, port]
        signaling_server = Popen(cmd)
        print 'Listening on port: %s' % port
        sys.stdout.flush()

        cmd = ('chromium-browser --app=http://localhost:%s/sender '
               '--use-fake-ui-for-media-stream '
               '--use-fake-device-for-media-stream '
               '--use-file-for-fake-video-capture=%s '
               '--user-data-dir=/tmp/pantheon-tmp/webrtc-%s' %
               (port, video_file, uuid.uuid4()))
        check_call(cmd, shell=True)

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

        ip = sys.argv[2]
        port = sys.argv[3]
        cmd = ('chromium-browser --app=http://%s:%s/receiver '
               '--user-data-dir=/tmp/pantheon-tmp/webrtc-%s' %
               (ip, port, uuid.uuid4()))

        check_call(cmd, shell=True)
Esempio n. 12
0
def main():
    usage.check_args(sys.argv, path.basename(__file__), 'sender_first')
    option = sys.argv[1]
    src_dir = path.abspath(path.dirname(__file__))
    submodule_dir = path.abspath(
        path.join(src_dir, '../third_party/proto-quic'))
    find_unused_port_file = path.join(src_dir, 'find_unused_port')
    quic_server = path.join(submodule_dir, 'src/out/Release/quic_server')
    quic_client = path.join(submodule_dir, 'src/out/Release/quic_client')

    cert_dir = path.abspath(path.join(path.dirname(__file__), 'certs'))
    html_dir = path.join(submodule_dir, 'www.example.org')
    DEVNULL = open(os.devnull, 'w')

    # build dependencies
    if option == 'deps':
        print 'libnss3-tools'

    # build
    if option == 'build':
        os.environ['PATH'] += ':%s/depot_tools' % submodule_dir
        cmd = ('cd %s && gclient runhooks && ninja -C out/Release '
               'quic_client quic_server' % path.join(submodule_dir, 'src'))
        check_call(cmd, shell=True)

    # commands to be run after building and before running
    if option == 'init':
        # initialize NSS Shared DB
        home_dir = path.abspath(path.expanduser('~'))
        nssdb_dir = path.join(home_dir, '.pki/nssdb')

        try:
            # create nssdb directory if it doesn't exist
            os.makedirs(nssdb_dir)
        except OSError as exception:
            if exception.errno != errno.EEXIST:
                raise

        for f in os.listdir(nssdb_dir):
            os.remove(path.join(nssdb_dir, f))

        cert_pwd = path.join(cert_dir, 'cert_pwd')
        cmd = 'certutil -d %s -N -f %s' % (nssdb_dir, cert_pwd)
        check_call(cmd, shell=True)

        # trust certificate
        pem = path.join(cert_dir, '2048-sha256-root.pem')
        cmd = ('certutil -d sql:%s -A -t "C,," -n "QUIC" -i %s -f %s' %
               (nssdb_dir, pem, cert_pwd))
        check_call(cmd, shell=True)

        # generate a html of size that can be transferred longer than 60 s
        generate_html(html_dir, 50000000)

    # who goes first
    if option == 'who_goes_first':
        print 'Sender first'

    # friendly name
    if option == 'friendly_name':
        print 'QUIC Cubic (toy)'

    # sender
    if option == 'sender':
        port = get_open_udp_port()
        print 'Listening on port: %s' % port
        sys.stdout.flush()
        cmd = [
            quic_server,
            '--port=%s' % port,
            '--quic_in_memory_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)

    # receiver
    if option == 'receiver':
        ip = sys.argv[2]
        port = sys.argv[3]
        cmd = [
            quic_client,
            '--host=%s' % ip,
            '--port=%s' % port, 'https://www.example.org/'
        ]
        check_call(cmd, stdout=DEVNULL)

    DEVNULL.close()