Revision 748e35d5 examples/linearBandwidth.py

View differences:

examples/linearBandwidth.py
1 1
#!/usr/bin/python
2 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
   
3 12
from mininet import init, LinearNet, iperfTest
4 13

  
5 14
def linearBandwidthTest():
6
   """Test bandwidth on a linear network of varying size, using both
7
      the kernel and user datapaths."""
8
  
9
   print "*** Testing Mininet with kernel and user datapath"
10
   
11
   datapaths = [ 'kernel' ]
15

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

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

  
36
   
47
   

Also available in: Unified diff