Changed to automatically call build() if necessary.

This commit is contained in:
Bob Lantz
2010-04-10 23:52:15 -07:00
parent 6c82d1bae7
commit 99c035d9ca
+7 -3
View File
@@ -120,7 +120,7 @@ init.inited = False
class Mininet( object ):
"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,
cparams=ControllerParams( '10.0.0.0', 8 ),
build=True, xterms=False, cleanup=False,
@@ -160,7 +160,8 @@ class Mininet( object ):
init()
switch.setup()
if build:
self.built = False
if topo and build:
self.build()
@@ -322,6 +323,7 @@ class Mininet( object ):
self.setMacs()
if self.autoStaticArp:
self.staticArp()
self.built = True
def startTerms( self ):
"Start a terminal for each node."
@@ -352,7 +354,9 @@ class Mininet( object ):
src.setARP( ip=dst.IP(), mac=dst.MAC() )
def start( self ):
"Start controller and switches"
"Start controller and switches."
if not self.built:
self.build()
info( '*** Starting controller\n' )
for controller in self.controllers:
controller.start()