From: Alina Quereilhac <alina.quereilhac@inria.fr>
Date: Wed, 3 Sep 2014 11:57:38 +0000 (+0200)
Subject: small bug fix in src/nepi/util/netgraph.py
X-Git-Tag: nepi-3.2.0~90
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=baf0ec72915b1290a0be284aab90b6ebdf057115;p=nepi.git

small bug fix in src/nepi/util/netgraph.py
---

diff --git a/src/nepi/util/netgraph.py b/src/nepi/util/netgraph.py
index 6d686226..c04f94df 100644
--- a/src/nepi/util/netgraph.py
+++ b/src/nepi/util/netgraph.py
@@ -19,6 +19,7 @@
 
 import ipaddr
 import networkx
+import math
 import random
 
 class TopologyType:
@@ -325,8 +326,8 @@ class NetGraph(object):
         # The ladder is a special case because is not symmetric.
         if self.topo_type == TopologyType.LADDER:
             total_nodes = self.order/2
-            leaf1 = str(total_nodes - 1)
-            leaf2 = str(nodes - 1)
+            leaf1 = str(total_nodes)
+            leaf2 = str(total_nodes - 1)
             leaves = [leaf1, leaf2]
             source = leaves.pop(random.randint(0, len(leaves) - 1))
         else: