Jon Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 3 | """ |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 4 | Copyright 2015 Open Networking Foundation ( ONF ) |
Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 5 | |
| 6 | Please refer questions to either the onos test mailing list at <onos-test@onosproject.org>, |
| 7 | the System Testing Plans and Results wiki page at <https://wiki.onosproject.org/x/voMg>, |
| 8 | or 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 Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 13 | ( at your option ) any later version. |
Jeremy Ronquillo | b27ce4c | 2017-07-17 12:41:28 -0700 | [diff] [blame] | 14 | |
| 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 Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 23 | from mininet.topo import Topo |
| 24 | |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 25 | |
Jon Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 26 | class ObeliskTopo( Topo ): |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 27 | |
Jon Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 28 | def __init__( self ): |
| 29 | Topo.__init__( self ) |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 30 | 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 Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 36 | |
Jon Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 37 | topHost = self.addHost( 'h1' ) |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 38 | 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 Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 56 | |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 57 | 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 Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 65 | |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 66 | 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 Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 72 | |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 73 | 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 Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 79 | |
Jeremy Ronquillo | 23fb216 | 2017-09-15 14:59:57 -0700 | [diff] [blame] | 80 | topos = { 'obelisk': ( lambda: ObeliskTopo() ) } |
| 81 | |
Jon Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 82 | |
| 83 | def run(): |
| 84 | topo = ObeliskTopo() |
| 85 | net = Mininet( topo=topo, controller=RemoteController, autoSetMacs=True ) |
| 86 | net.start() |
| 87 | CLI( net ) |
| 88 | net.stop() |
| 89 | |
| 90 | if __name__ == '__main__': |
| 91 | setLogLevel( 'info' ) |
| 92 | run() |