So far we've built our OpenFlow switch, installed Erlang and installed the LINC OpenFlow switch.
The switch isn't much use without a controller. There are a number of OpenFlow switches out there. Beacon, Flashlight, Ryu and more.
Beacon is rather old so doesn't work with LINC which supports the latest protocols. For my OpenFlow lab I'm going to use the NTT ryu controller.
Ryu is written in python so should work on your platform. It's even possible to run it on the Raspberry Pi but for now I'm running it on an OpenSuse machine.
The Ryu webpage is http://osrg.github.io/ryu/ and the download page takes you to Ryu's github page at https://github.com/osrg/ryu
If you have an up-to-date python installation you may be able to install Ryu with the simple command
pip install ryuIf you're like me you're installation will need some work to make it install!
I didn't have pip (the python package installer) so I had to install "distribute" first
$ wget http://python-distribute.org/distribute_setup.py
$ python distribute_setup.py
Then I had to install pip
$ wget http://pypi.python.org/packages/source/p/pip/pip-0.7.2.tar.gz
$ tar xzf pip-0.7.2.tar.gz
$ cd pip-0.7.2
$ python setup.py install
Then I installed ryu
$ pip install ryu
You may be lucky and it runs.
$ pip install ryu
I was not so lucky. I was missing the gevent python library
$ pip install gevent
However it wouldn't install so I had to install the python-devel RPM next
I then installed a bunch of missing python libraries
$ pip install gevent
$ pip install webob
$ pip install routes
Finally gevent worked !
$ pip install gevent
$ ryu-manager
loading app ryu.controller.ofp_handler
instantiating app ryu.controller.ofp_handler
Yes a running OpenFlow controller !!
Although LINC supports auto controller configuration using OF Config, we'll set it up manually.
Now we have a running controller on a machine, we need to find the IP address of the machine. On Linux
the command is /sbin/ifconfig -a
My address is 192.168.1.4
On windows machines you need a cmd prompt and type ipconfig /all to find the IP address
We now need to edit the LINC config file to point it at the controller.
To edit the file on the Pi
pi@raspberrypi ~/LINC-Switch $ sudo vi rel/linc/releases/1.0/sys.config
%% Configuration of the controllers switch will connect to. Ideally
%% this list should be empty and assignement should be handled by an
%% OF-Config client.
%% Default OFP controller port is 6633.
{controllers,
[
{"Switch0-DefaultController", "192.168.1.4", 6633, tcp}
]},
%% Configure ports available to the switch when using the
%% userspace backend according to your system setup.
%% * Under Linux all TAP interfaces must be set up beforehand
%% as persistent.
%% * Under MacOSX TAP interfaces are created during node
%% startup (which requires setting an ip parameter).
This line is commented out with a %% by default so the %% needs to be removed and the correct IP address inserted.
OK time to let the switch connect to the controller!
pi@raspberrypi ~/LINC-Switch $ sudo rel/linc/bin/linc console
Exec: /home/pi/LINC-Switch/rel/linc/erts-5.9.3.1/bin/erlexec -boot /home/pi/LINC-Switch/rel/linc/releases/1.0/linc -mode embedded -config /home/pi/LINC-Switch/rel/linc/releases/1.0/sys.config -args_file /home/pi/LINC-Switch/rel/linc/releases/1.0/vm.args -- console
Root: /home/pi/LINC-Switch/rel/linc
Erlang R15B03 (erts-5.9.3.1) [source] [async-threads:0] [kernel-poll:false]
20:52:02.873 [info] Application lager started on node linc@raspberrypi
20:52:02.883 [info] Application ssh started on node linc@raspberrypi
20:52:02.912 [info] Application enetconf started on node linc@raspberrypi
20:52:02.927 [info] Application linc started on node linc@raspberrypi
Eshell V5.9.3.1 (abort with ^G)
(linc@raspberrypi)1>
(linc@raspberrypi)1> 20:52:03.230 [info] Created port: {port,4,[{queues_status,disabled},{queues,[]},{config,{port_configuration,undefined,up,false,false,false}},{features,{features,undefined,'100Mb-FD',true,copper,unsupported}},{queues,[]},{interface,"eth0"}]}
20:52:03.481 [info] Created port: {port,3,[{queues_status,disabled},{queues,[]},{config,{port_configuration,undefined,up,false,false,false}},{features,{features,undefined,'100Mb-FD',true,copper,unsupported}},{queues,[]},{interface,"wlan0"}]}
20:52:03.736 [info] Created port: {port,2,[{queues_status,disabled},{queues,[]},{config,{port_configuration,undefined,up,false,false,false}},{features,{features,undefined,'100Mb-FD',true,copper,unsupported}},{queues,[]},{interface,"eth2"}]}
20:52:03.974 [info] Created port: {port,1,[{queues_status,disabled},{queues,[]},{config,{port_configuration,undefined,up,false,false,false}},{features,{features,undefined,'100Mb-FD',true,copper,unsupported}},{queues,[]},{interface,"eth1"}]}
20:52:04.020 [info] Connected to controller 192.168.1.4:6633/0 using OFP v4
(linc@raspberrypi)1>
Success!
In my next post in this series we'll start doing some useful experiments.

