Simon Hunt | 5c3c091 | 2016-02-29 23:21:48 -0800 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | |
| 3 | """ |
| 4 | """ |
| 5 | from mininet.topo import Topo |
| 6 | |
| 7 | class UkTopo( Topo ): |
Simon Hunt | cf7e3b5 | 2016-02-29 23:26:16 -0800 | [diff] [blame] | 8 | """Switches projected onto the UK map""" |
Simon Hunt | 5c3c091 | 2016-02-29 23:21:48 -0800 | [diff] [blame] | 9 | |
| 10 | def __init__( self ): |
| 11 | """Create a topology.""" |
| 12 | |
| 13 | # Initialize Topology |
| 14 | Topo.__init__( self ) |
| 15 | |
| 16 | # add nodes, switches first... |
| 17 | LONDON = self.addSwitch( 's1' ) |
| 18 | BRISTL = self.addSwitch( 's2' ) |
| 19 | BIRMHM = self.addSwitch( 's3' ) |
| 20 | PLYMTH = self.addSwitch( 's4' ) |
| 21 | DOVER = self.addSwitch( 's5' ) |
| 22 | BRGHTN = self.addSwitch( 's6' ) |
| 23 | LIVRPL = self.addSwitch( 's7' ) |
| 24 | YORK = self.addSwitch( 's8' ) |
| 25 | NWCSTL = self.addSwitch( 's9' ) |
| 26 | NRWICH = self.addSwitch( 's10' ) |
| 27 | EDBUGH = self.addSwitch( 's11' ) |
| 28 | ABYSTW = self.addSwitch( 's12' ) |
| 29 | |
Simon Hunt | 5c3c091 | 2016-02-29 23:21:48 -0800 | [diff] [blame] | 30 | # ... and now hosts |
| 31 | LONDON_host = self.addHost( 'h1' ) |
| 32 | BRISTL_host = self.addHost( 'h2' ) |
| 33 | BIRMHM_host = self.addHost( 'h3' ) |
| 34 | PLYMTH_host = self.addHost( 'h4' ) |
| 35 | DOVER_host = self.addHost( 'h5' ) |
| 36 | BRGHTN_host = self.addHost( 'h6' ) |
| 37 | LIVRPL_host = self.addHost( 'h7' ) |
| 38 | YORK_host = self.addHost( 'h8' ) |
| 39 | NWCSTL_host = self.addHost( 'h9' ) |
| 40 | NRWICH_host = self.addHost( 'h10' ) |
| 41 | EDBUGH_host = self.addHost( 'h11' ) |
| 42 | ABYSTW_host = self.addHost( 'h12' ) |
| 43 | |
| 44 | # add edges between switch and corresponding host |
| 45 | self.addLink( LONDON, LONDON_host ) |
| 46 | self.addLink( BRISTL, BRISTL_host ) |
| 47 | self.addLink( BIRMHM, BIRMHM_host ) |
| 48 | self.addLink( PLYMTH, PLYMTH_host ) |
| 49 | self.addLink( DOVER, DOVER_host ) |
| 50 | self.addLink( BRGHTN, BRGHTN_host ) |
| 51 | self.addLink( LIVRPL, LIVRPL_host ) |
| 52 | self.addLink( YORK, YORK_host ) |
| 53 | self.addLink( NWCSTL, NWCSTL_host ) |
| 54 | self.addLink( NRWICH, NRWICH_host ) |
| 55 | self.addLink( EDBUGH, EDBUGH_host ) |
| 56 | self.addLink( ABYSTW, ABYSTW_host ) |
| 57 | |
| 58 | # add edges between switches |
Simon Hunt | 5c3c091 | 2016-02-29 23:21:48 -0800 | [diff] [blame] | 59 | self.addLink( BIRMHM, LIVRPL, bw=10, delay='1.0ms') |
| 60 | self.addLink( BIRMHM, YORK, bw=10, delay='1.0ms') |
Simon Hunt | 5c3c091 | 2016-02-29 23:21:48 -0800 | [diff] [blame] | 61 | self.addLink( BRISTL, ABYSTW, bw=10, delay='1.0ms') |
Simon Hunt | cf7e3b5 | 2016-02-29 23:26:16 -0800 | [diff] [blame] | 62 | self.addLink( BRISTL, BIRMHM, bw=10, delay='1.0ms') |
| 63 | self.addLink( BRISTL, PLYMTH, bw=10, delay='1.0ms') |
| 64 | self.addLink( DOVER, BRGHTN, bw=10, delay='1.0ms') |
| 65 | self.addLink( DOVER, NRWICH, bw=10, delay='1.0ms') |
| 66 | self.addLink( LIVRPL, ABYSTW, bw=10, delay='1.0ms') |
| 67 | self.addLink( LIVRPL, EDBUGH, bw=10, delay='1.0ms') |
| 68 | self.addLink( LONDON, BIRMHM, bw=10, delay='1.0ms') |
| 69 | self.addLink( LONDON, BRGHTN, bw=10, delay='1.0ms') |
| 70 | self.addLink( LONDON, BRISTL, bw=10, delay='1.0ms') |
| 71 | self.addLink( LONDON, BRISTL, bw=10, delay='1.0ms') |
| 72 | self.addLink( LONDON, DOVER, bw=10, delay='1.0ms') |
| 73 | self.addLink( LONDON, NRWICH, bw=10, delay='1.0ms') |
| 74 | self.addLink( LONDON, PLYMTH, bw=10, delay='1.0ms') |
| 75 | self.addLink( LONDON, YORK, bw=10, delay='1.0ms') |
| 76 | self.addLink( LONDON, YORK, bw=10, delay='1.0ms') |
| 77 | self.addLink( NWCSTL, EDBUGH, bw=10, delay='1.0ms') |
| 78 | self.addLink( NWCSTL, LIVRPL, bw=10, delay='1.0ms') |
| 79 | self.addLink( NWCSTL, YORK, bw=10, delay='1.0ms') |
| 80 | self.addLink( YORK, LIVRPL, bw=10, delay='1.0ms') |
| 81 | self.addLink( YORK, NRWICH, bw=10, delay='1.0ms') |
Simon Hunt | 5c3c091 | 2016-02-29 23:21:48 -0800 | [diff] [blame] | 82 | |
| 83 | topos = { 'uk': ( lambda: UkTopo() ) } |