Пример #1
0
def intfOptions():
    "run various traffic control commands on a single interface"
    net = Mininet(autoStaticArp=True)
    net.addController('c0')
    h1 = net.addHost('h1')
    h2 = net.addHost('h2')
    s1 = net.addSwitch('s1')
    link1 = net.addLink(h1, s1, cls=TCLink)
    net.addLink(h2, s1)
    net.start()

    # flush out latency from reactive forwarding delay
    net.pingAll()

    info('\n*** Configuring one intf with bandwidth of 5 Mb\n')
    link1.intf1.config(bw=5)
    info('\n*** Running iperf to test\n')
    net.iperf()

    info('\n*** Configuring one intf with loss of 50%\n')
    link1.intf1.config(loss=50)
    info('\n')
    net.iperf((h1, h2), l4Type='UDP')

    info('\n*** Configuring one intf with delay of 15ms\n')
    link1.intf1.config(delay='15ms')
    info('\n*** Run a ping to confirm delay\n')
    net.pingPairFull()

    info('\n*** Done testing\n')
    net.stop()
Пример #2
0
def perfTest(lossy=True):
    "Create network and run simple performance test"
    topo = SingleSwitchTopo(n=4, lossy=lossy)
    net = Mininet(topo=topo,
                  host=CPULimitedHost,
                  link=TCLink,
                  autoStaticArp=True)
    net.start()
    print "Dumping host connections"
    dumpNodeConnections(net.hosts)
    print "Testing bandwidth between h1 and h4"
    h1, h4 = net.getNodeByName('h1', 'h4')
    net.iperf((h1, h4), l4Type='UDP')
    net.stop()
Пример #3
0
def verySimpleLimit(bw=150):
    "Absurdly simple limiting test"
    intf = custom(TCIntf, bw=bw)
    net = Mininet(intf=intf)
    h1, h2 = net.addHost('h1'), net.addHost('h2')
    net.addLink(h1, h2)
    net.start()
    net.pingAll()
    net.iperf()
    h1.cmdPrint('tc -s qdisc ls dev', h1.defaultIntf())
    h2.cmdPrint('tc -d class show dev', h2.defaultIntf())
    h1.cmdPrint('tc -s qdisc ls dev', h1.defaultIntf())
    h2.cmdPrint('tc -d class show dev', h2.defaultIntf())
    net.stop()
Пример #4
0
def linearBandwidthTest(lengths):

    "Check bandwidth at various lengths along a switch chain."

    results = {}
    switchCount = max(lengths)
    hostCount = switchCount + 1

    switches = {
        'reference user': UserSwitch,
        'Open vSwitch kernel': OVSKernelSwitch
    }

    # UserSwitch is horribly slow with recent kernels.
    # We can reinstate it once its performance is fixed
    del switches['reference user']

    topo = LinearTestTopo(hostCount)

    # Select TCP Reno
    output = quietRun('sysctl -w net.ipv4.tcp_congestion_control=reno')
    assert 'reno' in output

    for datapath in switches.keys():
        print "*** testing", datapath, "datapath"
        Switch = switches[datapath]
        results[datapath] = []
        link = partial(TCLink, delay='1ms')
        net = Mininet(topo=topo,
                      switch=Switch,
                      controller=Controller,
                      waitConnected=True,
                      link=link)
        net.start()
        print "*** testing basic connectivity"
        for n in lengths:
            net.ping([net.hosts[0], net.hosts[n]])
        print "*** testing bandwidth"
        for n in lengths:
            src, dst = net.hosts[0], net.hosts[n]
            # Try to prime the pump to reduce PACKET_INs during test
            # since the reference controller is reactive
            src.cmd('telnet', dst.IP(), '5001')
            print "testing", src.name, "<->", dst.name,
            bandwidth = net.iperf([src, dst], seconds=10)
            print bandwidth
            flush()
            results[datapath] += [(n, bandwidth)]
        net.stop()

    for datapath in switches.keys():
        print
        print "*** Linear network results for", datapath, "datapath:"
        print
        result = results[datapath]
        print "SwitchCount\tiperf Results"
        for switchCount, bandwidth in result:
            print switchCount, '\t\t',
            print bandwidth[0], 'server, ', bandwidth[1], 'client'
        print
    print