diff --git a/INSTALL b/INSTALL index c8b99309be54f2b6f3de4648e206d450769a1d84..843f35ee6f0e001c93dff9055a7a58e6aa0487c5 100644 --- a/INSTALL +++ b/INSTALL @@ -4,7 +4,7 @@ Preliminary Mininet Installation/Configuration Notes - This is not (yet) a 'release'; things may be broken. - Mininet is not currently 'installed.' If you want to install it, - so that you can 'import mininet', place it somewhere in your + so that you can 'import mininet', place mininet.py somewhere in your python path. - A functional netns binary is required to run mininet, but currently you diff --git a/README b/README index 59c19c145268b25f8f4df0f973711ecadc663a68..2b2a0dfc363f211afcfef803a99c9afade45abb3 100644 --- a/README +++ b/README @@ -21,7 +21,8 @@ creation of OpenFlow networks of varying sizes and topologies. In order to run Mininet, you must have: * A Linux 2.6.26 or greater kernel compiled with network namespace support - enabled. (debian-testing seems to have such a kernel.) + enabled. (debian-testing seems to have such a kernel, but it doesn't + work for compiling nox, unfortunately.) * The OpenFlow reference implementation (either the user or kernel datapath may be used, and the tun or ofdatapath kernel modules must be diff --git a/cleanup b/cleanup index f3294b54ebd22e59e829b980db8ab4072551bf87..dedfb8307d783b4fcb563c459439a11c2d93f5cb 100755 --- a/cleanup +++ b/cleanup @@ -31,7 +31,7 @@ def cleanup(): print "*** Removing all links of the pattern foo-ethX" links = sh( "ip link show | egrep -o '(\w+-eth\w+)'" ).split( '\n' ) for link in links: - if link: sh( "ip link del " + link ) + if link != '': sh( "ip link del " + link ) print "*** Removing excess controllers/ofprotocols/ofdatapaths/pings/noxes" zombies = 'controller ofprotocol ofdatapath ping nox_core lt-nox_core' @@ -43,7 +43,7 @@ def cleanup(): print "*** Removing excess kernel datapaths" dps = sh( "ps ax | egrep -o 'dp[0-9]+' | sed 's/dp/nl:/'" ).split( '\n') for dp in dps: - if dp: sh( 'ip link del ' + link ) + if dp != '': sh( 'ip link del ' + link ) print "*** Removing junk from /tmp" sh( 'rm -f /tmp/vconn* /tmp/vlogs* /tmp/*.out /tmp/*.log' ) diff --git a/mininet.py b/mininet.py index f503cf7972525ee33250c3bcecda6e3344364590..3704a7232d144e00ba51f20f36a3c3faf0cad0f3 100755 --- a/mininet.py +++ b/mininet.py @@ -346,21 +346,30 @@ def makeIntfPair( intf1, intf2 ): def moveIntf( intf, node ): "Move intf to node." cmd = 'ip link set ' + intf + ' netns ' + `node.pid` - checkRun( cmd ) + quietRun( cmd ) links = node.cmd( 'ip link show' ) if not intf in links: print "*** Error: moveIntf:", intf, "not successfully moved to", print node.name,":" - exit( 1 ) - return + return False + return True + +def retry( n, fn, *args): + "Try something N times before giving up." + tries = 0 + while not apply( fn, args ) and tries < 3: + sleep( 1 ) + print "*** retrying..."; flush() + tries += 1 + if tries > 3: exit( 1 ) def createLink( node1, node2 ): "Create a link node1-intf1 <---> node2-intf2." intf1 = node1.newIntf() intf2 = node2.newIntf() makeIntfPair( intf1, intf2 ) - if node1.inNamespace: moveIntf( intf1, node1 ) - if node2.inNamespace: moveIntf( intf2, node2 ) + if node1.inNamespace: retry( 3, moveIntf, intf1, node1 ) + if node2.inNamespace: retry( 3, moveIntf, intf2, node2 ) node1.connection[ intf1 ] = ( node2, intf2 ) node2.connection[ intf2 ] = ( node1, intf1 ) return intf1, intf2