From 8dea57d2711d7cec6e5602a368a600c9aa912c4c Mon Sep 17 00:00:00 2001 From: Bob Lantz Date: Mon, 3 Nov 2014 14:20:01 -0800 Subject: [PATCH] Ignore link info when sorting links. --- mininet/topo.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mininet/topo.py b/mininet/topo.py index b6f1fa3..1331306 100644 --- a/mininet/topo.py +++ b/mininet/topo.py @@ -203,7 +203,11 @@ class Topo( object ): withInfo: return link info returns: list of ( src, dst [,key, info ] )""" links = list( self.iterLinks( withKeys, withInfo ) ) - return links if not sort else self.sorted( links ) + if not sorted: + return links + # Ignore info when sorting + tupleSize = 3 if withKeys else 2 + return sorted( links, key=( lambda l: naturalSeq( l[ 0 : tupleSize ] ) ) ) # This legacy port management mechanism is clunky and will probably # be removed at some point.