andrewonlab | c34fa94 | 2014-11-06 14:10:52 -0500 | [diff] [blame] | 1 | ''' |
| 2 | Topology with 3 core switches connected linearly. |
| 3 | |
| 4 | Each 'core' switch has a 'flower' of 10 switches |
| 5 | for a total of 33 switches. |
| 6 | |
| 7 | Used in conjunction with 'IntentPerfNext' test |
| 8 | ''' |
| 9 | |
| 10 | from mininet.topo import Topo |
| 11 | |
| 12 | class MyTopo( Topo ): |
| 13 | |
| 14 | def __init__( self ): |
| 15 | Topo.__init__( self ) |
| 16 | |
| 17 | #Switches are listed out here for better view |
| 18 | #of the topology from this code |
| 19 | core_sw_list = ['s1','s2','s3'] |
| 20 | |
| 21 | #Flower switches for core switch 1 |
| 22 | flower_sw_list_s1 =\ |
| 23 | ['s10', 's11', 's12', 's13', 's14', |
| 24 | 's15', 's16', 's17', 's18', 's19'] |
| 25 | #Flower switches for core switch 2 |
| 26 | flower_sw_list_s2 =\ |
| 27 | ['s20', 's21', 's22', 's23', 's24', |
| 28 | 's25', 's26', 's27', 's28', 's29'] |
| 29 | #Flower switches for core switch 3 |
| 30 | flower_sw_list_s3 =\ |
| 31 | ['s30', 's31', 's32', 's33', 's34', |
| 32 | 's35', 's36', 's37', 's38', 's39'] |
| 33 | |
| 34 | #Store switch objects in these variables |
| 35 | core_switches = [] |
| 36 | flower_switches_1 = [] |
| 37 | flower_switches_2 = [] |
| 38 | flower_switches_3 = [] |
| 39 | |
| 40 | #Add switches |
| 41 | for sw in core_sw_list: |
| 42 | core_switches.append( |
| 43 | self.addSwitch( |
| 44 | sw, |
| 45 | dpid = sw.replace('s','').zfill(16) |
| 46 | ) |
| 47 | ) |
| 48 | for sw in flower_sw_list_s1: |
| 49 | flower_switches_1.append( |
| 50 | self.addSwitch( |
| 51 | sw, |
| 52 | dpid = sw.replace('s','').zfill(16) |
| 53 | ) |
| 54 | ) |
| 55 | for sw in flower_sw_list_s2: |
| 56 | flower_switches_2.append( |
| 57 | self.addSwitch( |
| 58 | sw, |
| 59 | dpid = sw.replace('s','').zfill(16) |
| 60 | ) |
| 61 | ) |
| 62 | for sw in flower_sw_list_s3: |
| 63 | flower_switches_3.append( |
| 64 | self.addSwitch( |
| 65 | sw, |
| 66 | dpid = sw.replace('s','').zfill(16) |
| 67 | ) |
| 68 | ) |
| 69 | |
| 70 | self.addLink(core_switches[0], core_switches[1]) |
| 71 | self.addLink(core_switches[1], core_switches[2]) |
| 72 | |
| 73 | for x in range(0, len(flower_sw_list_s1)): |
| 74 | self.addLink(core_switches[0], flower_switches_1[x]) |
| 75 | for x in range(0, len(flower_sw_list_s2)): |
| 76 | self.addLink(core_switches[1], flower_switches_2[x]) |
| 77 | for x in range(0, len(flower_sw_list_s3)): |
| 78 | self.addLink(core_switches[2], flower_switches_3[x]) |
| 79 | |
| 80 | topos = { 'mytopo': ( lambda: MyTopo() ) } |