Thomas Vachuska | 02aeb03 | 2015-01-06 22:36:30 -0800 | [diff] [blame] | 1 | """ |
| 2 | """ |
| 3 | from mininet.topo import Topo |
| 4 | from mininet.net import Mininet |
| 5 | from mininet.node import RemoteController |
| 6 | from mininet.node import Node |
| 7 | from mininet.node import CPULimitedHost |
| 8 | from mininet.link import TCLink |
| 9 | from mininet.cli import CLI |
| 10 | from mininet.log import setLogLevel |
| 11 | from mininet.util import dumpNodeConnections |
| 12 | |
| 13 | class chordalTopo( Topo ): |
| 14 | |
| 15 | def __init__( self, **opts ): |
| 16 | "Create a topology." |
| 17 | |
| 18 | # Initialize Topology |
| 19 | Topo.__init__( self, **opts ) |
| 20 | |
| 21 | # add nodes, switches first... |
| 22 | s1 = self.addSwitch( 's1' ) |
| 23 | s2 = self.addSwitch( 's2' ) |
| 24 | s3 = self.addSwitch( 's3' ) |
| 25 | s4 = self.addSwitch( 's4' ) |
| 26 | s5 = self.addSwitch( 's5' ) |
| 27 | s6 = self.addSwitch( 's6' ) |
| 28 | s7 = self.addSwitch( 's7' ) |
| 29 | s8 = self.addSwitch( 's8' ) |
| 30 | s9 = self.addSwitch( 's9' ) |
| 31 | s10 = self.addSwitch( 's10' ) |
| 32 | s11 = self.addSwitch( 's11' ) |
| 33 | s12 = self.addSwitch( 's12' ) |
| 34 | s13 = self.addSwitch( 's13' ) |
| 35 | s14 = self.addSwitch( 's14' ) |
| 36 | s15 = self.addSwitch( 's15' ) |
| 37 | s16 = self.addSwitch( 's16' ) |
| 38 | s17 = self.addSwitch( 's17' ) |
| 39 | s18 = self.addSwitch( 's18' ) |
| 40 | s19 = self.addSwitch( 's19' ) |
| 41 | s20 = self.addSwitch( 's20' ) |
| 42 | s21 = self.addSwitch( 's21' ) |
| 43 | s22 = self.addSwitch( 's22' ) |
| 44 | s23 = self.addSwitch( 's23' ) |
| 45 | s24 = self.addSwitch( 's24' ) |
| 46 | s25 = self.addSwitch( 's25' ) |
| 47 | |
| 48 | # ... and now hosts |
| 49 | s1_host = self.addHost( 'h1' ) |
| 50 | s2_host = self.addHost( 'h2' ) |
| 51 | s3_host = self.addHost( 'h3' ) |
| 52 | s4_host = self.addHost( 'h4' ) |
| 53 | s5_host = self.addHost( 'h5' ) |
| 54 | s6_host = self.addHost( 'h6' ) |
| 55 | s7_host = self.addHost( 'h7' ) |
| 56 | s8_host = self.addHost( 'h8' ) |
| 57 | s9_host = self.addHost( 'h9' ) |
| 58 | s10_host = self.addHost( 'h10' ) |
| 59 | s11_host = self.addHost( 'h11' ) |
| 60 | s12_host = self.addHost( 'h12' ) |
| 61 | s13_host = self.addHost( 'h13' ) |
| 62 | s14_host = self.addHost( 'h14' ) |
| 63 | s15_host = self.addHost( 'h15' ) |
| 64 | s16_host = self.addHost( 'h16' ) |
| 65 | s17_host = self.addHost( 'h17' ) |
| 66 | s18_host = self.addHost( 'h18' ) |
| 67 | s19_host = self.addHost( 'h19' ) |
| 68 | s20_host = self.addHost( 'h20' ) |
| 69 | s21_host = self.addHost( 'h21' ) |
| 70 | s22_host = self.addHost( 'h22' ) |
| 71 | s23_host = self.addHost( 'h23' ) |
| 72 | s24_host = self.addHost( 'h24' ) |
| 73 | s25_host = self.addHost( 'h25' ) |
| 74 | |
| 75 | # add edges between switch and corresponding host |
| 76 | self.addLink( s1 , s1_host ) |
| 77 | self.addLink( s2 , s2_host ) |
| 78 | self.addLink( s3 , s3_host ) |
| 79 | self.addLink( s4 , s4_host ) |
| 80 | self.addLink( s5 , s5_host ) |
| 81 | self.addLink( s6 , s6_host ) |
| 82 | self.addLink( s7 , s7_host ) |
| 83 | self.addLink( s8 , s8_host ) |
| 84 | self.addLink( s9 , s9_host ) |
| 85 | self.addLink( s10 , s10_host ) |
| 86 | self.addLink( s11 , s11_host ) |
| 87 | self.addLink( s12 , s12_host ) |
| 88 | self.addLink( s13 , s13_host ) |
| 89 | self.addLink( s14 , s14_host ) |
| 90 | self.addLink( s15 , s15_host ) |
| 91 | self.addLink( s16 , s16_host ) |
| 92 | self.addLink( s17 , s17_host ) |
| 93 | self.addLink( s18 , s18_host ) |
| 94 | self.addLink( s19 , s19_host ) |
| 95 | self.addLink( s20 , s20_host ) |
| 96 | self.addLink( s21 , s21_host ) |
| 97 | self.addLink( s22 , s22_host ) |
| 98 | self.addLink( s23 , s23_host ) |
| 99 | self.addLink( s24 , s24_host ) |
| 100 | self.addLink( s25 , s25_host ) |
| 101 | self.addLink(s1, s2) |
| 102 | self.addLink(s1, s3) |
| 103 | self.addLink(s1, s4) |
| 104 | self.addLink(s1, s5) |
| 105 | self.addLink(s1, s6) |
| 106 | self.addLink(s1, s7) |
| 107 | self.addLink(s1, s8) |
| 108 | self.addLink(s1, s9) |
| 109 | self.addLink(s1, s10) |
| 110 | self.addLink(s1, s11) |
| 111 | self.addLink(s1, s12) |
| 112 | self.addLink(s1, s13) |
| 113 | self.addLink(s1, s14) |
| 114 | self.addLink(s1, s15) |
| 115 | self.addLink(s1, s16) |
| 116 | self.addLink(s1, s17) |
| 117 | self.addLink(s1, s18) |
| 118 | self.addLink(s1, s19) |
| 119 | self.addLink(s1, s20) |
| 120 | self.addLink(s1, s21) |
| 121 | self.addLink(s1, s22) |
| 122 | self.addLink(s1, s23) |
| 123 | self.addLink(s1, s24) |
| 124 | self.addLink(s1, s25) |
| 125 | self.addLink(s2, s3) |
| 126 | self.addLink(s2, s4) |
| 127 | self.addLink(s2, s5) |
| 128 | self.addLink(s2, s6) |
| 129 | self.addLink(s2, s7) |
| 130 | self.addLink(s2, s8) |
| 131 | self.addLink(s2, s9) |
| 132 | self.addLink(s2, s10) |
| 133 | self.addLink(s2, s11) |
| 134 | self.addLink(s2, s12) |
| 135 | self.addLink(s2, s13) |
| 136 | self.addLink(s2, s14) |
| 137 | self.addLink(s2, s15) |
| 138 | self.addLink(s2, s16) |
| 139 | self.addLink(s2, s17) |
| 140 | self.addLink(s2, s18) |
| 141 | self.addLink(s2, s19) |
| 142 | self.addLink(s2, s20) |
| 143 | self.addLink(s2, s21) |
| 144 | self.addLink(s2, s22) |
| 145 | self.addLink(s2, s23) |
| 146 | self.addLink(s2, s24) |
| 147 | self.addLink(s2, s25) |
| 148 | self.addLink(s3, s4) |
| 149 | self.addLink(s3, s5) |
| 150 | self.addLink(s3, s6) |
| 151 | self.addLink(s3, s7) |
| 152 | self.addLink(s3, s8) |
| 153 | self.addLink(s3, s9) |
| 154 | self.addLink(s3, s10) |
| 155 | self.addLink(s3, s11) |
| 156 | self.addLink(s3, s12) |
| 157 | self.addLink(s3, s13) |
| 158 | self.addLink(s3, s14) |
| 159 | self.addLink(s3, s15) |
| 160 | self.addLink(s3, s16) |
| 161 | self.addLink(s3, s17) |
| 162 | self.addLink(s3, s18) |
| 163 | self.addLink(s3, s19) |
| 164 | self.addLink(s3, s20) |
| 165 | self.addLink(s3, s21) |
| 166 | self.addLink(s3, s22) |
| 167 | self.addLink(s3, s23) |
| 168 | self.addLink(s3, s24) |
| 169 | self.addLink(s3, s25) |
| 170 | self.addLink(s4, s5) |
| 171 | self.addLink(s4, s6) |
| 172 | self.addLink(s4, s7) |
| 173 | self.addLink(s4, s8) |
| 174 | self.addLink(s4, s9) |
| 175 | self.addLink(s4, s10) |
| 176 | self.addLink(s4, s11) |
| 177 | self.addLink(s4, s12) |
| 178 | self.addLink(s4, s13) |
| 179 | self.addLink(s4, s14) |
| 180 | self.addLink(s4, s15) |
| 181 | self.addLink(s4, s16) |
| 182 | self.addLink(s4, s17) |
| 183 | self.addLink(s4, s18) |
| 184 | self.addLink(s4, s19) |
| 185 | self.addLink(s4, s20) |
| 186 | self.addLink(s4, s21) |
| 187 | self.addLink(s4, s22) |
| 188 | self.addLink(s4, s23) |
| 189 | self.addLink(s4, s24) |
| 190 | self.addLink(s4, s25) |
| 191 | self.addLink(s5, s6) |
| 192 | self.addLink(s5, s7) |
| 193 | self.addLink(s5, s8) |
| 194 | self.addLink(s5, s9) |
| 195 | self.addLink(s5, s10) |
| 196 | self.addLink(s5, s11) |
| 197 | self.addLink(s5, s12) |
| 198 | self.addLink(s5, s13) |
| 199 | self.addLink(s5, s14) |
| 200 | self.addLink(s5, s15) |
| 201 | self.addLink(s5, s16) |
| 202 | self.addLink(s5, s17) |
| 203 | self.addLink(s5, s18) |
| 204 | self.addLink(s5, s19) |
| 205 | self.addLink(s5, s20) |
| 206 | self.addLink(s5, s21) |
| 207 | self.addLink(s5, s22) |
| 208 | self.addLink(s5, s23) |
| 209 | self.addLink(s5, s24) |
| 210 | self.addLink(s5, s25) |
| 211 | self.addLink(s6, s7) |
| 212 | self.addLink(s6, s8) |
| 213 | self.addLink(s6, s9) |
| 214 | self.addLink(s6, s10) |
| 215 | self.addLink(s6, s11) |
| 216 | self.addLink(s6, s12) |
| 217 | self.addLink(s6, s13) |
| 218 | self.addLink(s6, s14) |
| 219 | self.addLink(s6, s15) |
| 220 | self.addLink(s6, s16) |
| 221 | self.addLink(s6, s17) |
| 222 | self.addLink(s6, s18) |
| 223 | self.addLink(s6, s19) |
| 224 | self.addLink(s6, s20) |
| 225 | self.addLink(s6, s21) |
| 226 | self.addLink(s6, s22) |
| 227 | self.addLink(s6, s23) |
| 228 | self.addLink(s6, s24) |
| 229 | self.addLink(s6, s25) |
| 230 | self.addLink(s7, s8) |
| 231 | self.addLink(s7, s9) |
| 232 | self.addLink(s7, s10) |
| 233 | self.addLink(s7, s11) |
| 234 | self.addLink(s7, s12) |
| 235 | self.addLink(s7, s13) |
| 236 | self.addLink(s7, s14) |
| 237 | self.addLink(s7, s15) |
| 238 | self.addLink(s7, s16) |
| 239 | self.addLink(s7, s17) |
| 240 | self.addLink(s7, s18) |
| 241 | self.addLink(s7, s19) |
| 242 | self.addLink(s7, s20) |
| 243 | self.addLink(s7, s21) |
| 244 | self.addLink(s7, s22) |
| 245 | self.addLink(s7, s23) |
| 246 | self.addLink(s7, s24) |
| 247 | self.addLink(s7, s25) |
| 248 | self.addLink(s8, s9) |
| 249 | self.addLink(s8, s10) |
| 250 | self.addLink(s8, s11) |
| 251 | self.addLink(s8, s12) |
| 252 | self.addLink(s8, s13) |
| 253 | self.addLink(s8, s14) |
| 254 | self.addLink(s8, s15) |
| 255 | self.addLink(s8, s16) |
| 256 | self.addLink(s8, s17) |
| 257 | self.addLink(s8, s18) |
| 258 | self.addLink(s8, s19) |
| 259 | self.addLink(s8, s20) |
| 260 | self.addLink(s8, s21) |
| 261 | self.addLink(s8, s22) |
| 262 | self.addLink(s8, s23) |
| 263 | self.addLink(s8, s24) |
| 264 | self.addLink(s8, s25) |
| 265 | self.addLink(s9, s10) |
| 266 | self.addLink(s9, s11) |
| 267 | self.addLink(s9, s12) |
| 268 | self.addLink(s9, s13) |
| 269 | self.addLink(s9, s14) |
| 270 | self.addLink(s9, s15) |
| 271 | self.addLink(s9, s16) |
| 272 | self.addLink(s9, s17) |
| 273 | self.addLink(s9, s18) |
| 274 | self.addLink(s9, s19) |
| 275 | self.addLink(s9, s20) |
| 276 | self.addLink(s9, s21) |
| 277 | self.addLink(s9, s22) |
| 278 | self.addLink(s9, s23) |
| 279 | self.addLink(s9, s24) |
| 280 | self.addLink(s9, s25) |
| 281 | self.addLink(s10, s11) |
| 282 | self.addLink(s10, s12) |
| 283 | self.addLink(s10, s13) |
| 284 | self.addLink(s10, s14) |
| 285 | self.addLink(s10, s15) |
| 286 | self.addLink(s10, s16) |
| 287 | self.addLink(s10, s17) |
| 288 | self.addLink(s10, s18) |
| 289 | self.addLink(s10, s19) |
| 290 | self.addLink(s10, s20) |
| 291 | self.addLink(s10, s21) |
| 292 | self.addLink(s10, s22) |
| 293 | self.addLink(s10, s23) |
| 294 | self.addLink(s10, s24) |
| 295 | self.addLink(s10, s25) |
| 296 | self.addLink(s11, s12) |
| 297 | self.addLink(s11, s13) |
| 298 | self.addLink(s11, s14) |
| 299 | self.addLink(s11, s15) |
| 300 | self.addLink(s11, s16) |
| 301 | self.addLink(s11, s17) |
| 302 | self.addLink(s11, s18) |
| 303 | self.addLink(s11, s19) |
| 304 | self.addLink(s11, s20) |
| 305 | self.addLink(s11, s21) |
| 306 | self.addLink(s11, s22) |
| 307 | self.addLink(s11, s23) |
| 308 | self.addLink(s11, s24) |
| 309 | self.addLink(s11, s25) |
| 310 | self.addLink(s12, s13) |
| 311 | self.addLink(s12, s14) |
| 312 | self.addLink(s12, s15) |
| 313 | self.addLink(s12, s16) |
| 314 | self.addLink(s12, s17) |
| 315 | self.addLink(s12, s18) |
| 316 | self.addLink(s12, s19) |
| 317 | self.addLink(s12, s20) |
| 318 | self.addLink(s12, s21) |
| 319 | self.addLink(s12, s22) |
| 320 | self.addLink(s12, s23) |
| 321 | self.addLink(s12, s24) |
| 322 | self.addLink(s12, s25) |
| 323 | self.addLink(s13, s14) |
| 324 | self.addLink(s13, s15) |
| 325 | self.addLink(s13, s16) |
| 326 | self.addLink(s13, s17) |
| 327 | self.addLink(s13, s18) |
| 328 | self.addLink(s13, s19) |
| 329 | self.addLink(s13, s20) |
| 330 | self.addLink(s13, s21) |
| 331 | self.addLink(s13, s22) |
| 332 | self.addLink(s13, s23) |
| 333 | self.addLink(s13, s24) |
| 334 | self.addLink(s13, s25) |
| 335 | self.addLink(s14, s15) |
| 336 | self.addLink(s14, s16) |
| 337 | self.addLink(s14, s17) |
| 338 | self.addLink(s14, s18) |
| 339 | self.addLink(s14, s19) |
| 340 | self.addLink(s14, s20) |
| 341 | self.addLink(s14, s21) |
| 342 | self.addLink(s14, s22) |
| 343 | self.addLink(s14, s23) |
| 344 | self.addLink(s14, s24) |
| 345 | self.addLink(s14, s25) |
| 346 | self.addLink(s15, s16) |
| 347 | self.addLink(s15, s17) |
| 348 | self.addLink(s15, s18) |
| 349 | self.addLink(s15, s19) |
| 350 | self.addLink(s15, s20) |
| 351 | self.addLink(s15, s21) |
| 352 | self.addLink(s15, s22) |
| 353 | self.addLink(s15, s23) |
| 354 | self.addLink(s15, s24) |
| 355 | self.addLink(s15, s25) |
| 356 | self.addLink(s16, s17) |
| 357 | self.addLink(s16, s18) |
| 358 | self.addLink(s16, s19) |
| 359 | self.addLink(s16, s20) |
| 360 | self.addLink(s16, s21) |
| 361 | self.addLink(s16, s22) |
| 362 | self.addLink(s16, s23) |
| 363 | self.addLink(s16, s24) |
| 364 | self.addLink(s16, s25) |
| 365 | self.addLink(s17, s18) |
| 366 | self.addLink(s17, s19) |
| 367 | self.addLink(s17, s20) |
| 368 | self.addLink(s17, s21) |
| 369 | self.addLink(s17, s22) |
| 370 | self.addLink(s17, s23) |
| 371 | self.addLink(s17, s24) |
| 372 | self.addLink(s17, s25) |
| 373 | self.addLink(s18, s19) |
| 374 | self.addLink(s18, s20) |
| 375 | self.addLink(s18, s21) |
| 376 | self.addLink(s18, s22) |
| 377 | self.addLink(s18, s23) |
| 378 | self.addLink(s18, s24) |
| 379 | self.addLink(s18, s25) |
| 380 | self.addLink(s19, s20) |
| 381 | self.addLink(s19, s21) |
| 382 | self.addLink(s19, s22) |
| 383 | self.addLink(s19, s23) |
| 384 | self.addLink(s19, s24) |
| 385 | self.addLink(s19, s25) |
| 386 | self.addLink(s20, s21) |
| 387 | self.addLink(s20, s22) |
| 388 | self.addLink(s20, s23) |
| 389 | self.addLink(s20, s24) |
| 390 | self.addLink(s20, s25) |
| 391 | self.addLink(s21, s22) |
| 392 | self.addLink(s21, s23) |
| 393 | self.addLink(s21, s24) |
| 394 | self.addLink(s21, s25) |
| 395 | self.addLink(s22, s23) |
| 396 | self.addLink(s22, s24) |
| 397 | self.addLink(s22, s25) |
| 398 | self.addLink(s23, s24) |
| 399 | self.addLink(s23, s25) |
| 400 | self.addLink(s24, s25) |
| 401 | |
| 402 | topos = { 'chordal': ( lambda: chordalTopo() ) } |