Changed to automatically call build() if necessary.
This commit is contained in:
+7
-3
@@ -120,7 +120,7 @@ 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."
|
||||||
|
|
||||||
def __init__( self, topo, switch=KernelSwitch, host=Host,
|
def __init__( self, topo=None, switch=KernelSwitch, host=Host,
|
||||||
controller=Controller,
|
controller=Controller,
|
||||||
cparams=ControllerParams( '10.0.0.0', 8 ),
|
cparams=ControllerParams( '10.0.0.0', 8 ),
|
||||||
build=True, xterms=False, cleanup=False,
|
build=True, xterms=False, cleanup=False,
|
||||||
@@ -160,7 +160,8 @@ class Mininet( object ):
|
|||||||
init()
|
init()
|
||||||
switch.setup()
|
switch.setup()
|
||||||
|
|
||||||
if build:
|
self.built = False
|
||||||
|
if topo and build:
|
||||||
self.build()
|
self.build()
|
||||||
|
|
||||||
|
|
||||||
@@ -322,6 +323,7 @@ class Mininet( object ):
|
|||||||
self.setMacs()
|
self.setMacs()
|
||||||
if self.autoStaticArp:
|
if self.autoStaticArp:
|
||||||
self.staticArp()
|
self.staticArp()
|
||||||
|
self.built = True
|
||||||
|
|
||||||
def startTerms( self ):
|
def startTerms( self ):
|
||||||
"Start a terminal for each node."
|
"Start a terminal for each node."
|
||||||
@@ -352,7 +354,9 @@ class Mininet( object ):
|
|||||||
src.setARP( ip=dst.IP(), mac=dst.MAC() )
|
src.setARP( ip=dst.IP(), mac=dst.MAC() )
|
||||||
|
|
||||||
def start( self ):
|
def start( self ):
|
||||||
"Start controller and switches"
|
"Start controller and switches."
|
||||||
|
if not self.built:
|
||||||
|
self.build()
|
||||||
info( '*** Starting controller\n' )
|
info( '*** Starting controller\n' )
|
||||||
for controller in self.controllers:
|
for controller in self.controllers:
|
||||||
controller.start()
|
controller.start()
|
||||||
|
|||||||
Reference in New Issue
Block a user