Merging MurphyMc LinearTopo pull request
This commit is contained in:
@@ -281,7 +281,7 @@ if __name__ == "__main__":
|
||||
try:
|
||||
MininetRunner()
|
||||
except KeyboardInterrupt:
|
||||
info( "Keyboard Interrupt. Shutting down and cleaning up...")
|
||||
info( "\n\nKeyboard Interrupt. Shutting down and cleaning up...\n\n")
|
||||
cleanup()
|
||||
except Exception:
|
||||
# Print exception
|
||||
|
||||
+8
-1
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user