run various traffic control commands on a single interface
()
| 12 | from mininet.link import TCLink |
| 13 | |
| 14 | def 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 | |
| 47 | if __name__ == '__main__': |
no test coverage detected