diff options
author | Feng Pan <fpan@redhat.com> | 2016-11-07 19:22:21 -0500 |
---|---|---|
committer | Feng Pan <fpan@redhat.com> | 2016-11-21 21:27:09 -0500 |
commit | 9326e4237f4d161f297dc4493ab4928ea6e2bf0f (patch) | |
tree | 25372fa964fe84b160c5bfc58304285902edbefc /manifests | |
parent | c70bea9fb9cd5dfb29d7ab8f7aaae7324c31f1e3 (diff) |
Initial Commit.
Change-Id: I212ec4be42357edddd931e9e479e33131ccd4bac
Signed-off-by: Feng Pan <fpan@redhat.com>
Diffstat (limited to 'manifests')
-rw-r--r-- | manifests/config.pp | 16 | ||||
-rw-r--r-- | manifests/honeycomb.pp | 51 | ||||
-rw-r--r-- | manifests/init.pp | 90 | ||||
-rw-r--r-- | manifests/install.pp | 25 | ||||
-rw-r--r-- | manifests/params.pp | 13 | ||||
-rw-r--r-- | manifests/service.pp | 13 |
6 files changed, 208 insertions, 0 deletions
diff --git a/manifests/config.pp b/manifests/config.pp new file mode 100644 index 0000000..aeac676 --- /dev/null +++ b/manifests/config.pp @@ -0,0 +1,16 @@ +# == Class fdio::config +# +# This class handles fdio config changes. +# +class fdio::config { + file { '/etc/vpp/startup.conf': + content => template('fdio/startup.conf.erb'), + } + + # ensure that dpdk module is loaded + exec { 'insert_dpdk_kmod': + command => "modprobe ${::fdio::vpp_dpdk_uio_driver}", + unless => "lsmod | grep ${::fdio::vpp_dpdk_uio_driver}", + path => '/bin:/sbin', + } +} diff --git a/manifests/honeycomb.pp b/manifests/honeycomb.pp new file mode 100644 index 0000000..3d28179 --- /dev/null +++ b/manifests/honeycomb.pp @@ -0,0 +1,51 @@ +# == Class: honeycomb +# +# OpenDaylight Honeycomb Agent +# +# === Parameters: +# [*rest_port*] +# Port for Honeycomb REST interface to listen on. +# +# [*websocket_rest_port*] +# Port for Honeycomb REST interface to listen on for websocket connections. +# +# [*user*] +# Username to configure in honeycomb. +# +# [*password*] +# Password to configure in honeycomb. +# +class fdio::honeycomb ( + $rest_port = '8181', + $websocket_rest_port = '7779', + $user = 'admin', + $password = 'admin', +) { + include ::fdio + + package { 'honeycomb': + ensure => present, + require => Package['vpp'], + } + -> + # Configuration of Honeycomb + file { 'honeycomb.json': + ensure => file, + path => '/opt/honeycomb/config/honeycomb.json', + # Set user:group owners + owner => 'honeycomb', + group => 'honeycomb', + # Use a template to populate the content + content => template('fdio/honeycomb.json.erb'), + } + ~> + service { 'honeycomb': + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + require => [ Vpp_service['vpp'], Package['honeycomb'] ], + restart => 'systemctl stop vpp;systemctl stop honeycomb;rm -rf /var/lib/honeycomb/persist/*;systemctl start vpp; sleep 5;systemctl start honeycomb', + } + +} diff --git a/manifests/init.pp b/manifests/init.pp new file mode 100644 index 0000000..7f2d09d --- /dev/null +++ b/manifests/init.pp @@ -0,0 +1,90 @@ +# == Class: fdio +# +# Installs vpp and configures /etc/vpp/startup.conf +# +# === Parameters: +# [*repo_branch*] +# (optional) fd.io repo branch, valid values are 'release', 'master', and stable branch such as 'stable.1609'. +# Defaults to 'release'. +# +# [*vpp_dpdk_devs*] +# (optional) Array of PCI addresses to bind to vpp. +# Defaults to undef. +# +# [*vpp_dpdk_uio_driver*] +# (optional) VPP DPDK UIO driver type. +# Defaults to 'uio_pci_generic' +# +# [*vpp_vlan_enabled*] +# (optional) Enabled vlan tagged traffic on VPP interfaces. This is needed to configure +# vlan_strip_offload option for Cisco VIC interfaces. +# Default to false. +# +# [*vpp_cpu_main_core*] +# (optional) VPP main thread pinning. +# Defaults to undef (no pinning) +# +# [*vpp_cpu_corelist_workers*] +# (optional) List of cores for VPP worker thread pinning in string format. +# Defaults to undef (no pinning) +# +# [*copy_kernel_nic_ip*] +# (optional) Configures VPP interface with IP settings found on its corresponding kernel NIC. +# Defaults to true +# +class fdio ( + $repo_branch = $::fdio::params::repo_branch, + $vpp_dpdk_devs = $::fdio::params::vpp_dpdk_devs, + $vpp_dpdk_uio_driver = $::fdio::params::vpp_dpdk_uio_driver, + $vpp_vlan_enabled = $::fdio::params::vpp_vlan_enabled, + $vpp_cpu_main_core = $::fdio::params::vpp_cpu_main_core, + $vpp_cpu_corelist_workers = $::fdio::params::vpp_cpu_corelist_workers, + $copy_kernel_nic_ip = $::fdio::params::copy_kernel_nic_ip, +) inherits ::fdio::params { + + validate_array($vpp_dpdk_devs) + validate_bool($vpp_vlan_enabled) + validate_bool($copy_kernel_nic_ip) + + # Validate OS family + case $::osfamily { + 'RedHat': {} + 'Debian': { + warning('Debian has limited support, is less stable, less tested.') + } + default: { + fail("Unsupported OS family: ${::osfamily}") + } + } + + # Validate OS + case $::operatingsystem { + 'centos', 'redhat': { + if $::operatingsystemmajrelease != '7' { + # RHEL/CentOS versions < 7 not supported as they lack systemd + fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}") + } + } + 'fedora': { + # Fedora distros < 23 are EOL as of 2016-07-19 + # https://fedoraproject.org/wiki/End_of_life + if $::operatingsystemmajrelease < '23' { + fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}") + } + } + 'ubuntu': { + if $::operatingsystemmajrelease != '16.04' { + fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}") + } + } + default: { + fail("Unsupported OS: ${::operatingsystem}") + } + } + + class { '::fdio::install': } -> + class { '::fdio::config': } ~> + class { '::fdio::service': } -> + Class['::fdio'] + +} diff --git a/manifests/install.pp b/manifests/install.pp new file mode 100644 index 0000000..14577a7 --- /dev/null +++ b/manifests/install.pp @@ -0,0 +1,25 @@ +# == Class fdio::install +# +# Manages the installation of fdio. +# +class fdio::install { + $base_url = $fdio::repo_branch ? { + 'release' => 'https://nexus.fd.io/content/repositories/fd.io.centos7/', + 'master' => 'https://nexus.fd.io/content/repositories/fd.io.master.centos7/', + default => "https://nexus.fd.io/content/repositories/fd.io.${fdio::repo_branch}.centos7/", + } + + # Add fdio's Yum repository + yumrepo { "fdio-${fdio::repo_branch}": + baseurl => $base_url, + descr => "FD.io ${fdio::repo_branch} packages", + enabled => 1, + gpgcheck => 0, + } + + # Install the VPP RPM + package { 'vpp': + ensure => present, + require => Yumrepo["fdio-${fdio::repo_branch}"], + } +} diff --git a/manifests/params.pp b/manifests/params.pp new file mode 100644 index 0000000..9dae301 --- /dev/null +++ b/manifests/params.pp @@ -0,0 +1,13 @@ +# == Class fdio::params +# +# This class manages the default params for the fdio class. +# +class fdio::params { + $repo_branch = 'release' + $vpp_dpdk_devs = [] + $vpp_dpdk_uio_driver = 'uio_pci_generic' + $vpp_vlan_enabled = false + $vpp_cpu_main_core = undef + $vpp_cpu_corelist_workers = undef + $copy_kernel_nic_ip = true +} diff --git a/manifests/service.pp b/manifests/service.pp new file mode 100644 index 0000000..cb08721 --- /dev/null +++ b/manifests/service.pp @@ -0,0 +1,13 @@ +# == Class fdio::service +# +# Configure and start VPP service. +# +class fdio::service { + vpp_service { 'vpp' : + ensure => present, + pci_devs => $::fdio::vpp_dpdk_devs, + state => 'up', + copy_kernel_nic_ip => $::fdio::copy_kernel_nic_ip, + } +} + |