Tutorial:

Deploying OpenDaylight

Daniel Farrell
Red Hat SDN Team


*All  things ODL packaging/deployment!*

VERY QUICK: INTRO TO ME

Daniel Farrell
Software Engineer, Red Hat SDN Team

VERY QUICK: INTRO TO ME

Code!

VERY QUICK: INTRO TO ME

OpenDaylight Integration Committer

VERY QUICK: INTRO TO ME

Robotics advisor
 

VERY QUICK: INTRO TO ME

Craft beer lover
 

VERY QUICK: INTRO TO ME

Or other interesting drinks

VERY QUICK: INTRO TO ME

  (Pedal) Biker
 

VERY QUICK: INTRO TO ME

High adventure generally
 

Outline

Overview

All packaging/deployment tools

OUTLINE

Overview, then hands on, of each

Outline

pakdep-toolbox-odl

Outline

RPM

OUTLINE

Puppet module

OUTLINE

Ansible role


Outline

Docker

Outline

Vagrant base box

Outline

Packer

Manual

Manual

"Just download and run"

Manual

Let's try it...

Manual

[~/sandbox]$ vagrant init -m centos/7
[~/sandbox]$ cat Vagrantfile
Vagrant.configure(2) do |config|
  config.vm.box = "centos/7"
end

Manual

[~/sandbox]$ vagrant up

Manual

[~/sandbox]$ vagrant ssh
[vagrant@localhost ~]$


Manual

[vagrant@localhost ~]$ curl -o distribution-karaf-0.2.3-Helium-SR3.tar.gz \
                               <long tarball URL>

Manual

[vagrant@localhost ~]$ sudo mkdir /opt/opendaylight    

Manual

[vagrant@localhost ~]$ sudo tar -x
                                --strip-components=1 
                                --directory=/opt/opendaylight
                                -f <long tarball name>

Manual

[vagrant@localhost ~]$ sudo /opt/opendaylight/bin/karaf server
karaf: java command not found

Manual

[vagrant@localhost ~]$ sudo yum install -y java

Manual

vagrant@localhost ~]$ sudo /opt/opendaylight/bin/karaf server &

Manual

