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 | """ |
| 4 | Copyright 2015 Open Networking Foundation (ONF) |
| 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 |
| 13 | (at your option) any later version. |
| 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 | """ |
| 23 | |
Jon Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 24 | from mininet.topo import Topo |
| 25 | |
| 26 | class ObeliskTopo( Topo ): |
| 27 | def __init__( self ): |
| 28 | Topo.__init__( self ) |
| 29 | topSwitch = self.addSwitch('s1',dpid='1000'.zfill(16)) |
| 30 | leftTopSwitch = self.addSwitch('s2',dpid='2000'.zfill(16)) |
| 31 | rightTopSwitch = self.addSwitch('s5',dpid='5000'.zfill(16)) |
| 32 | leftBotSwitch = self.addSwitch('s3',dpid='3000'.zfill(16)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 33 | rightBotSwitch = self.addSwitch('s6',dpid='6000'.zfill(16)) |
Jon Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 34 | midBotSwitch = self.addSwitch('s28',dpid='2800'.zfill(16)) |
Jon Hall | 4ba53f0 | 2015-07-29 13:07:41 -0700 | [diff] [blame] | 35 | |
Jon Hall | 5cf14d5 | 2015-07-16 12:15:19 -0700 | [diff] [blame] | 36 | topHost = self.addHost( 'h1' ) |
| 37 | leftTopHost = self.addHost('h2') |
| 38 | rightTopHost = self.addHost('h5') |
| 39 | leftBotHost = self.addHost('h3') |
| 40 | rightBotHost = self.addHost('h6') |
| 41 | midBotHost = self.addHost('h28') |
| 42 | self.addLink(topSwitch,topHost) |
| 43 | self.addLink(leftTopSwitch,leftTopHost) |
| 44 | self.addLink(rightTopSwitch,rightTopHost) |
| 45 | self.addLink(leftBotSwitch,leftBotHost) |
| 46 | self.addLink(rightBotSwitch,rightBotHost) |
| 47 | self.addLink(midBotSwitch,midBotHost) |
| 48 | self.addLink(leftTopSwitch,rightTopSwitch) |
| 49 | self.addLink(topSwitch,leftTopSwitch) |
| 50 | self.addLink(topSwitch,rightTopSwitch) |
| 51 | self.addLink(leftTopSwitch,leftBotSwitch) |
| 52 | self.addLink(rightTopSwitch,rightBotSwitch) |
| 53 | self.addLink(leftBotSwitch,midBotSwitch) |
| 54 | self.addLink(midBotSwitch,rightBotSwitch) |
| 55 | |
| 56 | agg1Switch = self.addSwitch('s4',dpid = '3004'.zfill(16)) |
| 57 | agg2Switch = self.addSwitch('s7',dpid = '6007'.zfill(16)) |
| 58 | agg1Host = self.addHost('h4') |
| 59 | agg2Host = self.addHost('h7') |
| 60 | self.addLink(agg1Switch,agg1Host) |
| 61 | self.addLink(agg2Switch,agg2Host) |
| 62 | self.addLink(agg1Switch, leftBotSwitch) |
| 63 | self.addLink(agg2Switch, rightBotSwitch) |
| 64 | |
| 65 | for i in range(10): |
| 66 | num = str(i+8) |
| 67 | switch = self.addSwitch('s'+num,dpid = ('30'+num.zfill(2)).zfill(16)) |
| 68 | host = self.addHost('h'+num) |
| 69 | self.addLink(switch, host) |
| 70 | self.addLink(switch, agg1Switch) |
| 71 | |
| 72 | for i in range(10): |
| 73 | num = str(i+18) |
| 74 | switch = self.addSwitch('s'+num,dpid = ('60'+num.zfill(2)).zfill(16)) |
| 75 | host = self.addHost('h'+num) |
| 76 | self.addLink(switch, host) |
| 77 | self.addLink(switch, agg2Switch) |
| 78 | |
| 79 | topos = { 'obelisk': (lambda: ObeliskTopo() ) } |
| 80 | |
| 81 | def run(): |
| 82 | topo = ObeliskTopo() |
| 83 | net = Mininet( topo=topo, controller=RemoteController, autoSetMacs=True ) |
| 84 | net.start() |
| 85 | CLI( net ) |
| 86 | net.stop() |
| 87 | |
| 88 | if __name__ == '__main__': |
| 89 | setLogLevel( 'info' ) |
| 90 | run() |