Statistics
| Branch: | Tag: | Revision:

mininet / examples / linearBandwidth.py @ 748e35d5

History | View | Annotate | Download (1.19 KB)

1
#!/usr/bin/python
2

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

7
The network looks like:
8

9
h0 <-> s0 <-> s1 .. sN <-> h1
10
"""
11
   
12
from mininet import init, LinearNet, iperfTest
13

    
14
def linearBandwidthTest():
15

    
16
   datapaths = [ 'kernel', 'user' ]
17
   switchCounts = [ 1, 20, 40, 60, 80, 100 ]
18
   results = {}
19

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

    
47