-
Notifications
You must be signed in to change notification settings - Fork 10
/
topology.py
37 lines (31 loc) · 1.11 KB
/
topology.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""Custom topology example
Two directly connected switches plus a host for each switch:
host --- switch --- switch --- host
Adding the 'topos' dict with a key/value pair to generate our newly defined
topology enables one to pass in '--topo=mytopo' from the command line.
"""
from mininet.topo import Topo
class MyTopo( Topo ):
def build( self ):
# Add hosts and switches
h1 = self.addHost( 'h1' )
h2 = self.addHost( 'h2' )
ovsA = self.addSwitch( 's1' )
ovsB = self.addSwitch( 's2' )
ovsC = self.addSwitch( 's3' )
ovsD = self.addSwitch( 's4' )
ovsE = self.addSwitch( 's5' )
# Add links
self.addLink(h1, ovsA)
self.addLink(ovsA, ovsB)
self.addLink(ovsB, ovsD)
self.addLink(ovsD, h2)
self.addLink( ovsB, ovsE)
self.addLink(ovsE , ovsD)
self.addLink(ovsE, ovsC)
self.addLink(ovsC,ovsD)
self.addLink( ovsC, ovsA )
#self.addLink( BSwitch, ESwitch )
#self.addLink( CSwitch, ESwitch )
#self.addLink( DSwitch, rightHost)
topos = { 'mytopo': ( lambda: MyTopo() ) }