I am learning about SDN controllers and was hoping to implement a custom topology with a main controller (Floodlight) connected to sub controllers (POX and RYU) which are connected to switches in the network. I have drawn a brief diagram of what i'm trying to achieve here (excuse my bad drawing skills)
I had a go at programming the controllers to connect with the other controllers but I'm not sure if I done it right.
from mininet.net import Mininet
from mininet.node import OVSSwitch, Controller, RemoteController
from mininet.topolib import TreeTopo
from mininet.log import setLogLevel
from mininet.cli import CLI
setLogLevel( 'info' )
c0 = RemoteController( 'pox', ip='192.168.56.102', port=6633 )
c1 = RemoteController( 'floodlight', ip='192.168.56.101', port=6653 )
c2 = RemoteController( 'ryu', ip='192.168.56.103', port=6653 )
y
cmap = { 's1': c0, 's2': c0, 's3': c1, 's4': c1, 's5': c2, 's6': c2}
class MultiSwitch( OVSSwitch ):
"Custom Switch() subclass that connects to different controllers"
def start( self, controllers ):
return OVSSwitch.start( self, [ cmap[ self.name ] ] )
topo = TreeTopo( depth=2, fanout=5 )
net = Mininet( topo=topo, switch=MultiSwitch, build=False )
for c in [ c0,c1,c2 ]:
net.addController(c)
net.build()
net.start()
CLI( net )
net.stop()
As you can see from the code, I have a custom topology which connects switches to multiple controllers using a tree topology. However I am not sure if the controllers are connected to each other.
How can I make Floodlight the main controller and POX and RYU sub controllers?
Also, are the switches connected to the right controllers?
Any advice would be helpful!