Skip to content

Instantly share code, notes, and snippets.

@vinothgithub15
Last active January 22, 2016 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vinothgithub15/315d0a427d5afc39f2d7 to your computer and use it in GitHub Desktop.
Save vinothgithub15/315d0a427d5afc39f2d7 to your computer and use it in GitHub Desktop.
Redirect test scripts
#!/usr/bin/python
from mininet.topo import Topo
class MyTopo2( Topo ):
"Simple topology example."
def __init__( self ):
"Create custom topo."
# Initialize topology
Topo.__init__( self )
# Add hosts and switches
Switch1 = self.addSwitch( 's1' )
Switch2 = self.addSwitch( 's2' )
Switch3 = self.addSwitch( 's3' )
Switch4 = self.addSwitch( 's4' )
Host11 = self.addHost( 'h1' )
Host12 = self.addHost( 'h2' )
Host21 = self.addHost( 'h3' )
Host22 = self.addHost( 'h4' )
Host23 = self.addHost( 'h5' )
Service1 = self.addHost( 'srvc1' )
# Add links
self.addLink( Host11, Switch1 )
self.addLink( Host12, Switch1 )
self.addLink( Host21, Switch2 )
self.addLink( Host22, Switch2 )
self.addLink( Host23, Switch2 )
self.addLink( Switch1, Switch2 )
self.addLink( Switch2, Switch4 )
self.addLink( Switch4, Switch3 )
self.addLink( Switch3, Switch1 )
self.addLink( Switch3, Service1 )
self.addLink( Switch4, Service1 )
topos = { 'mytopo2': ( lambda: MyTopo2() ) }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment