Skip to content
Snippets Groups Projects
linearBandwidth.py 1.19 KiB
Newer Older
#!/usr/bin/python

Bob Lantz's avatar
Bob Lantz committed
"""
Test bandwidth on linear networks of varying size, using both
Bob Lantz's avatar
Bob Lantz committed
the kernel and user datapaths.

Each network looks like:
Bob Lantz's avatar
Bob Lantz committed

h0 <-> s0 <-> s1 .. sN <-> h1
"""
   
from mininet import init, LinearNet, iperfTest

def linearBandwidthTest():
Bob Lantz's avatar
Bob Lantz committed

   datapaths = [ 'kernel', 'user' ]
   switchCounts = [ 1, 20, 40, 60, 80, 100 ]
Bob Lantz's avatar
Bob Lantz committed

   for datapath in datapaths:
      k = datapath == 'kernel'
      results[ datapath ] = []
Bob Lantz's avatar
Bob Lantz committed
      for switchCount in switchCounts: 
         print "*** Creating linear network of size", switchCount
         network = LinearNet( switchCount, k)
         bandwidth = network.run( iperfTest )
         results[ datapath ] += [ ( switchCount, bandwidth ) ]
         
   for datapath in datapaths:
      print
Bob Lantz's avatar
Bob Lantz committed
      print "*** Linear network results for", datapath, "datapath:"
      print
      result = results[ datapath ]  
Bob Lantz's avatar
Bob Lantz committed
      print "SwitchCount\tiPerf results"
      for switchCount, bandwidth in result:
Bob Lantz's avatar
Bob Lantz committed
         print switchCount, '\t\t', 
         print bandwidth[ 0 ], 'server, ', bandwidth[ 1 ], 'client'
      print
   print
      
if __name__ == '__main__':
   init()
Bob Lantz's avatar
Bob Lantz committed
   print "*** Running linearBandwidthTest"
   linearBandwidthTest()
   exit( 1 )

Bob Lantz's avatar
Bob Lantz committed