77c473687e
In certain cases, dp0 and its interfaces were not being cleaned up, probably due to scratchnet.py being killed before it terminated. This in turn caused the natnet test to fail.
29 lines
695 B
Python
Executable File
29 lines
695 B
Python
Executable File
#!/usr/bin/env python
|
|
|
|
"""
|
|
Test for scratchnet.py
|
|
"""
|
|
|
|
import unittest
|
|
from mininet.util import pexpect
|
|
|
|
class testScratchNet( unittest.TestCase ):
|
|
|
|
opts = [ "1 packets transmitted, 1 received, 0% packet loss", pexpect.EOF ]
|
|
|
|
def pingTest( self, name ):
|
|
"Verify that no ping packets were dropped"
|
|
p = pexpect.spawn( 'python -m %s' % name )
|
|
index = p.expect( self.opts, timeout=120 )
|
|
self.assertEqual( index, 0 )
|
|
p.wait()
|
|
|
|
def testPingKernel( self ):
|
|
self.pingTest( 'mininet.examples.scratchnet' )
|
|
|
|
def testPingUser( self ):
|
|
self.pingTest( 'mininet.examples.scratchnetuser' )
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|