Daniel Farrell
Software Engineer, Red Hat SDN Team
[opendaylight-6-testing]
name=CentOS CBS OpenDaylight Carbon testing repository
baseurl=http://cbs.centos.org/repos/nfv7-opendaylight-6-testing/$basearch/os/
enabled=1
gpgcheck=0
[~]$ sudo curl -o /etc/yum.repos.d/opendaylight-6-testing.repo \
<URL to repo config>
[~]$ sudo yum install -y opendaylight
<snip>
Installed:
opendaylight.noarch 0:6.0.0-0.1.20170405snap4741.el7
Complete!
[~]$ sudo systemctl start opendaylight
[~]$ sudo systemctl is-active opendaylight
active
$ ssh -p 8101 karaf@localhost
opendaylight-user@root>feature:install ...
class opendaylight::params {
$default_features = ['config', 'standard', 'region', 'package', 'kar', 'ssh', 'management']
$extra_features = []
$odl_rest_port = '8080'
$odl_bind_ip = '0.0.0.0'
$rpm_repo = 'opendaylight-6-testing'
$deb_repo = 'ppa:odl-team/boron'
$log_levels = {}
$enable_ha = false
$ha_node_ips = []
$ha_node_index = 0
$security_group_mode = 'stateful'
$vpp_routing_node = ''
$java_opts = '-Djava.net.preferIPv4Stack=true'
$manage_repositories = true
$username = 'admin'
$password = 'admin'
}
desc "Run syntax, lint, and spec tests."
task :test => [
:syntax,
:lint,
:metadata_lint,
:spec,
]
Executing section git...
Executing section spacing...
Executing section markdown...
Executing section rest...
Executing section yaml...
Executing section json...
Executing section xml...
Bringing machine 'centos-7' up with 'libvirt' 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
desc "All tests, use containers for Beaker tests"
task :acceptance_dock => [
:cent_5rel_dock,
:ubuntu_5rel_dock,
:cent_5test_dock,
:cent_6test_dock,
]
desc "All tests, use VMs for Beaker tests"
task :acceptance_vm => [
:cent_5rel_vm,
:ubuntu_5rel_vm,
:cent_5test_vm,
:cent_6test_vm,
]
# 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 ~]$ 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>
$ docker run -ti opendaylight/odl /opt/opendaylight/bin/karaf
$ docker ps
CONTACONTAINER ID IMAGE COMMAND
b2869594fab3 opendaylight/odl:latest "/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 ONS 2017 with Marcus Williams