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

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

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

h0 <-> s0 <-> s1 .. sN <-> h1
Bob Lantz's avatar
Bob Lantz committed

Note: by default, the reference controller only supports 16
switches, so this test WILL NOT WORK unless you have recompiled
your controller to support a 100 switches (or more.)
Bob Lantz's avatar
Bob Lantz committed
"""
   
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