blob: 14aa9e753347872f99c5608404c7ede3d08aa70a [file] [log] [blame]
Simon Hunt0ee20bf2017-05-10 19:59:17 -07001#!/usr/bin/env python
2
3"""
4 [1] ----- [3] ----- [5]
5 | ____/ | \ |
6 | / | \____ |
7 | / | \ |
8 [2] ----- [4] ----- [6]
9"""
10from mininet.topo import Topo
11
12class RegionABC( Topo ):
13 """Simple 6 switch example"""
14
15 def __init__( self ):
16 """Create a topology."""
17
18 # Initialize Topology
19 Topo.__init__( self )
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
29 # ... and now hosts
30 S1_host = self.addHost( 'h1' )
31 S2_host = self.addHost( 'h2' )
32 S3_host = self.addHost( 'h3' )
33 S4_host = self.addHost( 'h4' )
Simon Hunt87c9a092017-05-11 20:28:43 -070034 S5_host = self.addHost( 'h5' )
Simon Hunt0ee20bf2017-05-10 19:59:17 -070035 S6_host = self.addHost( 'h6' )
36
37 # add edges between switch and corresponding host
38 self.addLink( S1, S1_host )
39 self.addLink( S2, S2_host )
40 self.addLink( S3, S3_host )
41 self.addLink( S4, S4_host )
42 self.addLink( S5, S5_host )
43 self.addLink( S6, S6_host )
44
45 # add edges between switches as diagrammed above
46 self.addLink( S1, S2, bw=10, delay='1.0ms')
47 self.addLink( S1, S3, bw=10, delay='1.0ms')
48 self.addLink( S2, S3, bw=10, delay='1.0ms')
49 self.addLink( S2, S4, bw=10, delay='1.0ms')
50 self.addLink( S3, S4, bw=10, delay='1.0ms')
51 self.addLink( S3, S5, bw=10, delay='1.0ms')
52 self.addLink( S3, S6, bw=10, delay='1.0ms')
53 self.addLink( S4, S6, bw=10, delay='1.0ms')
54 self.addLink( S5, S6, bw=10, delay='1.0ms')
55
56topos = { 'regionabc': ( lambda: RegionABC() ) }
57
58if __name__ == '__main__':
59 from onosnet import run
60 run( RegionABC() )