示例#1
0
def main():
    top_dir = os.path.join(args.dir, args.topo, args.workload)
    if not os.path.exists(top_dir):
        os.makedirs(top_dir)

    start = time()
    topo, pox_c = get_topology(top_dir)
    link = custom(TCLink, bw=args.bw,
                  max_queue_size=args.q)  #, delay=args.delay)
    net = Mininet(controller=RemoteController,
                  topo=topo,
                  host=Host,
                  link=link,
                  switch=OVSKernelSwitch)
    net.start()

    workload = get_workload(net)
    #net.pingAll()
    sleep(3)
    #CLI(net)

    get_max_throughput(net, top_dir)

    for nflows in range(1, 9):
        cwd = os.path.join(top_dir, "flows%d" % nflows)

        if not os.path.exists(cwd):
            os.makedirs(cwd)
        enable_mptcp(nflows)

        cprint(
            "Starting experiment for workload %s with %i subflows" %
            (args.workload, nflows), "green")

        workload.run(cwd, args.qmon)

        # Shut down iperf processes
        os.system('killall -9 ' + CUSTOM_IPERF_PATH)

    net.stop()

    # kill pox controller
    pox_c.kill()
    pox_c.wait()

    Popen("killall -9 top bwm-ng tcpdump cat mnexec", shell=True).wait()
    end = time()
    reset()
    cprint("Experiment took %.3f seconds" % (end - start), "yellow")
示例#2
0
def main():
    top_dir = os.path.join(args.dir, args.topo, args.workload)
    if not os.path.exists(top_dir):
        os.makedirs(top_dir)

    start = time()
    topo, pox_c = get_topology(top_dir)
    link = custom(TCLink, bw=args.bw, max_queue_size=args.q) #, delay=args.delay)
    net = Mininet(controller=RemoteController, topo=topo, host=Host,
                  link=link, switch=OVSKernelSwitch)
    net.start()

    workload = get_workload(net)
    #net.pingAll()
    sleep(3)
    #CLI(net)

    get_max_throughput(net, top_dir)

    for nflows in range(1, 9):
        cwd = os.path.join(top_dir, "flows%d" % nflows)

        if not os.path.exists(cwd):
            os.makedirs(cwd)
        enable_mptcp(nflows)

        cprint("Starting experiment for workload %s with %i subflows" % (
                args.workload, nflows), "green")

        workload.run(cwd, args.qmon)

        # Shut down iperf processes
        os.system('killall -9 ' + CUSTOM_IPERF_PATH)

    net.stop()

    # kill pox controller
    pox_c.kill()
    pox_c.wait()

    Popen("killall -9 top bwm-ng tcpdump cat mnexec", shell=True).wait()
    end = time()
    reset()
    cprint("Experiment took %.3f seconds" % (end - start), "yellow")
示例#3
0
文件: test_ft.py 项目: jreeseue/mptcp
def main():
    args = parse_args()
    # pox_c = Popen("exec ~/pox/pox.py --no-cli riplpox.riplpox --topo=dht --routing=hashed --mode=reactive 1> /tmp/pox.out 2> /tmp/pox.out", shell=True)
    pox_c = Popen("exec ~/pox/pox.py --no-cli riplpox.riplpox --topo=ft,%s --routing=hashed --mode=reactive 1> /tmp/pox.out 2> /tmp/pox.out" % args.k, shell=True)
    time.sleep(1) # wait for controller to start

    topo = FatTreeTopo(k=args.k)
    # topo = DualHomedTopo(k=args.k)
    link = custom(TCLink, bw=args.bw, max_queue_size=100)

    print 'Starting mininet...'
    net = Mininet(controller=RemoteController, topo=topo, link=link,
                  switch=OVSKernelSwitch, host=Host)
    net.start()

    enable_mptcp(args.nflows)
    time.sleep(3)

    mappings = create_mappings(args, net)
    
    sndrs = mappings['s']
    rcvrs = mappings['r']

    # print 's:', sndrs
    # print 'r:', rcvrs

    if args.debug:
        outfiles = {h: '/tmp/%s.out' % h.name for h in sndrs + rcvrs}
        errfiles = {h: '/tmp/%s.out' % h.name for h in sndrs + rcvrs}
        [ h.cmd('echo >',outfiles[h]) for h in sndrs + rcvrs ]
        [ h.cmd('echo >',errfiles[h]) for h in sndrs + rcvrs ]

    for r in rcvrs:
        if args.debug:
            r.sendCmd('python receiver.py --id %s --nr %d --ns %d --ds %s --debug'
                      % (r.name, args.nr, args.ns, args.ds),
                      '1>', outfiles[r],
                      '2>', errfiles[r])
        else:
            r.sendCmd('python receiver.py --id %s --nr %i --ns %i --ds %s' 
                      % (r.name, args.nr, args.ns, args.ds))

    time.sleep(1) # let servers start up

    ips = map(lambda x: x.IP(), rcvrs)

    for s,i in zip(sndrs,range(len(sndrs))):
        if args.debug:
            s.sendCmd('python sender.py --id %s --cs %d --ips %s --ds %s --debug' 
                      % (i, args.cs, ips, args.ds),
                      '1>', outfiles[s],
                      '2>', errfiles[s])
        else:
            s.sendCmd('python sender.py --id %s --cs %d --ips %s --ds %s' %
                      (i, args.cs, ips, args.ds))

    tts = {}
    ttr = {}
    p = subprocess.Popen(['./timer.py'])
    for s in sndrs:
        tts[s] = s.waitOutput()
    for r in rcvrs:
        ttr[r] = r.waitOutput()

    p.kill()

    print tts.values()
    print ttr.values()
    
    net.stop()

    # kill pox controller
    pox_c.kill()
    pox_c.wait()

    #net.stop()
    reset()
    write_results(tts, ttr, args)