pythonmininetsdnopendaylightopenflow

Connecting local instance of OpenDaylight controller to local instance of Mininet


I have the following Mininet topology:

from mininet.net import Mininet
from mininet.node import RemoteController
from mininet.cli import CLI

def create_topology():

    net = Mininet(controller=None)
    c0 = net.addController('c0', controller=RemoteController, ip='127.0.0.1', port=6633)
    s1 = net.addSwitch('s1')
    s2 = net.addSwitch('s2')
    h1 = net.addHost('h1')
    h2 = net.addHost('h2')
    h3 = net.addHost('h3')
    h4 = net.addHost('h4')
    net.addLink(h1, s1)
    net.addLink(h2, s2)
    net.addLink(h3, s1)
    net.addLink(h4, s2)
    net.addLink(s1, c0)
    net.addLink(s2, c0)
    return net

if __name__ == '__main__':
    topo = create_topology()
    topo.controllers[0].start()
    topo.start()
    CLI(topo)
    topo.controllers[0].stop()
    topo.stop()

I was previously using two virtual machines to run the emulator and the controller separately, and everything ran fine this way. Now I am running both Mininet and the OpenDaylight controller in my computer. I am running Mininet 2.3.1 (as provided in this package) and OpenDaylight 0.8.4.

However, I can't seem to get the network to connect with the controller. I've tried using both localhost and my IP address in the remote controller configuration inside the script, but neither works.

I did notice that running a command like sudo mn --controller=remote,ip=[my actual IP address],port=6633 works fine and the controller connects without errors.

How can I make this setup work with my current script and system setup? Any help would be massively appreciated.


Solution

  • Try replacing the net= line with the following:

    net = Mininet(controller=RemoteController, switch=OVSSwitch)