Software-Defined Networking and Cloud: Hands on OpenStack integration with OpenDayLight

Getting started with Software-Defined Networking could be an unpleasant experience especially with open-source that evolve quickly with lag between the software releases and the documentation. This article aims to introduce the current trend on network programing with OpenStack (Pika release) and OpenDayLight (Nitrogen release).

Introduction

OpenStack is a set of software tools for building and managing cloud computing platforms. It is my favorite to play with the cloud as it lets users deploy virtual machines and container instances and enables managing a cloud environment on the fly. OpenStack is available to install using multiple distributions including RDO ProjectMirantis , and Devstack. in this hands on, i will only describe the process with DevStack.
The networking service on OpenStack is handled using the Modular Layer 2 (ML2) plug-into simultaneously utilize the variety of layer 2 networking technologies. its main implementation is using Open vSwitch (OVS). OpenDaylight is an SDN controller back-end used to control OVS using a a library of drivers and plugins called networking-odl that integrates OpenStack Neutron API with OpenDaylight. For this integration, ML2 driver and L3 plugin are used to enable communication of OpenStack Neutron L2 and L3 resources API to OpenDayLight Backend.
As Neutron uses OVS for underlying networking, it creates communication bridges called br-int, br-ext, and br-tun. these bridges enables communication between VMs and the external network at L2/L3. Two operation modes are supported by OVS: normal mode and SDN mode.
By default, OVS behaves in Normal Mode. To activate SDN mode, Networking-ODL is used. Networking-ODL is a Neutron plugin project that is used to manage the Neutron OVS via OpenDayLight SDN Controller using a specific applications : odl-ovsdb-openstack.

Environment

I am using two machines for this experiment. My favorite Intel IoT gateway (Sorry Intel, i am running it under Ubuntu 16) as a host for the SDN controller. My favorite System 76 Kudu also running under Ubuntu 16 as a cloud (Devstack). The machines are connected to a control network 10.0.0.0/24 and a data network 10.1.0.0/24
The controller is called gw with the following configuration :
charif@gw:~$ sudo lshw -short
H/W path           Device     Class          Description
========================================================
                              system         Dell Wyse Thin Client Desktop 3290 (Null)
/0                            bus            Dell Wyse Thin Client Desktop 3290
/0/0                          memory         128KiB BIOS
/0/4                          processor      Intel(R) Celeron(R) CPU  N2807  @ 1.58GHz
/0/4/6                        memory         32KiB L1 cache
/0/4/7                        memory         1MiB L2 cache
/0/5                          memory         24KiB L1 cache
/0/8                          memory         4GiB System Memory
/0/8/0                        memory         4GiB SODIMM DDR3 Synchronous 1333 MHz (0.8 ns)
/0/8/1                        memory         SODIMM [empty]
/0/100/1c/0        enp1s0     network        RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
/0/100/1c.1                   bridge         Atom Processor E3800 Series PCI Express Root Port 2
/0/100/1c.1/0      wlp2s0     network        Wireless 7260
/0/1               scsi0      storage
/0/1/0.0.0         /dev/sda   disk           32GB 32GB SATA Flash
/0/1/0.0.0/1                  volume         511MiB Windows FAT volume
/0/1/0.0.0/2       /dev/sda2  volume         25GiB EXT4 volume
/0/1/0.0.0/3       /dev/sda3  volume         3971MiB Linux swap volume
/1                            power          Smart Battery


The cloud machine is called lap1 with the following configuration:
stack@lap1:~$ sudo lshw -short
H/W path         Device      Class          Description
=======================================================
                             system         Darter UltraThin (Not Applicable)
/0                           bus            Darter UltraThin
/0/0                         memory         64KiB BIOS
/0/14                        processor      Intel(R) Core(TM) i7-4500U CPU @ 1.80GHz
/0/14/15                     memory         512KiB L2 cache
/0/14/16                     memory         128KiB L1 cache
/0/14/17                     memory         4MiB L3 cache
/0/18                        memory         16GiB System Memory
/0/18/0                      memory         8GiB SODIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/18/1                      memory         DIMM [empty]
/0/18/2                      memory         8GiB SODIMM DDR3 Synchronous 1600 MHz (0.6 ns)
/0/18/3                      memory         DIMM [empty]
/0/100/1c.2/0    wlp2s0      network        Wireless 7260
/0/100/1c.3/0.1  enp3s0f1    network        RTL8111/8168/8411 PCI Express Gigabit Ethernet Controller
/0/1/0.0.0       /dev/sda    disk           240GB INTEL SSDSC2BP24
/0/1/0.0.0/1     /dev/sda1   volume         207GiB EXT4 volume
/0/1/0.0.0/2     /dev/sda2   volume         15GiB Extended partition
/0/1/0.0.0/2/5   /dev/sda5   volume         15GiB Linux swap / Solaris partition
/0/2             scsi1       storage
/0/2/0.0.0       /dev/sdb    disk           240GB INTEL SSDMCEAW24
/0/2/0.0.0/1     /dev/sdb1   volume         223GiB Windows FAT volume
/1               virbr0-nic  network        Ethernet interface

