Minor changes to get 'make test' to pass.

- some namespace conflicts due to unpep8
- fixed infinite recursion caused by removing redundant makeIntfPair
This commit is contained in:
Bob Lantz
2010-02-05 16:42:01 -08:00
parent 80a8fa62d5
commit 281f6e59db
4 changed files with 45 additions and 31 deletions
+6
View File
@@ -17,3 +17,9 @@ codecheck: $(PYSRC)
test: $(MININET) $(TEST) test: $(MININET) $(TEST)
mininet/test/test_nets.py mininet/test/test_nets.py
install:
python setup.py install
+26 -18
View File
@@ -1,5 +1,8 @@
#!/usr/bin/python #!/usr/bin/python
"""Mininet: A simple networking testbed for OpenFlow! """
Mininet: A simple networking testbed for OpenFlow!
author: Bob Lantz (rlantz@cs.stanford.edu) author: Bob Lantz (rlantz@cs.stanford.edu)
author: Brandon Heller (brandonh@stanford.edu) author: Brandon Heller (brandonh@stanford.edu)
@@ -39,9 +42,13 @@ several switch interfaces, halves of veth pairs whose other halves
reside in the host nodes that the switches are connected to. reside in the host nodes that the switches are connected to.
Naming: Naming:
Host nodes are named h1-hN Host nodes are named h1-hN
Switch nodes are named s0-sN Switch nodes are named s0-sN
Interfaces are named { nodename }-eth0 .. { nodename }-ethN,""" Interfaces are named { nodename }-eth0 .. { nodename }-ethN
"""
import os import os
import re import re
import signal import signal
@@ -219,7 +226,8 @@ class Mininet( object ):
lg.info( '\n' ) lg.info( '\n' )
lg.info( '*** Testing control network\n' ) lg.info( '*** Testing control network\n' )
while not controller.intfIsUp( controller.intfs[ 0 ] ): while not controller.intfIsUp( controller.intfs[ 0 ] ):
lg.info( '*** Waiting for %s to come up\n', controller.intfs[ 0 ] ) lg.info( '*** Waiting for %s to come up\n',
controller.intfs[ 0 ] )
sleep( 1 ) sleep( 1 )
for switchDpid in self.topo.switches(): for switchDpid in self.topo.switches():
switch = self.nodes[ switchDpid ] switch = self.nodes[ switchDpid ]
@@ -509,21 +517,21 @@ class MininetCLI( object ):
# Commands # Commands
def help( self, args ): def help( self, args ):
"Semi-useful help for CLI." "Semi-useful help for CLI."
helpStr = ( 'Available commands are:' + str( self.cmds ) + '\n' + helpStr = ( 'Available commands are:' + str( self.cmds ) + '\n'
'You may also send a command to a node using:\n' + 'You may also send a command to a node using:\n'
' <node> command {args}\n' + ' <node> command {args}\n'
'For example:\n' + 'For example:\n'
' mininet> h0 ifconfig\n' + ' mininet> h0 ifconfig\n'
'\n' + '\n'
'The interpreter automatically substitutes IP ' + 'The interpreter automatically substitutes IP '
'addresses\n' + 'addresses\n'
'for node names, so commands like\n' + 'for node names, so commands like\n'
' mininet> h0 ping -c1 h1\n' + ' mininet> h0 ping -c1 h1\n'
'should work.\n' + 'should work.\n'
'\n\n' + '\n\n'
'Interactive commands are not really supported yet,\n' + 'Interactive commands are not really supported yet,\n'
'so please limit commands to ones that do not\n' + 'so please limit commands to ones that do not\n'
'require user interaction and will terminate\n' + 'require user interaction and will terminate\n'
'after a reasonable amount of time.\n' ) 'after a reasonable amount of time.\n' )
print( helpStr ) print( helpStr )
+1 -1
View File
@@ -28,7 +28,7 @@ class Node( object ):
if self.inNamespace: if self.inNamespace:
cmd = [ 'netns' ] + cmd cmd = [ 'netns' ] + cmd
self.shell = Popen( cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT, self.shell = Popen( cmd, stdin=PIPE, stdout=PIPE, stderr=STDOUT,
closeFds=closeFds ) close_fds=closeFds )
self.stdin = self.shell.stdin self.stdin = self.shell.stdin
self.stdout = self.shell.stdout self.stdout = self.shell.stdout
self.pollOut = select.poll() self.pollOut = select.poll()
+1 -1
View File
@@ -100,7 +100,7 @@ def moveIntf( intf, node, printError=False, retries=3, delaySecs=0.001 ):
intf: string, interface intf: string, interface
node: Node object node: Node object
printError: if true, print error""" printError: if true, print error"""
retry( retries, delaySecs, moveIntf, intf, node, printError ) retry( retries, delaySecs, moveIntfNoRetry, intf, node, printError )
def createLink( node1, node2, retries=10, delaySecs=0.001 ): def createLink( node1, node2, retries=10, delaySecs=0.001 ):
"""Create a link between nodes, making an interface for each. """Create a link between nodes, making an interface for each.