Remove trailing whitespace. ;-/
This commit is contained in:
@@ -145,7 +145,7 @@ class MininetRunner( object ):
|
||||
else:
|
||||
# Accept a comma-separated list of filenames
|
||||
files += value.split(',')
|
||||
|
||||
|
||||
for fileName in files:
|
||||
customs = {}
|
||||
if os.path.isfile( fileName ):
|
||||
@@ -289,7 +289,7 @@ class MininetRunner( object ):
|
||||
else:
|
||||
raise Exception( "Could not find a default controller for switch %s" %
|
||||
self.options.switch )
|
||||
|
||||
|
||||
topo = buildTopo( TOPOS, self.options.topo )
|
||||
switch = customConstructor( SWITCHES, self.options.switch )
|
||||
host = customConstructor( HOSTS, self.options.host )
|
||||
|
||||
+3
-5
@@ -22,7 +22,7 @@ to temporary private directories. To do this, simply create a list of
|
||||
directories to be made private. A tmpfs will then be mounted on them.
|
||||
|
||||
You may use both temporary and persistent directories at the same
|
||||
time. In the following privateDirs string, each host will have a
|
||||
time. In the following privateDirs string, each host will have a
|
||||
persistent directory in the root filesystem at
|
||||
"/tmp/(hostname)/var/run" mounted on "/var/run". Each host will also
|
||||
have a temporary private directory mounted on "/var/log".
|
||||
@@ -48,8 +48,8 @@ from functools import partial
|
||||
def testHostWithPrivateDirs():
|
||||
"Test bind mounts"
|
||||
topo = SingleSwitchTopo( 10 )
|
||||
privateDirs = [ ( '/var/log', '/tmp/%(name)s/var/log' ),
|
||||
( '/var/run', '/tmp/%(name)s/var/run' ),
|
||||
privateDirs = [ ( '/var/log', '/tmp/%(name)s/var/log' ),
|
||||
( '/var/run', '/tmp/%(name)s/var/run' ),
|
||||
'/var/mn' ]
|
||||
host = partial( Host,
|
||||
privateDirs=privateDirs )
|
||||
@@ -65,5 +65,3 @@ if __name__ == '__main__':
|
||||
setLogLevel( 'info' )
|
||||
testHostWithPrivateDirs()
|
||||
info( 'Done.\n')
|
||||
|
||||
|
||||
|
||||
+5
-5
@@ -346,7 +346,7 @@ class RemoteLink( Link ):
|
||||
' not successfully moved to ' + node.name + '\n' )
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def makeTunnel( self, node1, node2, intfname1, intfname2,
|
||||
addr1=None, addr2=None ):
|
||||
"Make a tunnel across switches on different servers"
|
||||
@@ -380,7 +380,7 @@ class RemoteLink( Link ):
|
||||
if ch != '@':
|
||||
error( 'makeTunnel:\n',
|
||||
'Tunnel setup failed for',
|
||||
'%s:%s' % ( node1, node1.dest ), 'to',
|
||||
'%s:%s' % ( node1, node1.dest ), 'to',
|
||||
'%s:%s\n' % ( node2, node2.dest ),
|
||||
'command was:', cmd, '\n' )
|
||||
tunnel.terminate()
|
||||
@@ -421,7 +421,7 @@ class RemoteLink( Link ):
|
||||
|
||||
class Placer( object ):
|
||||
"Node placement algorithm for MininetCluster"
|
||||
|
||||
|
||||
def __init__( self, servers=None, nodes=None, hosts=None,
|
||||
switches=None, controllers=None, links=None ):
|
||||
"""Initialize placement object
|
||||
@@ -459,7 +459,7 @@ class RoundRobinPlacer( Placer ):
|
||||
"""Round-robin placement
|
||||
Note this will usually result in cross-server links between
|
||||
hosts and switches"""
|
||||
|
||||
|
||||
def __init__( self, *args, **kwargs ):
|
||||
Placer.__init__( self, *args, **kwargs )
|
||||
self.next = 0
|
||||
@@ -560,7 +560,7 @@ class HostSwitchBinPlacer( Placer ):
|
||||
self.sset = frozenset( self.switches )
|
||||
self.cset = frozenset( self.controllers )
|
||||
self.hind, self.sind, self.cind = 0, 0, 0
|
||||
|
||||
|
||||
def place( self, nodename ):
|
||||
"""Simple placement algorithm:
|
||||
place nodes into evenly sized bins"""
|
||||
|
||||
@@ -12,7 +12,7 @@ from mininet.topo import SingleSwitchTopo
|
||||
def clusterSanity():
|
||||
"Sanity check for cluster mode"
|
||||
topo = SingleSwitchTopo()
|
||||
net = MininetCluster( topo=topo )
|
||||
net = MininetCluster( topo=topo )
|
||||
net.start()
|
||||
CLI( net )
|
||||
net.stop()
|
||||
|
||||
@@ -22,7 +22,7 @@ class ClusterCLI( CLI ):
|
||||
colors = colors * reps
|
||||
colors = colors[ 0 : slen ]
|
||||
return colors
|
||||
|
||||
|
||||
def do_plot( self, line ):
|
||||
"Plot topology colored by node placement"
|
||||
# Import networkx if needed
|
||||
|
||||
@@ -35,7 +35,7 @@ class DataController( Controller ):
|
||||
class MininetFacade( object ):
|
||||
"""Mininet object facade that allows a single CLI to
|
||||
talk to one or more networks"""
|
||||
|
||||
|
||||
def __init__( self, net, *args, **kwargs ):
|
||||
"""Create MininetFacade object.
|
||||
net: Primary Mininet object
|
||||
@@ -114,7 +114,7 @@ class ControlNetwork( Topo ):
|
||||
|
||||
def run():
|
||||
"Create control and data networks, and invoke the CLI"
|
||||
|
||||
|
||||
info( '* Creating Control Network\n' )
|
||||
ctopo = ControlNetwork( n=4, dataController=DataController )
|
||||
cnet = Mininet( topo=ctopo, ipBase='192.168.123.0/24', controller=None )
|
||||
|
||||
@@ -21,7 +21,7 @@ def intfOptions():
|
||||
link1 = net.addLink( h1, s1, cls=TCLink )
|
||||
net.addLink( h2, s1 )
|
||||
net.start()
|
||||
|
||||
|
||||
# flush out latency from reactive forwarding delay
|
||||
net.pingAll()
|
||||
|
||||
@@ -34,12 +34,12 @@ def intfOptions():
|
||||
link1.intf1.config( loss=50 )
|
||||
info( '\n' )
|
||||
net.iperf( ( h1, h2 ), l4Type='UDP' )
|
||||
|
||||
|
||||
info( '\n*** Configuring one intf with delay of 15ms\n' )
|
||||
link1.intf1.config( delay='15ms' )
|
||||
info( '\n*** Run a ping to confirm delay\n' )
|
||||
net.pingPairFull()
|
||||
|
||||
|
||||
info( '\n*** Done testing\n' )
|
||||
net.stop()
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
"""
|
||||
linuxrouter.py: Example network with Linux IP router
|
||||
|
||||
|
||||
This example converts a Node into a router using IP forwarding
|
||||
already built into Linux.
|
||||
|
||||
@@ -16,7 +16,7 @@ The topology contains a router with three IP subnets:
|
||||
- h2 (IP: 172.16.0.100)
|
||||
- h3 (IP: 10.0.0.100)
|
||||
|
||||
Routing entries can be added to the routing tables of the
|
||||
Routing entries can be added to the routing tables of the
|
||||
hosts or router using the "ip route add" or "route add" command.
|
||||
See the man pages for more details.
|
||||
|
||||
|
||||
+13
-13
@@ -750,7 +750,7 @@ class SwitchDialog(CustomDialog):
|
||||
'please either specify a DPID or use a '
|
||||
'canonical switch name such as s23.' )
|
||||
|
||||
|
||||
|
||||
results = {'externalInterfaces':externalInterfaces,
|
||||
'hostname':self.hostnameEntry.get(),
|
||||
'dpid':dpid,
|
||||
@@ -784,10 +784,10 @@ class VerticalScrolledTable(LabelFrame):
|
||||
* Use the 'interior' attribute to place widgets inside the scrollable frame
|
||||
* Construct and pack/place/grid normally
|
||||
* This frame only allows vertical scrolling
|
||||
|
||||
|
||||
"""
|
||||
def __init__(self, parent, rows=2, columns=2, title=None, *args, **kw):
|
||||
LabelFrame.__init__(self, parent, text=title, padx=5, pady=5, *args, **kw)
|
||||
LabelFrame.__init__(self, parent, text=title, padx=5, pady=5, *args, **kw)
|
||||
|
||||
# create a canvas object and a vertical scrollbar for scrolling it
|
||||
vscrollbar = Scrollbar(self, orient=VERTICAL)
|
||||
@@ -1709,7 +1709,7 @@ class MiniEdit( Frame ):
|
||||
for widget in self.widgetToItem:
|
||||
name = widget[ 'text' ]
|
||||
tags = self.canvas.gettags( self.widgetToItem[ widget ] )
|
||||
|
||||
|
||||
if 'Controller' in tags:
|
||||
opts = self.controllers[name]
|
||||
controllerType = opts['controllerType']
|
||||
@@ -1720,9 +1720,9 @@ class MiniEdit( Frame ):
|
||||
controllerIP = opts['remoteIP']
|
||||
controllerPort = opts['remotePort']
|
||||
|
||||
|
||||
|
||||
f.write(" "+name+"=net.addController(name='"+name+"',\n")
|
||||
|
||||
|
||||
if controllerType == 'remote':
|
||||
f.write(" controller=RemoteController,\n")
|
||||
f.write(" ip='"+controllerIP+"',\n")
|
||||
@@ -1733,7 +1733,7 @@ class MiniEdit( Frame ):
|
||||
f.write(" controller=OVSController,\n")
|
||||
else:
|
||||
f.write(" controller=Controller,\n")
|
||||
|
||||
|
||||
f.write(" protocol='"+controllerProtocol+"',\n")
|
||||
f.write(" port="+str(controllerPort)+")\n")
|
||||
f.write("\n")
|
||||
@@ -1943,7 +1943,7 @@ class MiniEdit( Frame ):
|
||||
for widget in self.widgetToItem:
|
||||
name = widget[ 'text' ]
|
||||
tags = self.canvas.gettags( self.widgetToItem[ widget ] )
|
||||
|
||||
|
||||
if 'Switch' in tags:
|
||||
opts = self.switchOpts[name]
|
||||
if 'netflow' in opts:
|
||||
@@ -1967,7 +1967,7 @@ class MiniEdit( Frame ):
|
||||
for widget in self.widgetToItem:
|
||||
name = widget[ 'text' ]
|
||||
tags = self.canvas.gettags( self.widgetToItem[ widget ] )
|
||||
|
||||
|
||||
if 'Switch' in tags:
|
||||
opts = self.switchOpts[name]
|
||||
if 'sflow' in opts:
|
||||
@@ -2641,7 +2641,7 @@ class MiniEdit( Frame ):
|
||||
else:
|
||||
controllerName = dest[ 'text' ]
|
||||
switchName = source[ 'text' ]
|
||||
|
||||
|
||||
if controllerName in self.switchOpts[switchName]['controllers']:
|
||||
self.switchOpts[switchName]['controllers'].remove(controllerName)
|
||||
|
||||
@@ -2662,7 +2662,7 @@ class MiniEdit( Frame ):
|
||||
if 'Switch' in tags:
|
||||
if widget['text'] in self.switchOpts[name]['controllers']:
|
||||
self.switchOpts[name]['controllers'].remove(widget['text'])
|
||||
|
||||
|
||||
for link in widget.links.values():
|
||||
# Delete from view and model
|
||||
self.deleteItem( link )
|
||||
@@ -2917,7 +2917,7 @@ class MiniEdit( Frame ):
|
||||
for widget in self.widgetToItem:
|
||||
name = widget[ 'text' ]
|
||||
tags = self.canvas.gettags( self.widgetToItem[ widget ] )
|
||||
|
||||
|
||||
if 'Switch' in tags:
|
||||
opts = self.switchOpts[name]
|
||||
if 'netflow' in opts:
|
||||
@@ -2947,7 +2947,7 @@ class MiniEdit( Frame ):
|
||||
for widget in self.widgetToItem:
|
||||
name = widget[ 'text' ]
|
||||
tags = self.canvas.gettags( self.widgetToItem[ widget ] )
|
||||
|
||||
|
||||
if 'Switch' in tags:
|
||||
opts = self.switchOpts[name]
|
||||
if 'sflow' in opts:
|
||||
|
||||
@@ -9,9 +9,9 @@ from mininet.cli import CLI
|
||||
from mininet.log import setLogLevel
|
||||
from mininet.net import Mininet
|
||||
from mininet.topo import Topo
|
||||
|
||||
|
||||
def runMultiLink():
|
||||
|
||||
|
||||
topo = simpleMultiLinkTopo( n=2 )
|
||||
net = Mininet( topo=topo )
|
||||
net.start()
|
||||
@@ -25,7 +25,7 @@ class simpleMultiLinkTopo( Topo ):
|
||||
|
||||
h1, h2 = self.addHost( 'h1' ), self.addHost( 'h2' )
|
||||
s1 = self.addSwitch( 's1' )
|
||||
|
||||
|
||||
for _ in range( n ):
|
||||
self.addLink( s1, h1 )
|
||||
self.addLink( s1, h2 )
|
||||
|
||||
+5
-5
@@ -14,7 +14,7 @@ natnet.py: Example network with NATs
|
||||
| |
|
||||
s1 s2
|
||||
| |
|
||||
h1 h2
|
||||
h1 h2
|
||||
|
||||
"""
|
||||
|
||||
@@ -44,15 +44,15 @@ class InternetTopo(Topo):
|
||||
localSubnet = '192.168.%d.0/24' % i
|
||||
natParams = { 'ip' : '%s/24' % localIP }
|
||||
# add NAT to topology
|
||||
nat = self.addNode('nat%d' % i, cls=NAT, subnet=localSubnet,
|
||||
nat = self.addNode('nat%d' % i, cls=NAT, subnet=localSubnet,
|
||||
inetIntf=inetIntf, localIntf=localIntf)
|
||||
switch = self.addSwitch('s%d' % i)
|
||||
# connect NAT to inet and local switches
|
||||
self.addLink(nat, inetSwitch, intfName1=inetIntf)
|
||||
self.addLink(nat, switch, intfName1=localIntf, params1=natParams)
|
||||
# add host and connect to local switch
|
||||
host = self.addHost('h%d' % i,
|
||||
ip='192.168.%d.100/24' % i,
|
||||
host = self.addHost('h%d' % i,
|
||||
ip='192.168.%d.100/24' % i,
|
||||
defaultRoute='via %s' % localIP)
|
||||
self.addLink(host, switch)
|
||||
|
||||
@@ -67,4 +67,4 @@ def run():
|
||||
if __name__ == '__main__':
|
||||
setLogLevel('info')
|
||||
run()
|
||||
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
"""
|
||||
Create a network with 5 hosts, numbered 1-4 and 9.
|
||||
Create a network with 5 hosts, numbered 1-4 and 9.
|
||||
Validate that the port numbers match to the interface name,
|
||||
and that the ovs ports match the mininet ports.
|
||||
"""
|
||||
@@ -54,13 +54,13 @@ def net():
|
||||
info( '\n*** printing and validating the ports running on each interface\n' )
|
||||
for intfs in s1.intfList():
|
||||
if not intfs.name == "lo":
|
||||
info( intfs, ': ', s1.ports[intfs],
|
||||
info( intfs, ': ', s1.ports[intfs],
|
||||
'\n' )
|
||||
info ( 'Validating that', intfs, 'is actually on port', s1.ports[intfs], '... ' )
|
||||
if validatePort( s1, intfs ):
|
||||
info( 'Validated.\n' )
|
||||
print '\n'
|
||||
|
||||
|
||||
# test the network with pingall
|
||||
net.pingAll()
|
||||
print '\n'
|
||||
|
||||
@@ -36,7 +36,7 @@ class testBareSSHD( unittest.TestCase ):
|
||||
'-o StrictModes=no' )
|
||||
p = pexpect.spawn( cmd )
|
||||
runOpts = [ 'You may now ssh into h1 at 10.0.0.1',
|
||||
'after 5 seconds, h1 is not listening on port 22',
|
||||
'after 5 seconds, h1 is not listening on port 22',
|
||||
pexpect.EOF, pexpect.TIMEOUT ]
|
||||
while True:
|
||||
index = p.expect( runOpts )
|
||||
|
||||
@@ -6,7 +6,7 @@ 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
|
||||
@@ -28,13 +28,13 @@ class testCPU( unittest.TestCase ):
|
||||
"Verify that CPU utilization is monotonically decreasing for each scheduler"
|
||||
p = pexpect.spawn( 'python -m mininet.examples.cpu' )
|
||||
# matches each line from results( shown above )
|
||||
opts = [ '([a-z]+)\t([\d\.]+)%\t([\d\.]+)',
|
||||
opts = [ '([a-z]+)\t([\d\.]+)%\t([\d\.]+)',
|
||||
pexpect.EOF ]
|
||||
scheds = []
|
||||
while True:
|
||||
index = p.expect( opts, timeout=600 )
|
||||
if index == 0:
|
||||
sched = p.match.group( 1 )
|
||||
sched = p.match.group( 1 )
|
||||
cpu = float( p.match.group( 2 ) )
|
||||
bw = float( p.match.group( 3 ) )
|
||||
if sched not in scheds:
|
||||
|
||||
@@ -19,7 +19,7 @@ class testEmptyNet( unittest.TestCase ):
|
||||
p.sendline( 'pingall' )
|
||||
p.expect ( '(\d+)% dropped' )
|
||||
percent = int( p.match.group( 1 ) ) if p.match else -1
|
||||
self.assertEqual( percent, 0 )
|
||||
self.assertEqual( percent, 0 )
|
||||
p.expect( self.prompt )
|
||||
# iperf test
|
||||
p.sendline( 'iperf' )
|
||||
|
||||
@@ -14,8 +14,8 @@ class testLimit( unittest.TestCase ):
|
||||
def testLimit( self ):
|
||||
"Verify that CPU limits are within a 2% tolerance of limit for each scheduler"
|
||||
p = pexpect.spawn( 'python -m mininet.examples.limit' )
|
||||
opts = [ '\*\*\* Testing network ([\d\.]+) Mbps',
|
||||
'\*\*\* Results: \[([\d\., ]+)\]',
|
||||
opts = [ '\*\*\* Testing network ([\d\.]+) Mbps',
|
||||
'\*\*\* Results: \[([\d\., ]+)\]',
|
||||
pexpect.EOF ]
|
||||
count = 0
|
||||
bw = 0
|
||||
|
||||
@@ -15,8 +15,8 @@ class testLinearBandwidth( unittest.TestCase ):
|
||||
"Verify that bandwidth is monotonically decreasing as # of hops increases"
|
||||
p = pexpect.spawn( 'python -m mininet.examples.linearbandwidth' )
|
||||
count = 0
|
||||
opts = [ '\*\*\* Linear network results',
|
||||
'(\d+)\s+([\d\.]+) (.bits)',
|
||||
opts = [ '\*\*\* Linear network results',
|
||||
'(\d+)\s+([\d\.]+) (.bits)',
|
||||
pexpect.EOF ]
|
||||
while True:
|
||||
index = p.expect( opts, timeout=600 )
|
||||
|
||||
@@ -22,14 +22,14 @@ class testMultiLink( unittest.TestCase ):
|
||||
hostToIntfs = intfsOutput.split( '\r\n' )[ 1:3 ]
|
||||
intfList = []
|
||||
for hostToIntf in hostToIntfs:
|
||||
intfList += [ intf for intf in
|
||||
intfList += [ intf for intf in
|
||||
hostToIntf.split()[1].split(',') ]
|
||||
|
||||
# get interfaces from system by running ifconfig on every host
|
||||
sysIntfList = []
|
||||
opts = [ 'h(\d)-eth(\d)', self.prompt ]
|
||||
p.expect( self.prompt )
|
||||
|
||||
|
||||
p.sendline( 'h1 ifconfig' )
|
||||
while True:
|
||||
p.expect( opts )
|
||||
|
||||
@@ -11,7 +11,7 @@ from collections import defaultdict
|
||||
class testMultiPing( unittest.TestCase ):
|
||||
|
||||
def testMultiPing( self ):
|
||||
"""Verify that each target is pinged at least once, and
|
||||
"""Verify that each target is pinged at least once, and
|
||||
that pings to 'real' targets are successful and unknown targets fail"""
|
||||
p = pexpect.spawn( 'python -m mininet.examples.multiping' )
|
||||
opts = [ "Host (h\d+) \(([\d.]+)\) will be pinging ips: ([\d\. ]+)",
|
||||
|
||||
@@ -14,7 +14,7 @@ class testNAT( unittest.TestCase ):
|
||||
|
||||
prompt = 'mininet>'
|
||||
|
||||
@unittest.skipIf( '0 received' in quietRun( 'ping -c 1 %s' % destIP ),
|
||||
@unittest.skipIf( '0 received' in quietRun( 'ping -c 1 %s' % destIP ),
|
||||
'Destination IP is not reachable' )
|
||||
def testNAT( self ):
|
||||
"Attempt to ping an IP on the Internet and verify 0% packet loss"
|
||||
|
||||
@@ -15,8 +15,8 @@ class testNumberedports( unittest.TestCase ):
|
||||
def testConsistency( self ):
|
||||
"""verify consistency between mininet and ovs ports"""
|
||||
p = pexpect.spawn( 'python -m mininet.examples.numberedports' )
|
||||
opts = [ 'Validating that s1-eth\d is actually on port \d ... Validated.',
|
||||
'Validating that s1-eth\d is actually on port \d ... WARNING',
|
||||
opts = [ 'Validating that s1-eth\d is actually on port \d ... Validated.',
|
||||
'Validating that s1-eth\d is actually on port \d ... WARNING',
|
||||
pexpect.EOF ]
|
||||
correct_ports = True
|
||||
count = 0
|
||||
@@ -34,7 +34,7 @@ class testNumberedports( unittest.TestCase ):
|
||||
def testNumbering( self ):
|
||||
"""verify that all of the port numbers are printed correctly and consistent with their interface"""
|
||||
p = pexpect.spawn( 'python -m mininet.examples.numberedports' )
|
||||
opts = [ 's1-eth(\d+) : (\d+)',
|
||||
opts = [ 's1-eth(\d+) : (\d+)',
|
||||
pexpect.EOF ]
|
||||
count_intfs = 0
|
||||
while True:
|
||||
|
||||
@@ -14,7 +14,7 @@ class testSSHD( unittest.TestCase ):
|
||||
|
||||
def connected( self, ip ):
|
||||
"Log into ssh server, check banner, then exit"
|
||||
# Note: this test will fail if "Welcome" is not in the sshd banner
|
||||
# Note: this test will fail if "Welcome" is not in the sshd banner
|
||||
# and '#'' or '$'' are not in the prompt
|
||||
p = pexpect.spawn( 'ssh -i /tmp/ssh/test_rsa %s' % ip, timeout=10 )
|
||||
while True:
|
||||
@@ -26,7 +26,7 @@ class testSSHD( unittest.TestCase ):
|
||||
return False
|
||||
elif index == 2:
|
||||
p.sendline( 'exit' )
|
||||
p.wait()
|
||||
p.wait()
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
@@ -47,4 +47,4 @@ class testVLANHost( unittest.TestCase ):
|
||||
self.assertEqual( i, 0 ) # check vlan intf is present
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
unittest.main()
|
||||
|
||||
@@ -40,7 +40,7 @@ class VLANHost( Host ):
|
||||
intf = self.defaultIntf()
|
||||
# remove IP from default, "physical" interface
|
||||
self.cmd( 'ifconfig %s inet 0' % intf )
|
||||
# create VLAN interface
|
||||
# create VLAN interface
|
||||
self.cmd( 'vconfig add %s %d' % ( intf, vlan ) )
|
||||
# assign the host's IP to the VLAN interface
|
||||
self.cmd( 'ifconfig %s.%d inet %s' % ( intf, vlan, params['ip'] ) )
|
||||
|
||||
+1
-1
@@ -92,5 +92,5 @@ def cleanup():
|
||||
killprocs( 'Tunnel=Ethernet' )
|
||||
killprocs( '.ssh/mn')
|
||||
sh( 'rm -f ~/.ssh/mn/*' )
|
||||
|
||||
|
||||
info( "*** Cleanup complete.\n" )
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ class Intf( object ):
|
||||
self.link = link
|
||||
self.mac = mac
|
||||
self.ip, self.prefixLen = None, None
|
||||
|
||||
|
||||
# if interface is lo, we know the ip is 127.0.0.1.
|
||||
# This saves an ifconfig command per node
|
||||
if self.name == 'lo':
|
||||
|
||||
+4
-4
@@ -692,7 +692,7 @@ class CPULimitedHost( Host ):
|
||||
retry( retries=3, delaySecs=1, fn=self.cgroupDel )
|
||||
|
||||
_rtGroupSched = False # internal class var: Is CONFIG_RT_GROUP_SCHED set?
|
||||
|
||||
|
||||
@classmethod
|
||||
def checkRtGroupSched( cls ):
|
||||
"Check (Ubuntu,Debian) kernel config for CONFIG_RT_GROUP_SCHED for RT"
|
||||
@@ -749,7 +749,7 @@ class CPULimitedHost( Host ):
|
||||
"""Set overall CPU fraction for this host
|
||||
f: CPU bandwidth limit (positive fraction, or -1 for cfs unlimited)
|
||||
sched: 'rt' or 'cfs'
|
||||
Note 'cfs' requires CONFIG_CFS_BANDWIDTH,
|
||||
Note 'cfs' requires CONFIG_CFS_BANDWIDTH,
|
||||
and 'rt' requires CONFIG_RT_GROUP_SCHED"""
|
||||
if not sched:
|
||||
sched = self.sched
|
||||
@@ -1199,11 +1199,11 @@ OVSKernelSwitch = OVSSwitch
|
||||
|
||||
class OVSBridge( OVSSwitch ):
|
||||
"OVSBridge is an OVSSwitch in standalone/bridge mode"
|
||||
|
||||
|
||||
def __init__( self, args, **kwargs ):
|
||||
kwargs.update( failMode='standalone' )
|
||||
OVSSwitch.__init__( self, args, **kwargs )
|
||||
|
||||
|
||||
def start( self, controllers ):
|
||||
OVSSwitch.start( self, controllers=[] )
|
||||
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ class LinuxBridge( Switch ):
|
||||
return 'forwarding' in self.cmd( 'brctl showstp', self )
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
def start( self, controllers ):
|
||||
"Start Linux bridge"
|
||||
self.cmd( 'ifconfig', self, 'down' )
|
||||
|
||||
@@ -181,7 +181,7 @@ class testOptionsTopoCommon( object ):
|
||||
|
||||
for rttval in [rttmin, rttavg, rttmax]:
|
||||
# Multiply delay by 4 to cover there & back on two links
|
||||
self.assertWithinTolerance( rttval, DELAY_MS * 4.0,
|
||||
self.assertWithinTolerance( rttval, DELAY_MS * 4.0,
|
||||
DELAY_TOLERANCE, msg )
|
||||
|
||||
|
||||
|
||||
@@ -27,14 +27,14 @@ class testSwitchDpidAssignmentCommon ( object ):
|
||||
self.assertEqual( switch.defaultDpid(), switch.dpid )
|
||||
|
||||
def testActualDpidAssignment( self ):
|
||||
"""Verify that Switch dpid is the actual dpid assigned if dpid is
|
||||
"""Verify that Switch dpid is the actual dpid assigned if dpid is
|
||||
passed in switch creation."""
|
||||
switch = Mininet( Topo(), self.switchClass, Host, Controller ).addSwitch( 'A', dpid = '000000000000ABCD' )
|
||||
self.assertEqual( switch.dpid, '000000000000ABCD' )
|
||||
|
||||
def testDefaultDpidAssignmentFailure( self ):
|
||||
"""Verify that Default dpid assignment raises an Exception if the
|
||||
name of the switch does not contin a digit. Also verify the
|
||||
"""Verify that Default dpid assignment raises an Exception if the
|
||||
name of the switch does not contin a digit. Also verify the
|
||||
exception message."""
|
||||
with self.assertRaises( Exception ) as raises_cm:
|
||||
Mininet( Topo(), self.switchClass, Host, Controller ).addSwitch( 'A' )
|
||||
@@ -58,7 +58,7 @@ class testSwitchDpidAssignmentCommon ( object ):
|
||||
except TypeError:
|
||||
# Switch is OVS User Switch
|
||||
self.assertEqual( switch.dpid, '0' * (16 - len(dpid)) + str(dpid) )
|
||||
|
||||
|
||||
|
||||
class testSwitchOVSKernel( testSwitchDpidAssignmentCommon, unittest.TestCase ):
|
||||
"""Test dpid assignnment of OVS Kernel Switch."""
|
||||
@@ -67,12 +67,12 @@ class testSwitchOVSKernel( testSwitchDpidAssignmentCommon, unittest.TestCase ):
|
||||
class testSwitchOVSUser( testSwitchDpidAssignmentCommon, unittest.TestCase ):
|
||||
"""Test dpid assignnment of OVS User Switch."""
|
||||
switchClass = partial(OVSSwitch, datapath = 'user')
|
||||
|
||||
|
||||
@unittest.skipUnless( quietRun( 'which ovs-openflowd' ), 'OVS Legacy Kernel switch is not installed' )
|
||||
class testSwitchOVSLegacyKernel( testSwitchDpidAssignmentCommon, unittest.TestCase ):
|
||||
"""Test dpid assignnment of OVS Legacy Kernel Switch."""
|
||||
switchClass = OVSLegacyKernelSwitch
|
||||
|
||||
|
||||
@unittest.skipUnless( quietRun( 'which ivs-ctl' ), 'IVS switch is not installed' )
|
||||
class testSwitchIVS( testSwitchDpidAssignmentCommon, unittest.TestCase ):
|
||||
"""Test dpid assignment of IVS switch."""
|
||||
|
||||
+2
-2
@@ -101,7 +101,7 @@ class Topo( object ):
|
||||
"Data center network representation for structured multi-trees."
|
||||
|
||||
def __init__( self, *args, **params ):
|
||||
"""Topo object.
|
||||
"""Topo object.
|
||||
Optional named parameters:
|
||||
hinfo: default host options
|
||||
sopts: default switch options
|
||||
@@ -256,7 +256,7 @@ class Topo( object ):
|
||||
if key is None:
|
||||
key = min( entry )
|
||||
return entry, key
|
||||
|
||||
|
||||
def linkInfo( self, src, dst, key=None ):
|
||||
"Return link metadata dict"
|
||||
entry, key = self._linkEntry( src, dst, key )
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ class TorusTopo( Topo ):
|
||||
with the default controller or any Ethernet bridge
|
||||
without STP turned on! It can be used with STP, e.g.:
|
||||
# mn --topo torus,3,3 --switch lxbr,stp=1 --test pingall"""
|
||||
|
||||
|
||||
def build( self, x, y ):
|
||||
if x < 3 or y < 3:
|
||||
raise Exception( 'Please use 3x3 or greater for compatibility '
|
||||
@@ -65,5 +65,5 @@ class TorusTopo( Topo ):
|
||||
self.addLink( sw1, sw2 )
|
||||
self.addLink( sw1, sw3 )
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+3
-3
@@ -30,7 +30,7 @@ def fixParam( line ):
|
||||
def fixReturns( line ):
|
||||
"Change returns: foo to @return foo"
|
||||
return re.sub( 'returns:', r'@returns', line )
|
||||
|
||||
|
||||
def fixLine( line ):
|
||||
global comment
|
||||
match = spaces.match( line )
|
||||
@@ -69,7 +69,7 @@ def funTest():
|
||||
).splitlines( True )
|
||||
|
||||
fixLines( testFun )
|
||||
|
||||
|
||||
def fixLines( lines, fid ):
|
||||
for line in lines:
|
||||
os.write( fid, fixLine( line ) )
|
||||
@@ -86,4 +86,4 @@ if __name__ == '__main__':
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -881,7 +881,7 @@ def getMininetVersion( vm ):
|
||||
return version
|
||||
|
||||
|
||||
def bootAndRun( image, prompt=Prompt, memory=1024, outputFile=None,
|
||||
def bootAndRun( image, prompt=Prompt, memory=1024, outputFile=None,
|
||||
runFunction=None, **runArgs ):
|
||||
"""Boot and test VM
|
||||
tests: list of tests to run
|
||||
|
||||
Reference in New Issue
Block a user