Add MAC auto set for switches

Also use indexing for DPIDs to avoid zeroed MAC
This commit is contained in:
Brandon Heller
2010-01-01 03:16:57 -08:00
parent 376bcba442
commit 540379957b
5 changed files with 49 additions and 27 deletions
+5 -5
View File
@@ -324,11 +324,11 @@ class SingleSwitchTopo(Topo):
self.k = k
self._add_node(0, Node())
hosts = range(1, k + 1)
self._add_node(1, Node())
hosts = range(2, k + 2)
for h in hosts:
self._add_node(h, Node(is_switch = False))
self._add_edge(h, 0, Edge())
self._add_edge(h, 1, Edge())
if enable_all:
self.enable_all()
@@ -347,14 +347,14 @@ class LinearTopo(Topo):
self.k = k
switches = range(0, k)
switches = range(1, k + 1)
for s in switches:
h = s + k
self._add_node(s, Node())
self._add_node(h, Node(is_switch = False))
self._add_edge(s, h, Edge())
for s in switches:
if s != k - 1:
if s != k:
self._add_edge(s, s + 1, Edge())
if enable_all: