Changed messages slightly.
For a network, we create "links" rather than "edges" on a graph. "Edges" is a bit confusing because the links may not be edge links on the network! Also, since you're not necessarily running a "test", I changed it to just say that we're "Done."
This commit is contained in:
+9
-2
@@ -99,8 +99,11 @@ from mininet.term import cleanUpScreens, makeTerms
|
|||||||
|
|
||||||
DATAPATHS = [ 'kernel' ] # [ 'user', 'kernel' ]
|
DATAPATHS = [ 'kernel' ] # [ 'user', 'kernel' ]
|
||||||
|
|
||||||
|
|
||||||
def init():
|
def init():
|
||||||
"Initialize Mininet."
|
"Initialize Mininet."
|
||||||
|
if init.inited:
|
||||||
|
return
|
||||||
if os.getuid() != 0:
|
if os.getuid() != 0:
|
||||||
# Note: this script must be run as root
|
# Note: this script must be run as root
|
||||||
# Perhaps we should do so automatically!
|
# Perhaps we should do so automatically!
|
||||||
@@ -111,6 +114,8 @@ def init():
|
|||||||
if not quietRun( [ 'which', 'mnexec' ] ):
|
if not quietRun( [ 'which', 'mnexec' ] ):
|
||||||
raise Exception( "Could not find mnexec - check $PATH" )
|
raise Exception( "Could not find mnexec - check $PATH" )
|
||||||
fixLimits()
|
fixLimits()
|
||||||
|
|
||||||
|
init.inited = False
|
||||||
|
|
||||||
class Mininet( object ):
|
class Mininet( object ):
|
||||||
"Network emulation with hosts spawned in network namespaces."
|
"Network emulation with hosts spawned in network namespaces."
|
||||||
@@ -152,11 +157,13 @@ class Mininet( object ):
|
|||||||
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
|
||||||
|
|
||||||
|
init()
|
||||||
switch.setup()
|
switch.setup()
|
||||||
|
|
||||||
if build:
|
if build:
|
||||||
self.build()
|
self.build()
|
||||||
|
|
||||||
|
|
||||||
def addHost( self, name, mac=None, ip=None ):
|
def addHost( self, name, mac=None, ip=None ):
|
||||||
"""Add host.
|
"""Add host.
|
||||||
name: name of host to add
|
name: name of host to add
|
||||||
@@ -292,7 +299,7 @@ class Mininet( object ):
|
|||||||
info( '\n*** Adding switches:\n' )
|
info( '\n*** Adding switches:\n' )
|
||||||
for switchId in sorted( topo.switches() ):
|
for switchId in sorted( topo.switches() ):
|
||||||
addNode( 's', self.addSwitch, switchId )
|
addNode( 's', self.addSwitch, switchId )
|
||||||
info( '\n*** Adding edges:\n' )
|
info( '\n*** Adding links:\n' )
|
||||||
for srcId, dstId in sorted( topo.edges() ):
|
for srcId, dstId in sorted( topo.edges() ):
|
||||||
src, dst = self.idToNode[ srcId ], self.idToNode[ dstId ]
|
src, dst = self.idToNode[ srcId ], self.idToNode[ dstId ]
|
||||||
srcPort, dstPort = topo.port( srcId, dstId )
|
srcPort, dstPort = topo.port( srcId, dstId )
|
||||||
@@ -373,7 +380,7 @@ class Mininet( object ):
|
|||||||
info( '*** Stopping %i controllers\n' % len( self.controllers ) )
|
info( '*** Stopping %i controllers\n' % len( self.controllers ) )
|
||||||
for controller in self.controllers:
|
for controller in self.controllers:
|
||||||
controller.stop()
|
controller.stop()
|
||||||
info( '*** Test complete\n' )
|
info( '*** Done\n' )
|
||||||
|
|
||||||
def run( self, test, *args, **kwargs ):
|
def run( self, test, *args, **kwargs ):
|
||||||
"Perform a complete start/test/stop cycle."
|
"Perform a complete start/test/stop cycle."
|
||||||
|
|||||||
Reference in New Issue
Block a user