blob: fb6ccdbea4b9877a7d58d132d358d83078e7c67c [file] [log] [blame]
Jon Hall85794ff2015-07-08 14:12:30 -07001#!/usr/bin/env python
2
3from mininet.topo import Topo
4
5class ObeliskTopo( Topo ):
6 def __init__( self ):
7 Topo.__init__( self )
8 topSwitch = self.addSwitch('s1',dpid='1000'.zfill(16))
9 leftTopSwitch = self.addSwitch('s2',dpid='2000'.zfill(16))
10 rightTopSwitch = self.addSwitch('s5',dpid='5000'.zfill(16))
11 leftBotSwitch = self.addSwitch('s3',dpid='3000'.zfill(16))
12 rightBotSwitch = self.addSwitch('s6',dpid='6000'.zfill(16))
13 midBotSwitch = self.addSwitch('s28',dpid='2800'.zfill(16))
14
15 topHost = self.addHost( 'h1' )
16 leftTopHost = self.addHost('h2')
17 rightTopHost = self.addHost('h5')
18 leftBotHost = self.addHost('h3')
19 rightBotHost = self.addHost('h6')
20 midBotHost = self.addHost('h28')
21 self.addLink(topSwitch,topHost)
22 self.addLink(leftTopSwitch,leftTopHost)
23 self.addLink(rightTopSwitch,rightTopHost)
24 self.addLink(leftBotSwitch,leftBotHost)
25 self.addLink(rightBotSwitch,rightBotHost)
26 self.addLink(midBotSwitch,midBotHost)
27 self.addLink(leftTopSwitch,rightTopSwitch)
28 self.addLink(topSwitch,leftTopSwitch)
29 self.addLink(topSwitch,rightTopSwitch)
30 self.addLink(leftTopSwitch,leftBotSwitch)
31 self.addLink(rightTopSwitch,rightBotSwitch)
32 self.addLink(leftBotSwitch,midBotSwitch)
33 self.addLink(midBotSwitch,rightBotSwitch)
34
35 agg1Switch = self.addSwitch('s4',dpid = '3004'.zfill(16))
36 agg2Switch = self.addSwitch('s7',dpid = '6007'.zfill(16))
37 agg1Host = self.addHost('h4')
38 agg2Host = self.addHost('h7')
39 self.addLink(agg1Switch,agg1Host)
40 self.addLink(agg2Switch,agg2Host)
41 self.addLink(agg1Switch, leftBotSwitch)
42 self.addLink(agg2Switch, rightBotSwitch)
43
44 for i in range(10):
45 num = str(i+8)
46 switch = self.addSwitch('s'+num,dpid = ('30'+num.zfill(2)).zfill(16))
47 host = self.addHost('h'+num)
48 self.addLink(switch, host)
49 self.addLink(switch, agg1Switch)
50
51 for i in range(10):
52 num = str(i+18)
53 switch = self.addSwitch('s'+num,dpid = ('60'+num.zfill(2)).zfill(16))
54 host = self.addHost('h'+num)
55 self.addLink(switch, host)
56 self.addLink(switch, agg2Switch)
57
58topos = { 'obelisk': (lambda: ObeliskTopo() ) }
59
60def run():
61 topo = ObeliskTopo()
62 net = Mininet( topo=topo, controller=RemoteController, autoSetMacs=True )
63 net.start()
64 CLI( net )
65 net.stop()
66
67if __name__ == '__main__':
68 setLogLevel( 'info' )
69 run()
70