Playing with docker and opendaylight

by Olivier Barais     sdn   opendaylight   docker  

Posted 2015.03.13 — Rennes, France

A short blog post to share my experience in playing with opendaylight and docker.

Currently there is no native integration of Open vSwitch in Docker, i.e., one cannot use the Docker client to automatically add a container's network interface to an Open vSwitch bridge during the creation of the container. However the last version of ovs provides a utility to use ovs with docker. As ovs support openflow 1.3. It provides a greate playground for practical work combining opendaylight, docker and ovs.

Step 0 Installation

First install one of the last version of ovs.

Next install docker

#Install ovs-docker as root
cd /usr/bin
chmod a+rwx ovs-docker

Step 1 Docker and Openvswitch

Manually create a first bridge to test.

#Create your bridge
ovs-vsctl add-br ovs-br1            # create a bridge named 'ovs-br1'
ovs-vsctl add-port ovs-br1 eth0     # attach eth0 to ovs-br1
ifconfig ovs-br1 netmask up

Start two containers in different consoles

docker run -t -i --name container1 ubuntu /bin/bash
docker run -t -i --name container2 ubuntu /bin/bash

Add a port to this docker

ovs-docker add-port ovs-br1 eth1 container1
ovs-docker add-port ovs-br1 eth1 container2

Play to ping your containers.

Step 2 Openvswitch and opendaylight

Start opendaylight.

You can follow this tutorial to learn how to develop a plugin for opendaylight.

get opendaylight

Check you use Java 7.

 git clone -b release/helium-sr2 helium-integ-pristin 
cd  helium-integ-pristin
mvn clean install -DskipTests

cd distributions/extra/karaf/target/assembly/

In karaf console, install the following feature

feature:install odl-openflowplugin-all

Next in another console

Set Controller (opendaylight ip)

export ip=
export port=6633
ovs-vsctl set-controller ovs-br0 tcp:$ip:$port
#Verify Connection
 ovs-vsctl list controller        # verify that it's actively connected

Connect to dlux and check you can see your containers.

Step 3 Create your own learning switch to connect your container

git clone -b release/helium-sr2 openflowplugin
cd openflowplugin/samples/learning-switch
mvn clean install -DskipTests

create a ping between your two docker containers.

It will not work.

in Karak console, install your learning switch.

install file://yourpath/openflowplugin/samples/learning-switch/target/learning-switch-0.0.5-Helium-SR2.jar
start bundlenumber

Now ping should work.

Step 4 Build your own multi-tenant apps with a clear network isolation.

The goal in this task is to create a vswitch per tenant to clearly isolate your apps.

We will use Kevoree and Occi to deploy container and get an abstraction of the configuration.

Step 5 Use opendaylight to create routes between distributed container

Coming soon ...