Running as root :(
[vagrant@localhost bin]$ ps -u -p `pgrep java` | awk {'print $1'}
root

Manual

Create `odl:odl` user:group?

Manual

Want a home dir for that user?

Manual

chown ODL's dir to `odl:odl`

Manual

Restart ODL service

Manual

(if only you had systemd support)

Manual

Login and configure Karaf features?

Manual

Port configuration?

Manual

Fine for devs

Manual

Automatic deployments?

Manual

OPNFV?

manual

First user experience?

manual

Modern users expect better

Manual

Modern deployments need better

PakDep Toolbox

PAKDEP TOOLBOX

[~/pakdep-toolbox-opendaylight]$ vagrant status
Current machine states:

pakdep                    not created (virtualbox)
cached                    not created (virtualbox)

PAKDEP TOOLBOX

But first, dependencies!
*deep sigh*

Pakdep Toolbox

pakdep-toolbox-odl-0.1.0.tar

VirtualBox-5.0.0-101573-OSX.dmg
VirtualBox-5.0.0-101573-Win.exe
VirtualBox-5.0-5.0.0_101573_fedora18-1.x86_64.rpm
VirtualBox-5.0-5.0.0_101573_fedora22-1.x86_64.rpm
virtualbox-5.0_5.0.0-101573-Ubuntu-trusty_amd64.deb

vagrant_1.7.4_x86_64.rpm
vagrant_1.7.4_x86_64.deb
vagrant_1.7.4.dmg
vagrant_1.7.4.msi

7z920-x64.msi
7z920.exe

Git-1.9.5-preview20150319.exe

Pakdep Toolbox

Install them!

PAKDEP TOOLBOX

Not sure how to help?

Pakdep toolbox

Overall, you need:
VirtualBox
Vagrant
Git
Tar unarchiver

PAKDEP TOOLBOX

Try to get to this point:
[~]$ tar xf pakdep-toolbox-odl-0.1.0.tar
[~]$ cd pakdep-toolbox-opendaylight
[~/pakdep-toolbox-opendaylight]$ vagrant status
Current machine states:

pakdep                    not created (virtualbox)
cached                    not created (virtualbox)

PAKDEP TOOLBOX

Import our cached box
[~/pakdep-toolbox-opendaylight]$ vagrant box add --name "dfarrell07/pakdep" pakdep.box

PAKDEP TOOLBOX

Start the VM's boot
[~/pakdep-toolbox-opendaylight]$ vagrant up cached

RPM

RPM

Copr

RPM

Example

RPM

Copy Copr repo URL

RPM

Install ODL's repo
[~]$ sudo curl -so /etc/yum.repos.d/opendaylight.repo <long Copr URL>

RPM

Install ODL
[~]$ sudo yum install -y opendaylight
<snip>
Installed:
  opendaylight.noarch 0:0.2.3-2.fc20
Complete!

RPM

Systemd integration
[~]$ sudo systemctl start opendaylight

RPM

Systemd integration
[~]$ sudo systemctl is-active opendaylight
active

RPM

RPM

[/opt/opendaylight/bin]$ ./client
<snip>
opendaylight-user@root>feature:install ...    

RPM

#endexample

RPM

Future: Host in more official location
(CentOS NFV SIG, ODL infra)

Hands ON: RPM

HANDS ON: RPM

Let's visit the source

HANDS ON: RPM

/we visit source repo web UI

HANDS ON: RPM

/me shows layout of source

HANDS ON: RPM

/we connect to the toolbox

HANDS ON: RPM

[~/pakdep-toolbox-opendaylight]$ vagrant ssh cached
Last login: Sun Jul 26 07:04:58 2015 from 10.0.2.2
Welcome to your Packer-built virtual machine.
[vagrant@localhost ~]$

HANDS ON: RPM

/we build ODL's RPM

HANDS ON: RPM

[vagrant@localhost ~]$ cd /vagrant/integration/packaging/rpm/
[vagrant@localhost rpm]$

HANDS ON: RPM

[vagrant@localhost rpm]$ ls
build.sh  connect.sh  install.sh  opendaylight.spec  README.md  uninstall.sh  Vagrantfile

HANDS ON: RPM

First, a few minor tweaks

HANDS ON: RPM

Correct disttag
[vagrant@localhost rpm]$ grep -rniI el7.centos .
./build.sh:22:rpm_release="2.el7.centos"
./install.sh:20:rpm_release="2.el7.centos"
[vagrant@localhost rpm]$ sed -i 's/el7.centos/fc21/' build.sh install.sh
[vagrant@localhost rpm]$ grep -rniI el7.centos .
[vagrant@localhost rpm]$

HANDS ON: RPM

Don't build SRPM
[vagrant@localhost rpm]$ grep "rpmbuild -ba" build.sh 
rpmbuild -ba opendaylight.spec
[vagrant@localhost rpm]$ sed -i 's/rpmbuild -ba/rpmbuild -bb/' build.sh 
[vagrant@localhost rpm]$ grep "rpmbuild -ba" build.sh 
[vagrant@localhost rpm]$ grep "rpmbuild -bb" build.sh 
rpmbuild -bb opendaylight.spec

HANDS ON: RPM

/we actually build the RPM

HANDS ON: RPM

[vagrant@localhost rpm]$ ./build.sh /vagrant/cache/
^^don't forget the param

HANDS ON: RPM

Build's done!?

HANDS ON: RPM

[vagrant@localhost rpm]$ ls -rc /vagrant/cache/ | tail -n 1
opendaylight-3.0.0-2.fc21.noarch.rpm

HANDS ON: RPM

/we install ODL's RPM

HANDS ON: RPM

[vagrant@localhost rpm]$ ./install.sh /vagrant/cache/
^^don't forget the param

HANDS ON: RPM

Installing ODL from /vagrant/cache//opendaylight-3.0.0-2.fc21.noarch.rpm
+ sudo rpm -i /vagrant/cache//opendaylight-3.0.0-2.fc21.noarch.rpm

HANDS ON: RPM

/we start ODL

HANDS ON: RPM

[vagrant@localhost rpm]$ sudo systemctl is-active opendaylight
unknown
[vagrant@localhost rpm]$ sudo systemctl start opendaylight
[vagrant@localhost rpm]$ sudo systemctl is-active opendaylight
active

HANDS ON: RPM

/we connect to ODL

HANDS ON: RPM

[vagrant@localhost rpm]$ ./connect.sh

HANDS ON: RPM

opendaylight-user@root>info
Karaf
  Karaf version               3.0.3
  Karaf home                  /opt/opendaylight
...

HANDS ON: RPM

/we stop and remove ODL

HANDS ON: RPM

[vagrant@localhost rpm]$ sudo systemctl stop opendaylight
[vagrant@localhost rpm]$ ./uninstall.sh

HANDS ON: RPM

Uninstalling ODL
+ sudo rpm -e opendaylight-3.0.0

Puppet

Puppet

Puppet Forge

Puppet

Stable

Puppet

Well documented

Puppet

We work to make contributing easy.

Puppet

OS support


Puppet

Community: Ubuntu support

Puppet

Supports tarball-based installs

Puppet

class { 'opendaylight':
  install_method => 'tarball',
  tarball_url    => '<URL to your custom tarball>',
  unitfile_url   => '<URL to your custom unitfile>',
}

Puppet

Major part of OPNFV

Puppet


[~]$ less genesis/puppet/opnfv/manifests/network.pp
<snip>
class { "opendaylight":
  features => [<OPNFV's Karaf features>],
}
<snip>      

Puppet

Well tested

PUPPET

rspec-puppet

Puppet

[~/puppet-opendaylight]$ bundle exec rake test

Puppet

At a high level...

Puppet

In detail...

Puppet

---> syntax:manifests
---> syntax:templates
---> syntax:hiera:yaml

Puppet

Finished in 14.14 seconds (files took 0.53374 seconds to load)
537 examples, 0 failures

Total resources:   17
Touched resources: 17
Resource coverage: 100.00%

Puppet

rspec-puppet
"We're saying what we expected we said"

Puppet

metadata-json-lint metadata.json

Puppet

Beaker

Puppet

Deploy against real VMs

Puppet

Verify resulting state

Puppet

Repeat for various configs

Puppet

At a high level...

Puppet

In detail...

Puppet

Bringing machine 'centos-7' up with 'virtualbox' provider...

centos-7 12:45:09$ yum install -y puppet

Puppet

centos-7 12:45:46$ puppet apply <test manifest>

Puppet

centos-7 12:49:37$ /bin/sh -c systemctl\ is-active\ opendaylight
active

centos-7 executed in 0.04 seconds
      should be running

Puppet

centos-7 12:49:37$ /bin/sh -c id\ odl
uid=1001(odl) gid=1001(odl) groups=1001(odl)

centos-7 executed in 0.04 seconds
      should exist

Puppet

centos-7 executed in 0.05 seconds
            should match /^featuresBoot=standard,ssh/

Puppet

Finished in 5 minutes 22 seconds (files took 1 minute 10.87 seconds to load)
51 examples, 0 failures

Puppet

Beaker is pretty great

Puppet

Example: Vagrant provisioner

Puppet

At a high level...

Puppet

  # Box that installs ODL via Puppet RPM method on CentOS 7
  config.vm.define "cent7_pup_rpm" do |cent7_pup_rpm|
    # Build Vagrant box based on CentOS 7
    cent7_pup_rpm.vm.box = "chef/centos-7.0"

    # Add EPEL repo for access to Puppet et al
    cent7_pup_rpm.vm.provision "shell", inline: "yum install -y epel-release"

    # Install Puppet
    cent7_pup_rpm.vm.provision "shell", inline: "yum install -y puppet"

    # Install OpenDaylight using its Puppet module
    cent7_pup_rpm.vm.provision "puppet" do |puppet|
      puppet.module_path = ["modules"]
      puppet.manifest_file = "odl_install.pp"
    end
  end

Puppet

In detail...

Puppet

Install Puppet

Puppet

Configure provisioner
    # Install OpenDaylight using its Puppet module
    cent7_pup_rpm.vm.provision "puppet" do |puppet|
      puppet.module_path = ["modules"]
      puppet.manifest_file = "odl_install.pp"
    end       

Puppet

      puppet.module_path = ["modules"]

Puppet

[~/vagrant-opendaylight]$ librarian-puppet install
[~/vagrant-opendaylight]$ ls modules
archive  java  opendaylight  stdlib

Puppet

[~/vagrant-opendaylight]$ cat Puppetfile
#!/usr/bin/env ruby

forge "https://forgeapi.puppetlabs.com"

mod 'dfarrell07-opendaylight',
  :git => 'git://github.com/dfarrell07/puppet-opendaylight.git',
  :ref => 'origin/master'

Puppet

      puppet.manifest_file = "odl_install.pp"

Puppet

[~/vagrant-opendaylight]$ cat manifests/odl_install.pp
class { 'opendaylight':
  extra_features => ['odl-ovsdb-openstack'],
}

Puppet

Provision the box

Puppet

[~/vagrant-opendaylight]$ vagrant up cent7_pup_rpm

Puppet

ODL installed
Notice: /Stage[main]/Opendaylight::Install/Yumrepo[opendaylight]/ensure: created
Notice: /Stage[main]/Opendaylight::Install/Package[opendaylight]/ensure: created

Puppet

Features configured
/Stage[main]/Opendaylight::Config/File[org.apache.karaf.features.cfg]/content: content changed '<hash>' to '<different hash>'

Puppet

Explore

Puppet

[~/vagrant-opendaylight]$ vagrant ssh cent7_pup_rpm
[vagrant@localhost ~]$

Puppet

[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active

Puppet

[vagrant@localhost ~]$ /vagrant/scripts/connect.sh

Puppet


Puppet

opendaylight-user@root>config:list | grep featuresBoot\ =
   featuresBoot = <default features>,odl-ovsdb-openstack

Puppet

opendaylight-user@root>feature:list | grep odl-ovsdb-openstack
odl-ovsdb-openstack | 1.0.3-Helium-SR3 | x | ovsdb-1.0.3-Helium-SR3 <snip>

Puppet

#endexample

Puppet

Con: Complexity vs Ansible
(for me, not for users)

Puppet

Con: Ecosystem quality


Puppet

Future: OS support updates

Puppet

Future: Beaker using containers for speed

Puppet

Future:  Stackforge? OpenStack Puppet mods?

HANDS ON: Puppet

Hands On: Puppet

Let's visit the source

HANDS ON: PUPPET

/we visit source repo web UI

HANDS ON: PUPPET

/me shows layout of source

HANDS ON: PUPPET

Let's see it in the toolbox

HANDS ON: PUPPET

/we navigate to source dir in toolbox

HANDS ON: PUPPET

Run rspec-puppet tests

HANDS ON: PUPPET

/we run rspec-puppet tests

HANDS ON: PUPPET

/we modify tests and re-run

HANDS ON: PUPPET

[vagrant@localhost puppet-opendaylight]$ vim spec/classes/opendaylight_spec.rb

HANDS ON: PUPPET

Line 219 via `:219`

HANDS ON: PUPPET

[vagrant@localhost puppet-opendaylight]$ git diff
-        karaf_feature_tests(extra_features: extra_features)
+        karaf_feature_tests(extra_features: ['odl-toaster'])

HANDS ON: PUPPET

[vagrant@localhost puppet-opendaylight]$ bundle exec rake spec
# snip
537 examples, 1 failure

Failed examples:

rspec ./spec/classes/opendaylight_spec.rb[1:2:1:2:18] # opendaylight Karaf feature tests using default features and passing extra features should contain File[org.apache.karaf.features.cfg] with ensure => "file", path => "/opt/opendaylight/etc/org.apache.karaf.features.cfg", owner => "odl", group => "odl" and content =~ /^featuresBoot=config,standard,region,package,kar,ssh,management,odl-toaster/

HANDS ON: PUPPET

/we revert changes and test again

HANDS ON: PUPPET

[vagrant@localhost puppet-opendaylight]$ git checkout -- spec/classes/opendaylight_spec.rb 
[vagrant@localhost puppet-opendaylight]$ git diff

HANDS ON: PUPPET

[vagrant@localhost puppet-opendaylight]$ bundle exec rake spec
# snip
537 examples, 0 failures

Ansible

Ansible

Ansible Galaxy

Ansible

Simple

Ansible

[~/ansible-opendaylight]$ cat tasks/main.yml
- include: install_odl_via_rpm_repo.yml
  when: install_method == "rpm_repo"
- include: install_odl_via_rpm_path.yml
  when: install_method == "rpm_path"
- include: configure_karaf_features.yml
- include: configure_nb_rest_port.yml
- include: open_nb_rest_port.yml
- include: start_odl_systemd_service.yml

Ansible

- name: Start ODL systemd service
  service:
    name=opendaylight
    enabled=yes
    state=started

Ansible

- name: Configure ODL Karaf features
  template:
    src=org.apache.karaf.features.cfg
    dest=/opt/opendaylight/etc/
    owner=odl
    group=odl
  notify:
    - Stop ODL
    - Cleanup Karaf
    - Start ODL

Ansible

[~/ansible-opendaylight]$ wc -l **/*.yml 
<snip>
186 total

Ansible

Rejects Puppet's style of testing
“don’t unit test your playbook"

“Ansible believes you should not need another framework to validate basic things of your infrastructure”

Ansible

So no rspec-puppet or Beaker

Ansible

Beaker was kinda nice...

Ansible

No tears for rspec-puppet

Ansible

Fail fast and clearly

Ansible

Focus on the deployment logic

Ansible

Example: Vagrant provisioner

Ansible

At a high level...

Ansible

  # Box that installs ODL via its Ansible role on CentOS 7
  config.vm.define "cent7_ansible" do |cent7_ansible|
    # Build Vagrant box based on CentOS 7
    cent7_ansible.vm.box = "chef/centos-7.0"

    # Install ODL using the Ansible provisioner
    cent7_ansible.vm.provision "ansible" do |ansible|
      # Path to playbook that installs ODL using ODL's Ansible role
      ansible.playbook = "provisioning/playbook.yml"
    end
  end

Ansible

In detail...

Ansible

      ansible.playbook = "provisioning/playbook.yml"

Ansible

[~/vagrant-opendaylight]$ cat provisioning/playbook.yml
---
- hosts: all
  sudo: yes
  roles:
    - opendaylight

ansible

Provision the box

Ansible

[~/vagrant-opendaylight]$ vagrant up cent7_ansible

ansible

At a high level...


Ansible

In detail...

Ansible

TASK: [opendaylight | Add ODL yum repo] ********************************** 
changed: [cent7_ansible]
TASK: [opendaylight | Install ODL RPM] ***********************************
changed: [cent7_ansible]

Ansible

TASK: [opendaylight | Configure ODL Karaf features] ********************** 
changed: [cent7_ansible]

Ansible

TASK: [opendaylight | Configure ODL NB REST port] ************************ 
changed: [cent7_ansible]
TASK: [opendaylight | Check if FirewallD service is running] ************* 
ok: [cent7_ansible]
TASK: [opendaylight | Open ODL NB REST port via FirewallD] *************** 
skipping: [cent7_ansible]      

Ansible

TASK: [opendaylight | Start ODL systemd service] ************************* 
changed: [cent7_ansible]

Ansible

Explore

Ansible

[~/vagrant-opendaylight]$ vagrant ssh cent7_ansible
[vagrant@localhost ~]$

Ansible

[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active

Ansible

Example: config change

Ansible

[~/vagrant-opendaylight]$ cat provisioning/playbook.yml
---
- hosts: all
  sudo: yes
  roles:
    - role: opendaylight
      extra_features: ['odl-ovsdb-openstack']

ansible

At a high level...


Ansible

In detail...

Ansible

TASK: [opendaylight | Configure ODL Karaf features] ********************** 
changed: [cent7_ansible]

Ansible

NOTIFIED: [opendaylight | Stop ODL] ************************************** 
changed: [cent7_ansible]

NOTIFIED: [opendaylight | Cleanup Karaf] ********************************* 
changed: [cent7_ansible]

NOTIFIED: [opendaylight | Start ODL] ************************************* 
changed: [cent7_ansible]

Ansible

Explore

Ansible

[~/vagrant-opendaylight]$ vagrant ssh cent7_ansible

Ansible

[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active

Ansible

[vagrant@localhost ~]$ /vagrant/scripts/connect.sh


Ansible


Ansible

opendaylight-user@root>config:list | grep odl-ovsdb-openstack
featuresBoot = config,<snip>,odl-ovsdb-openstack

Ansible

opendaylight-user@root>feature:list | grep odl-ovsdb-openstack
odl-ovsdb-openstack | 1.0.3-Helium-SR3 | x | ovsdb-1.0.3-Helium-SR3 <snip>

Ansible

Example: Remote host

Ansible

[~]$ sudo ansible-galaxy install dfarrell07.opendaylight

Ansible

[~/sandbox]$ cat /etc/ansible/hosts
odl_box ansible_ssh_host=10.3.12.87 ansible_ssh_user=centos

Ansible

[~/sandbox]$ cat install_odl.yml
---
- hosts: odl_box
  sudo: yes
  roles:
    - opendaylight

Ansible

[~/sandbox]$ ansible-playbook install_odl.yml

ansible

At a high level...

ansible

In detail...

Ansible

TASK: [opendaylight | Configure ODL Karaf features] ************************** 
changed: [odl_box]

Ansible

TASK: [opendaylight | Start ODL systemd service] ***************************** 
changed: [odl_box]

Ansible

[~/sandbox]$ ssh ansible0

Ansible

[centos@dfarrell-ansible0 ~]$ sudo systemctl is-active opendaylight
active

Ansible

#endexamples

Ansible

Future: cluster support

Ansible

Future: Integrate ODL + OPNFV?

Ansible

Future: Wider OS support

Ansible

Future: Expanded used by Packer

Ansible

Future: Test in build system

Hands On: Ansible

HANDS ON: ANSIBLE

Let's visit the source

HANDS ON: ANSIBLE

/we visit source repo web UI

HANDS ON: ANSIBLE

/me shows layout of source

HANDS ON: ANSIBLE

Apply role to local system

HANDS ON: ANSIBLE

[vagrant@localhost ~]$ ansible-galaxy list
- dfarrell07.opendaylight, 0.4.0

HANDS ON: ANSIBLE

[vagrant@localhost ~]$ cat playbook.yml 
---
- hosts: localhost
  sudo: yes
  roles:
    - role: dfarrell07.opendaylight
      install_method: "rpm_path"
      rpm_path: "/vagrant/cache/opendaylight-3.0.0-2.el7.centos.noarch.rpm"

HANDS ON: ANSIBLE

[vagrant@localhost ~]$ ansible-playbook playbook.yml

HANDS ON: ANSIBLE

At a high level...

HANDS ON: ANSIBLE

Modify vars and re-apply role

HANDS ON: ANSIBLE

[vagrant@localhost ~]$ vim playbook.yml 
[vagrant@localhost ~]$ cat playbook.yml 
---
- hosts: localhost
  sudo: yes
  roles:
    - role: dfarrell07.opendaylight
      install_method: "rpm_path"
      rpm_path: "/vagrant/cache/opendaylight-3.0.0-2.el7.centos.noarch.rpm"
      extra_features: ['odl-toaster']

HANDS ON: ANSIBLE

[vagrant@localhost ~]$ ansible-playbook playbook.yml

HANDS ON: ANSIBLE

At a high level...

HANDS ON: ANSIBLE

TASK: [dfarrell07.opendaylight | Configure ODL Karaf features] *********** 
changed: [localhost]

HANDS ON: ANSIBLE

[vagrant@localhost ~]$ grep "^featuresBoot=" /opt/opendaylight/etc/org.apache.karaf.features.cfg 
featuresBoot=config,standard,region,package,kar,ssh,management,odl-toaster

Docker

Docker

Docker Hub

Docker

Example: One-liner Karaf shell

Docker

[~/sandbox]$ docker run -ti dfarrell07/odl:0.2.3 ./bin/karaf

Docker

[~/sandbox]$ docker ps
CONTACONTAINER ID   IMAGE                  COMMAND
b2869594fab3        dfarrell07/odl:0.2.3   "./bin/karaf"

Docker

Example: Build ODL's Docker image

Docker

[~/integration/packaging/docker]$ docker build -t dfarrell07/odl:0.2.3 .

Docker

At a high level...

Docker

In detail...

Docker

(needs an update)
Step 0 : FROM debian:7
 ---> 479215127fa7

Docker

Install Java
Step 2 : RUN apt-get update && apt-get install -y openjdk-7-jre-headless wget
 ---> Using cache
 ---> 7f3f5c682c1c

Docker

Very basic tarball-based install
Step 5 : RUN wget...

Docker

Open ports
Step 6 : EXPOSE 162 179 1088 1790 1830 2400 2550 2551 2552 4189 4342 5005 5666 6633 6640 6653 7800 8000 8080 8101 8181 8383 12001
 ---> Running in 8625b7f32695
 ---> 0be36e6be661

Docker

Start ODL
(lacks systemd support)
Step 9 : CMD ./bin/karaf server
 ---> Running in 16cab37bf9c2
 ---> af863ac2de74

Docker

#endexamples

docker

OPNFV Fuel uses containerized ODL

Docker

Future: Examples that build on base image

Docker

Future: Docker Hub ODL org

Docker

Future: Host containers on ODL infra?

Docker

Future: Build snapshots

Docker

Future: Build containers via Packer instead

Hands On: Docker

Hands On: Docker

Let's visit the source

Hands On: Docker

/we visit source repo web UI

Hands On: Docker

/we navigate to source in toolbox

Hands On: Docker

[vagrant@localhost ~]$ cd /vagrant/integration/packaging/docker/
[vagrant@localhost docker]$

Hands On: Docker

/we are awed by the magic oneliner

Hands On: Docker

[vagrant@localhost docker]$ docker run -ti dfarrell07/odl ./bin/karaf

Hands On: Docker

opendaylight-user@root>feature:install odl-toaster

Hands On: Docker

opendaylight-user@root>feature:list | grep toaster
odl-toaster  |  1.1.3-Helium-SR3  |  x  |  odl-mdsal-1.1.3-Helium-SR3

Hands On: Docker

Build Docker image
(cheat via cache)

Hands On: Docker

/we build ODL' s Docker image

Hands On: Docker

[vagrant@localhost docker]$ docker build -t odl:0.2.3 .

HANDS ON: DOCKER

/we explore our Docker image

HANDS ON: DOCKER

[vagrant@localhost docker]$ docker run -ti odl:0.2.3 bash
root@5d25df28e880:/opt/opendaylight#

HANDS ON: DOCKER

root@5d25df28e880:/opt/opendaylight# ./bin/karaf

HANDS ON: DOCKER

opendaylight-user@root>info

HANDS ON: DOCKER

opendaylight-user@root>^D
root@5d25df28e880:/opt/opendaylight# exit
[vagrant@localhost docker]$

Vagrant base box

Vagrant Base Box

Best user experience?

Vagrant Base Box

Example

Vagrant Base Box

[~/sandbox]$ vagrant init -m dfarrell07/opendaylight
[~/sandbox]$ cat Vagrantfile
Vagrant.configure(2) do |config|
  config.vm.box = "dfarrell07/opendaylight"
end

Vagrant Base Box

[~/sandbox]$ vagrant up

Vagrant Base Box

    default: URL: https://atlas.hashicorp.com/dfarrell07/opendaylight
==> default: Adding box 'dfarrell07/opendaylight' (v2.3.0)

Vagrant Base Box

[~/sandbox]$ vagrant status
Current machine states:

default                   running (virtualbox)

Vagrant Base Box

[~/sandbox]$ vagrant ssh

Vagrant Base Box

[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active

Vagrant Base Box

#endexample

Vagrant Base Box

Future: Support libvirt provider

Vagrant Base Box

Future: Support other OSs

Vagrant Base Box

Future: Convert Vagrantfiles to use ODL base

Vagrant Base box

Future: Official ODL account

Vagrant Base Box

Future: Integrate with build system
(build snapshots)

Vagrant Base Box

Future: Host on ODL infra

Hands on: VAGRANT BASE BOX

HANDS ON: VAGRANT BASE BOX

Skip the source, we'll get there

HANDS ON: VAGRANT BASE BOX

Demo!

HANDS ON: VAGRANT BASE BOX

/we stand up ODL's base box

HANDS ON: VAGRANT BASE BOX

/we disconnect from toolbox VM

HANDS ON:  VAGRANT BASE BOX

[~/pakdep-toolbox-opendaylight]$ ls -lh cache/opendaylight-2.3.0-centos-1503.box
-rw-rw-r--. 1 daniel daniel 1.1G Jul 24 16:07 cache/opendaylight-2.3.0-centos-1503.box

HANDS ON:  VAGRANT BASE BOX

/we add ODL's base box

HANDS ON: VAGRANT BASE BOX

[~/pakdep-toolbox-opendaylight]$ vagrant box add \
                                 --name "opendaylight" \
                                 cache/opendaylight-2.3.0-centos-1503.box \
                                 --force

HANDS ON: VAGRANT BASE BOX

==> box: Successfully added box 'opendaylight' (v0) for 'virtualbox'!

HANDS ON: VAGRANT BASE BOX

/we base a Vagrantfile on ODL's base box

HANDS ON: VAGRANT BASE BOX

[~/pakdep-toolbox-opendaylight]$ mkdir sandbox
[~/pakdep-toolbox-opendaylight]$ cd sandbox

HANDS ON: VAGRANT BASE BOX

[~/pakdep-toolbox-opendaylight/sandbox]$ vagrant init -m opendaylight

HANDS ON: VAGRANT BASE BOX

[~/pakdep-toolbox-opendaylight/sandbox]$ cat Vagrantfile
Vagrant.configure(2) do |config|
  config.vm.box = "opendaylight"
end

HANDS ON: VAGRANT BASE BOX

/we stand up ODL's base box

HANDS ON: VAGRANT BASE BOX

[~/pakdep-toolbox-opendaylight/sandbox]$ vagrant status
Current machine states:

default                   not created (virtualbox)

HANDS ON: VAGRANT BASE BOX

[~/pakdep-toolbox-opendaylight/sandbox]$ vagrant up 

HANDS ON: VAGRANT BASE BOX

/we explore the box

HANDS ON: VAGRANT BASE BOX

[~/pakdep-toolbox-opendaylight/sandbox]$ vagrant ssh
Last login: Fri Jun 12 17:59:10 2015 from 10.0.2.2
[vagrant@localhost ~]$

HANDS ON: VAGRANT BASE BOX

[vagrant@localhost ~]$ pgrep java
909
[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active

HANDS ON: VAGRANT BASE BOX

[vagrant@localhost ~]$ ssh -p 8101 karaf@localhost
("yes" to RSA cert, password "karaf`)

HANDS ON: VAGRANT BASE BOX

opendaylight-user@root>feature:list | grep odl-toaster
odl-toaster                           | 1.1.3-Helium-SR3    | x         | odl-mdsal-1.1.3-Helium-SR3

HANDS ON: VAGRANT BASE BOX

/we disconnect and suspend box

HANDS ON: VAGRANT BASE BOX

opendaylight-user@root>^D
Connection to localhost closed.
[vagrant@localhost ~]$ logout
Connection to 127.0.0.1 closed.
[~/pakdep-toolbox-opendaylight/sandbox]$ vagrant suspend
==> default: Saving VM state and suspending execution...

Packer

Packer

Creates ODL's Vagrant base box

Packer

Simple

Packer

[~/integration/packaging/packer]$ packer build centos.json

Packer

At a high level...

Packer

Details...
(but quickly)

Packer

Install CentOS from ISO against VM

Packer

Basic OS config via Kickstart

Packer

Shell provisioners
  "provisioners": [
    {   
      "type": "shell",
      "scripts":
        [
          "config_vagrant.sh",
          "config_virtualbox.sh",
          "config_ansible.sh"
        ]
    },

Packer

Ansible role installs ODL
#..."provisioners": [
    {
      "type": "ansible-local",
      "playbook_file": "install_odl.yml"
    }

Packer

Package as a Vagrant box
  "post-processors": [
    {
      "type": "vagrant",
      "compression_level": "9",
      "output": "opendaylight-{{ user `box_version` }}-centos-1503.box"
    }
  ]

Packer

==> Builds finished. The artifacts of successful builds are:
--> virtualbox' provider box: opendaylight-2.3.0-centos-1503.box

Packer

[~/integration/packaging/packer]$ ls -rc | tail -n 1
opendaylight-2.3.0-centos-1503.box

Packer

[~/sandbox]$ vagrant box add --name "opendaylight" \
                             opendaylight-2.3.0-centos-1503.box

Packer

[~/sandbox]$ vagrant init -m opendaylight

Packer

[~/sandbox]$ cat Vagrantfile
Vagrant.configure(2) do |config|
  config.vm.box = "opendaylight"
end

Packer

[~/sandbox]$ vagrant up
==> default: Importing base box 'opendaylight'...

Packer

[~/sandbox]$ vagrant ssh

Packer

[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active

Packer

#endexample

Packer

Everything' s in VCS

Packer

Configuration possible through Ansible

Packer

Room for growth

Packer

Future: Build containers

Packer

Future: Additional ODL versions

Packer

Future: Additional OS versions

Packer

Future: Integrate into build system
(build snapshots)

HANDS ON: PACKER?

Hands On: Packer?

#nope

HANDS ON: PACKER

Nested virt not possible given constraints

HANDS ON: PACKER

Dependencies too complex for tutorial

HANDS ON: PACKER

But, let's at least see the source

HANDS ON: PACKER

/we visit source repo web UI

HANDS ON: PACKER

/me shows layout of source

Review

REVIEW

We installed VBox/Vagrant

REVIEW

We used Vagrant to boot the pakdep toolbox

REVIEW

Learned about ODL's RPM

REVIEW

Built ODL's latest RPM from source

REVIEW

Installed ODL from your RPM

REVIEW

Started and explored ODL

REVIEW

Learned about ODL's Puppet mod

REVIEW

Saw examples Puppet testing

REVIEW

Saw example of Puppet mod as Vagrant provisioner

REVIEW

Ran ODL's rspec-puppet tests

REVIEW

Learned about ODL's Ansible role

REVIEW

Saw example of Ansible role as Vagrant provisioner

REVIEW

Saw example of Ansible role against remote host

REVIEW

Applied Ansible role to local system

REVIEW

Learned about ODL's Docker image

REVIEW

Ran the magic Docker oneliner

REVIEW

Built ODL's Docker image

REVIEW

Learned about ODL's Vagrant base box

REVIEW

Stood up ODL's Vagrant base box

REVIEW

Learned about Packer

REVIEW

Learned about the future of
*All things ODL packaging/deployment*

Conclusion

Conclusion

ODL has a rich deployment toolset

Conclusion

Reusable, composable building blocks

Conclusion

Enables modern automatic deployments

Conclusion

Enables drive-by exploration

Conclusion

Focus on quality

Conclusion

Contributions welcome :)

Contact

Daniel Farrell
SDN broadcasts via Twitter:

General:
dfarrell@redhat.com
dfarrell07 on IRC, GitHub

Tutorial: Deploying OpenDaylight

By Daniel Farrell

Tutorial: Deploying OpenDaylight

Tutorial given at OpenDaylight Summit 2015

  • 4,947