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

Use sudo -n when talking to VM

parent 6008f987
No related branches found
No related tags found
No related merge requests found
...@@ -259,7 +259,8 @@ class MininetRunner( object ): ...@@ -259,7 +259,8 @@ class MininetRunner( object ):
CONTROLLERS[ 'default' ] = findController() CONTROLLERS[ 'default' ] = findController()
if CONTROLLERS[ 'default' ] is None: if CONTROLLERS[ 'default' ] is None:
if self.options.switch == 'default': if self.options.switch == 'default':
# Fall back to OVS Bridge, which does not use an OF controller # Fall back to OVS Bridge, which does not u
se an OF controller
info( '*** No default OpenFlow controller found for default switch!\n' ) info( '*** No default OpenFlow controller found for default switch!\n' )
info( '*** Falling back to OVS Bridge\n' ) info( '*** Falling back to OVS Bridge\n' )
self.options.switch = 'ovsbr' self.options.switch = 'ovsbr'
......
...@@ -490,21 +490,21 @@ def login( vm, user='mininet', password='mininet' ): ...@@ -490,21 +490,21 @@ def login( vm, user='mininet', password='mininet' ):
def removeNtpd( vm, prompt=Prompt, ntpPackage='ntp' ): def removeNtpd( vm, prompt=Prompt, ntpPackage='ntp' ):
"Remove ntpd and set clock immediately" "Remove ntpd and set clock immediately"
log( '* Removing ntpd' ) log( '* Removing ntpd' )
vm.sendline( 'sudo apt-get -qy remove ' + ntpPackage ) vm.sendline( 'sudo -n apt-get -qy remove ' + ntpPackage )
vm.expect( prompt ) vm.expect( prompt )
# Try to make sure that it isn't still running # Try to make sure that it isn't still running
vm.sendline( 'sudo pkill ntpd' ) vm.sendline( 'sudo -n pkill ntpd' )
vm.expect( prompt ) vm.expect( prompt )
log( '* Getting seconds since epoch from this server' ) log( '* Getting seconds since epoch from this server' )
# Note r'date +%s' specifies a format for 'date', not python! # Note r'date +%s' specifies a format for 'date', not python!
seconds = int( run( r'date +%s' ) ) seconds = int( run( r'date +%s' ) )
log( '* Setting VM clock' ) log( '* Setting VM clock' )
vm.sendline( 'sudo date -s @%d' % seconds ) vm.sendline( 'sudo -n date -s @%d' % seconds )
def sanityTest( vm ): def sanityTest( vm ):
"Run Mininet sanity test (pingall) in vm" "Run Mininet sanity test (pingall) in vm"
vm.sendline( 'sudo mn --test pingall' ) vm.sendline( 'sudo -n mn --test pingall' )
if vm.expect( [ ' 0% dropped', pexpect.TIMEOUT ], timeout=45 ) == 0: if vm.expect( [ ' 0% dropped', pexpect.TIMEOUT ], timeout=45 ) == 0:
log( '* Sanity check OK' ) log( '* Sanity check OK' )
else: else:
...@@ -516,9 +516,9 @@ def sanityTest( vm ): ...@@ -516,9 +516,9 @@ def sanityTest( vm ):
def coreTest( vm, prompt=Prompt ): def coreTest( vm, prompt=Prompt ):
"Run core tests (make test) in VM" "Run core tests (make test) in VM"
log( '* Making sure cgroups are mounted' ) log( '* Making sure cgroups are mounted' )
vm.sendline( 'sudo service cgroup-lite restart' ) vm.sendline( 'sudo -n service cgroup-lite restart' )
vm.expect( prompt ) vm.expect( prompt )
vm.sendline( 'sudo cgroups-mount' ) vm.sendline( 'sudo -n cgroups-mount' )
vm.expect( prompt ) vm.expect( prompt )
log( '* Running make test' ) log( '* Running make test' )
vm.sendline( 'cd ~/mininet; sudo make test' ) vm.sendline( 'cd ~/mininet; sudo make test' )
...@@ -537,7 +537,7 @@ def coreTest( vm, prompt=Prompt ): ...@@ -537,7 +537,7 @@ def coreTest( vm, prompt=Prompt ):
def installPexpect( vm, prompt=Prompt ): def installPexpect( vm, prompt=Prompt ):
"install pexpect" "install pexpect"
vm.sendline( 'sudo apt-get -qy install python-pexpect' ) vm.sendline( 'sudo -n apt-get -qy install python-pexpect' )
vm.expect( prompt ) vm.expect( prompt )
...@@ -550,19 +550,19 @@ def noneTest( vm, prompt=Prompt ): ...@@ -550,19 +550,19 @@ def noneTest( vm, prompt=Prompt ):
def examplesquickTest( vm, prompt=Prompt ): def examplesquickTest( vm, prompt=Prompt ):
"Quick test of mininet examples" "Quick test of mininet examples"
installPexpect( vm, prompt ) installPexpect( vm, prompt )
vm.sendline( 'sudo python ~/mininet/examples/test/runner.py -v -quick' ) vm.sendline( 'sudo -n python ~/mininet/examples/test/runner.py -v -quick' )
def examplesfullTest( vm, prompt=Prompt ): def examplesfullTest( vm, prompt=Prompt ):
"Full (slow) test of mininet examples" "Full (slow) test of mininet examples"
installPexpect( vm, prompt ) installPexpect( vm, prompt )
vm.sendline( 'sudo python ~/mininet/examples/test/runner.py -v' ) vm.sendline( 'sudo -n python ~/mininet/examples/test/runner.py -v' )
def walkthroughTest( vm, prompt=Prompt ): def walkthroughTest( vm, prompt=Prompt ):
"Test mininet walkthrough" "Test mininet walkthrough"
installPexpect( vm, prompt ) installPexpect( vm, prompt )
vm.sendline( 'sudo python ~/mininet/mininet/test/test_walkthrough.py -v' ) vm.sendline( 'sudo -n python ~/mininet/mininet/test/test_walkthrough.py -v' )
def useTest( vm, prompt=Prompt ): def useTest( vm, prompt=Prompt ):
...@@ -588,7 +588,7 @@ def checkOutBranch( vm, branch, prompt=Prompt ): ...@@ -588,7 +588,7 @@ def checkOutBranch( vm, branch, prompt=Prompt ):
vm.sendline( 'cd ~/mininet; git fetch --all; git checkout ' vm.sendline( 'cd ~/mininet; git fetch --all; git checkout '
+ branch + '; git pull --rebase origin ' + branch ) + branch + '; git pull --rebase origin ' + branch )
vm.expect( prompt ) vm.expect( prompt )
vm.sendline( 'sudo make install' ) vm.sendline( 'sudo -n make install' )
def interact( vm, tests, pre='', post='', prompt=Prompt ): def interact( vm, tests, pre='', post='', prompt=Prompt ):
...@@ -607,7 +607,7 @@ def interact( vm, tests, pre='', post='', prompt=Prompt ): ...@@ -607,7 +607,7 @@ def interact( vm, tests, pre='', post='', prompt=Prompt ):
'install-mininet-vm.sh' % branch ) 'install-mininet-vm.sh' % branch )
vm.expect( prompt ) vm.expect( prompt )
log( '* Running VM install script' ) log( '* Running VM install script' )
installcmd = 'bash install-mininet-vm.sh' installcmd = 'bash -v install-mininet-vm.sh'
if Branch: if Branch:
installcmd += ' ' + Branch installcmd += ' ' + Branch
vm.sendline( installcmd ) vm.sendline( installcmd )
...@@ -910,7 +910,7 @@ def bootAndRun( image, prompt=Prompt, memory=1024, outputFile=None, ...@@ -910,7 +910,7 @@ def bootAndRun( image, prompt=Prompt, memory=1024, outputFile=None,
if runFunction: if runFunction:
runFunction( vm, **runArgs ) runFunction( vm, **runArgs )
log( '* Shutting down' ) log( '* Shutting down' )
vm.sendline( 'sudo shutdown -h now ' ) vm.sendline( 'sudo -n shutdown -h now ' )
log( '* Waiting for shutdown' ) log( '* Waiting for shutdown' )
vm.wait() vm.wait()
if outputFile: if outputFile:
......
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