Skip to content

Commit

Permalink
Change nodeName generator in tristar topo
Browse files Browse the repository at this point in the history
It may be a bug in mininet or odl/onos. Because when I
assign some complex name for nodes, odl/onos always
cannot collect topology information correctly.

Signed-off-by: jensenzhang <[email protected]>
  • Loading branch information
fno2010 committed Jan 21, 2017
1 parent 21d1189 commit 6617a1f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 23 deletions.
8 changes: 4 additions & 4 deletions sdntest/examples/customtopo/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ def test( controller, branch, hop, seconds):
net.addController( ip=controller )
net.start()

host1 = net.get('core1h1')
host2 = net.get('core2h2')
core1 = net.get('core1')
core2 = net.get('core2')
host1 = net.get('h1')
host2 = net.get('h2')
core1 = net.get('s1')
core2 = net.get('s1')

# Add host-to-host intent
h2hintent( controller, host1.IP(), host2.IP() )
Expand Down
37 changes: 18 additions & 19 deletions sdntest/examples/customtopo/triangle.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
"""

from mininet.topo import Topo
from mininet.log import info

CORE_NUMBER = 3

Expand All @@ -23,36 +22,36 @@ def build( self, m=1, n=1 ):
n: hop count between host and nearby core switche.
"""

switch_count = 0
host_count = 0
self.hostNum = 0
self.switchNum = 0
core = []
switch = []
host = []

for c in range(CORE_NUMBER):
core.append( self.addSwitch( 'core%d' % (c+1) ) )
switch_count += 1
self.switchNum += 1
core.append( self.addSwitch( 's%d' % self.switchNum ) )
for c in range(CORE_NUMBER):
self.addLink( core[c], core[(c+1) % CORE_NUMBER] )

switch.append([])
host.append([])
switch.append( [] )
host.append( [] )
for b in range(m):
switch[c].append([])
switch[c].append( [] )
for h in range(n):
switch[c][b].append( self.addSwitch( 'core%db%ds%d' % (c+1, b+1, h+1) ) )
switch_count += 1
if h:
self.switchNum += 1
switch[c][b].append( self.addSwitch( 's%d' % self.switchNum ) )
if h > 0:
self.addLink( switch[c][b][h-1],
switch[c][b][h] )
else:
self.addLink( switch[c][b][h],
core[c] )
host[c].append(self.addHost( 'core%dh%d' % (c+1, b+1) ) )
host_count += 1
self.addLink( host[c][b], switch[c][b][h] )
info("***** total_switches=%u *****\n" % (switch_count))
info("***** total_hosts=%u *****\n" % (host_count))
info("***** total_nodes=%u *****\n" % (switch_count + host_count))

topos = { 'tristar': ( lambda m,n: TriangleStarTopo(m, n) ) }
self.hostNum += 1
host[c].append( self.addHost( 'h%d' % self.hostNum ) )
if n > 0:
self.addLink( host[c][b], switch[c][b][h] )
else:
self.addLink( host[c][b], core[c] )

topos = { 'tristar': TriangleStarTopo }

0 comments on commit 6617a1f

Please sign in to comment.