blob: 65613d6ca4932a19972d441b6e47e5d90b964277 [file] [log] [blame]
Jon Hall58c76b72015-02-23 11:09:24 -08001from mininet.topo import Topo
2class MyTopo( Topo ):
3 def __init__( self ):
4 Topo.__init__( self )
5 topSwitch = self.addSwitch('s1',dpid='1000'.zfill(16))
6 leftTopSwitch = self.addSwitch('s2',dpid='2000'.zfill(16))
7 rightTopSwitch = self.addSwitch('s5',dpid='5000'.zfill(16))
8 leftBotSwitch = self.addSwitch('s3',dpid='3000'.zfill(16))
9 rightBotSwitch = self.addSwitch('s6',dpid='6000'.zfill(16))
10 midBotSwitch = self.addSwitch('s28',dpid='2800'.zfill(16))
11
12 topHost = self.addHost( 'h1' )
13 leftTopHost = self.addHost('h2')
14 rightTopHost = self.addHost('h5')
15 leftBotHost = self.addHost('h3')
16 rightBotHost = self.addHost('h6')
17 midBotHost = self.addHost('h28')
18 self.addLink(topSwitch,topHost)
19 self.addLink(leftTopSwitch,leftTopHost)
20 self.addLink(rightTopSwitch,rightTopHost)
21 self.addLink(leftBotSwitch,leftBotHost)
22 self.addLink(rightBotSwitch,rightBotHost)
23 self.addLink(midBotSwitch,midBotHost)
24 self.addLink(leftTopSwitch,rightTopSwitch)
25 self.addLink(topSwitch,leftTopSwitch)
26 self.addLink(topSwitch,rightTopSwitch)
27 self.addLink(leftTopSwitch,leftBotSwitch)
28 self.addLink(rightTopSwitch,rightBotSwitch)
29 self.addLink(leftBotSwitch,midBotSwitch)
30 self.addLink(midBotSwitch,rightBotSwitch)
31
32 agg1Switch = self.addSwitch('s4',dpid = '3004'.zfill(16))
33 agg2Switch = self.addSwitch('s7',dpid = '6007'.zfill(16))
34 agg1Host = self.addHost('h4')
35 agg2Host = self.addHost('h7')
36 self.addLink(agg1Switch,agg1Host)
37 self.addLink(agg2Switch,agg2Host)
38 self.addLink(agg1Switch, leftBotSwitch)
39 self.addLink(agg2Switch, rightBotSwitch)
40
41 for i in range(10):
42 num = str(i+8)
43 switch = self.addSwitch('s'+num,dpid = ('30'+num.zfill(2)).zfill(16))
44 host = self.addHost('h'+num)
45 self.addLink(switch, host)
46 self.addLink(switch, agg1Switch)
47
48 for i in range(10):
49 num = str(i+18)
50 switch = self.addSwitch('s'+num,dpid = ('60'+num.zfill(2)).zfill(16))
51 host = self.addHost('h'+num)
52 self.addLink(switch, host)
53 self.addLink(switch, agg2Switch)
54
55topos = { 'mytopo': (lambda: MyTopo() ) }
56
57
58
59
60
61
62
63