Statistics
| Branch: | Tag: | Revision:

mininet / examples / linearbandwidth.py @ 696a619d

History | View | Annotate | Download (1.38 KB)

1
#!/usr/bin/python
2

    
3
"""
4
Test bandwidth (using iperf) on linear networks of varying size, 
5
using both 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
from mininet import init, LinearNet, iperfTest
17

    
18
def linearBandwidthTest():
19

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

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

    
51