0
votes

I'm new to mininet, I want to see the network topology using opendaylight(carbon) controller. I have tried command:

sudo mn --topo linear,3 --mac \
    --controller=remote,ip=10.109.253.152,port=6633 \
    --switch ovs,protocols=OpenFlow13,stp=1

And the opendaylight can successfully show the whole topology. And Then, I want to show the same result by using python code solely. However, it doesn't work.

#!/usr/bin/python

from mininet.net import Mininet
from mininet.node import RemoteController, OVSSwitch
from mininet.log import info, setLogLevel
from mininet.cli import CLI

def RemoteCon():
    net = Mininet(controller=RemoteController, switch=OVSSwitch)

    c1 = net.addController('c1', ip='10.109.253.152',port=6633)
    h1 = net.addHost('h1')
    h2 = net.addHost('h2')
    s1 = net.addSwitch('s1')
    net.addLink(s1, h1)
    net.addLink(s1, h2)

    net.build()
    net.start()

    CLI(net)

    net.stop()

if __name__ == '__main__':
    setLogLevel('info')
    RemoteCon()

Oh, by the way, does the switches have default forwarding functionality? Sometimes, I have hosts and switch connected to each other and hosts can ping each other while running above code, h1 cannot ping h2 and vice versa.

Thanks in advance.

2

2 Answers

0
votes

I'm assuming you are using the l2switch feature in OpenDaylight.

if you search this forum, you'll find others complaining of inconsistent connectivity when using l2switch. You are probably hitting bugs, but after a restart of OpenDaylight, it might be ok. By default, with l2switch it should learn the links of the topology, and create the flows to allow all hosts to ping every other host.

as for your python script to run mininet, I don't see anything obvious. Can you look in the OpenDaylight karaf.log for any clues? Or check the OVS logs for other clues? If you are just simply not seeing anything in the topology viewer, then my guess is that the OVS is not connecting to OpenDaylight at all.

One thing to double check. I don't know how the python script is deciding which openflow version to use, but maybe it's using 1.0 and that's the big difference from your command line, which sets it to 1.3?

0
votes

I see that you missed starting your switch to communicate with the controller. Try

s1.start([c1])

This defines which controller the switch is connected to. Hope this helps.