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:
@@ -13,10 +13,10 @@ topology enables one to pass in '--topo=mytopo' from the command line.
|
||||
from mininet.topo import Topo, Node
|
||||
|
||||
class MyTopo( Topo ):
|
||||
"""Simple topology example."""
|
||||
"Simple topology example."
|
||||
|
||||
def __init__( self, enable_all = True ):
|
||||
"""Create custom topo."""
|
||||
"Create custom topo."
|
||||
|
||||
# Add default members to class.
|
||||
super( MyTopo, self ).__init__()
|
||||
@@ -42,4 +42,6 @@ class MyTopo( Topo ):
|
||||
self.enable_all()
|
||||
|
||||
|
||||
topos = { 'mytopo': ( lambda: MyTopo() ) }
|
||||
topos = { 'mytopo': MyTopo }
|
||||
|
||||
# topos = { 'mytopo': ( lambda: MyTopo() ) }
|
||||
Reference in New Issue
Block a user