Statistics
| Branch: | Tag: | Revision:

mininet / examples / linearBandwidth.py @ f4d9e05d

History | View | Annotate | Download (1.36 KB)

1
#!/usr/bin/python
2

    
3
"""
4
Test bandwidth on linear networks of varying size, using both
5
the kernel and user datapaths.
6

7
Each network looks like:
8

9
h0 <-> s0 <-> s1 .. sN <-> h1
10

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
"""
16
   
17
from mininet import init, LinearNet, iperfTest
18

    
19
def linearBandwidthTest():
20

    
21
   datapaths = [ 'kernel', 'user' ]
22
   switchCounts = [ 1, 20, 40, 60, 80, 100 ]
23
   results = {}
24

    
25
   for datapath in datapaths:
26
      k = datapath == 'kernel'
27
      results[ datapath ] = []
28
      for switchCount in switchCounts: 
29
         print "*** Creating linear network of size", switchCount
30
         network = LinearNet( switchCount, k)
31
         bandwidth = network.run( iperfTest )
32
         results[ datapath ] += [ ( switchCount, bandwidth ) ]
33
         
34
   for datapath in datapaths:
35
      print
36
      print "*** Linear network results for", datapath, "datapath:"
37
      print
38
      result = results[ datapath ]  
39
      print "SwitchCount\tiPerf results"
40
      for switchCount, bandwidth in result:
41
         print switchCount, '\t\t', 
42
         print bandwidth[ 0 ], 'server, ', bandwidth[ 1 ], 'client'
43
      print
44
   print
45
      
46
if __name__ == '__main__':
47
   init()
48
   print "*** Running linearBandwidthTest"
49
   linearBandwidthTest()
50
   exit( 1 )
51

    
52