4 example of using various TCIntf options.
5 reconfigures a single interface using intf.config()
6 to use different traffic control commands to test
7 bandwidth, loss, and delay
10 from mininet.net import Mininet
11 from mininet.log import setLogLevel, info
12 from mininet.link import TCLink
15 "run various traffic control commands on a single interface"
16 net = Mininet( autoStaticArp=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 )
25 # flush out latency from reactive forwarding delay
28 info( '\n*** Configuring one intf with bandwidth of 5 Mb\n' )
29 link1.intf1.config( bw=5 )
30 info( '\n*** Running iperf to test\n' )
33 info( '\n*** Configuring one intf with loss of 50%\n' )
34 link1.intf1.config( loss=50 )
36 net.iperf( ( h1, h2 ), l4Type='UDP' )
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' )
43 info( '\n*** Done testing\n' )
46 if __name__ == '__main__':