Created
April 2, 2018 14:42
-
-
Save eloydegen/94dca0cdd7d712098b81993d680ec8a6 to your computer and use it in GitHub Desktop.
Mininet topology
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from mininet.topo import Topo | |
from mininet.net import Mininet | |
from mininet.node import Controller | |
class MyTopo( Topo): | |
"Simple topology example." | |
def __init__( self ): | |
"Create custom topo." # initialize topology | |
Topo.__init__( self ) | |
# Hosts | |
leftHost = self.addHost(‘H1’) | |
rightHost = self.addhost(‘H2’) | |
# Switches | |
S1 = self.addSwitch(‘S1’) | |
S2 = self.addSwitch(‘S2’) | |
S3 = self.addSwitch(‘S3’) | |
S4 = self.addSwitch(‘S4’) | |
S5 = self.addSwitch(‘S5’) | |
# Links | |
self.addLink(leftHost, S1) | |
self.addLink(S1, S3) | |
self.addlink(S1, S2) | |
self.addLink(S2, S4) | |
self.addLink(S4, S5) | |
self.addLink(S3, S5) | |
self.addLink(S5, rightHost) | |
topos = {'mytopo':(lambda:MyTopo())} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment