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

Function intfOptions

examples/intfoptions.py:14–44  ·  view source on GitHub ↗

run various traffic control commands on a single interface

()

Source from the content-addressed store, hash-verified

12from mininet.link import TCLink
13
14def intfOptions():
15 "run various traffic control commands on a single interface"
16 net = Mininet( autoStaticArp=True, waitConnected=True )
17 net.addController( 'c0' )
18 h1 = net.addHost( 'h1' )
19 h2 = net.addHost( 'h2' )
20 s1 = net.addSwitch( 's1' )
21 link1 = net.addLink( h1, s1, cls=TCLink )
22 net.addLink( h2, s1 )
23 net.start()
24
25 # flush out latency from reactive forwarding delay
26 net.pingAll()
27
28 info( '\n*** Configuring one intf with bandwidth of 10 Mb\n' )
29 link1.intf1.config( bw=10 )
30 info( '\n*** Running iperf to test\n' )
31 net.iperf( seconds=10 )
32
33 info( '\n*** Configuring one intf with loss of 50%\n' )
34 link1.intf1.config( loss=50 )
35 info( '\n' )
36 net.iperf( ( h1, h2 ), l4Type='UDP' )
37
38 info( '\n*** Configuring one intf with delay of 15ms\n' )
39 link1.intf1.config( delay='15ms' )
40 info( '\n*** Run a ping to confirm delay\n' )
41 net.pingPairFull()
42
43 info( '\n*** Done testing\n' )
44 net.stop()
45
46
47if __name__ == '__main__':

Callers 1

intfoptions.pyFile · 0.85

Calls 11

addControllerMethod · 0.95
addHostMethod · 0.95
addSwitchMethod · 0.95
addLinkMethod · 0.95
startMethod · 0.95
pingAllMethod · 0.95
iperfMethod · 0.95
pingPairFullMethod · 0.95
stopMethod · 0.95
MininetClass · 0.90
configMethod · 0.45

Tested by

no test coverage detected