Skip to content
Snippets Groups Projects
Commit c80e18cd authored by Bob Lantz's avatar Bob Lantz
Browse files

Worked once on user, kernel for 1-20 switches.

parent 1bda2d21
No related branches found
No related tags found
No related merge requests found
...@@ -4,11 +4,11 @@ ...@@ -4,11 +4,11 @@
Test bandwidth (using iperf) on linear networks of varying size, Test bandwidth (using iperf) on linear networks of varying size,
using both kernel and user datapaths. using both kernel and user datapaths.
We construct a network of N switches and N+1 hosts, connected as follows: We construct a network of N hosts and N-1 switches, connected as follows:
hN <-> s0 <-> s1 .. sN-1 h1 <-> sN+1 <-> sN+2 .. sN+N-1
| | | | | |
hN+1 hN+2 hN+N h2 h3 hN
Note: by default, the reference controller only supports 16 Note: by default, the reference controller only supports 16
switches, so this test WILL NOT WORK unless you have recompiled switches, so this test WILL NOT WORK unless you have recompiled
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
from mininet.log import lg from mininet.log import lg
class LinearTopo( Topo ): class LinearTopo( Topo ):
"Topology for a string of N switches and 1+N hosts." "Topology for a string of N hosts and N-1 switches."
def __init__( self, N ): def __init__( self, N ):
...@@ -32,22 +32,22 @@ def __init__( self, N ): ...@@ -32,22 +32,22 @@ def __init__( self, N ):
super( LinearTopo, self ).__init__() super( LinearTopo, self ).__init__()
# Create switch and host nodes # Create switch and host nodes
switches = range( 0, N ) hosts = range( 1, N+1 )
hosts = range( N, 2*N + 1 ) switches = range( N+1, N+N )
for id in switches:
self._add_node( id, Node( is_switch=True ) )
for id in hosts: for id in hosts:
self._add_node( id, Node( is_switch=False ) ) self._add_node( id, Node( is_switch=False ) )
for id in switches:
# Connect switches self._add_node( id, Node( is_switch=True ) )
# Wire up switches
for s in switches[ :-1 ]: for s in switches[ :-1 ]:
self._add_edge( s, s + 1 ) self._add_edge( s, s + 1 )
# Connect hosts # Wire up hosts
self._add_edge( hosts[ 0 ], switches[ 0 ] ) self._add_edge( hosts[ 0 ], switches[ 0 ] )
for s in switches: for h in hosts[ 1: ]:
self._add_edge( s, s + N + 1) self._add_edge( h, h+N-1 )
# Consider all switches and hosts 'on' # Consider all switches and hosts 'on'
self.enable_all() self.enable_all()
...@@ -58,18 +58,20 @@ def linearBandwidthTest( lengths ): ...@@ -58,18 +58,20 @@ def linearBandwidthTest( lengths ):
datapaths = [ 'kernel', 'user' ] datapaths = [ 'kernel', 'user' ]
results = {} results = {}
switchCount = max( lengths ) switchCount = max( lengths )
hostCount = switchCount + 1
for datapath in datapaths: for datapath in datapaths:
Switch = KernelSwitch if datapath == 'kernel' else UserSwitch Switch = KernelSwitch if datapath == 'kernel' else UserSwitch
results[ datapath ] = [] results[ datapath ] = []
net = Mininet( topo=LinearTopo( switchCount ), switch=Switch ) net = Mininet( topo=LinearTopo( hostCount ), switch=Switch )
net.start() net.start()
print "*** testing basic connectivity" print "*** testing basic connectivity"
net.ping( [ net.hosts[ 0 ], net.hosts[ -1 ] ] ) net.ping( [ net.hosts[ 0 ], net.hosts[ -1 ] ] )
print "*** testing bandwidth" print "*** testing bandwidth"
for n in lengths: for n in lengths:
print "testing h0 <-> h" + `n`, ; flush() src, dst = net.hosts[ 0 ], net.hosts[ n ]
bandwidth = net.iperf( [ net.hosts[ 0 ], net.hosts[ n ] ] ) print "testing", src.name, "<->", dst.name
bandwidth = net.iperf( [ src, dst ] )
print bandwidth ; flush() print bandwidth ; flush()
results[ datapath ] += [ ( n, bandwidth ) ] results[ datapath ] += [ ( n, bandwidth ) ]
net.stop() net.stop()
...@@ -90,6 +92,6 @@ def linearBandwidthTest( lengths ): ...@@ -90,6 +92,6 @@ def linearBandwidthTest( lengths ):
lg.setLogLevel( 'info' ) lg.setLogLevel( 'info' )
init() init()
print "*** Running linearBandwidthTest" print "*** Running linearBandwidthTest"
linearBandwidthTest( [ 1, 10 ] ) linearBandwidthTest( [ 1, 10, 20 ] )
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment