MCPcopy Create free account
hub / github.com/mininet/mininet / limit

Function limit

examples/limit.py:20–41  ·  view source on GitHub ↗

Example/test of link and CPU bandwidth limits bw: interface bandwidth limit in Mbps cpu: cpu limit as fraction of overall CPU time

( bw=10, cpu=.1 )

Source from the content-addressed store, hash-verified

18 net.iperf()
19
20def limit( bw=10, cpu=.1 ):
21 """Example/test of link and CPU bandwidth limits
22 bw: interface bandwidth limit in Mbps
23 cpu: cpu limit as fraction of overall CPU time"""
24 intf = custom( TCIntf, bw=bw )
25 myTopo = TreeTopo( depth=1, fanout=2 )
26 for sched in 'rt', 'cfs':
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'
31 % release )
32 if output == '# CONFIG_RT_GROUP_SCHED is not set\n':
33 info( '*** RT Scheduler is not enabled in your kernel. '
34 'Skipping this test\n' )
35 continue
36 host = custom( CPULimitedHost, sched=sched, cpu=cpu )
37 net = Mininet( topo=myTopo, intf=intf, host=host, waitConnected=True )
38 net.start()
39 testLinkLimit( net, bw=bw )
40 net.runCpuLimitTest( cpu=cpu )
41 net.stop()
42
43def verySimpleLimit( bw=150 ):
44 "Absurdly simple limiting test"

Callers 1

limit.pyFile · 0.85

Calls 8

startMethod · 0.95
runCpuLimitTestMethod · 0.95
stopMethod · 0.95
customFunction · 0.90
TreeTopoClass · 0.90
quietRunFunction · 0.90
MininetClass · 0.90
testLinkLimitFunction · 0.85

Tested by

no test coverage detected