class Switch1(Topo):
"""Single switch s1 connected to n=2 hosts."""
+
def __init__(self):
Topo.__init__(self)
switch = self.addSwitch('s1')
n = 2
for h in range(n):
- host = self.addHost('h%s' % (h + 1), mac="00:00:00:00:00:0"+str(h+1), ip="10.0.0."+str(h+1))
+ host = self.addHost('h%s' % (h + 1), mac="00:00:00:00:00:0" + str(h + 1), ip="10.0.0." + str(h + 1))
self.addLink(host, switch)
class Switch2(Topo):
"""Single switch s2 connected to n=2 hosts."""
+
def __init__(self):
Topo.__init__(self)
switch = self.addSwitch('s2')
n = 2
for h in range(n):
- host = self.addHost('h%s' % (h + 3), mac="00:00:00:00:00:0"+str(h+3), ip="10.0.0."+str(h+3))
+ host = self.addHost('h%s' % (h + 3), mac="00:00:00:00:00:0" + str(h + 3), ip="10.0.0." + str(h + 3))
self.addLink(host, switch)
+
topos = {'Switch1': (lambda: Switch1()),
'Switch2': (lambda: Switch2())}