Worked once on user, kernel for 1-20 switches.
This commit is contained in:
+22
-20
@@ -4,11 +4,11 @@
|
||||
Test bandwidth (using iperf) on linear networks of varying size,
|
||||
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
|
||||
| | |
|
||||
hN+1 hN+2 hN+N
|
||||
h1 <-> sN+1 <-> sN+2 .. sN+N-1
|
||||
| | |
|
||||
h2 h3 hN
|
||||
|
||||
Note: by default, the reference controller only supports 16
|
||||
switches, so this test WILL NOT WORK unless you have recompiled
|
||||
@@ -24,7 +24,7 @@ from mininet.topo import Topo, Node
|
||||
from mininet.log import lg
|
||||
|
||||
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 ):
|
||||
|
||||
@@ -32,22 +32,22 @@ class LinearTopo( Topo ):
|
||||
super( LinearTopo, self ).__init__()
|
||||
|
||||
# Create switch and host nodes
|
||||
switches = range( 0, N )
|
||||
hosts = range( N, 2*N + 1 )
|
||||
for id in switches:
|
||||
self._add_node( id, Node( is_switch=True ) )
|
||||
hosts = range( 1, N+1 )
|
||||
switches = range( N+1, N+N )
|
||||
for id in hosts:
|
||||
self._add_node( id, Node( is_switch=False ) )
|
||||
|
||||
# Connect switches
|
||||
for id in switches:
|
||||
self._add_node( id, Node( is_switch=True ) )
|
||||
|
||||
# Wire up switches
|
||||
for s in switches[ :-1 ]:
|
||||
self._add_edge( s, s + 1 )
|
||||
|
||||
# Connect hosts
|
||||
|
||||
# Wire up hosts
|
||||
self._add_edge( hosts[ 0 ], switches[ 0 ] )
|
||||
for s in switches:
|
||||
self._add_edge( s, s + N + 1)
|
||||
|
||||
for h in hosts[ 1: ]:
|
||||
self._add_edge( h, h+N-1 )
|
||||
|
||||
# Consider all switches and hosts 'on'
|
||||
self.enable_all()
|
||||
|
||||
@@ -58,18 +58,20 @@ def linearBandwidthTest( lengths ):
|
||||
datapaths = [ 'kernel', 'user' ]
|
||||
results = {}
|
||||
switchCount = max( lengths )
|
||||
hostCount = switchCount + 1
|
||||
|
||||
for datapath in datapaths:
|
||||
Switch = KernelSwitch if datapath == 'kernel' else UserSwitch
|
||||
results[ datapath ] = []
|
||||
net = Mininet( topo=LinearTopo( switchCount ), switch=Switch )
|
||||
net = Mininet( topo=LinearTopo( hostCount ), switch=Switch )
|
||||
net.start()
|
||||
print "*** testing basic connectivity"
|
||||
net.ping( [ net.hosts[ 0 ], net.hosts[ -1 ] ] )
|
||||
print "*** testing bandwidth"
|
||||
for n in lengths:
|
||||
print "testing h0 <-> h" + `n`, ; flush()
|
||||
bandwidth = net.iperf( [ net.hosts[ 0 ], net.hosts[ n ] ] )
|
||||
src, dst = net.hosts[ 0 ], net.hosts[ n ]
|
||||
print "testing", src.name, "<->", dst.name
|
||||
bandwidth = net.iperf( [ src, dst ] )
|
||||
print bandwidth ; flush()
|
||||
results[ datapath ] += [ ( n, bandwidth ) ]
|
||||
net.stop()
|
||||
@@ -90,6 +92,6 @@ if __name__ == '__main__':
|
||||
lg.setLogLevel( 'info' )
|
||||
init()
|
||||
print "*** Running linearBandwidthTest"
|
||||
linearBandwidthTest( [ 1, 10 ] )
|
||||
linearBandwidthTest( [ 1, 10, 20 ] )
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user