andrewonlab | c34fa94 | 2014-11-06 14:10:52 -0500 | [diff] [blame] | 1 | |
| 2 | from mininet.topo import Topo |
| 3 | |
| 4 | class MyTopo( Topo ): |
| 5 | "100 'floating' switch topology" |
| 6 | |
| 7 | def __init__( self ): |
| 8 | # Initialize topology |
| 9 | Topo.__init__( self ) |
| 10 | |
| 11 | sw_list = [] |
| 12 | |
| 13 | for i in range(1, 101): |
| 14 | sw_list.append( |
| 15 | self.addSwitch( |
| 16 | 's'+str(i), |
| 17 | dpid = str(i).zfill(16))) |
| 18 | |
| 19 | |
| 20 | #Below connections are used for test cases |
| 21 | #that need to test link and port events |
| 22 | #Add link between switch 1 and switch 2 |
| 23 | self.addLink(sw_list[0],sw_list[1]) |
| 24 | |
| 25 | #Create hosts and attach to sw 1 and sw 2 |
| 26 | h1 = self.addHost('h1') |
| 27 | h2 = self.addHost('h2') |
| 28 | self.addLink(sw_list[0],h1) |
| 29 | self.addLink(sw_list[1],h2) |
| 30 | |
| 31 | topos = { 'mytopo': ( lambda: MyTopo() ) } |