Skip to content

Ryu SDN controller

Ryu is an implementation of an SDN controller that is controlled through relatively simple python scripts. The Ryu project has lost its momentum the last years, but it suffices as an example of an SDN-implementation that fits our intended level of the labs.

Starting the Ryu Controller

The Ryu SDN controller can be started using the ryu-manager tool. When operating in the CLI of a RYU-machine in GNS3, you can find this tool in the ./ryu/bin directory. If one wishes to start an empty instance of the Ryu-controller, the sequence hence becomes:

cd ryu/bin
./ryu-manager
The ryu-manager can be instanciated with both options and a controller python-script. We recommend using the "--verbose" flag, at least initially, to have a clearer view of message structure and information flow.

To start the controller with a controller script, simple append the script to the command, e.g:

ryu-manager --verbose simple_switch_13.py

Starting the Ryu-manager service only exposes the SDN-controller as a server. It does not automatically connect to forwarding devices, but rather relies on forwarding devices connecting to the controller. The Ryu-controller exposes tcp-port 6653, which acts as an endpoint for forwarding devices to connect to.

Building Ryu-Apps

As the options regarding how to build your SDN-application are endless, we will not present specifics or details on building the apps here. Some general hints, however, include how to implement common coding practices into your SDN controller.

The SDN-controller can only be instantiated with one python-file. Therefore, if you wish to seperate your code into multiple files, you will need to utilize python's import function, allowing you to import functionality from your files into the "main" python file. This is recommended, especially as you add on functionality to your controller behaviour.

There are openly available applications written for Ryu that can be used as the basis/inspiration for your own applications. You can find these in the Ryu-Repository It is recommended to use the OpenFlow 1.3 versions of the files, as these have sufficient functionality and documentation to solve the lab.