Merging MurphyMc LinearTopo pull request

This commit is contained in:
Brian O'Connor
2013-08-02 13:35:38 -07:00
2 changed files with 9 additions and 2 deletions
+8 -1
View File
@@ -249,6 +249,12 @@ class LinearTopo(Topo):
self.k = k
self.n = n
if n == 1:
genHostName = lambda i,j: 'h%s' % i
else:
genHostName = lambda i,j: 'h%ss%d' % (j,i)
lastSwitch = None
for i in irange(1, k):
# Add switch
@@ -256,7 +262,8 @@ class LinearTopo(Topo):
# Add hosts to switch
for j in irange(1, n):
hostNum = (i-1)*n + j
host = self.addHost('h%s' % hostNum)
#host = self.addHost('h%s' % hostNum)
host = self.addHost(genHostName(i, j))
self.addLink(host, switch)
# Connect switch to previous
if lastSwitch: