Thomas Vachuska | d9c900e | 2015-05-19 14:04:08 -0700 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | """ |
| 4 | """ |
| 5 | from mininet.topo import Topo |
Thomas Vachuska | d9c900e | 2015-05-19 14:04:08 -0700 | [diff] [blame] | 6 | |
| 7 | class AttMplsTopo( Topo ): |
| 8 | "Internet Topology Zoo Specimen." |
| 9 | |
Yuta HIGUCHI | 6512f3e | 2017-05-18 17:21:24 -0700 | [diff] [blame] | 10 | def addSwitch( self, name, **opts ): |
| 11 | kwargs = { 'protocols' : 'OpenFlow13' } |
| 12 | kwargs.update( opts ) |
| 13 | return super(AttMplsTopo, self).addSwitch( name, **kwargs ) |
| 14 | |
alshabib | 8a4a600 | 2015-11-25 14:31:16 -0800 | [diff] [blame] | 15 | def __init__( self ): |
Thomas Vachuska | d9c900e | 2015-05-19 14:04:08 -0700 | [diff] [blame] | 16 | "Create a topology." |
| 17 | |
alshabib | 8a4a600 | 2015-11-25 14:31:16 -0800 | [diff] [blame] | 18 | # Initialize Topology |
| 19 | Topo.__init__( self ) |
| 20 | |
Thomas Vachuska | d9c900e | 2015-05-19 14:04:08 -0700 | [diff] [blame] | 21 | # add nodes, switches first... |
alshabib | 8a4a600 | 2015-11-25 14:31:16 -0800 | [diff] [blame] | 22 | NY54 = self.addSwitch( 's25' ) # 40.728270, -73.994483 |
Thomas Vachuska | d9c900e | 2015-05-19 14:04:08 -0700 | [diff] [blame] | 23 | CMBR = self.addSwitch( 's1' ) # 42.373730, -71.109734 |
Thomas Vachuska | 541413d | 2016-04-05 16:37:27 -0700 | [diff] [blame] | 24 | CHCG = self.addSwitch( 's2' ) # 41.877461, -87.642892 |
Thomas Vachuska | d9c900e | 2015-05-19 14:04:08 -0700 | [diff] [blame] | 25 | CLEV = self.addSwitch( 's3' ) # 41.498928, -81.695217 |
| 26 | RLGH = self.addSwitch( 's4' ) # 35.780150, -78.644026 |
| 27 | ATLN = self.addSwitch( 's5' ) # 33.749017, -84.394168 |
| 28 | PHLA = self.addSwitch( 's6' ) # 39.952906, -75.172278 |
| 29 | WASH = self.addSwitch( 's7' ) # 38.906696, -77.035509 |
| 30 | NSVL = self.addSwitch( 's8' ) # 36.166410, -86.787305 |
Thomas Vachuska | 541413d | 2016-04-05 16:37:27 -0700 | [diff] [blame] | 31 | STLS = self.addSwitch( 's9' ) # 38.626418, -90.198143 |
Thomas Vachuska | d9c900e | 2015-05-19 14:04:08 -0700 | [diff] [blame] | 32 | NWOR = self.addSwitch( 's10' ) # 29.951475, -90.078434 |
| 33 | HSTN = self.addSwitch( 's11' ) # 29.763249, -95.368332 |
| 34 | SNAN = self.addSwitch( 's12' ) # 29.424331, -98.491745 |
| 35 | DLLS = self.addSwitch( 's13' ) # 32.777665, -96.802064 |
| 36 | ORLD = self.addSwitch( 's14' ) # 28.538641, -81.381110 |
| 37 | DNVR = self.addSwitch( 's15' ) # 39.736623, -104.984887 |
| 38 | KSCY = self.addSwitch( 's16' ) # 39.100725, -94.581228 |
| 39 | SNFN = self.addSwitch( 's17' ) # 37.779751, -122.409791 |
| 40 | SCRM = self.addSwitch( 's18' ) # 38.581001, -121.497844 |
| 41 | PTLD = self.addSwitch( 's19' ) # 45.523317, -122.677768 |
| 42 | STTL = self.addSwitch( 's20' ) # 47.607326, -122.331786 |
| 43 | SLKC = self.addSwitch( 's21' ) # 40.759577, -111.895079 |
Thomas Vachuska | 541413d | 2016-04-05 16:37:27 -0700 | [diff] [blame] | 44 | LA03 = self.addSwitch( 's22' ) # 34.056346, -118.235951 |
Thomas Vachuska | d9c900e | 2015-05-19 14:04:08 -0700 | [diff] [blame] | 45 | SNDG = self.addSwitch( 's23' ) # 32.714564, -117.153528 |
| 46 | PHNX = self.addSwitch( 's24' ) # 33.448289, -112.076299 |
| 47 | |
| 48 | # ... and now hosts |
alshabib | 8a4a600 | 2015-11-25 14:31:16 -0800 | [diff] [blame] | 49 | NY54_host = self.addHost( 'h25' ) |
Thomas Vachuska | d9c900e | 2015-05-19 14:04:08 -0700 | [diff] [blame] | 50 | CMBR_host = self.addHost( 'h1' ) |
| 51 | CHCG_host = self.addHost( 'h2' ) |
| 52 | CLEV_host = self.addHost( 'h3' ) |
| 53 | RLGH_host = self.addHost( 'h4' ) |
| 54 | ATLN_host = self.addHost( 'h5' ) |
| 55 | PHLA_host = self.addHost( 'h6' ) |
| 56 | WASH_host = self.addHost( 'h7' ) |
| 57 | NSVL_host = self.addHost( 'h8' ) |
| 58 | STLS_host = self.addHost( 'h9' ) |
| 59 | NWOR_host = self.addHost( 'h10' ) |
| 60 | HSTN_host = self.addHost( 'h11' ) |
| 61 | SNAN_host = self.addHost( 'h12' ) |
| 62 | DLLS_host = self.addHost( 'h13' ) |
| 63 | ORLD_host = self.addHost( 'h14' ) |
| 64 | DNVR_host = self.addHost( 'h15' ) |
| 65 | KSCY_host = self.addHost( 'h16' ) |
| 66 | SNFN_host = self.addHost( 'h17' ) |
| 67 | SCRM_host = self.addHost( 'h18' ) |
| 68 | PTLD_host = self.addHost( 'h19' ) |
| 69 | STTL_host = self.addHost( 'h20' ) |
| 70 | SLKC_host = self.addHost( 'h21' ) |
| 71 | LA03_host = self.addHost( 'h22' ) |
| 72 | SNDG_host = self.addHost( 'h23' ) |
| 73 | PHNX_host = self.addHost( 'h24' ) |
| 74 | |
| 75 | # add edges between switch and corresponding host |
| 76 | self.addLink( NY54 , NY54_host ) |
| 77 | self.addLink( CMBR , CMBR_host ) |
| 78 | self.addLink( CHCG , CHCG_host ) |
| 79 | self.addLink( CLEV , CLEV_host ) |
| 80 | self.addLink( RLGH , RLGH_host ) |
| 81 | self.addLink( ATLN , ATLN_host ) |
| 82 | self.addLink( PHLA , PHLA_host ) |
| 83 | self.addLink( WASH , WASH_host ) |
| 84 | self.addLink( NSVL , NSVL_host ) |
| 85 | self.addLink( STLS , STLS_host ) |
| 86 | self.addLink( NWOR , NWOR_host ) |
| 87 | self.addLink( HSTN , HSTN_host ) |
| 88 | self.addLink( SNAN , SNAN_host ) |
| 89 | self.addLink( DLLS , DLLS_host ) |
| 90 | self.addLink( ORLD , ORLD_host ) |
| 91 | self.addLink( DNVR , DNVR_host ) |
| 92 | self.addLink( KSCY , KSCY_host ) |
| 93 | self.addLink( SNFN , SNFN_host ) |
| 94 | self.addLink( SCRM , SCRM_host ) |
| 95 | self.addLink( PTLD , PTLD_host ) |
| 96 | self.addLink( STTL , STTL_host ) |
| 97 | self.addLink( SLKC , SLKC_host ) |
| 98 | self.addLink( LA03 , LA03_host ) |
| 99 | self.addLink( SNDG , SNDG_host ) |
| 100 | self.addLink( PHNX , PHNX_host ) |
| 101 | |
| 102 | # add edges between switches |
Thomas Vachuska | 5160dbb | 2015-07-14 10:21:45 -0700 | [diff] [blame] | 103 | self.addLink( NY54 , CMBR) |
| 104 | self.addLink( NY54 , CMBR) |
| 105 | self.addLink( NY54 , CMBR) |
| 106 | self.addLink( NY54 , CHCG) |
| 107 | self.addLink( NY54 , PHLA) |
| 108 | self.addLink( NY54 , PHLA) |
| 109 | self.addLink( NY54 , WASH) |
| 110 | self.addLink( CMBR , PHLA) |
| 111 | self.addLink( CHCG , CLEV) |
| 112 | self.addLink( CHCG , PHLA) |
| 113 | self.addLink( CHCG , STLS) |
| 114 | self.addLink( CHCG , DNVR) |
| 115 | self.addLink( CHCG , KSCY) |
| 116 | self.addLink( CHCG , KSCY) |
| 117 | self.addLink( CHCG , SNFN) |
| 118 | self.addLink( CHCG , STTL) |
| 119 | self.addLink( CHCG , SLKC) |
| 120 | self.addLink( CLEV , NSVL) |
| 121 | self.addLink( CLEV , STLS) |
| 122 | self.addLink( CLEV , PHLA) |
| 123 | self.addLink( RLGH , ATLN) |
| 124 | self.addLink( RLGH , WASH) |
| 125 | self.addLink( ATLN , WASH) |
| 126 | self.addLink( ATLN , NSVL) |
| 127 | self.addLink( ATLN , STLS) |
| 128 | self.addLink( ATLN , DLLS) |
| 129 | self.addLink( ATLN , DLLS) |
| 130 | self.addLink( ATLN , DLLS) |
| 131 | self.addLink( ATLN , ORLD) |
| 132 | self.addLink( PHLA , WASH) |
| 133 | self.addLink( NSVL , STLS) |
| 134 | self.addLink( NSVL , DLLS) |
| 135 | self.addLink( STLS , DLLS) |
| 136 | self.addLink( STLS , KSCY) |
| 137 | self.addLink( STLS , LA03) |
| 138 | self.addLink( NWOR , HSTN) |
| 139 | self.addLink( NWOR , DLLS) |
| 140 | self.addLink( NWOR , ORLD) |
| 141 | self.addLink( HSTN , SNAN) |
| 142 | self.addLink( HSTN , DLLS) |
| 143 | self.addLink( HSTN , ORLD) |
| 144 | self.addLink( SNAN , PHNX) |
| 145 | self.addLink( SNAN , DLLS) |
| 146 | self.addLink( DLLS , DNVR) |
| 147 | self.addLink( DLLS , DNVR) |
| 148 | self.addLink( DLLS , KSCY) |
| 149 | self.addLink( DLLS , KSCY) |
| 150 | self.addLink( DLLS , SNFN) |
| 151 | self.addLink( DLLS , LA03) |
| 152 | self.addLink( DLLS , LA03) |
| 153 | self.addLink( DNVR , KSCY) |
| 154 | self.addLink( DNVR , SNFN) |
| 155 | self.addLink( DNVR , SNFN) |
| 156 | self.addLink( DNVR , SLKC) |
| 157 | self.addLink( KSCY , SNFN) |
| 158 | self.addLink( SNFN , SCRM) |
| 159 | self.addLink( SNFN , PTLD) |
| 160 | self.addLink( SNFN , STTL) |
| 161 | self.addLink( SNFN , SLKC) |
| 162 | self.addLink( SNFN , LA03) |
| 163 | self.addLink( SNFN , LA03) |
| 164 | self.addLink( SNFN , LA03) |
| 165 | self.addLink( SCRM , SLKC) |
| 166 | self.addLink( PTLD , STTL) |
| 167 | self.addLink( SLKC , LA03) |
| 168 | self.addLink( LA03 , SNDG) |
| 169 | self.addLink( LA03 , SNDG) |
| 170 | self.addLink( LA03 , PHNX) |
| 171 | self.addLink( LA03 , PHNX) |
| 172 | self.addLink( SNDG , PHNX) |
Thomas Vachuska | d9c900e | 2015-05-19 14:04:08 -0700 | [diff] [blame] | 173 | |
| 174 | topos = { 'att': ( lambda: AttMplsTopo() ) } |
Thomas Vachuska | 541413d | 2016-04-05 16:37:27 -0700 | [diff] [blame] | 175 | |
| 176 | if __name__ == '__main__': |
| 177 | from onosnet import run |
| 178 | run( AttMplsTopo() ) |