blob: aabd0b75db4dfef0dab54f92627293e77e0b14ec [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
Thomas Vachuska43ae4982018-02-01 09:23:44 -080010 def addSwitch( self, name, **opts ):
11 kwargs = { 'protocols' : 'OpenFlow13' }
12 kwargs.update( opts )
13 return super(UkTopo, self).addSwitch( name, **kwargs )
14
Simon Hunt5c3c0912016-02-29 23:21:48 -080015 def __init__( self ):
16 """Create a topology."""
17
18 # Initialize Topology
19 Topo.__init__( self )
20
21 # add nodes, switches first...
22 LONDON = self.addSwitch( 's1' )
23 BRISTL = self.addSwitch( 's2' )
24 BIRMHM = self.addSwitch( 's3' )
25 PLYMTH = self.addSwitch( 's4' )
26 DOVER = self.addSwitch( 's5' )
27 BRGHTN = self.addSwitch( 's6' )
28 LIVRPL = self.addSwitch( 's7' )
29 YORK = self.addSwitch( 's8' )
30 NWCSTL = self.addSwitch( 's9' )
31 NRWICH = self.addSwitch( 's10' )
32 EDBUGH = self.addSwitch( 's11' )
33 ABYSTW = self.addSwitch( 's12' )
34
Simon Hunt5c3c0912016-02-29 23:21:48 -080035 # ... and now hosts
36 LONDON_host = self.addHost( 'h1' )
37 BRISTL_host = self.addHost( 'h2' )
38 BIRMHM_host = self.addHost( 'h3' )
39 PLYMTH_host = self.addHost( 'h4' )
40 DOVER_host = self.addHost( 'h5' )
41 BRGHTN_host = self.addHost( 'h6' )
42 LIVRPL_host = self.addHost( 'h7' )
43 YORK_host = self.addHost( 'h8' )
44 NWCSTL_host = self.addHost( 'h9' )
45 NRWICH_host = self.addHost( 'h10' )
46 EDBUGH_host = self.addHost( 'h11' )
47 ABYSTW_host = self.addHost( 'h12' )
48
49 # add edges between switch and corresponding host
50 self.addLink( LONDON, LONDON_host )
51 self.addLink( BRISTL, BRISTL_host )
52 self.addLink( BIRMHM, BIRMHM_host )
53 self.addLink( PLYMTH, PLYMTH_host )
54 self.addLink( DOVER, DOVER_host )
55 self.addLink( BRGHTN, BRGHTN_host )
56 self.addLink( LIVRPL, LIVRPL_host )
57 self.addLink( YORK, YORK_host )
58 self.addLink( NWCSTL, NWCSTL_host )
59 self.addLink( NRWICH, NRWICH_host )
60 self.addLink( EDBUGH, EDBUGH_host )
61 self.addLink( ABYSTW, ABYSTW_host )
62
63 # add edges between switches
Thomas Vachuska43ae4982018-02-01 09:23:44 -080064 self.addLink( BIRMHM, LIVRPL )
65 self.addLink( BIRMHM, YORK )
66 self.addLink( BRISTL, ABYSTW )
67 self.addLink( BRISTL, BIRMHM )
68 self.addLink( BRISTL, PLYMTH )
69 self.addLink( DOVER, BRGHTN )
70 self.addLink( DOVER, NRWICH )
71 self.addLink( LIVRPL, ABYSTW )
72 self.addLink( LIVRPL, EDBUGH )
73 self.addLink( LONDON, BIRMHM )
74 self.addLink( LONDON, BRGHTN )
75 self.addLink( LONDON, BRISTL )
76 self.addLink( LONDON, BRISTL )
77 self.addLink( LONDON, DOVER )
78 self.addLink( LONDON, NRWICH )
79 self.addLink( LONDON, PLYMTH )
80 self.addLink( LONDON, YORK )
81 self.addLink( LONDON, YORK )
82 self.addLink( NWCSTL, EDBUGH )
83 self.addLink( NWCSTL, LIVRPL )
84 self.addLink( NWCSTL, YORK )
85 self.addLink( YORK, LIVRPL )
86 self.addLink( YORK, NRWICH )
Simon Hunt5c3c0912016-02-29 23:21:48 -080087
88topos = { 'uk': ( lambda: UkTopo() ) }
Thomas Vachuska9ee49792016-03-01 16:51:14 -080089
90if __name__ == '__main__':
91 from onosnet import run
92 run( UkTopo() )