You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The function AddLink() in topo.py in class Topo is in my version like this:
def addLink( self, node1, node2, port1=None, port2=None,
key=None, **opts ):
"""node1, node2: nodes to link together
port1, port2: ports (optional)
opts: link options (optional)
returns: link info key"""
if not opts and self.lopts:
opts = self.lopts
port1, port2 = self.addPort( node1, node2, port1, port2 )
opts = dict( opts )
opts.update( node1=node1, node2=node2, port1=port1, port2=port2 )
self.g.add_edge(node1, node2, key, opts )
return key
The last line should be removed and the line before it should get the return, like this:
..... other code...
opts.update( node1=node1, node2=node2, port1=port1, port2=port2 )
return self.g.add_edge(node1, node2, key, opts )
The key argument in is by default None and Multigraph.add_edge will change the key if it is None to the actual key value and return the actual key. AddLink also have key as None by default and the present code simply returns the input key even if it is None.
Instead it should return the key it gets from add_edge so that it returns the actual key used.
The text was updated successfully, but these errors were encountered:
The function AddLink() in topo.py in class Topo is in my version like this:
The last line should be removed and the line before it should get the return, like this:
..... other code...
opts.update( node1=node1, node2=node2, port1=port1, port2=port2 )
return self.g.add_edge(node1, node2, key, opts )
The key argument in is by default None and Multigraph.add_edge will change the key if it is None to the actual key value and return the actual key. AddLink also have key as None by default and the present code simply returns the input key even if it is None.
Instead it should return the key it gets from add_edge so that it returns the actual key used.
The text was updated successfully, but these errors were encountered: