Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python
- import functools
- from mininet.node import RemoteController, OVSSwitch
- from mininet.topo import Topo
- from mininet.net import Mininet
- from mininet.util import dumpNodeConnections
- from mininet.log import setLogLevel
- class DiamondTopo( Topo ):
- def build( self ):
- s1 = self.addSwitch( 's1', mac='00:00:00:00:00:01' )
- s2 = self.addSwitch( 's2', mac='00:00:00:00:00:02' )
- s3 = self.addSwitch( 's3', mac='00:00:00:00:00:03' )
- h1 = self.addHost( 'h1', mac='00:00:00:00:ff:01' )
- h2 = self.addHost( 'h2', mac='00:00:00:00:ff:02' )
- h3 = self.addHost( 'h3', mac='00:00:00:00:ff:03' )
- self.addLink( s1, s2 )
- self.addLink( s2, s3 )
- self.addLink( s3, s1 )
- self.addLink( h1, s1 )
- self.addLink( h2, s2 )
- self.addLink( h3, s3 )
- def simpleTest():
- topo = DiamondTopo()
- testController = RemoteController( 'OpenDaylight', '192.168.150.131' )
- OVSSwitchOF13 = functools.partial( OVSSwitch, protocols='OpenFlow13' )
- net = Mininet( topo, switch=OVSSwitchOF13, controller=testController )
- net.start()
- print "Dumping host connections"
- dumpNodeConnections( net.hosts )
- print "Dumping switch connections"
- dumpNodeConnections( net.switches )
- net.interact()
- if __name__ == '__main__':
- setLogLevel( 'info' )
- simpleTest()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement