Fixed problem for empty lists in cleanup.

Added retry() function for createLink to see if it helps (probably won't.)
Random edits to docs.
This commit is contained in:
Bob Lantz
2009-12-15 19:53:22 -08:00
parent 696a619d0e
commit 0a9ea29fd2
4 changed files with 19 additions and 9 deletions
+1 -1
View File
@@ -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
+2 -1
View File
@@ -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
+2 -2
View File
@@ -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' )
+14 -5
View File
@@ -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