diff --git a/mininet/link.py b/mininet/link.py index 2f90d4e7a9ca8365d8ffafc23573be3fc35d4512..24028aca9aa3d6edd93702d8d322fa2f1d2023b8 100644 --- a/mininet/link.py +++ b/mininet/link.py @@ -290,8 +290,8 @@ def config( self, bw=None, delay=None, jitter=None, loss=None, cmds += bwcmds # Delay/jitter/loss/max_queue_size using netem - delaycmds, parent = self.delayCmds( delay=delay, jitter=jitter, loss=loss, - max_queue_size=max_queue_size, + delaycmds, parent = self.delayCmds( delay=delay, jitter=jitter, + loss=loss, max_queue_size=max_queue_size, parent=parent ) cmds += delaycmds diff --git a/mininet/topo.py b/mininet/topo.py index 3ff0e8efec656645c3cb90b7415a0f185d192c1e..cae1c04a64f2a0cc34f97a7a608a3bfb7b7a33e4 100644 --- a/mininet/topo.py +++ b/mininet/topo.py @@ -13,28 +13,33 @@ from mininet.util import irange, natural, naturalSeq -class Graph(object): - "Utility class to track nodes and edges " +class Graph( object ): + "Utility class to track nodes and edges - replaces networkx.Graph" - def __init__(self): + def __init__( self ): self.data = {} - def add_node(self,node): + def add_node( self, node ): + "Add node to graph" if node not in self.data.keys(): - self.data[node] = [] + self.data[ node ] = [] - def add_edge(self,src,dest): - self.add_node(src) - self.add_node(dest) - self.data[src].append(dest) + def add_edge( self, src, dest ): + "Add edge to graph" + self.add_node( src ) + self.add_node( dest ) + self.data[ src ].append( dest ) - def nodes(self): + def nodes( self ): + "Return list of graph nodes" return self.data.keys() - def edges(self): + def edges( self ): + "Iterator: return graph edges" for src in self.data.keys(): - for dest in self.data[src]: - yield (src,dest) + for dest in self.data[ src ]: + yield ( src, dest ) + class Topo(object): "Data center network representation for structured multi-trees."