Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 31b1093d86 | |||
| ea48a0e6e8 | |||
| ae8c12c471 | |||
| a30d2fb42d | |||
| 2c0f29d361 | |||
| aacd47136c | |||
| 38a4c3309c | |||
| c8aff1dab0 | |||
| 71bdfd37bd | |||
| b558055c3e | |||
| 2554a2d02d | |||
| b21782d121 | |||
| 5e216acca4 | |||
| fe923b2a18 | |||
| 66ccff9275 | |||
| 89ec246bd2 | |||
| ac4a673e6f | |||
| d2d27043a8 | |||
| 023a6169a8 | |||
| 6fdf8dcf2b | |||
| dbba9dc711 | |||
| 305651c006 | |||
| c359825be9 | |||
| f86fe7f9d2 | |||
| befde4825b | |||
| dc9399b308 | |||
| 095e4e299a | |||
| b1d84855cc | |||
| 7476c5e051 | |||
| a8a9e7d2eb |
+28
@@ -0,0 +1,28 @@
|
||||
language: python
|
||||
sudo: required
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- dist: trusty
|
||||
env: dist="14.04 LTS trusty"
|
||||
- dist: xenial
|
||||
env: dist="16.04 LTS xenial"
|
||||
|
||||
before_install:
|
||||
- sudo apt-get update -qq
|
||||
- sudo apt-get install -qq vlan
|
||||
- sudo util/install.sh -n
|
||||
|
||||
install:
|
||||
- bash -c "[ `lsb_release -rs` == '14.04' ] && make codecheck"
|
||||
- sudo util/install.sh -fnvw
|
||||
|
||||
script:
|
||||
- sudo mn --test pingall
|
||||
- sudo python mininet/test/runner.py -v -quick
|
||||
- sudo python examples/test/runner.py -v -quick
|
||||
|
||||
notifications:
|
||||
email:
|
||||
on_success: never
|
||||
# More details: https://docs.travis-ci.com/user/notifications#Configuring-email-notifications
|
||||
@@ -18,6 +18,7 @@ Cody Burkard
|
||||
|
||||
Additional Mininet Contributors
|
||||
|
||||
M S Vishwanath Bhat
|
||||
Tomasz Buchert
|
||||
Gustavo Pantuza Coelho Pinto
|
||||
Fernando Cappi
|
||||
@@ -29,6 +30,7 @@ Andrew Ferguson
|
||||
Eder Leao Fernandes
|
||||
Gregory Gee
|
||||
Jon Hall
|
||||
Jono Hart
|
||||
Roan Huang
|
||||
Vitaly Ivanov
|
||||
Babis Kaidos
|
||||
@@ -39,10 +41,12 @@ David Mahler
|
||||
Murphy McCauley
|
||||
José Pedro Oliveira
|
||||
James Page
|
||||
Rahman Pujianto
|
||||
Angad Singh
|
||||
Piyush Srivastava
|
||||
Ed Swierk
|
||||
Darshan Thaker
|
||||
Olivier Tilmans
|
||||
Andreas Wundsam
|
||||
Isaku Yamahata
|
||||
Baohua Yang
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
Mininet Installation/Configuration Notes
|
||||
----------------------------------------
|
||||
|
||||
Mininet 2.2.2b1
|
||||
Mininet 2.2.2
|
||||
---
|
||||
|
||||
The supported installation methods for Mininet are 1) using a
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Mininet 2.2.2b1 License
|
||||
Mininet 2.2.2 License
|
||||
|
||||
Copyright (c) 2013-2016 Open Networking Laboratory
|
||||
Copyright (c) 2013-2017 Open Networking Laboratory
|
||||
Copyright (c) 2009-2012 Bob Lantz and The Board of Trustees of
|
||||
The Leland Stanford Junior University
|
||||
|
||||
|
||||
@@ -3,7 +3,9 @@ Mininet: Rapid Prototyping for Software Defined Networks
|
||||
|
||||
*The best way to emulate almost any network on your laptop!*
|
||||
|
||||
Mininet 2.2.2b1
|
||||
Mininet 2.2.2
|
||||
|
||||
[![Build Status][1]](https://travis-ci.org/mininet/mininet)
|
||||
|
||||
### What is Mininet?
|
||||
|
||||
@@ -127,3 +129,5 @@ Mininet to change the networking world!
|
||||
|
||||
Bob Lantz
|
||||
Mininet Core Team
|
||||
|
||||
[1]: https://travis-ci.org/mininet/mininet.svg?branch=devel/2.2.2
|
||||
|
||||
@@ -30,7 +30,7 @@ from mininet.node import ( Host, CPULimitedHost, Controller, OVSController,
|
||||
UserSwitch, OVSSwitch, OVSBridge,
|
||||
IVSSwitch )
|
||||
from mininet.nodelib import LinuxBridge
|
||||
from mininet.link import Link, TCLink, OVSLink
|
||||
from mininet.link import Link, TCLink, TCULink, OVSLink
|
||||
from mininet.topo import ( SingleSwitchTopo, LinearTopo,
|
||||
SingleSwitchReversedTopo, MinimalTopo )
|
||||
from mininet.topolib import TreeTopo, TorusTopo
|
||||
@@ -73,29 +73,30 @@ HOSTS = { 'proc': Host,
|
||||
'cfs': specialClass( CPULimitedHost, defaults=dict( sched='cfs' ) ) }
|
||||
|
||||
CONTROLLERDEF = 'default'
|
||||
|
||||
CONTROLLERS = { 'ref': Controller,
|
||||
'ovsc': OVSController,
|
||||
'nox': NOX,
|
||||
'remote': RemoteController,
|
||||
'ryu': Ryu,
|
||||
'default': DefaultController, # Note: replaced below
|
||||
'default': DefaultController, # Note: overridden below
|
||||
'none': NullController }
|
||||
|
||||
LINKDEF = 'default'
|
||||
LINKS = { 'default': Link,
|
||||
LINKS = { 'default': Link, # Note: overridden below
|
||||
'tc': TCLink,
|
||||
'tcu': TCULink,
|
||||
'ovs': OVSLink }
|
||||
|
||||
|
||||
# optional tests to run
|
||||
TESTS = [ 'cli', 'build', 'pingall', 'pingpair', 'iperf', 'all', 'iperfudp',
|
||||
'none' ]
|
||||
# Names of tests that are Mininet() methods
|
||||
TESTNAMES = [ 'cli', 'build', 'pingall', 'pingpair', 'iperf', 'all',
|
||||
'iperfudp', 'none' ]
|
||||
|
||||
ALTSPELLING = { 'pingall': 'pingAll',
|
||||
'pingpair': 'pingPair',
|
||||
'iperfudp': 'iperfUdp',
|
||||
'iperfUDP': 'iperfUdp' }
|
||||
# Map to alternate functions and/or spellings of Mininet() methods
|
||||
TESTS = { 'pingall': 'pingAll',
|
||||
'pingpair': 'pingPair',
|
||||
'iperfudp': 'iperfUdp',
|
||||
'iperfUDP': 'iperfUdp' }
|
||||
|
||||
|
||||
def addDictOption( opts, choicesDict, default, name, **kwargs ):
|
||||
@@ -158,7 +159,8 @@ class MininetRunner( object ):
|
||||
|
||||
def setCustom( self, name, value ):
|
||||
"Set custom parameters for MininetRunner."
|
||||
if name in ( 'topos', 'switches', 'hosts', 'controllers', 'links' ):
|
||||
if name in ( 'topos', 'switches', 'hosts', 'controllers', 'links'
|
||||
'testnames', 'tests' ):
|
||||
# Update dictionaries
|
||||
param = name.upper()
|
||||
globals()[ param ].update( value )
|
||||
@@ -208,10 +210,9 @@ class MininetRunner( object ):
|
||||
type='string',
|
||||
help='read custom classes or params from .py file(s)'
|
||||
)
|
||||
|
||||
opts.add_option( '--test', type='choice', choices=TESTS,
|
||||
default=TESTS[ 0 ],
|
||||
help='|'.join( TESTS ) )
|
||||
testList = TESTNAMES + TESTS.keys()
|
||||
opts.add_option( '--test', default=[], action='append',
|
||||
dest='tests', help='|'.join( testList ) )
|
||||
opts.add_option( '--xterms', '-x', action='store_true',
|
||||
default=False, help='spawn xterms for each node' )
|
||||
opts.add_option( '--ipbase', '-i', type='string', default='10.0.0.0/8',
|
||||
@@ -225,7 +226,7 @@ class MininetRunner( object ):
|
||||
help = '|'.join( LEVELS.keys() ) )
|
||||
opts.add_option( '--innamespace', action='store_true',
|
||||
default=False, help='sw and ctrl in namespace?' )
|
||||
opts.add_option( '--listenport', type='int', default=6634,
|
||||
opts.add_option( '--listenport', type='int', default=6654,
|
||||
help='base port for passive switch listening' )
|
||||
opts.add_option( '--nolistenport', action='store_true',
|
||||
default=False, help="don't use passive listening " +
|
||||
@@ -312,6 +313,10 @@ class MininetRunner( object ):
|
||||
host = customClass( HOSTS, self.options.host )
|
||||
controller = [ customClass( CONTROLLERS, c )
|
||||
for c in self.options.controller ]
|
||||
if self.options.switch == 'user' and self.options.link == 'default':
|
||||
debug( '*** Using TCULink with UserSwitch\n' )
|
||||
# Use link configured correctly for UserSwitch
|
||||
self.options.link = 'tcu'
|
||||
link = customClass( LINKS, self.options.link )
|
||||
|
||||
if self.validate:
|
||||
@@ -358,23 +363,27 @@ class MininetRunner( object ):
|
||||
if self.options.pre:
|
||||
cli( mn, script=self.options.pre )
|
||||
|
||||
test = self.options.test
|
||||
test = ALTSPELLING.get( test, test )
|
||||
|
||||
mn.start()
|
||||
|
||||
if test == 'none':
|
||||
pass
|
||||
elif test == 'all':
|
||||
mn.waitConnected()
|
||||
mn.start()
|
||||
mn.ping()
|
||||
mn.iperf()
|
||||
elif test == 'cli':
|
||||
if not self.options.tests:
|
||||
cli( mn )
|
||||
elif test != 'build':
|
||||
mn.waitConnected()
|
||||
getattr( mn, test )()
|
||||
|
||||
for test in self.options.tests:
|
||||
test = TESTS.get( test, test )
|
||||
if callable( test ): # user added TESTMAP={'mytest': testfn}
|
||||
test( mn )
|
||||
elif test == 'none':
|
||||
pass
|
||||
elif test == 'all':
|
||||
mn.waitConnected()
|
||||
mn.start()
|
||||
mn.ping()
|
||||
mn.iperf()
|
||||
elif test == 'cli':
|
||||
cli( mn )
|
||||
elif test != 'build':
|
||||
mn.waitConnected()
|
||||
getattr( mn, test )()
|
||||
|
||||
if self.options.post:
|
||||
cli( mn, script=self.options.post )
|
||||
|
||||
+1
-1
@@ -402,7 +402,7 @@ class RemoteLink( Link ):
|
||||
cmd = 'ip link set %s netns %s' % ( intf, node.pid )
|
||||
node.rcmd( cmd )
|
||||
links = node.cmd( 'ip link show' )
|
||||
if not ' %s:' % intf in links:
|
||||
if not re.search( r' %s[:@]' % intf, links ):
|
||||
if printError:
|
||||
error( '*** Error: RemoteLink.moveIntf: ' + intf +
|
||||
' not successfully moved to ' + node.name + '\n' )
|
||||
|
||||
+49
-16
@@ -2,6 +2,30 @@
|
||||
|
||||
"""
|
||||
cpu.py: test iperf bandwidth for varying cpu limits
|
||||
|
||||
Since we are limiting the hosts (only), we should expect the iperf
|
||||
processes to be affected, as well as any system processing which is
|
||||
billed to the hosts.
|
||||
|
||||
We reserve >50% of cycles for system processing; we assume that
|
||||
this is enough for it not to affect results. Hosts are limited to
|
||||
40% of total cycles, which we assume is enough to make them CPU
|
||||
bound.
|
||||
|
||||
As CPU performance increases over time, we may have to reduce the
|
||||
overall CPU allocation so that the host processing is still CPU bound.
|
||||
This is perhaps an argument for specifying performance in a more
|
||||
system-independent manner.
|
||||
|
||||
It would also be nice to have a better handle on limiting packet
|
||||
processing cycles. It's not entirely clear to me how those are
|
||||
billed to user or system processes if we are using OVS with a kernel
|
||||
datapath. With a user datapath, they are easier to account for, but
|
||||
overall performance is usually lower.
|
||||
|
||||
Although the iperf client uses more CPU and should be CPU bound (?),
|
||||
we measure the received data at the server since the client transmit
|
||||
rate includes buffering.
|
||||
"""
|
||||
|
||||
from mininet.net import Mininet
|
||||
@@ -11,7 +35,7 @@ from mininet.util import custom, waitListening
|
||||
from mininet.log import setLogLevel, info
|
||||
|
||||
|
||||
def bwtest( cpuLimits, period_us=100000, seconds=5 ):
|
||||
def bwtest( cpuLimits, period_us=100000, seconds=10 ):
|
||||
"""Example/test of link and CPU bandwidth limits
|
||||
cpu: cpu limit as fraction of overall CPU time"""
|
||||
|
||||
@@ -20,27 +44,35 @@ def bwtest( cpuLimits, period_us=100000, seconds=5 ):
|
||||
results = {}
|
||||
|
||||
for sched in 'rt', 'cfs':
|
||||
print '*** Testing with', sched, 'bandwidth limiting'
|
||||
info( '*** Testing with', sched, 'bandwidth limiting\n' )
|
||||
for cpu in cpuLimits:
|
||||
# cpu is the cpu fraction for all hosts, so we divide
|
||||
# it across two hosts
|
||||
host = custom( CPULimitedHost, sched=sched,
|
||||
period_us=period_us,
|
||||
cpu=cpu )
|
||||
cpu=.5*cpu )
|
||||
try:
|
||||
net = Mininet( topo=topo, host=host )
|
||||
# pylint: disable=bare-except
|
||||
except:
|
||||
info( '*** Skipping host %s\n' % sched )
|
||||
info( '*** Skipping scheduler %s\n' % sched )
|
||||
break
|
||||
net.start()
|
||||
net.pingAll()
|
||||
hosts = [ net.getNodeByName( h ) for h in topo.hosts() ]
|
||||
client, server = hosts[ 0 ], hosts[ -1 ]
|
||||
server.cmd( 'iperf -s -p 5001 &' )
|
||||
info( '*** Starting iperf with %d%% of CPU allocated to hosts\n' %
|
||||
( 100.0 * cpu ) )
|
||||
# We measure at the server because it doesn't include
|
||||
# the client's buffer fill rate
|
||||
popen = server.popen( 'iperf -yc -s -p 5001' )
|
||||
waitListening( client, server, 5001 )
|
||||
result = client.cmd( 'iperf -yc -t %s -c %s' % (
|
||||
seconds, server.IP() ) ).split( ',' )
|
||||
# ignore empty result from waitListening/telnet
|
||||
popen.stdout.readline()
|
||||
client.cmd( 'iperf -yc -t %s -c %s' % ( seconds, server.IP() ) )
|
||||
result = popen.stdout.readline().split( ',' )
|
||||
bps = float( result[ -1 ] )
|
||||
server.cmdPrint( 'kill %iperf' )
|
||||
popen.terminate()
|
||||
net.stop()
|
||||
updated = results.get( sched, [] )
|
||||
updated += [ ( cpu, bps ) ]
|
||||
@@ -52,22 +84,23 @@ def bwtest( cpuLimits, period_us=100000, seconds=5 ):
|
||||
def dump( results ):
|
||||
"Dump results"
|
||||
|
||||
fmt = '%s\t%s\t%s'
|
||||
fmt = '%s\t%s\t%s\n'
|
||||
|
||||
print
|
||||
print fmt % ( 'sched', 'cpu', 'client MB/s' )
|
||||
print
|
||||
info( '\n' )
|
||||
info( fmt % ( 'sched', 'cpu', 'received bits/sec' ) )
|
||||
|
||||
for sched in sorted( results.keys() ):
|
||||
entries = results[ sched ]
|
||||
for cpu, bps in entries:
|
||||
pct = '%.2f%%' % ( cpu * 100 )
|
||||
mbps = bps / 1e6
|
||||
print fmt % ( sched, pct, mbps )
|
||||
pct = '%d%%' % ( cpu * 100 )
|
||||
mbps = '%.2e' % bps
|
||||
info( fmt % ( sched, pct, mbps ) )
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
setLogLevel( 'info' )
|
||||
limits = [ .45, .4, .3, .2, .1 ]
|
||||
# These are the limits for the hosts/iperfs - the
|
||||
# rest is for system processes
|
||||
limits = [ .5, .4, .3, .2, .1 ]
|
||||
out = bwtest( limits )
|
||||
dump( out )
|
||||
|
||||
+14
-12
@@ -26,7 +26,7 @@ of switches, this example demonstrates:
|
||||
from mininet.net import Mininet
|
||||
from mininet.node import UserSwitch, OVSKernelSwitch, Controller
|
||||
from mininet.topo import Topo
|
||||
from mininet.log import lg
|
||||
from mininet.log import lg, info
|
||||
from mininet.util import irange, quietRun
|
||||
from mininet.link import TCLink
|
||||
from functools import partial
|
||||
@@ -86,7 +86,7 @@ def linearBandwidthTest( lengths ):
|
||||
print "*** testing", datapath, "datapath"
|
||||
Switch = switches[ datapath ]
|
||||
results[ datapath ] = []
|
||||
link = partial( TCLink, delay='1ms' )
|
||||
link = partial( TCLink, delay='2ms', bw=10 )
|
||||
net = Mininet( topo=topo, switch=Switch,
|
||||
controller=Controller, waitConnected=True,
|
||||
link=link )
|
||||
@@ -100,11 +100,12 @@ def linearBandwidthTest( lengths ):
|
||||
# Try to prime the pump to reduce PACKET_INs during test
|
||||
# since the reference controller is reactive
|
||||
src.cmd( 'telnet', dst.IP(), '5001' )
|
||||
print "testing", src.name, "<->", dst.name,
|
||||
bandwidth = net.iperf( [ src, dst ], seconds=10 )
|
||||
print bandwidth
|
||||
info( "testing", src.name, "<->", dst.name, '\n' )
|
||||
# serverbw = received; _clientbw = buffered
|
||||
serverbw, _clientbw = net.iperf( [ src, dst ], seconds=10 )
|
||||
info( serverbw, '\n' )
|
||||
flush()
|
||||
results[ datapath ] += [ ( n, bandwidth ) ]
|
||||
results[ datapath ] += [ ( n, serverbw ) ]
|
||||
net.stop()
|
||||
|
||||
for datapath in switches.keys():
|
||||
@@ -112,12 +113,13 @@ def linearBandwidthTest( lengths ):
|
||||
print "*** Linear network results for", datapath, "datapath:"
|
||||
print
|
||||
result = results[ datapath ]
|
||||
print "SwitchCount\tiperf Results"
|
||||
for switchCount, bandwidth in result:
|
||||
print switchCount, '\t\t',
|
||||
print bandwidth[ 0 ], 'server, ', bandwidth[ 1 ], 'client'
|
||||
print
|
||||
print
|
||||
info( "SwitchCount\tiperf Results\n" )
|
||||
for switchCount, serverbw in result:
|
||||
info( switchCount, '\t\t' )
|
||||
info( serverbw, '\n' )
|
||||
info( '\n')
|
||||
info( '\n' )
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
lg.setLogLevel( 'info' )
|
||||
|
||||
+10
-11
@@ -5,13 +5,12 @@ Test for cpu.py
|
||||
|
||||
results format:
|
||||
|
||||
sched cpu client MB/s
|
||||
|
||||
cfs 45.00% 13254.669841
|
||||
cfs 40.00% 11822.441399
|
||||
cfs 30.00% 5112.963009
|
||||
cfs 20.00% 3449.090009
|
||||
cfs 10.00% 2271.741564
|
||||
sched cpu received bits/sec
|
||||
cfs 50% 8.14e+09
|
||||
cfs 40% 6.48e+09
|
||||
cfs 30% 4.56e+09
|
||||
cfs 20% 2.84e+09
|
||||
cfs 10% 1.29e+09
|
||||
|
||||
"""
|
||||
|
||||
@@ -26,13 +25,13 @@ class testCPU( unittest.TestCase ):
|
||||
@unittest.skipIf( '-quick' in sys.argv, 'long test' )
|
||||
def testCPU( self ):
|
||||
"Verify that CPU utilization is monotonically decreasing for each scheduler"
|
||||
p = pexpect.spawn( 'python -m mininet.examples.cpu' )
|
||||
p = pexpect.spawn( 'python -m mininet.examples.cpu', timeout=300 )
|
||||
# matches each line from results( shown above )
|
||||
opts = [ '([a-z]+)\t([\d\.]+)%\t([\d\.]+)',
|
||||
opts = [ '([a-z]+)\t([\d\.]+)%\t([\d\.e\+]+)',
|
||||
pexpect.EOF ]
|
||||
scheds = []
|
||||
while True:
|
||||
index = p.expect( opts, timeout=600 )
|
||||
index = p.expect( opts )
|
||||
if index == 0:
|
||||
sched = p.match.group( 1 )
|
||||
cpu = float( p.match.group( 2 ) )
|
||||
@@ -41,7 +40,7 @@ class testCPU( unittest.TestCase ):
|
||||
scheds.append( sched )
|
||||
else:
|
||||
self.assertTrue( bw < previous_bw,
|
||||
"%f should be less than %f\n" %
|
||||
"%e should be less than %e\n" %
|
||||
( bw, previous_bw ) )
|
||||
previous_bw = bw
|
||||
else:
|
||||
|
||||
@@ -34,8 +34,8 @@ class testLinearBandwidth( unittest.TestCase ):
|
||||
bw *= 10 ** 9
|
||||
# check that we have a previous result to compare to
|
||||
if n != 1:
|
||||
info = ( 'bw: %d bits/s across %d switches, '
|
||||
'previous: %d bits/s across %d switches' %
|
||||
info = ( 'bw: %.2e bits/s across %d switches, '
|
||||
'previous: %.2e bits/s across %d switches' %
|
||||
( bw, n, previous_bw, previous_n ) )
|
||||
self.assertTrue( bw < previous_bw, info )
|
||||
previous_bw, previous_n = bw, n
|
||||
|
||||
@@ -14,7 +14,7 @@ class testScratchNet( unittest.TestCase ):
|
||||
def pingTest( self, name ):
|
||||
"Verify that no ping packets were dropped"
|
||||
p = pexpect.spawn( 'python -m %s' % name )
|
||||
index = p.expect( self.opts )
|
||||
index = p.expect( self.opts, timeout=120 )
|
||||
self.assertEqual( index, 0 )
|
||||
|
||||
def testPingKernel( self ):
|
||||
|
||||
+3
-1
@@ -77,13 +77,15 @@ class CLI( Cmd ):
|
||||
return
|
||||
cls.readlineInited = True
|
||||
try:
|
||||
from readline import read_history_file, write_history_file
|
||||
from readline import ( read_history_file, write_history_file,
|
||||
set_history_length )
|
||||
except ImportError:
|
||||
pass
|
||||
else:
|
||||
history_path = os.path.expanduser( '~/.mininet_history' )
|
||||
if os.path.isfile( history_path ):
|
||||
read_history_file( history_path )
|
||||
set_history_length( 1000 )
|
||||
atexit.register( lambda: write_history_file( history_path ) )
|
||||
|
||||
def run( self ):
|
||||
|
||||
+45
-6
@@ -311,16 +311,40 @@ class TCIntf( Intf ):
|
||||
return self.cmd( c )
|
||||
|
||||
def config( self, bw=None, delay=None, jitter=None, loss=None,
|
||||
disable_gro=True, speedup=0, use_hfsc=False, use_tbf=False,
|
||||
gro=False, txo=True, rxo=True,
|
||||
speedup=0, use_hfsc=False, use_tbf=False,
|
||||
latency_ms=None, enable_ecn=False, enable_red=False,
|
||||
max_queue_size=None, **params ):
|
||||
"Configure the port and set its properties."
|
||||
"""Configure the port and set its properties.
|
||||
bw: bandwidth in b/s (e.g. '10m')
|
||||
delay: transmit delay (e.g. '1ms' )
|
||||
jitter: jitter (e.g. '1ms')
|
||||
loss: loss (e.g. '1%' )
|
||||
gro: enable GRO (False)
|
||||
txo: enable transmit checksum offload (True)
|
||||
rxo: enable receive checksum offload (True)
|
||||
speedup: experimental switch-side bw option
|
||||
use_hfsc: use HFSC scheduling
|
||||
use_tbf: use TBF scheduling
|
||||
latency_ms: TBF latency parameter
|
||||
enable_ecn: enable ECN (False)
|
||||
enable_red: enable RED (False)
|
||||
max_queue_size: queue limit parameter for netem"""
|
||||
|
||||
# Support old names for parameters
|
||||
gro = not params.pop( 'disable_gro', not gro )
|
||||
|
||||
result = Intf.config( self, **params)
|
||||
|
||||
# Disable GRO
|
||||
if disable_gro:
|
||||
self.cmd( 'ethtool -K %s gro off' % self )
|
||||
def on( isOn ):
|
||||
"Helper method: bool -> 'on'/'off'"
|
||||
return 'on' if isOn else 'off'
|
||||
|
||||
# Set offload parameters with ethool
|
||||
self.cmd( 'ethtool -K', self,
|
||||
'gro', on( gro ),
|
||||
'tx', on( txo ),
|
||||
'rx', on( rxo ) )
|
||||
|
||||
# Optimization: return if nothing else to configure
|
||||
# Question: what happens if we want to reset things?
|
||||
@@ -330,7 +354,7 @@ class TCIntf( Intf ):
|
||||
|
||||
# Clear existing configuration
|
||||
tcoutput = self.tc( '%s qdisc show dev %s' )
|
||||
if "priomap" not in tcoutput:
|
||||
if "priomap" not in tcoutput and "noqueue" not in tcoutput:
|
||||
cmds = [ '%s qdisc del dev %s root' ]
|
||||
else:
|
||||
cmds = []
|
||||
@@ -533,3 +557,18 @@ class TCLink( Link ):
|
||||
addr1=addr1, addr2=addr2,
|
||||
params1=params,
|
||||
params2=params )
|
||||
|
||||
|
||||
class TCULink( TCLink ):
|
||||
"""TCLink with default settings optimized for UserSwitch
|
||||
(txo=rxo=0/False). Unfortunately with recent Linux kernels,
|
||||
enabling TX and RX checksum offload on veth pairs doesn't work
|
||||
well with UserSwitch: either it gets terrible performance or
|
||||
TCP packets with bad checksums are generated, forwarded, and
|
||||
*dropped* due to having bad checksums! OVS and LinuxBridge seem
|
||||
to cope with this somehow, but it is likely to be an issue with
|
||||
many software Ethernet bridges."""
|
||||
|
||||
def __init__( self, *args, **kwargs ):
|
||||
kwargs.update( txo=False, rxo=False )
|
||||
TCLink.__init__( self, *args, **kwargs )
|
||||
|
||||
+1
-1
@@ -108,7 +108,7 @@ from mininet.util import ( quietRun, fixLimits, numCores, ensureRoot,
|
||||
from mininet.term import cleanUpScreens, makeTerms
|
||||
|
||||
# Mininet version: should be consistent with README and LICENSE
|
||||
VERSION = "2.2.2b1"
|
||||
VERSION = "2.2.2"
|
||||
|
||||
class Mininet( object ):
|
||||
"Network emulation with hosts spawned in network namespaces."
|
||||
|
||||
+1
-1
@@ -686,7 +686,7 @@ class CPULimitedHost( Host ):
|
||||
_out, _err, exitcode = errRun( 'cgdelete -r ' + self.cgroup )
|
||||
# Sometimes cgdelete returns a resource busy error but still
|
||||
# deletes the group; next attempt will give "no such file"
|
||||
return exitcode == 0 or ( 'no such file' in _err.lower() )
|
||||
return exitcode == 0 or ( 'no such file' in _err.lower() )
|
||||
|
||||
def popen( self, *args, **kwargs ):
|
||||
"""Return a Popen() object in node's namespace
|
||||
|
||||
+4
-3
@@ -106,9 +106,10 @@ class NAT( Node ):
|
||||
self.cmd( 'iptables -A FORWARD',
|
||||
'-i', self.localIntf, '-s', self.subnet, '-j ACCEPT' )
|
||||
self.cmd( 'iptables -A FORWARD',
|
||||
'-o', self.localIntf, '-d', self.subnet,'-j ACCEPT' )
|
||||
'-o', self.localIntf, '-d', self.subnet, '-j ACCEPT' )
|
||||
self.cmd( 'iptables -t nat -A POSTROUTING',
|
||||
'-s', self.subnet, "'!'", '-d', self.subnet, '-j MASQUERADE' )
|
||||
'-s', self.subnet, "'!'", '-d', self.subnet,
|
||||
'-j MASQUERADE' )
|
||||
|
||||
# Instruct the kernel to perform forwarding
|
||||
self.cmd( 'sysctl net.ipv4.ip_forward=1' )
|
||||
@@ -135,7 +136,7 @@ class NAT( Node ):
|
||||
self.cmd( 'iptables -D FORWARD',
|
||||
'-i', self.localIntf, '-s', self.subnet, '-j ACCEPT' )
|
||||
self.cmd( 'iptables -D FORWARD',
|
||||
'-o', self.localIntf, '-d', self.subnet,'-j ACCEPT' )
|
||||
'-o', self.localIntf, '-d', self.subnet, '-j ACCEPT' )
|
||||
self.cmd( 'iptables -t nat -D POSTROUTING',
|
||||
'-s', self.subnet, '\'!\'', '-d', self.subnet,
|
||||
'-j MASQUERADE' )
|
||||
|
||||
@@ -12,12 +12,13 @@ import os
|
||||
import re
|
||||
from mininet.util import quietRun
|
||||
from distutils.version import StrictVersion
|
||||
from time import sleep
|
||||
|
||||
def tsharkVersion():
|
||||
"Return tshark version"
|
||||
versionStr = quietRun( 'tshark -v' )
|
||||
versionMatch = re.findall( r'TShark \d+.\d+.\d+', versionStr )[0]
|
||||
return versionMatch.split()[ 1 ]
|
||||
versionMatch = re.findall( r'TShark[^\d]*(\d+.\d+.\d+)', versionStr )
|
||||
return versionMatch[ 0 ]
|
||||
|
||||
# pylint doesn't understand pexpect.match, unfortunately!
|
||||
# pylint:disable=maybe-no-member
|
||||
@@ -47,6 +48,8 @@ class testWalkthrough( unittest.TestCase ):
|
||||
mn.expect( '0% dropped' )
|
||||
tshark.expect( [ '74 Hello', '74 of_hello', '74 Type: OFPT_HELLO' ] )
|
||||
tshark.sendintr()
|
||||
mn.expect( pexpect.EOF )
|
||||
tshark.expect( pexpect.EOF )
|
||||
|
||||
def testBasic( self ):
|
||||
"Test basic CLI commands (help, nodes, net, dump)"
|
||||
@@ -91,7 +94,9 @@ class testWalkthrough( unittest.TestCase ):
|
||||
"Test ifconfig and ps on h1 and s1"
|
||||
p = pexpect.spawn( 'mn' )
|
||||
p.expect( self.prompt )
|
||||
interfaces = [ 'h1-eth0', 's1-eth1', '[^-]eth0', 'lo', self.prompt ]
|
||||
# Third pattern is a local interface beginning with 'eth' or 'en'
|
||||
interfaces = [ 'h1-eth0', 's1-eth1', r'[^-](eth|en)\w*\d', 'lo',
|
||||
self.prompt ]
|
||||
# h1 ifconfig
|
||||
p.sendline( 'h1 ifconfig -a' )
|
||||
ifcount = 0
|
||||
@@ -117,7 +122,7 @@ class testWalkthrough( unittest.TestCase ):
|
||||
ifcount += 1
|
||||
else:
|
||||
break
|
||||
self.assertEqual( ifcount, 3, 'Missing interfaces on s1')
|
||||
self.assertTrue( ifcount >= 3, 'Missing interfaces on s1')
|
||||
# h1 ps
|
||||
p.sendline( "h1 ps -a | egrep -v 'ps|grep'" )
|
||||
p.expect( self.prompt )
|
||||
@@ -126,10 +131,13 @@ class testWalkthrough( unittest.TestCase ):
|
||||
p.sendline( "s1 ps -a | egrep -v 'ps|grep'" )
|
||||
p.expect( self.prompt )
|
||||
s1Output = p.before
|
||||
# strip command from ps output
|
||||
h1Output = h1Output.split( '\n', 1 )[ 1 ]
|
||||
s1Output = s1Output.split( '\n', 1 )[ 1 ]
|
||||
self.assertEqual( h1Output, s1Output, 'h1 and s1 "ps" output differs')
|
||||
# strip command from ps output and compute diffs
|
||||
h1Output = h1Output.split( '\n' )[ 1: ]
|
||||
s1Output = s1Output.split( '\n' )[ 1: ]
|
||||
diffs = set( h1Output ).difference( set( s1Output ) )
|
||||
# allow up to two diffs to account for daemons, etc.
|
||||
self.assertTrue( len( diffs ) <= 2,
|
||||
'h1 and s1 "ps" output differ too much: %s' % diffs )
|
||||
p.sendline( 'exit' )
|
||||
p.wait()
|
||||
|
||||
@@ -151,6 +159,11 @@ class testWalkthrough( unittest.TestCase ):
|
||||
p = pexpect.spawn( 'mn' )
|
||||
p.expect( self.prompt )
|
||||
p.sendline( 'h1 python -m SimpleHTTPServer 80 &' )
|
||||
# The walkthrough doesn't specify a delay here, and
|
||||
# we also don't read the output (also a possible problem),
|
||||
# but for now let's wait a couple of seconds to make
|
||||
# it less likely to fail due to the race condition.
|
||||
sleep( 2 )
|
||||
p.expect( self.prompt )
|
||||
p.sendline( ' h2 wget -O - h1' )
|
||||
p.expect( '200 OK' )
|
||||
@@ -249,6 +262,8 @@ class testWalkthrough( unittest.TestCase ):
|
||||
p.sendline( 'h%d ifconfig' % i )
|
||||
p.expect( 'HWaddr 00:00:00:00:00:0%d' % i )
|
||||
p.expect( self.prompt )
|
||||
p.sendline( 'exit' )
|
||||
p.expect( pexpect.EOF )
|
||||
|
||||
def testSwitches( self ):
|
||||
"Run iperf test using user and ovsk switches"
|
||||
|
||||
+15
-9
@@ -301,30 +301,36 @@ function ubuntuOvs {
|
||||
fi
|
||||
|
||||
# Remove any old packages
|
||||
$remove openvswitch-common openvswitch-datapath-dkms openvswitch-controller \
|
||||
openvswitch-pki openvswitch-switch
|
||||
|
||||
$remove openvswitch-common openvswitch-datapath-dkms openvswitch-pki openvswitch-switch \
|
||||
openvswitch-controller || true
|
||||
|
||||
# Get build deps
|
||||
$install build-essential fakeroot debhelper autoconf automake libssl-dev \
|
||||
pkg-config bzip2 openssl python-all procps python-qt4 \
|
||||
python-zopeinterface python-twisted-conch dkms
|
||||
python-zopeinterface python-twisted-conch dkms dh-python dh-autoreconf \
|
||||
uuid-runtime
|
||||
|
||||
# Build OVS
|
||||
parallel=`grep processor /proc/cpuinfo | wc -l`
|
||||
cd $BUILD_DIR/openvswitch/openvswitch-$OVS_RELEASE
|
||||
DEB_BUILD_OPTIONS='parallel=2 nocheck' fakeroot debian/rules binary
|
||||
DEB_BUILD_OPTIONS='parallel=$parallel nocheck' fakeroot debian/rules binary
|
||||
cd ..
|
||||
$pkginst openvswitch-common_$OVS_RELEASE*.deb openvswitch-datapath-dkms_$OVS_RELEASE*.deb \
|
||||
openvswitch-pki_$OVS_RELEASE*.deb openvswitch-switch_$OVS_RELEASE*.deb
|
||||
if $pkginst openvswitch-controller_$OVS_RELEASE*.deb; then
|
||||
for pkg in common datapath-dkms pki switch; do
|
||||
pkg=openvswitch-${pkg}_$OVS_RELEASE*.deb
|
||||
echo "Installing $pkg"
|
||||
$pkginst $pkg
|
||||
done
|
||||
if $pkginst openvswitch-controller_$OVS_RELEASE*.deb 2>/dev/null; then
|
||||
echo "Ignoring error installing openvswitch-controller"
|
||||
fi
|
||||
|
||||
modinfo openvswitch
|
||||
/sbin/modinfo openvswitch
|
||||
sudo ovs-vsctl show
|
||||
# Switch can run on its own, but
|
||||
# Mininet should control the controller
|
||||
# This appears to only be an issue on Ubuntu/Debian
|
||||
if sudo service openvswitch-controller stop; then
|
||||
if sudo service openvswitch-controller stop 2>/dev/null; then
|
||||
echo "Stopped running controller"
|
||||
fi
|
||||
if [ -e /etc/init.d/openvswitch-controller ]; then
|
||||
|
||||
+20
-6
@@ -69,16 +69,22 @@ isoURLs = {
|
||||
'ubuntu-12.04.5-server-amd64.iso',
|
||||
'trusty32server':
|
||||
'http://mirrors.kernel.org/ubuntu-releases/14.04/'
|
||||
'ubuntu-14.04.3-server-i386.iso',
|
||||
'ubuntu-14.04.4-server-i386.iso',
|
||||
'trusty64server':
|
||||
'http://mirrors.kernel.org/ubuntu-releases/14.04/'
|
||||
'ubuntu-14.04.3-server-amd64.iso',
|
||||
'ubuntu-14.04.4-server-amd64.iso',
|
||||
'wily32server':
|
||||
'http://mirrors.kernel.org/ubuntu-releases/15.10/'
|
||||
'ubuntu-15.10-server-i386.iso',
|
||||
'wily64server':
|
||||
'http://mirrors.kernel.org/ubuntu-releases/15.10/'
|
||||
'ubuntu-15.10-server-amd64.iso',
|
||||
'xenial32server':
|
||||
'http://mirrors.kernel.org/ubuntu-releases/16.04/'
|
||||
'ubuntu-16.04.1-server-i386.iso',
|
||||
'xenial64server':
|
||||
'http://mirrors.kernel.org/ubuntu-releases/16.04/'
|
||||
'ubuntu-16.04.1-server-amd64.iso',
|
||||
}
|
||||
|
||||
|
||||
@@ -148,7 +154,7 @@ def depend():
|
||||
run( 'sudo apt-get -qy update' )
|
||||
run( 'sudo apt-get -qy install'
|
||||
' kvm cloud-utils genisoimage qemu-kvm qemu-utils'
|
||||
' e2fsprogs dnsmasq curl'
|
||||
' e2fsprogs curl'
|
||||
' python-setuptools mtools zip' )
|
||||
run( 'sudo easy_install pexpect' )
|
||||
|
||||
@@ -221,7 +227,10 @@ def extractKernel( image, flavor, imageDir=VMImageDir ):
|
||||
return kernel, initrd
|
||||
log( '* Extracting kernel to', kernel )
|
||||
nbd = attachNBD( image, flags='-r' )
|
||||
print srun( 'partx ' + nbd )
|
||||
try:
|
||||
print( srun( 'partx ' + nbd ) )
|
||||
except:
|
||||
log( 'Warning - partx failed with error' )
|
||||
# Assume kernel is in partition 1/boot/vmlinuz*generic for now
|
||||
part = nbd + 'p1'
|
||||
mnt = mkdtemp()
|
||||
@@ -245,8 +254,9 @@ def findBaseImage( flavor, size='8G' ):
|
||||
# Detect race condition with multiple builds
|
||||
perms = stat( image )[ ST_MODE ] & 0777
|
||||
if perms != 0444:
|
||||
raise Exception( 'Error - %s is writable ' % image +
|
||||
'; are multiple builds running?' )
|
||||
raise Exception( 'Error - base image %s is writable.' % image +
|
||||
' Are multiple builds running? if not,'
|
||||
' remove %s and try again.' % image )
|
||||
else:
|
||||
# We create VMImageDir here since we are called first
|
||||
run( 'mkdir -p %s' % VMImageDir )
|
||||
@@ -378,6 +388,10 @@ def installUbuntu( iso, image, logfilename='install.log', memory=1024 ):
|
||||
accel = 'tcg'
|
||||
else:
|
||||
accel = 'kvm'
|
||||
try:
|
||||
run( 'kvm-ok' )
|
||||
except:
|
||||
raise Exception( 'kvm-ok failed; try using --nokvm' )
|
||||
cmd = [ 'sudo', kvm,
|
||||
'-machine', 'accel=%s' % accel,
|
||||
'-nographic',
|
||||
|
||||
Reference in New Issue
Block a user