Committed by
Gerrit Code Review
Adding QA HA test topo: obelisk.py
Change-Id: I48720c63060054dd7359c3c38ef9444d68280892
Showing
1 changed file
with
70 additions
and
0 deletions
tools/test/topos/obelisk.py
0 → 100755
| 1 | +#!/usr/bin/env python | ||
| 2 | + | ||
| 3 | +from mininet.topo import Topo | ||
| 4 | + | ||
| 5 | +class 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 | + | ||
| 58 | +topos = { 'obelisk': (lambda: ObeliskTopo() ) } | ||
| 59 | + | ||
| 60 | +def run(): | ||
| 61 | + topo = ObeliskTopo() | ||
| 62 | + net = Mininet( topo=topo, controller=RemoteController, autoSetMacs=True ) | ||
| 63 | + net.start() | ||
| 64 | + CLI( net ) | ||
| 65 | + net.stop() | ||
| 66 | + | ||
| 67 | +if __name__ == '__main__': | ||
| 68 | + setLogLevel( 'info' ) | ||
| 69 | + run() | ||
| 70 | + |
-
Please register or login to post a comment