Skip to content
Snippets Groups Projects
Commit 2ceb5791 authored by Bob Lantz's avatar Bob Lantz
Browse files

Merge branch 'cdburkard-patches/test_walkthrough'

parents 8537e8d9 61c144b9
No related branches found
No related tags found
No related merge requests found
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
import unittest import unittest
import pexpect import pexpect
import os import os
import re
from mininet.util import quietRun from mininet.util import quietRun
class testWalkthrough( unittest.TestCase ): class testWalkthrough( unittest.TestCase ):
...@@ -25,10 +26,10 @@ def testHelp( self ): ...@@ -25,10 +26,10 @@ def testHelp( self ):
def testWireshark( self ): def testWireshark( self ):
"Use tshark to test the of dissector" "Use tshark to test the of dissector"
tshark = pexpect.spawn( 'tshark -i lo -R of' ) tshark = pexpect.spawn( 'tshark -i lo -R of' )
tshark.expect( 'Capturing on lo' ) tshark.expect( [ 'Capturing on lo', "Capturing on 'Loopback'" ] )
mn = pexpect.spawn( 'mn --test pingall' ) mn = pexpect.spawn( 'mn --test pingall' )
mn.expect( '0% dropped' ) mn.expect( '0% dropped' )
tshark.expect( 'OFP 74 Hello' ) tshark.expect( [ '74 Hello', '74 of_hello' ] )
tshark.sendintr() tshark.sendintr()
def testBasic( self ): def testBasic( self ):
...@@ -64,7 +65,7 @@ def testBasic( self ): ...@@ -64,7 +65,7 @@ def testBasic( self ):
node = p.match.group( 1 ) node = p.match.group( 1 )
actual.append( node ) actual.append( node )
p.expect( '\n' ) p.expect( '\n' )
self.assertEqual( actual.sort(), nodes.sort(), '"nodes" and "dump" differ' ) self.assertEqual( actual.sort(), nodes.sort(), '"nodes" and "dump" differ' )
p.expect( self.prompt ) p.expect( self.prompt )
p.sendline( 'exit' ) p.sendline( 'exit' )
p.wait() p.wait()
...@@ -101,11 +102,11 @@ def testHostCommands( self ): ...@@ -101,11 +102,11 @@ def testHostCommands( self ):
break break
self.assertEqual( ifcount, 3, 'Missing interfaces on s1') self.assertEqual( ifcount, 3, 'Missing interfaces on s1')
# h1 ps # h1 ps
p.sendline( 'h1 ps -a' ) p.sendline( "h1 ps -a | egrep -v 'ps|grep'" )
p.expect( self.prompt ) p.expect( self.prompt )
h1Output = p.before h1Output = p.before
# s1 ps # s1 ps
p.sendline( 's1 ps -a' ) p.sendline( "s1 ps -a | egrep -v 'ps|grep'" )
p.expect( self.prompt ) p.expect( self.prompt )
s1Output = p.before s1Output = p.before
# strip command from ps output # strip command from ps output
...@@ -208,7 +209,7 @@ def testVerbosity( self ): ...@@ -208,7 +209,7 @@ def testVerbosity( self ):
p = pexpect.spawn( 'mn -v debug --test none' ) p = pexpect.spawn( 'mn -v debug --test none' )
p.expect( pexpect.EOF ) p.expect( pexpect.EOF )
lines = p.before.split( '\n' ) lines = p.before.split( '\n' )
self.assertTrue( len( lines ) > 100, "Debug output is too short" ) self.assertTrue( len( lines ) > 70, "Debug output is too short" )
def testCustomTopo( self ): def testCustomTopo( self ):
"Start Mininet using a custom topo, then run pingall" "Start Mininet using a custom topo, then run pingall"
...@@ -327,5 +328,6 @@ def testRemoteController( self ): ...@@ -327,5 +328,6 @@ def testRemoteController( self ):
pox.sendintr() pox.sendintr()
pox.wait() pox.wait()
if __name__ == '__main__': if __name__ == '__main__':
unittest.main() unittest.main()
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment