Statistics
| Branch: | Tag: | Revision:

mininet / examples / linearBandwidth.py @ f4d9e05d

History | View | Annotate | Download (1.36 KB)

1 4ccc7ee9 Bob Lantz
#!/usr/bin/python
2
3 748e35d5 Bob Lantz
"""
4 af8f0b61 Bob Lantz
Test bandwidth on linear networks of varying size, using both
5 748e35d5 Bob Lantz
the kernel and user datapaths.
6

7 af8f0b61 Bob Lantz
Each network looks like:
8 748e35d5 Bob Lantz

9
h0 <-> s0 <-> s1 .. sN <-> h1
10 f4d9e05d Bob Lantz

11
Note: by default, the reference controller only supports 16
12
switches, so this test WILL NOT WORK unless you have recompiled
13
your controller to support a 100 switches (or more.)
14

15 748e35d5 Bob Lantz
"""
16
   
17 4ccc7ee9 Bob Lantz
from mininet import init, LinearNet, iperfTest
18
19
def linearBandwidthTest():
20 748e35d5 Bob Lantz
21
   datapaths = [ 'kernel', 'user' ]
22
   switchCounts = [ 1, 20, 40, 60, 80, 100 ]
23 4ccc7ee9 Bob Lantz
   results = {}
24 748e35d5 Bob Lantz
25 4ccc7ee9 Bob Lantz
   for datapath in datapaths:
26
      k = datapath == 'kernel'
27
      results[ datapath ] = []
28 748e35d5 Bob Lantz
      for switchCount in switchCounts: 
29
         print "*** Creating linear network of size", switchCount
30 4ccc7ee9 Bob Lantz
         network = LinearNet( switchCount, k)
31
         bandwidth = network.run( iperfTest )
32
         results[ datapath ] += [ ( switchCount, bandwidth ) ]
33
         
34
   for datapath in datapaths:
35
      print
36 748e35d5 Bob Lantz
      print "*** Linear network results for", datapath, "datapath:"
37 4ccc7ee9 Bob Lantz
      print
38
      result = results[ datapath ]  
39 748e35d5 Bob Lantz
      print "SwitchCount\tiPerf results"
40 4ccc7ee9 Bob Lantz
      for switchCount, bandwidth in result:
41 748e35d5 Bob Lantz
         print switchCount, '\t\t', 
42
         print bandwidth[ 0 ], 'server, ', bandwidth[ 1 ], 'client'
43
      print
44
   print
45
      
46 4ccc7ee9 Bob Lantz
if __name__ == '__main__':
47
   init()
48 748e35d5 Bob Lantz
   print "*** Running linearBandwidthTest"
49 4ccc7ee9 Bob Lantz
   linearBandwidthTest()
50
   exit( 1 )
51
52 748e35d5 Bob Lantz