Minor tweaks and corrections.

Added commentary on control network to mininet.py.
Hopefully fixed linearbandwidth.py for real.
This commit is contained in:
Bob Lantz
2009-12-15 18:50:44 -08:00
parent ea420ee29f
commit 696a619d0e
6 changed files with 42 additions and 21 deletions
+1 -1
View File
@@ -13,5 +13,5 @@ class NoxController( Controller ):
if __name__ == '__main__': if __name__ == '__main__':
init() init()
network = GridNet( 2, 2, kernel=True, Controller=NoxController) network = GridNet( 2, 2, kernel=True, Controller=NoxController )
network.run( Cli ) network.run( Cli )
+1 -1
View File
@@ -26,7 +26,7 @@ def linearBandwidthTest():
results[ datapath ] = [] results[ datapath ] = []
for switchCount in switchCounts: for switchCount in switchCounts:
print "*** Creating linear network of size", switchCount print "*** Creating linear network of size", switchCount
network = LinearNet( switchCount, k) network = LinearNet( switchCount, kernel=k)
bandwidth = network.run( iperfTest ) bandwidth = network.run( iperfTest )
results[ datapath ] += [ ( switchCount, bandwidth ) ] results[ datapath ] += [ ( switchCount, bandwidth ) ]
+1 -1
View File
@@ -13,5 +13,5 @@ class NoxController( Controller ):
if __name__ == '__main__': if __name__ == '__main__':
init() init()
network = TreeNet( depth=2, fanout=4, kernel=True, Controller=NoxController) network = TreeNet( depth=2, fanout=4, kernel=True, Controller=NoxController )
network.run( Cli ) network.run( Cli )
+1 -1
View File
@@ -3,7 +3,7 @@
""" """
Build a simple network from scratch, using mininet primitives. Build a simple network from scratch, using mininet primitives.
This is more complicated than using the higher-level classes, This is more complicated than using the higher-level classes,
but it exposes the configuration details and allows cusomization. but it exposes the configuration details and allows customization.
""" """
from mininet import init, Node, createLink from mininet import init, Node, createLink
+7 -3
View File
@@ -3,15 +3,19 @@
""" """
Build a simple network from scratch, using mininet primitives. Build a simple network from scratch, using mininet primitives.
This is more complicated than using the higher-level classes, This is more complicated than using the higher-level classes,
but it exposes the configuration details and allows cusomization. but it exposes the configuration details and allows customization.
This version uses the user datapath. This version uses the user datapath.
""" """
from mininet import init, Node, createLink from mininet import init, Node, createLink
def scratchNet( cname='controller', cargs='ptcp:'): def scratchNetUser( cname='controller', cargs='ptcp:'):
# Create Network # Create Network
# It's not strictly necessary for the controller and switches
# to be in separate namespaces. For performance, they probably
# should be in the root namespace. However, it's interesting to
# see how they could work even if they are in separate namespaces.
controller = Node( 'c0' ) controller = Node( 'c0' )
switch = Node( 's0') switch = Node( 's0')
h0 = Node( 'h0' ) h0 = Node( 'h0' )
@@ -40,4 +44,4 @@ def scratchNet( cname='controller', cargs='ptcp:'):
if __name__ == '__main__': if __name__ == '__main__':
init() init()
scratchNet() scratchNetUser()
+31 -14
View File
@@ -50,9 +50,8 @@ Thoughts/TBD:
For the moment, specifying configurations and tests in Python For the moment, specifying configurations and tests in Python
is straightforward and relatively concise. is straightforward and relatively concise.
Soon, we may want to split the various subsystems (core, Soon, we may want to split the various subsystems (core,
cli, tests, etc.) into multiple modules. topology/network, cli, tests, etc.) into multiple modules.
We don't support nox nicely just yet - you have to hack this file Currently nox support is in nox.py.
or subclass things aggressively.
We'd like to support OpenVSwitch as well as the reference We'd like to support OpenVSwitch as well as the reference
implementation. implementation.
@@ -396,10 +395,27 @@ def nameGen( prefix ):
i = 0 i = 0
while True: yield prefix + `i`; i += 1 while True: yield prefix + `i`; i += 1
# Control network support # Control network support:
# For the user datapath, we create an explicit control network. #
# Note: Instead of routing, we could bridge or use "in-band" control # Create an explicit control network. Currently this is only
# used by the user datapath configuration.
#
# Notes:
#
# 1. If the controller and switches are in the same (e.g. root)
# namespace, they can just use the loopback connection.
# We may wish to do this for the user datapath as well as the
# kernel datapath.
#
# 2. If we can get unix domain sockets to work, we can use them
# instead of an explicit control network.
#
# 3. Instead of routing, we could bridge or use "in-band" control.
#
# 4. Even if we dispense with this in general, it could still be
# useful for people who wish to simulate a separate control
# network (since real networks may need one!)
def configureRoutedControlNetwork( controller, switches, ips): def configureRoutedControlNetwork( controller, switches, ips):
"""Configure a routed control network on controller and switches, """Configure a routed control network on controller and switches,
for use with the user datapath.""" for use with the user datapath."""
@@ -542,7 +558,7 @@ class TreeNet( Network ):
def __init__( self, depth, fanout, **kwargs): def __init__( self, depth, fanout, **kwargs):
self.depth, self.fanout = depth, fanout self.depth, self.fanout = depth, fanout
Network.__init__( self, **kwargs ) Network.__init__( self, **kwargs )
def treeNet( self, controller, depth, fanout, kernel=True, snames=None, def treeNet( self, controller, depth, fanout, snames=None,
hnames=None, dpnames=None ): hnames=None, dpnames=None ):
"""Return a tree network of the given depth and fanout as a triple: """Return a tree network of the given depth and fanout as a triple:
( root, switches, hosts ), using the given switch, host and ( root, switches, hosts ), using the given switch, host and
@@ -555,21 +571,21 @@ class TreeNet( Network ):
host = Host( hnames.next() ) host = Host( hnames.next() )
print host.name, ; flush() print host.name, ; flush()
return host, [], [ host ] return host, [], [ host ]
dp = dpnames.next() if kernel else None dp = dpnames.next() if self.kernel else None
switch = Switch( snames.next(), dp ) switch = Switch( snames.next(), dp )
if not kernel: createLink( switch, controller ) if not self.kernel: createLink( switch, controller )
print switch.name, ; flush() print switch.name, ; flush()
switches, hosts = [ switch ], [] switches, hosts = [ switch ], []
for i in range( 0, fanout ): for i in range( 0, fanout ):
child, slist, hlist = self.treeNet( controller, child, slist, hlist = self.treeNet( controller,
depth - 1, fanout, kernel, snames, hnames, dpnames ) depth - 1, fanout, snames, hnames, dpnames )
createLink( switch, child ) createLink( switch, child )
switches += slist switches += slist
hosts += hlist hosts += hlist
return switch, switches, hosts return switch, switches, hosts
def makeNet( self, controller ): def makeNet( self, controller ):
root, switches, hosts = self.treeNet( controller, root, switches, hosts = self.treeNet( controller,
self.depth, self.fanout, self.kernel) self.depth, self.fanout )
return switches, hosts return switches, hosts
# Grid network # Grid network
@@ -630,9 +646,10 @@ class GridNet( Network ):
return switches, hosts return switches, hosts
class LinearNet( GridNet ): class LinearNet( GridNet ):
def __init__( self, switchCount, kernel=True ): "A network consisting of two hosts connected by a string of switches."
def __init__( self, switchCount, **kwargs ):
self.switchCount = switchCount self.switchCount = switchCount
GridNet.__init__( self, switchCount, 1, linear=True ) GridNet.__init__( self, switchCount, 1, linear=True, **kwargs )
# Tests # Tests