blob: c43941c4a5b73776337ea777f272695d181a4a63 [file] [log] [blame]
Jon Hall5cf14d52015-07-16 12:15:19 -07001#!/usr/bin/env python
2
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07003"""
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -07004Copyright 2015 Open Networking Foundation ( ONF )
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -07005
6Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>,
7the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>,
8or the System Testing Guide page at <https://wiki.onosproject.org/x/WYQg>
9
10 TestON is free software: you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation, either version 2 of the License, or
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070013 ( at your option ) any later version.
Jeremy Ronquillob27ce4c2017-07-17 12:41:28 -070014
15 TestON is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19
20 You should have received a copy of the GNU General Public License
21 along with TestON. If not, see <http://www.gnu.org/licenses/>.
22"""
Jon Hall5cf14d52015-07-16 12:15:19 -070023from mininet.topo import Topo
24
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070025
Jon Hall5cf14d52015-07-16 12:15:19 -070026class ObeliskTopo( Topo ):
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070027
Jon Hall5cf14d52015-07-16 12:15:19 -070028 def __init__( self ):
29 Topo.__init__( self )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070030 topSwitch = self.addSwitch( 's1', dpid='1000'.zfill( 16 ) )
31 leftTopSwitch = self.addSwitch( 's2', dpid='2000'.zfill( 16 ) )
32 rightTopSwitch = self.addSwitch( 's5', dpid='5000'.zfill( 16 ) )
33 leftBotSwitch = self.addSwitch( 's3', dpid='3000'.zfill( 16 ) )
34 rightBotSwitch = self.addSwitch( 's6', dpid='6000'.zfill( 16 ) )
35 midBotSwitch = self.addSwitch( 's28', dpid='2800'.zfill( 16 ) )
Jon Hall4ba53f02015-07-29 13:07:41 -070036
Jon Hall5cf14d52015-07-16 12:15:19 -070037 topHost = self.addHost( 'h1' )
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070038 leftTopHost = self.addHost( 'h2' )
39 rightTopHost = self.addHost( 'h5' )
40 leftBotHost = self.addHost( 'h3' )
41 rightBotHost = self.addHost( 'h6' )
42 midBotHost = self.addHost( 'h28' )
43 self.addLink( topSwitch, topHost )
44 self.addLink( leftTopSwitch, leftTopHost )
45 self.addLink( rightTopSwitch, rightTopHost )
46 self.addLink( leftBotSwitch, leftBotHost )
47 self.addLink( rightBotSwitch, rightBotHost )
48 self.addLink( midBotSwitch, midBotHost )
49 self.addLink( leftTopSwitch, rightTopSwitch )
50 self.addLink( topSwitch, leftTopSwitch )
51 self.addLink( topSwitch, rightTopSwitch )
52 self.addLink( leftTopSwitch, leftBotSwitch )
53 self.addLink( rightTopSwitch, rightBotSwitch )
54 self.addLink( leftBotSwitch, midBotSwitch )
55 self.addLink( midBotSwitch, rightBotSwitch )
Jon Hall5cf14d52015-07-16 12:15:19 -070056
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070057 agg1Switch = self.addSwitch( 's4', dpid='3004'.zfill( 16 ) )
58 agg2Switch = self.addSwitch( 's7', dpid='6007'.zfill( 16 ) )
59 agg1Host = self.addHost( 'h4' )
60 agg2Host = self.addHost( 'h7' )
61 self.addLink( agg1Switch, agg1Host )
62 self.addLink( agg2Switch, agg2Host )
63 self.addLink( agg1Switch, leftBotSwitch )
64 self.addLink( agg2Switch, rightBotSwitch )
Jon Hall5cf14d52015-07-16 12:15:19 -070065
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070066 for i in range( 10 ):
67 num = str( i + 8 )
68 switch = self.addSwitch( 's' + num, dpid=( '30' + num.zfill( 2 ) ).zfill( 16 ) )
69 host = self.addHost( 'h' + num )
70 self.addLink( switch, host )
71 self.addLink( switch, agg1Switch )
Jon Hall5cf14d52015-07-16 12:15:19 -070072
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070073 for i in range( 10 ):
74 num = str( i + 18 )
75 switch = self.addSwitch( 's' + num, dpid=( '60' + num.zfill( 2 ) ).zfill( 16 ) )
76 host = self.addHost( 'h' + num )
77 self.addLink( switch, host )
78 self.addLink( switch, agg2Switch )
Jon Hall5cf14d52015-07-16 12:15:19 -070079
Jeremy Ronquillo23fb2162017-09-15 14:59:57 -070080topos = { 'obelisk': ( lambda: ObeliskTopo() ) }
81
Jon Hall5cf14d52015-07-16 12:15:19 -070082
83def run():
84 topo = ObeliskTopo()
85 net = Mininet( topo=topo, controller=RemoteController, autoSetMacs=True )
86 net.start()
87 CLI( net )
88 net.stop()
89
90if __name__ == '__main__':
91 setLogLevel( 'info' )
92 run()