diff options
Diffstat (limited to 'testing')
-rw-r--r-- | testing/puppet-fdio/LICENSE | 13 | ||||
-rw-r--r-- | testing/puppet-fdio/README.markdown | 113 | ||||
-rw-r--r-- | testing/puppet-fdio/manifests/honeycomb.pp | 14 | ||||
-rw-r--r-- | testing/puppet-fdio/manifests/honeycomb/install.pp | 18 | ||||
-rw-r--r-- | testing/puppet-fdio/manifests/honeycomb/service.pp | 12 | ||||
-rw-r--r-- | testing/puppet-fdio/manifests/init.pp | 51 | ||||
-rw-r--r-- | testing/puppet-fdio/manifests/install.pp | 34 | ||||
-rw-r--r-- | testing/puppet-fdio/manifests/params.pp | 14 | ||||
-rw-r--r-- | testing/puppet-fdio/manifests/test.pp | 2 | ||||
-rw-r--r-- | testing/puppet-fdio/manifests/vpp.pp | 25 | ||||
-rw-r--r-- | testing/puppet-fdio/manifests/vpp/config.pp | 18 | ||||
-rw-r--r-- | testing/puppet-fdio/manifests/vpp/install.pp | 18 | ||||
-rw-r--r-- | testing/puppet-fdio/manifests/vpp/service.pp | 20 | ||||
-rw-r--r-- | testing/puppet-fdio/templates/startup.conf.erb | 22 |
14 files changed, 374 insertions, 0 deletions
diff --git a/testing/puppet-fdio/LICENSE b/testing/puppet-fdio/LICENSE new file mode 100644 index 0000000..b8604c8 --- /dev/null +++ b/testing/puppet-fdio/LICENSE @@ -0,0 +1,13 @@ +Copyright 2016 Dan Radez (Red Hat), et al + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/testing/puppet-fdio/README.markdown b/testing/puppet-fdio/README.markdown new file mode 100644 index 0000000..33220d6 --- /dev/null +++ b/testing/puppet-fdio/README.markdown @@ -0,0 +1,113 @@ +# FD.IO + +#### Table of Contents +1. [Overview](#overview) +1. [Module Description](#module-description) +1. [Setup](#setup) +1. [Usage](#usage) +1. [Reference ](#reference) +1. [Limitations](#limitations) +1. [Development](#development) +1. [Release Notes/Contributors](#release-notescontributors) + +## Overview + +Puppet module that installs and configures [FD.IO][7]. + +## Module Description + +Deploys FD.IO to various OSs via package. + +All configuration should be handled through the Puppet +module's [params](#parameters). + +## Setup + +* Installs VPP and Honeycomb +* Assumes pre-exiting DPDK bindings +* Configures VPP's startup.conf +* Ensures services are running + + +## Usage + +The most basic usage, passing no parameters to the fdio class, will +install and start vpp and honeycomb with a default configuration. + +```puppet +class { 'fdio': +} +``` + +### Ports + +To change the port vpp listens use the `vpp_port` param. + + +```puppet +class { 'fdio': + vpp_port => '5002', +} +``` + +### Set uio-driver + +To set the uio-driver use the `dpdk_pmd_driver` param. + +```puppet +class { 'fdio': + dpdk_pmd_driver => 'vfio_pci', +} +``` + +## Reference + +### Classes + +#### Public classes + +* `::fdio`: Main entry point to the module. + +#### Private classes + +* `::fdio::params`: Contains default class param values. +* `::fdio::install`: Installs VPP and Honeycomb from packages. +* `::fdio::config`: Manages vpp config +* `::fdio::service`: Starts the services. + +### `::fdio` + +#### Parameters + +##### `vpp_port` + +Sets the VPP port. + +Default: `8080` + +Valid options: A valid port number for VPP to listen on. + +##### `dpdk_pmd_driver` + +Sets the uio-driver for vpp + +Default: `uio_pci_generic` + +Valid options: Driver names are specifed as strings. + + +## Limitations + +* Tested on CentOS 7. + +## Development + +We welcome contributions and work to make them easy! + +TODO + +## Release Notes/Contributors + +TODO + +[1]: <link to fd.io website> diff --git a/testing/puppet-fdio/manifests/honeycomb.pp b/testing/puppet-fdio/manifests/honeycomb.pp new file mode 100644 index 0000000..2471b2e --- /dev/null +++ b/testing/puppet-fdio/manifests/honeycomb.pp @@ -0,0 +1,14 @@ +# == Class: fdio::honeycomb +# +# fd.io::honeycomb +# +class fdio::honeycomb ( + $install_method = $::fdio::params::install_method, +) inherits ::fdio { + + class { '::fdio::honeycomb::install': + install_method => $install_method, + } -> + class { '::fdio::honeycomb::service': } -> + Class['::fdio'] +} diff --git a/testing/puppet-fdio/manifests/honeycomb/install.pp b/testing/puppet-fdio/manifests/honeycomb/install.pp new file mode 100644 index 0000000..2103cae --- /dev/null +++ b/testing/puppet-fdio/manifests/honeycomb/install.pp @@ -0,0 +1,18 @@ +# == Class fdio::honeycomb::install +# +# Manages the installation of fdio. +# +class fdio::honeycomb::install ( + $install_method = $::fdio::params::install_method, +) inherits fdio::install { + if $fdio::install_method == 'rpm' { + # Install the HC RPM + package { 'honeycomb': + ensure => present, + require => Yumrepo['fdio-master'], + } + } + else { + fail("Unknown install method: ${fdio::install_method}") + } +} diff --git a/testing/puppet-fdio/manifests/honeycomb/service.pp b/testing/puppet-fdio/manifests/honeycomb/service.pp new file mode 100644 index 0000000..58f7ae3 --- /dev/null +++ b/testing/puppet-fdio/manifests/honeycomb/service.pp @@ -0,0 +1,12 @@ +# == Class fdio::honeycomb::service +# +# Starts the honeycomb systemd or Upstart service. +# +class fdio::honeycomb::service { + service { 'honeycomb': + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + } +} diff --git a/testing/puppet-fdio/manifests/init.pp b/testing/puppet-fdio/manifests/init.pp new file mode 100644 index 0000000..ee6d25d --- /dev/null +++ b/testing/puppet-fdio/manifests/init.pp @@ -0,0 +1,51 @@ +# == Class: fdio +# +# fd.io +# +# === Parameters +# [* vpp_port *] +# Port for VPP to listen on. +# [* dpdk_pmd_driver *] +# Sets VPP's uio-driver value +class fdio inherits ::fdio::params { + + # 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 < 22 are EOL as of 2015-12-01 + # https://fedoraproject.org/wiki/End_of_life + if $::operatingsystemmajrelease < '22' { + fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}") + } + } + ubuntu: { + if $::operatingsystemmajrelease != '14.04' { + # Only tested on 14.04 + fail("Unsupported OS: ${::operatingsystem} ${::operatingsystemmajrelease}") + } + } + default: { + fail("Unsupported OS: ${::operatingsystem}") + } + } + + class { '::fdio::install': } -> + Class['::fdio'] +} diff --git a/testing/puppet-fdio/manifests/install.pp b/testing/puppet-fdio/manifests/install.pp new file mode 100644 index 0000000..ddba26b --- /dev/null +++ b/testing/puppet-fdio/manifests/install.pp @@ -0,0 +1,34 @@ +# == Class fdio::install +# +# Manages the installation of fdio. +# +class fdio::install ( + $install_method = $::fdio::params::install_method, +){ + if $install_method == 'rpm' { + # Choose Yum URL based on OS (CentOS vs Fedora) + # NB: Currently using the CentOS CBS for both Fedora and CentOS + $base_url = $::operatingsystem ? { + 'CentOS' => 'https://nexus.fd.io/content/repositories/fd.io.master.centos7/', + 'Fedora' => 'https://nexus.fd.io/content/repositories/fd.io.master.centos7/', + } + + # Add fdio's Yum repository + yumrepo { 'fdio-master': + # 'ensure' isn't supported with Puppet <3.5 + # Seems to default to present, but docs don't say + # https://docs.puppetlabs.com/references/3.4.0/type.html#yumrepo + # https://docs.puppetlabs.com/references/3.5.0/type.html#yumrepo + baseurl => $base_url, + descr => 'fd.io master branch latest merge', + enabled => 1, + # NB: RPM signing is an active TODO, but is not done. We will enable + # this gpgcheck once the RPM supports it. + gpgcheck => 0, + } + + } + else { + fail("Unknown install method: ${fdio::install_method}") + } +} diff --git a/testing/puppet-fdio/manifests/params.pp b/testing/puppet-fdio/manifests/params.pp new file mode 100644 index 0000000..01908c3 --- /dev/null +++ b/testing/puppet-fdio/manifests/params.pp @@ -0,0 +1,14 @@ +# == Class fdio::params +# +# This class manages the default params for the ODL class. +# +class fdio::params { + # NB: If you update the default values here, you'll also need to update: + # spec/spec_helper_acceptance.rb's install_odl helper fn + # spec/classes/fdio_spec.rb tests that use default Karaf features + # Else, both the Beaker and RSpec tests will fail + # TODO: Remove this possible source of bugs^^ + $install_method = 'rpm' + $dpdk_pmd_type = 'uio_pci_generic' + $dpdk_pci_devs = [] +} diff --git a/testing/puppet-fdio/manifests/test.pp b/testing/puppet-fdio/manifests/test.pp new file mode 100644 index 0000000..6317bda --- /dev/null +++ b/testing/puppet-fdio/manifests/test.pp @@ -0,0 +1,2 @@ +class { '::fdio::vpp': } +class { '::fdio::honeycomb': } diff --git a/testing/puppet-fdio/manifests/vpp.pp b/testing/puppet-fdio/manifests/vpp.pp new file mode 100644 index 0000000..bf23901 --- /dev/null +++ b/testing/puppet-fdio/manifests/vpp.pp @@ -0,0 +1,25 @@ +# == Class: fdio::vpp +# +# fd.io::vpp +# +# === Parameters +# [* vpp_port *] +# Port for VPP to listen on. +# [* dpdk_pmd_driver *] +# Sets VPP's uio-driver value +class fdio::vpp ( + $install_method = $::fdio::params::install_method, + $dpdk_pmd_type = $::fdio::params::dpdk_pmd_type, + $dpdk_pci_devs = $::fdio::params::dpdk_pci_devs, +) inherits ::fdio { + + class { '::fdio::vpp::install': + install_method => $install_method, + } -> + class { '::fdio::vpp::config': + dpdk_pmd_type => $dpdk_pmd_type, + dpdk_pci_devs => $dpdk_pci_devs, + } ~> + class { '::fdio::vpp::service': } -> + Class['::fdio::vpp'] +} diff --git a/testing/puppet-fdio/manifests/vpp/config.pp b/testing/puppet-fdio/manifests/vpp/config.pp new file mode 100644 index 0000000..96c3497 --- /dev/null +++ b/testing/puppet-fdio/manifests/vpp/config.pp @@ -0,0 +1,18 @@ +# == Class fdio::vpp::config +# +# This class handles vpp config changes. +# +class fdio::vpp::config ( + $dpdk_pmd_type = $::fdio::params::dpdk_pmd_type, + $dpdk_pci_devs = $::fdio::params::dpdk_pci_devs, +){ + file { '/etc/vpp/startup.conf': + content => template('fdio/startup.conf.erb'), + } + + # ensure that uio-pci-generic is loaded + exec { 'modprobe uio-pci-generic': + unless => 'lsmod | grep uio-pci-generic', + path => '/bin:/sbin', + } +} diff --git a/testing/puppet-fdio/manifests/vpp/install.pp b/testing/puppet-fdio/manifests/vpp/install.pp new file mode 100644 index 0000000..3ae4f87 --- /dev/null +++ b/testing/puppet-fdio/manifests/vpp/install.pp @@ -0,0 +1,18 @@ +# == Class fdio::vpp::install +# +# Manages the installation of vpp. +# +class fdio::vpp::install ( + $install_method = $::fdio::params::install_method, +) inherits fdio::install { + if $install_method == 'rpm' { + # Install the VPP RPM + package { 'vpp': + ensure => present, + require => Yumrepo['fdio-master'], + } + } + else { + fail("Unknown install method: ${fdio::install_method}") + } +} diff --git a/testing/puppet-fdio/manifests/vpp/service.pp b/testing/puppet-fdio/manifests/vpp/service.pp new file mode 100644 index 0000000..7453695 --- /dev/null +++ b/testing/puppet-fdio/manifests/vpp/service.pp @@ -0,0 +1,20 @@ +# == Class fdio::vpp::service +# +# Starts the VPP systemd or Upstart service. +# +class fdio::vpp::service { + # TODO + # bring interfaces down before service start + # so vpp can bind + service { 'vpp': + ensure => running, + enable => true, + hasstatus => true, + hasrestart => true, + } + # TODO + #sudo vppctl set interface ip address TenGigabitEthernet7/0/0 192.168.21.21/24 + #sudo vppctl set interface state TenGigabitEthernet7/0/0 up + + +} diff --git a/testing/puppet-fdio/templates/startup.conf.erb b/testing/puppet-fdio/templates/startup.conf.erb new file mode 100644 index 0000000..38a43ea --- /dev/null +++ b/testing/puppet-fdio/templates/startup.conf.erb @@ -0,0 +1,22 @@ +unix { + cli-listen localhost:5002 + nodaemon + log /tmp/vpp.log + full-coredump +} + +dpdk { + <% dpdk_pci_devs.each do |n| -%> + dev <%=n-%> + + <% end -%> + uio-driver <%=@dpdk_pmd_type%> +} + +api-trace { + on +} + +api-segment { + gid vpp +} |