diff options
-rw-r--r-- | lib/puppet/provider/vpp_config/vpp.rb | 2 | ||||
-rw-r--r-- | manifests/config.pp | 29 | ||||
-rw-r--r-- | manifests/init.pp | 5 | ||||
-rw-r--r-- | manifests/install.pp | 7 | ||||
-rw-r--r-- | manifests/params.pp | 1 | ||||
-rw-r--r-- | spec/acceptance/fdio_spec.rb | 5 | ||||
-rw-r--r-- | spec/acceptance/honeycomb_spec.rb | 1 | ||||
-rw-r--r-- | spec/classes/fdio_spec.rb | 1 | ||||
-rw-r--r-- | spec/spec_helper_acceptance.rb | 41 |
9 files changed, 77 insertions, 15 deletions
diff --git a/lib/puppet/provider/vpp_config/vpp.rb b/lib/puppet/provider/vpp_config/vpp.rb index 2574d4c..eb49fe3 100644 --- a/lib/puppet/provider/vpp_config/vpp.rb +++ b/lib/puppet/provider/vpp_config/vpp.rb @@ -36,7 +36,7 @@ Puppet::Type.type(:vpp_config).provide(:vpp) do scanner = StringScanner.new vpp_config #first skip to section beginning - string = scanner.scan_until(/#{@section}\s*{\s*/) + string = scanner.scan_until(/^\s*#{@section}\s*{\s*/) #if we can't find the section, add it to the end return vpp_config+"\n#{@section} {", "", "}\n" unless string diff --git a/manifests/config.pp b/manifests/config.pp index b74f6d4..b1ed7ad 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -4,20 +4,25 @@ # class fdio::config { + if $fdio::vpp_dpdk_support { + # ensure that dpdk module is loaded + $dpdk_pmd_real = regsubst($fdio::vpp_dpdk_uio_driver, '-', '_', 'G') + exec { 'insert_dpdk_kmod': + command => "modprobe ${fdio::vpp_dpdk_uio_driver}", + unless => "lsmod | grep ${dpdk_pmd_real}", + path => '/bin:/sbin', + } + + vpp_config { + 'dpdk/dev/default': value => $fdio::vpp_dpdk_dev_default_options; + 'dpdk/uio-driver': value => $fdio::vpp_dpdk_uio_driver; + } + + fdio::config::vpp_devices { $fdio::vpp_dpdk_devs: } + } + vpp_config { - 'dpdk/dev/default': value => $fdio::vpp_dpdk_dev_default_options; - 'dpdk/uio-driver': value => $fdio::vpp_dpdk_uio_driver; 'cpu/main-core': value => $fdio::vpp_cpu_main_core; 'cpu/corelist-workers': value => $fdio::vpp_cpu_corelist_workers; } - - fdio::config::vpp_devices { $fdio::vpp_dpdk_devs: } - - # ensure that dpdk module is loaded - $dpdk_pmd_real = regsubst($fdio::vpp_dpdk_uio_driver, '-', '_', 'G') - exec { 'insert_dpdk_kmod': - command => "modprobe ${fdio::vpp_dpdk_uio_driver}", - unless => "lsmod | grep ${dpdk_pmd_real}", - path => '/bin:/sbin', - } } diff --git a/manifests/init.pp b/manifests/init.pp index fbdc453..e2d1c0b 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -8,6 +8,10 @@ # Valid values are 'release', 'master' and stable branch like 'stable.1609'. # Defaults to 'release'. # +# [*vpp_dpdk_support*] +# (optional) Enable DPDK support for VPP +# Defaults to true +# # [*vpp_dpdk_devs*] # (optional) Array of PCI addresses to bind to vpp. # Defaults to undef. @@ -39,6 +43,7 @@ # class fdio ( $repo_branch = $::fdio::params::repo_branch, + $vpp_dpdk_support = $::fdio::params::vpp_dpdk_support, $vpp_dpdk_devs = $::fdio::params::vpp_dpdk_devs, $vpp_dpdk_uio_driver = $::fdio::params::vpp_dpdk_uio_driver, $vpp_dpdk_dev_default_options = $::fdio::params::vpp_dpdk_dev_default_options, diff --git a/manifests/install.pp b/manifests/install.pp index 14577a7..bad8ec4 100644 --- a/manifests/install.pp +++ b/manifests/install.pp @@ -22,4 +22,11 @@ class fdio::install { ensure => present, require => Yumrepo["fdio-${fdio::repo_branch}"], } + + if $fdio::vpp_dpdk_support { + package { 'vpp-plugins': + ensure => present, + require => Package['vpp'], + } + } } diff --git a/manifests/params.pp b/manifests/params.pp index 9adba11..c3c3ed8 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -4,6 +4,7 @@ # class fdio::params { $repo_branch = 'release' + $vpp_dpdk_support = true $vpp_dpdk_devs = [] $vpp_dpdk_uio_driver = 'uio_pci_generic' $vpp_dpdk_dev_default_options = undef diff --git a/spec/acceptance/fdio_spec.rb b/spec/acceptance/fdio_spec.rb index 168c085..3cc88ad 100644 --- a/spec/acceptance/fdio_spec.rb +++ b/spec/acceptance/fdio_spec.rb @@ -6,7 +6,9 @@ describe 'fdio' do it 'should work with no errors' do pp= <<-EOS - class { '::fdio': } + class { '::fdio': + repo_branch => 'master' + } EOS apply_manifest(pp, :catch_failures => true) @@ -26,6 +28,7 @@ describe 'fdio' do it { should be_running } it { should be_enabled } end + end context 'pinning' do diff --git a/spec/acceptance/honeycomb_spec.rb b/spec/acceptance/honeycomb_spec.rb index 426d3b9..012693b 100644 --- a/spec/acceptance/honeycomb_spec.rb +++ b/spec/acceptance/honeycomb_spec.rb @@ -28,6 +28,7 @@ describe 'fdio::honeycomb' do it { should be_running } it { should be_enabled } end + end end
\ No newline at end of file diff --git a/spec/classes/fdio_spec.rb b/spec/classes/fdio_spec.rb index 4b65779..847bc08 100644 --- a/spec/classes/fdio_spec.rb +++ b/spec/classes/fdio_spec.rb @@ -41,6 +41,7 @@ describe 'fdio' do ) } it { should contain_package('vpp').that_requires('Yumrepo[fdio-stable.1609]') } + it { should contain_package('vpp-plugins').that_requires('Package[vpp]') } end end diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb index 9196bc9..ea9b6dc 100644 --- a/spec/spec_helper_acceptance.rb +++ b/spec/spec_helper_acceptance.rb @@ -1 +1,40 @@ -require 'puppet-openstack_spec_helper/beaker_spec_helper' +require 'beaker-rspec' + +install_puppet_on(hosts, options) + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(Dir.getwd)) + module_name = JSON.parse(open('metadata.json').read)['name'].split('-')[1] + + # Make sure proj_root is the real project root + unless File.exists?("#{proj_root}/metadata.json") + raise "bundle exec rspec spec/acceptance needs be run from module root." + end + + # Readable test descriptions + c.formatter = :documentation + + # Configure all nodes in nodeset + c.before :suite do + # Install module and dependencies + hosts.each do |host| + # Start out with clean moduledir, don't trust r10k to purge it + on host, "rm -rf /etc/puppet/modules/*" + + # Make sure EPEL is not installed. + # It can happens in OpenStack Infra when using centos7 images. + if os[:family].casecmp('RedHat') == 0 + on host, "rpm -e epel-release || true" + end + + on(host, puppet('module', 'install', 'puppetlabs-stdlib')) + on(host, puppet('module', 'install', 'puppetlabs-dummy_service')) + + # Install the module being tested + on host, "rm -fr /etc/puppet/modules/#{module_name}" + puppet_module_install(:source => proj_root, :module_name => module_name) + + end + end +end
\ No newline at end of file |