Daniel Farrell
Software Engineer, Red Hat SDN Team
[opendaylight-50-release]
name=CentOS CBS OpenDaylight Boron repository
baseurl=http://cbs.centos.org/repos/nfv7-opendaylight-50-release/$basearch/os/
enabled=1
gpgcheck=0
[~]$ sudo curl -o /etc/yum.repos.d/opendaylight-50-release.repo \
<URL to repo config>
[~]$ sudo yum install -y opendaylight
<snip>
Installed:
opendaylight.noarch 0:5.0.0-1.el7
Complete!
[~]$ sudo systemctl start opendaylight
[~]$ sudo systemctl is-active opendaylight
active
[/opt/opendaylight/bin]$ ./client
<snip>
opendaylight-user@root>feature:install ...
We work to make contributing easy.
class { 'opendaylight':
install_method => 'tarball',
tarball_url => '<URL to your custom tarball>',
unitfile_url => '<URL to your custom unitfile>',
}
Bringing machine 'centos-7' up with 'virtualbox' provider...
centos-7 12:45:09$ yum install -y puppet
centos-7 12:45:46$ puppet apply <test manifest>
centos-7 12:49:37$ /bin/sh -c systemctl\ is-active\ opendaylight
active
centos-7 executed in 0.04 seconds
should be running
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
centos-7 executed in 0.05 seconds
should match /^featuresBoot=standard,ssh/
Finished in 5 minutes 22 seconds (files took 1 minute 10.87 seconds to load)
132 examples, 0 failures
# 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 = "centos/7"
# 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.manifest_file = "odl_install.pp"
[~/vagrant-opendaylight]$ cat manifests/odl_install.pp
class { 'opendaylight':
extra_features => ['odl-netvirt-openstack'],
}
[~/vagrant-opendaylight]$ vagrant up cent7_pup_rpm
Notice: /Stage[main]/Opendaylight::Install/Yumrepo[opendaylight]/ensure: created
Notice: /Stage[main]/Opendaylight::Install/Package[opendaylight]/ensure: created
/Stage[main]/Opendaylight::Config/File[org.apache.karaf.features.cfg]/content: content changed '<hash>' to '<different hash>'
[~/vagrant-opendaylight]$ vagrant ssh cent7_pup_rpm
[vagrant@localhost ~]$
[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active
[vagrant@localhost ~]$ ssh -p 8101 karaf@localhost
# password "karaf"
opendaylight-user@root>feature:list | grep odl-netvirt-openstack
odl-netvirt-openstack | 0.3.0-Boron | x | <snip>
[~/ansible-opendaylight]$ cat tasks/main.yml
---
- include: install_odl.yml
- include: configure_karaf_features.yml
- include: configure_nb_rest_port.yml
- include: open_nb_rest_port.yml
- include: start_odl.yml
- name: Start ODL systemd service
service:
name=opendaylight
enabled=yes
state=started
- 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-opendaylight]$ wc -l **/*.yml
<snip>
203 total
“don’t unit test your playbook"
“Ansible believes you should not need another framework to validate basic things of your infrastructure”
# 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 = "centos/7"
# Install ODL using the Ansible provisioner
cent7_ansible.vm.provision "ansible" do |ansible|
# Path to Ansible playbook that installs ODL using ODL's Ansible role
ansible.playbook = "provisioning/playbook.yml"
end
end
ansible.playbook = "provisioning/playbook.yml"
[~/vagrant-opendaylight]$ cat provisioning/playbook.yml
---
- hosts: all
sudo: yes
roles:
- opendaylight
[~/vagrant-opendaylight]$ vagrant up cent7_ansible
TASK: [opendaylight | Add ODL yum repo] **********************************
changed: [cent7_ansible]
TASK: [opendaylight | Install ODL via RPM repo] **************************
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]
TASK: [opendaylight | Start ODL systemd service] *************************
changed: [cent7_ansible]
[~/vagrant-opendaylight]$ vagrant ssh cent7_ansible
[vagrant@localhost ~]$
[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active
[~/vagrant-opendaylight]$ cat provisioning/playbook.yml
---
- hosts: all
sudo: yes
roles:
- role: opendaylight
extra_features: ['odl-netvirt-openstack']
[~/vagrant-opendaylight]$ vagrant provision cent7_ansible
TASK: [opendaylight | Configure ODL Karaf features] **********************
changed: [cent7_ansible]
NOTIFIED: [opendaylight | Stop ODL] **************************************
changed: [cent7_ansible]
NOTIFIED: [opendaylight | Cleanup Karaf] *********************************
changed: [cent7_ansible]
NOTIFIED: [opendaylight | Start ODL] *************************************
changed: [cent7_ansible]
[~/vagrant-opendaylight]$ vagrant ssh cent7_ansible
[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active
[vagrant@localhost ~]$ /vagrant/scripts/connect.sh
opendaylight-user@root>feature:list | grep odl-netvirt-openstack
odl-netvirt-openstack | 0.3.0-Boron | x | <snip>
$ docker run -ti opendaylight/odl:5.0.0 /opt/opendaylight/bin/karaf
$ docker ps
CONTACONTAINER ID IMAGE COMMAND
b2869594fab3 opendaylight/odl:5.0.0 "/opt/opendaylight/bin/karaf"
[~/sandbox]$ vagrant init -m opendaylight/odl
[~/sandbox]$ cat Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "opendaylight/odl"
end
[~/sandbox]$ vagrant up
default: URL: https://atlas.hashicorp.com/opendaylight/odl
==> default: Adding box 'opendaylight/odl' (v5.0.0)
[~/sandbox]$ vagrant status
Current machine states:
default running (libvirt)
[~/sandbox]$ vagrant ssh
[vagrant@localhost ~]$ sudo systemctl is-active opendaylight
active
By Daniel Farrell
Talk given at OpenDaylight Summit 2016