Skip to content
Snippets Groups Projects
Commit bb0006b6 authored by Brian O'Connor's avatar Brian O'Connor
Browse files

Merging MurphyMc LinearTopo pull request

parents 43ba774e a22e2618
No related branches found
No related tags found
No related merge requests found
...@@ -281,7 +281,7 @@ if __name__ == "__main__": ...@@ -281,7 +281,7 @@ if __name__ == "__main__":
try: try:
MininetRunner() MininetRunner()
except KeyboardInterrupt: except KeyboardInterrupt:
info( "Keyboard Interrupt. Shutting down and cleaning up...") info( "\n\nKeyboard Interrupt. Shutting down and cleaning up...\n\n")
cleanup() cleanup()
except Exception: except Exception:
# Print exception # Print exception
......
...@@ -249,6 +249,12 @@ def __init__(self, k=2, n=1, **opts): ...@@ -249,6 +249,12 @@ def __init__(self, k=2, n=1, **opts):
self.k = k self.k = k
self.n = n 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 lastSwitch = None
for i in irange(1, k): for i in irange(1, k):
# Add switch # Add switch
...@@ -256,7 +262,8 @@ def __init__(self, k=2, n=1, **opts): ...@@ -256,7 +262,8 @@ def __init__(self, k=2, n=1, **opts):
# Add hosts to switch # Add hosts to switch
for j in irange(1, n): for j in irange(1, n):
hostNum = (i-1)*n + j 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) self.addLink(host, switch)
# Connect switch to previous # Connect switch to previous
if lastSwitch: if lastSwitch:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment