blob: 1725d376e9d0db9797f68482ed870e1019d88b6f [file] [log] [blame]
Simon Hunt5c3c0912016-02-29 23:21:48 -08001#!/usr/bin/env python
2
3"""
4"""
5from mininet.topo import Topo
6
7class UkTopo( Topo ):
Simon Huntcf7e3b52016-02-29 23:26:16 -08008 """Switches projected onto the UK map"""
Simon Hunt5c3c0912016-02-29 23:21:48 -08009
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 Hunt5c3c0912016-02-29 23:21:48 -080030 # ... 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 Hunt5c3c0912016-02-29 23:21:48 -080059 self.addLink( BIRMHM, LIVRPL, bw=10, delay='1.0ms')
60 self.addLink( BIRMHM, YORK, bw=10, delay='1.0ms')
Simon Hunt5c3c0912016-02-29 23:21:48 -080061 self.addLink( BRISTL, ABYSTW, bw=10, delay='1.0ms')
Simon Huntcf7e3b52016-02-29 23:26:16 -080062 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 Hunt5c3c0912016-02-29 23:21:48 -080082
83topos = { 'uk': ( lambda: UkTopo() ) }