Changed custom feature so that params aren't added to globals.

There is probably a better way of doing this, but currently
parseCustomFile can modify globals (e.g. TOPOS) as well as
instance variables (self.validate) and classes (e.g. MyTopo),
which are also in the global name space.

Inconveniently enough, lambdas don't seem to be full closures
in Python; if they were, this trickiness would be unnecessary.

Even so, using execfile() seems like it might be a bit dubious...
This commit is contained in:
Bob Lantz
2010-02-27 23:19:57 -08:00
parent 5468377680
commit c3a4440025
4 changed files with 32 additions and 20 deletions
+2 -2
View File
@@ -303,14 +303,14 @@ class Mininet( object ):
ip = topo.ip( hostId )
host = self.addHost( name, defaultIp=ip, defaultMac=mac )
self.idToNode[ hostId ] = host
info( name )
info( name + ' ' )
info( '\n*** Adding switches:\n' )
for switchId in sorted( topo.switches() ):
name = 's' + topo.name( switchId )
mac = macColonHex( switchId) if self.setMacs else None
switch = self.addSwitch( name, defaultMac=mac )
self.idToNode[ switchId ] = switch
info( name )
info( name + ' ' )
info( '\n*** Adding edges:\n' )
for srcId, dstId in sorted( topo.edges() ):
src, dst = self.idToNode[ srcId ], self.idToNode[ dstId ]