0

I am new to using mininet and RYU controller. I was implementing the Dijkstra algorithm in RYU as mentioned on --> http://csie.nqu.edu.tw/smallko/sdn/dijkstra_ryu.htm

On the mininet I have created my custom topology as given below. But on running the controller on the mininet topology, the following error occurs --

unsupported version 0x1. If possible, set the switch to use one of the versions [4] on datapath ('127.0.0.1', 50884)

I don't know how to change the version of the switch to 1.3 in the topology. I also don't know how to change the switch protocol version in the RYU code from the link.

Please help me out!!!

# THE MININET TOPOLOGY
#!/usr/bin/python

from mininet.net import Mininet
from mininet.node import Controller, RemoteController, OVSController
from mininet.node import CPULimitedHost, Host, Node
from mininet.node import OVSKernelSwitch, UserSwitch
from mininet.node import IVSSwitch
from mininet.cli import CLI
from mininet.log import setLogLevel, info
from mininet.link import TCLink, Intf
from subprocess import call

def myNetwork():

    net = Mininet( topo=None,
                   build=False,
                   ipBase='10.0.0.0/8')

    info( '*** Adding controller\n' )
    c0=net.addController(name='c0',
                      controller=RemoteController,
                      protocol='tcp',
                      port=6633)

    info( '*** Add switches\n')
    s5 = net.addSwitch('s5', cls=OVSKernelSwitch)
    s1 = net.addSwitch('s1', cls=OVSKernelSwitch)
    s4 = net.addSwitch('s4', cls=OVSKernelSwitch)
    s9 = net.addSwitch('s9', cls=OVSKernelSwitch)
    s6 = net.addSwitch('s6', cls=OVSKernelSwitch)
    s8 = net.addSwitch('s8', cls=OVSKernelSwitch)
    s2 = net.addSwitch('s2', cls=OVSKernelSwitch)
    s10 = net.addSwitch('s10', cls=OVSKernelSwitch)
    s11 = net.addSwitch('s11', cls=OVSKernelSwitch)
    s3 = net.addSwitch('s3', cls=OVSKernelSwitch)
    s7 = net.addSwitch('s7', cls=OVSKernelSwitch)

    info( '*** Add hosts\n')
    h10 = net.addHost('h10', cls=Host, ip='10.0.0.10', defaultRoute=None)
    h2 = net.addHost('h2', cls=Host, ip='10.0.0.2', defaultRoute=None)
    h5 = net.addHost('h5', cls=Host, ip='10.0.0.5', defaultRoute=None)
    h3 = net.addHost('h3', cls=Host, ip='10.0.0.3', defaultRoute=None)
    h11 = net.addHost('h11', cls=Host, ip='10.0.0.11', defaultRoute=None)
    h1 = net.addHost('h1', cls=Host, ip='10.0.0.1', defaultRoute=None)
    h6 = net.addHost('h6', cls=Host, ip='10.0.0.6', defaultRoute=None)
    h9 = net.addHost('h9', cls=Host, ip='10.0.0.9', defaultRoute=None)
    h4 = net.addHost('h4', cls=Host, ip='10.0.0.4', defaultRoute=None)
    h7 = net.addHost('h7', cls=Host, ip='10.0.0.7', defaultRoute=None)
    h8 = net.addHost('h8', cls=Host, ip='10.0.0.8', defaultRoute=None)

    info( '*** Add links\n')
    net.addLink(h1, s1)
    net.addLink(h2, s2)
    net.addLink(s3, h3)
    net.addLink(s4, h4)
    net.addLink(s5, h5)
    net.addLink(h6, s6)
    net.addLink(s7, h7)
    net.addLink(s8, h8)
    net.addLink(s9, h9)
    net.addLink(s10, h10)
    net.addLink(h11, s11)
    net.addLink(s1, s6)
    net.addLink(s6, s3)
    net.addLink(s3, s1)
    net.addLink(s3, s7)
    net.addLink(s6, s4)
    net.addLink(s4, s5)
    net.addLink(s5, s9)
    net.addLink(s9, s8)
    net.addLink(s8, s2)
    net.addLink(s7, s8)
    net.addLink(s9, s10)
    net.addLink(s10, s11)
    net.addLink(s2, s11)
    net.addLink(s7, s5)

    info( '*** Starting network\n')
    net.build()
    info( '*** Starting controllers\n')
    for controller in net.controllers:
        controller.start()

    info( '*** Starting switches\n')
    net.get('s5').start([c0])
    net.get('s1').start([c0])
    net.get('s4').start([c0])
    net.get('s9').start([c0])
    net.get('s6').start([c0])
    net.get('s8').start([c0])
    net.get('s2').start([c0])
    net.get('s10').start([c0])
    net.get('s11').start([c0])
    net.get('s3').start([c0])
    net.get('s7').start([c0])

    info( '*** Post configure switches and hosts\n')

    CLI(net)
    net.stop()

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

3 Answers3

0

To use Openflow 1.3 with ryu, in your ryu controller import that version:

from ryu.base import app_manager
from ryu.controller import ofp_event
from ryu.controller.handler import CONFIG_DISPATCHER, MAIN_DISPATCHER
from ryu.controller.handler import set_ev_cls
from ryu.ofproto import ofproto_v1_3

class Controller(app_manager.RyuApp):
  OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]  # Use OpenFlow 1.3.x

  def __init__(self, *args, **kwargs):
    super(Controller, self).__init__(*args, **kwargs)
Soutzikevich
  • 991
  • 3
  • 13
  • 29
0

Add ovsk switch to support the openflow protocol:

$ sudo mn --typo tree,3 --mac --controller=remote,ip=127.0.0.1,port=5366 --switch=ovsk,protocols=OpenFlow13

The OFP_VERSIONSsrc, doc defined a list of supported versions of OpenFlow for the controller application. this is usually specified, in the application to be compatible with a version of OpenFlow that Ryu support OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]

Morteza
  • 1
  • 1
  • To make your answer more useful, please give a bit more context and describe how this solves the problem. – Klaus Gütter Aug 20 '20 at 15:23
  • The ovsk switch add to support openflow protocol, The OFP_VERSIONSsrc, doc define a list of supported versions of OpenFlow for the controller application. this is specified, in the application to be compatible with a version of OpenFlow that Ryu support OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION] – Morteza Aug 21 '20 at 06:05
  • It is better to edit your answer instead of adding additional information as comment where it is easily overlooked. – Klaus Gütter Aug 21 '20 at 06:31
0

In addition to the solution of friends, these can help you.

self.mySwitches.append(self.net.addSwitch(name='S'+str(i),protocols="OpenFlow13",cls=OVSKernelSwitch)) 
for switch in self.mySwitches:
    os.system(f'sudo ovs-vsctl set Bridge {switch} protocols=OpenFlow13')
   os.system(f'sudo ovs-vsctl set-manager ptcp:6632')
   os.system(f'curl -X PUT -d \'\"tcp:127.0.0.1:6632\"\' http://localhost:8080/v1.0/conf/switches/{switch.dpid}/ovsdb_addr')

Also don't forget to set the version in your app:

class Controller(app_manager.RyuApp):
  OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]