blob: ecbdf6aec0c925913a4f6c354cb8450119d39659 [file] [log] [blame]
Simon Hunt0bf56492016-10-20 18:30:11 -07001#!/usr/bin/env python
2
3"""
4 Sample network for demonstrating regions (see uk-region.json)
5"""
6from mininet.topo import Topo
7
8
9class UkRegionTopo(Topo):
10 """Switches projected onto a portion of the UK map"""
11
12 def __init__(self):
13 """Create a topology."""
14
15 # Initialize Topology
16 Topo.__init__(self)
17
18 # add nodes, switches first...
Simon Hunte578fc72016-10-24 09:28:29 -070019 DOVER = self.addSwitch('s1', dpid='0000000000000010')
20 BRGHTN_A = self.addSwitch('s2', dpid='0000000000000021')
21 BRGHTN_B = self.addSwitch('s3', dpid='0000000000000022')
22 BRGHTN_C = self.addSwitch('s4', dpid='0000000000000023')
23 LONDON_A = self.addSwitch('s5', dpid='0000000000000031')
24 LONDON_B = self.addSwitch('s6', dpid='0000000000000032')
25 LONDON_C = self.addSwitch('s7', dpid='0000000000000033')
26 LONDON_D = self.addSwitch('s8', dpid='0000000000000034')
27 LONDON_E = self.addSwitch('s9', dpid='0000000000000035')
Simon Hunt0bf56492016-10-20 18:30:11 -070028
29 # ... and now hosts
Simon Hunte578fc72016-10-24 09:28:29 -070030 DOVER_host = self.addHost('h1', mac='000000000010')
31 BRGHTN_A_host = self.addHost('h2', mac='000000000021')
32 BRGHTN_B_host = self.addHost('h3', mac='000000000022')
33 BRGHTN_C_host = self.addHost('h4', mac='000000000023')
34 LONDON_A_host = self.addHost('h5', mac='000000000031')
35 LONDON_B_host = self.addHost('h6', mac='000000000032')
36 LONDON_C_host = self.addHost('h7', mac='000000000033')
37 LONDON_D_host = self.addHost('h8', mac='000000000034')
38 LONDON_E_host = self.addHost('h9', mac='000000000035')
Simon Hunt0bf56492016-10-20 18:30:11 -070039
40 # add edges between switch and corresponding host
41 self.addLink(DOVER, DOVER_host)
42 self.addLink(BRGHTN_A, BRGHTN_A_host)
43 self.addLink(BRGHTN_B, BRGHTN_B_host)
44 self.addLink(BRGHTN_C, BRGHTN_C_host)
45 self.addLink(LONDON_A, LONDON_A_host)
46 self.addLink(LONDON_B, LONDON_B_host)
47 self.addLink(LONDON_C, LONDON_C_host)
48 self.addLink(LONDON_D, LONDON_D_host)
49 self.addLink(LONDON_E, LONDON_E_host)
50
51 # add edges between switches
52 self.addLink(DOVER, BRGHTN_A, bw=10, delay='1.0ms')
53 self.addLink(BRGHTN_A, BRGHTN_B, bw=10, delay='1.0ms')
54 self.addLink(BRGHTN_A, BRGHTN_C, bw=10, delay='1.0ms')
55 self.addLink(BRGHTN_B, BRGHTN_C, bw=10, delay='1.0ms')
56 self.addLink(BRGHTN_C, LONDON_A, bw=10, delay='1.0ms')
57 self.addLink(LONDON_A, LONDON_B, bw=10, delay='1.0ms')
58 self.addLink(LONDON_A, LONDON_C, bw=10, delay='1.0ms')
59 self.addLink(LONDON_B, LONDON_D, bw=10, delay='1.0ms')
60 self.addLink(LONDON_C, LONDON_D, bw=10, delay='1.0ms')
61 self.addLink(LONDON_C, LONDON_E, bw=10, delay='1.0ms')
62 self.addLink(LONDON_D, LONDON_E, bw=10, delay='1.0ms')
63
64
65topos = {'uk': (lambda: UkRegionTopo())}
66
67if __name__ == '__main__':
68 from onosnet import run
69
70 run(UkRegionTopo())