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

Begin test/example for popen().

parent 5ca91f9c
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/python
"""
This example tests the Host.popen()/pexec() interface
"""
from mininet.net import Mininet
from mininet.node import CPULimitedHost
from mininet.topo import SingleSwitchTopo
from mininet.log import setLogLevel
# from mininet.cli import CLI
from mininet.util import custom
def testpopen(sched='cfs'):
"Test popen() interface"
host = custom( CPULimitedHost, cpu=.2, sched=sched )
net = Mininet( SingleSwitchTopo( 2 ), host=host )
net.start()
h1 = net.get( 'h1' )
# CLI(net)
out, err, code = h1.pexec( 'ifconfig' )
print 'stdout:', out.strip()
print 'stderr:', err.strip()
print 'exit code:', code
net.stop()
if __name__ == '__main__':
setLogLevel( 'info' )
testpopen('rt')
testpopen('cfs')
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