Installing RYU SDN controller on Ubuntu 14.04 and running Simple Hub Application

October 31, 2016

In this post I will illustrate how to install RYU controller which is a python based SDN controller and run a simple RYU application.

RYU supports OpenFlow 1.0, 1.2, 1.3, 1.4, 1.5 and Nicira extensions. All of code is freely available under the Apache 2.0 license

Source : https://osrg.github.io/ryu/

Pre-Requisites

I am using a Linux machine with the following configuration

OS : Ubuntu 14.04.1 LTS
Python : Python 2.7.6

Installing RYU

Lets get started by installing RYU first and then to run the sample application we will setup mininet, OVS.

I have written a shell script which will install RYU and its dependencies. On your machine download the script by running

wget https://gist.githubusercontent.com/ajinkyakadam/d6ef527a2ddbfb29bc53fdaf2270c228/raw/4cb0b694055e19b2aa5a166d6328070138c6a8b0/ryusetup.sh

Now run the script, (please note you should have sudo access to run this script)

bash ryusetup.sh

It will take around 3 minutes to install the script.

Now we will install mininet which help us emulate a network. Please run the following commands line by line on your terminal.

git clone git://github.com/mininet/mininet
cd mininet/
git tag
git checkout -b 2.2.2b2 2.2.2b2
cd ..
mininet/util/install.sh -nfv

Once we install mininet now lets run a simple learning hub application on controller that is available in the ryu example applications. First we will understand what this applications does and then verify the functionalities

We need a "HUB" and a few hosts connected to it. So lets construct a topology similar to that given in RYU-BOOK. Following is our topology of 3 hosts, 1 switch and 1 controller.

topology

Functions achieved by Simple Hub application (ryu/app/example_switch_13.py)

Confirming Default Rule Insertion in Switch

In order to start the topology as drawn aboveon your terminal run

sudo mn --topo single,3 --mac --switch ovsk --controller remote -x

Now lets first set the openflow version of switch to 1.3 by running,

sudo ovs-vsctl set Bridge s1 protocols=OpenFlow13

We will now have a look at the flow table of the switch, (it should be empty)

sudo ovs-ofctl -O openflow13 dump-flows s1

topology

The flow table is empty as we anticipated. Start the controller application after the control channel connection is established there should be a default flow entry added to the switch. Lets confirm this. Open a second terminal on your machine and run

ryu-manager --verbose ryu.app.example_switch_13

Once the controller and switch exchange hello packets and the switch features are received by the controller the control channel is established. We can see the output like below

topology

Now lets check the flow table for the switch again, run

sudo ovs-ofctl -O openflow13 dump-flows s1

topology

The default flow entry is added with the least priority. Thats Great !!! Our first functionality is confirmed.