Installing OpenDayLight

First, let install ODL out of the box:
charif@gw:~$ sudo apt-get install openjdk-8-jdk
charif@gw:~$ wget https://nexus.opendaylight.org/content/repositories/public/org/opendaylight/integration/karaf/0.7.1/karaf-0.7.1.tar.gz
charif@gw:~$ tar -xvf ./karaf-0.7.1.tar.gz
charif@gw:~$ cd karaf-0.7.1/
charif@gw:~/karaf-0.7.1$ ./bin/karaf
karaf: JAVA_HOME not set; results may vary
Apache Karaf starting up. Press Enter to open the shell now...
100% [========================================================================]

Karaf started in 1s. Bundle stats: 10 active, 10 total

    ________                       ________                .__  .__       .__     __
    \_____  \ ______   ____   ____ \______ \ _____  ___.__.|  | |__| ____ |  |___/  |_
     /   |   \\____ \_/ __ \ /    \ |    |  \\__  \<   |  ||  | |  |/ ___\|  |  \   __\
    /    |    \  |_> >  ___/|   |  \|    `   \/ __ \\___  ||  |_|  / /_/  >   Y  \  |
    \_______  /   __/ \___  >___|  /_______  (____  / ____||____/__\___  /|___|  /__|
            \/|__|        \/     \/        \/     \/\/            /_____/      \/


Hit '<tab>' for a list of available commands
and '[cmd] --help' for help on a specific command.
Hit '<ctrl-d>' or type 'system:shutdown' or 'logout' to shutdown OpenDaylight.

opendaylight-user@root>
Then install the features :
opendaylight-user@root>feature:install odl-netvirt-openstack odl-dlux-core odl-mdsal-apidocs
You are all set for OpenDayLight, you can access to the UI using this link http://10.0.0.4:8181/index.html and don't forget to change the IP ;)

Installing Devstack

First clone, create the stack user, and switch to this new user:
charif@lap1:~$ sudo useradd -s /bin/bash -d /opt/stack -m stack
charif@lap1:~$ echo "stack ALL=(ALL) NOPASSWD: ALL" | sudo tee /etc/sudoers.d/stack
charif@lap1:~$ sudo su - stack
stack@lap1:~$ git clone https://git.openstack.org/openstack-dev/devstack
stack@lap1:~$ cd devstack
Then create a local.conf file and make sure that the IPs and the interfaces are accurate to your configuration:
[[local|localrc]]
#enable_plugin networking-odl https://github.com/stackforge/networking-odl
#enable_plugin networking-odl /vagrant/x/networking-odl.git plugin
enable_plugin networking-odl https://github.com/flavio-fernandes/networking-odl stable/Pike
enable_plugin neutron-lbaas http://git.openstack.org/openstack/neutron-lbaas
enable_plugin neutron-lbaas-dashboard https://git.openstack.org/openstack/neutron-lbaas-dashboard
 
LOGFILE=stack.sh.log
SCREEN_LOGDIR=/opt/stack/data/log
LOG_COLOR=False
OFFLINE=True
RECLONE=no
 
disable_service swift
disable_service cinder
disable_service n-net
disable_service q-vpn
enable_service q-svc
enable_service q-dhcp
enable_service q-meta
#enable_service q-lbaas
enable_service q-lbaasv2
enable_service tempest
 
HOST_IP=https://www.linkedin.com/redir/invalid-link-page?url=10%2e1%2e0%2e101
HOST_NAME=lap1
SERVICE_HOST=$HOST_IP
SERVICE_HOST_NAME=$HOST_NAME
 
NEUTRON_CREATE_INITIAL_NETWORKS=False
Q_PLUGIN=ml2
Q_ML2_TENANT_NETWORK_TYPE=vxlan
 
# https://github.com/stackforge/networking-odl/blob/master/devstack/settings
ODL_MODE=externalodl
 
ODL_NETVIRT_DEBUG_LOGS=True
ODL_MGR_IP=https://www.linkedin.com/redir/invalid-link-page?url=10%2e1%2e0%2e101
ODL_PORT=8080
ODL_ARGS="-Xmx1024m -XX:MaxPermSize=512m"
ODL_BOOT_WAIT=70
 
ENABLE_TENANT_TUNNELS=True
 
VNCSERVER_PROXYCLIENT_ADDRESS=${HOST_IP}
VNCSERVER_LISTEN=0.0.0.0


FLOATING_RANGE=10.1.0.0/24
FIXED_RANGE=10.2.0.0/24
FIXED_NETWORK_SIZE=256
FLAT_INTERFACE=enp3s0f1
IPV4_ADDRS_SAFE_TO_USE=10.3.0.0/24
Q_FLOATING_ALLOCATION_POOL=start=10.1.0.250,end=10.1.0.254
PUBLIC_NETWORK_GATEWAY=10.1.0.1



# Open vSwitch provider networking configuration
Q_USE_PROVIDERNET_FOR_PUBLIC=True
OVS_PHYSICAL_BRIDGE=br-ex
PUBLIC_BRIDGE=br-ex
OVS_BRIDGE_MAPPINGS=public:br-ex

 
#Q_HOST=$SERVICE_HOST
MYSQL_HOST=$SERVICE_HOST
RABBIT_HOST=$SERVICE_HOST
GLANCE_HOSTPORT=$SERVICE_HOST:9292
KEYSTONE_AUTH_HOST=$SERVICE_HOST
KEYSTONE_SERVICE_HOST=$SERVICE_HOST
 
MYSQL_PASSWORD=mahmoudi
SERVICE_TOKEN=mahmoudi
ADMIN_PASSWORD=mahmoudi
DATABASE_PASSWORD=mahmoudi
RABBIT_PASSWORD=mahmoudi
SERVICE_PASSWORD=$ADMIN_PASSWORD
 
BRANCH=stable/Pike
GLANCE_BRANCH=$BRANCH
HORIZON_BRANCH=$BRANCH
KEYSTONE_BRANCH=$BRANCH
NOVA_BRANCH=$BRANCH
NEUTRON_BRANCH=$BRANCH
SWIFT_BRANCH=$BRANCH
##CLIFF_BRANCH=$BRANCH
##TEMPEST_BRANCH=$BRANCH
CINDER_BRANCH=$BRANCH
HEAT_BRANCH=$BRANCH
TROVE_BRANCH=$BRANCH
CEILOMETER_BRANCH=$BRANCH
 
NEUTRON_LBAAS_SERVICE_PROVIDERV2="LOADBALANCERV2:opendaylight:networking_odl.lbaas.driver_v2.OpenDaylightLbaasDriverV2:default"
 
 
 
# Images
# Use this image when creating test instances
IMAGE_URLS+=",http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img"
# Use this image when working with Orchestration (Heat)
IMAGE_URLS+=",http://mirror.us.leaseweb.net/fedora/linux/releases/27/CloudImages/x86_64/images/Fedora-Cloud-Base-27-1.6.x86_64.qcow2"
IMAGE_URLS+=",https://cloud-images.ubuntu.com/xenial/current/xenial-server-cloudimg-amd64-disk1.img"



# Disable q-l3 and uncomment the lines below if ODL is being configured to perform l3fwd
# For more info:  https://github.com/stackforge/networking-odl/blob/master/devstack/README.rst
# enable_service q-l3
disable_service q-l3
Q_L3_ENABLED=True
ODL_L3=True
PUBLIC_INTERFACE=enp3s0f1
[[post-config|$NEUTRON_CONF]]
[DEFAULT]
service_plugins = networking_odl.l3.l3_odl.OpenDaylightL3RouterPlugin,neutron_lbaas.services.loadbalancer.plugin.LoadBalancerPluginv2
 
[[post-config|/etc/neutron/plugins/ml2/ml2_conf.ini]]
[agent]
minimize_polling=True
Run your stack script to start the installation :
stack@lap1:~/devstack$ ./stack.sh
After the setup, you can access to horizon dashboard to create and play with your VMs using this link : https://10.0.0.5/dashboard

Conclusion

Setting up a cloud environment with SDN is not straightforward. However, once up and running, its a very powerful environment that can be used for exiting experiments using the service function chaining for example. I will try to follow up with a more detailed article about SFC

Comments

Popular posts from this blog

Publicity plan for a workshop or conference

Per-device Service Function Chaining for Internet of Things