Revision 58324bdc examples/limit.py

View differences:

examples/limit.py
8 8
from mininet.link import TCIntf
9 9
from mininet.node import CPULimitedHost
10 10
from mininet.topolib import TreeTopo
11
from mininet.util import custom
12
from mininet.log import setLogLevel
11
from mininet.util import custom, quietRun
12
from mininet.log import setLogLevel, info
13 13

  
14 14

  
15 15
def testLinkLimit( net, bw ):
16 16
    "Run bandwidth limit test"
17
    print '*** Testing network %.2f Mbps bandwidth limit' % bw
18
    net.iperf( )
19

  
17
    info( '*** Testing network %.2f Mbps bandwidth limit\n' % bw )
18
    net.iperf()
20 19

  
21 20
def limit( bw=10, cpu=.1 ):
22 21
    """Example/test of link and CPU bandwidth limits
......
25 24
    intf = custom( TCIntf, bw=bw )
26 25
    myTopo = TreeTopo( depth=1, fanout=2 )
27 26
    for sched in 'rt', 'cfs':
28
        print '*** Testing with', sched, 'bandwidth limiting'
27
        info( '*** Testing with', sched, 'bandwidth limiting\n' )
28
        if sched == 'rt':
29
            release = quietRun( 'uname -r' ).strip('\r\n')
30
            output = quietRun( 'grep CONFIG_RT_GROUP_SCHED /boot/config-%s' % release )
31
            if output == '# CONFIG_RT_GROUP_SCHED is not set\n':
32
                info( '*** RT Scheduler is not enabled in your kernel. Skipping this test\n' )
33
                continue
29 34
        host = custom( CPULimitedHost, sched=sched, cpu=cpu )
30 35
        net = Mininet( topo=myTopo, intf=intf, host=host )
31 36
        net.start()

Also available in: Unified diff