Skip to content
Snippets Groups Projects
Commit 99c035d9 authored by Bob Lantz's avatar Bob Lantz
Browse files

Changed to automatically call build() if necessary.

parent 6c82d1ba
No related branches found
No related tags found
No related merge requests found
......@@ -120,7 +120,7 @@ def init():
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 @@ def __init__( self, topo, switch=KernelSwitch, host=Host,
init()
switch.setup()
if build:
self.built = False
if topo and build:
self.build()
......@@ -322,6 +323,7 @@ def build( self ):
self.setMacs()
if self.autoStaticArp:
self.staticArp()
self.built = True
def startTerms( self ):
"Start a terminal for each node."
......@@ -352,7 +354,9 @@ def staticArp( self ):
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()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment