Added two spaces before in-line # comments.
This commit is contained in:
+3
-3
@@ -47,9 +47,9 @@ def connectToRootNS( network, switch, ip, prefixLen, routes ):
|
|||||||
|
|
||||||
def sshd( network, cmd='/usr/sbin/sshd', opts='-D' ):
|
def sshd( network, cmd='/usr/sbin/sshd', opts='-D' ):
|
||||||
"Start a network, connect it to root ns, and run sshd on all hosts."
|
"Start a network, connect it to root ns, and run sshd on all hosts."
|
||||||
switch = network.switches[ 0 ] # switch to use
|
switch = network.switches[ 0 ] # switch to use
|
||||||
ip = '10.123.123.1' # our IP address on host network
|
ip = '10.123.123.1' # our IP address on host network
|
||||||
routes = [ '10.0.0.0/8' ] # host networks to route to
|
routes = [ '10.0.0.0/8' ] # host networks to route to
|
||||||
connectToRootNS( network, switch, ip, 8, routes )
|
connectToRootNS( network, switch, ip, 8, routes )
|
||||||
for host in network.hosts:
|
for host in network.hosts:
|
||||||
host.cmd( cmd + ' ' + opts + '&' )
|
host.cmd( cmd + ' ' + opts + '&' )
|
||||||
|
|||||||
+1
-1
@@ -43,7 +43,7 @@ class CLI( Cmd ):
|
|||||||
def __init__( self, mininet ):
|
def __init__( self, mininet ):
|
||||||
self.mn = mininet
|
self.mn = mininet
|
||||||
self.nodelist = self.mn.controllers + self.mn.switches + self.mn.hosts
|
self.nodelist = self.mn.controllers + self.mn.switches + self.mn.hosts
|
||||||
self.nodemap = {} # map names to Node objects
|
self.nodemap = {} # map names to Node objects
|
||||||
for node in self.nodelist:
|
for node in self.nodelist:
|
||||||
self.nodemap[ node.name ] = node
|
self.nodemap[ node.name ] = node
|
||||||
Cmd.__init__( self )
|
Cmd.__init__( self )
|
||||||
|
|||||||
+2
-2
@@ -40,8 +40,8 @@ class StreamHandlerNoNewline( logging.StreamHandler ):
|
|||||||
traceback.printException and appended to the stream."""
|
traceback.printException and appended to the stream."""
|
||||||
try:
|
try:
|
||||||
msg = self.format( record )
|
msg = self.format( record )
|
||||||
fs = '%s' # was '%s\n'
|
fs = '%s' # was '%s\n'
|
||||||
if not hasattr( types, 'UnicodeType' ): #if no unicode support...
|
if not hasattr( types, 'UnicodeType' ): # if no unicode support...
|
||||||
self.stream.write( fs % msg )
|
self.stream.write( fs % msg )
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
|
|||||||
+7
-7
@@ -97,7 +97,7 @@ from mininet.util import quietRun, fixLimits
|
|||||||
from mininet.util import createLink, macColonHex, ipStr, ipParse
|
from mininet.util import createLink, macColonHex, ipStr, ipParse
|
||||||
from mininet.xterm import cleanUpScreens, makeXterms
|
from mininet.xterm import cleanUpScreens, makeXterms
|
||||||
|
|
||||||
DATAPATHS = [ 'kernel' ] #[ 'user', 'kernel' ]
|
DATAPATHS = [ 'kernel' ] # [ 'user', 'kernel' ]
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"Initialize Mininet."
|
"Initialize Mininet."
|
||||||
@@ -147,10 +147,10 @@ class Mininet( object ):
|
|||||||
self.hosts = []
|
self.hosts = []
|
||||||
self.switches = []
|
self.switches = []
|
||||||
self.controllers = []
|
self.controllers = []
|
||||||
self.nameToNode = {} # name to Node (Host/Switch) objects
|
self.nameToNode = {} # name to Node (Host/Switch) objects
|
||||||
self.idToNode = {} # dpid to Node (Host/Switch) objects
|
self.idToNode = {} # dpid to Node (Host/Switch) objects
|
||||||
self.dps = 0 # number of created kernel datapaths
|
self.dps = 0 # number of created kernel datapaths
|
||||||
self.terms = [] # list of spawned xterm processes
|
self.terms = [] # list of spawned xterm processes
|
||||||
|
|
||||||
switch.setup()
|
switch.setup()
|
||||||
|
|
||||||
@@ -188,7 +188,7 @@ class Mininet( object ):
|
|||||||
"""Add controller.
|
"""Add controller.
|
||||||
controller: Controller class"""
|
controller: Controller class"""
|
||||||
controller = self.controller( 'c0', self.inNamespace )
|
controller = self.controller( 'c0', self.inNamespace )
|
||||||
if controller: # allow controller-less setups
|
if controller: # allow controller-less setups
|
||||||
self.controllers.append( controller )
|
self.controllers.append( controller )
|
||||||
self.nameToNode[ 'c0' ] = controller
|
self.nameToNode[ 'c0' ] = controller
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ class Mininet( object ):
|
|||||||
if hosts is None:
|
if hosts is None:
|
||||||
hosts = self.hosts
|
hosts = self.hosts
|
||||||
poller = select.poll()
|
poller = select.poll()
|
||||||
Node = hosts[ 0 ] # so we can call class method fdToNode
|
Node = hosts[ 0 ] # so we can call class method fdToNode
|
||||||
for host in hosts:
|
for host in hosts:
|
||||||
poller.register( host.stdout )
|
poller.register( host.stdout )
|
||||||
while True:
|
while True:
|
||||||
|
|||||||
+7
-7
@@ -56,8 +56,8 @@ class Node( object ):
|
|||||||
"""A virtual network node is simply a shell in a network namespace.
|
"""A virtual network node is simply a shell in a network namespace.
|
||||||
We communicate with it using pipes."""
|
We communicate with it using pipes."""
|
||||||
|
|
||||||
inToNode = {} # mapping of input fds to nodes
|
inToNode = {} # mapping of input fds to nodes
|
||||||
outToNode = {} # mapping of output fds to nodes
|
outToNode = {} # mapping of output fds to nodes
|
||||||
|
|
||||||
def __init__( self, name, inNamespace=True,
|
def __init__( self, name, inNamespace=True,
|
||||||
defaultMAC=None, defaultIP=None ):
|
defaultMAC=None, defaultIP=None ):
|
||||||
@@ -84,11 +84,11 @@ class Node( object ):
|
|||||||
self.outToNode[ self.stdout.fileno() ] = self
|
self.outToNode[ self.stdout.fileno() ] = self
|
||||||
self.inToNode[ self.stdin.fileno() ] = self
|
self.inToNode[ self.stdin.fileno() ] = self
|
||||||
self.pid = self.shell.pid
|
self.pid = self.shell.pid
|
||||||
self.intfs = {} # dict of port numbers to interface names
|
self.intfs = {} # dict of port numbers to interface names
|
||||||
self.ports = {} # dict of interface names to port numbers
|
self.ports = {} # dict of interface names to port numbers
|
||||||
# replace with Port objects, eventually ?
|
# replace with Port objects, eventually ?
|
||||||
self.ips = {} # dict of interfaces to ip addresses as strings
|
self.ips = {} # dict of interfaces to ip addresses as strings
|
||||||
self.connection = {} # remote node connected to each interface
|
self.connection = {} # remote node connected to each interface
|
||||||
self.execed = False
|
self.execed = False
|
||||||
self.defaultIP = defaultIP
|
self.defaultIP = defaultIP
|
||||||
self.defaultMAC = defaultMAC
|
self.defaultMAC = defaultMAC
|
||||||
|
|||||||
+1
-1
@@ -25,7 +25,7 @@ class TreeTopo( Topo ):
|
|||||||
for i in range( 0, fanout ):
|
for i in range( 0, fanout ):
|
||||||
child = n + 1
|
child = n + 1
|
||||||
self.add_edge( me, child )
|
self.add_edge( me, child )
|
||||||
n = self.addTree( child, depth-1, fanout )
|
n = self.addTree( child, depth - 1, fanout )
|
||||||
return n
|
return n
|
||||||
|
|
||||||
# pylint: enable-msg=W0612
|
# pylint: enable-msg=W0612
|
||||||
|
|||||||
Reference in New Issue
Block a user