Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- """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 ):
- "Simple topology example."
- def __init__( self ):
- "Create custom topo."
- # Initialize topology
- Topo.__init__( self )
- # Add hosts
- h1 = self.addHost("h1")
- h2 = self.addHost("h2")
- #add switches
- switch = self.addSwitch("s0")
- # Add links
- self.addLink( switch, h1)
- self.addLink( switch, h2)
- topos = { 'mytopo': ( lambda: MyTopo() ) }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement