diff options
-rw-r--r-- | lib/puppet/provider/vpp_config/vpp.rb | 118 | ||||
-rw-r--r-- | lib/puppet/provider/vpp_service/vpp.rb | 113 | ||||
-rw-r--r-- | lib/puppet/type/vpp_config.rb | 14 | ||||
-rw-r--r-- | lib/puppet/type/vpp_service.rb | 46 | ||||
-rw-r--r-- | manifests/config.pp | 15 | ||||
-rw-r--r-- | manifests/config/vpp_devices.pp | 15 | ||||
-rw-r--r-- | manifests/honeycomb.pp | 2 | ||||
-rw-r--r-- | manifests/init.pp | 35 | ||||
-rw-r--r-- | manifests/params.pp | 2 | ||||
-rw-r--r-- | manifests/service.pp | 9 | ||||
-rwxr-xr-x | scripts/ci-beaker.sh | 2 | ||||
-rwxr-xr-x | scripts/ci-unit-tests.sh | 2 | ||||
-rw-r--r-- | spec/acceptance/fdio_spec.rb | 1 | ||||
-rw-r--r-- | spec/classes/fdio_spec.rb | 25 | ||||
-rw-r--r-- | spec/classes/honeycomb_spec.rb | 2 | ||||
-rw-r--r-- | spec/unit/provider/vpp_config/vpp_spec.rb | 37 | ||||
-rw-r--r-- | spec/unit/provider/vpp_service/vpp_spec.rb | 44 | ||||
-rw-r--r-- | spec/unit/type/vpp_config_spec.rb | 15 | ||||
-rw-r--r-- | spec/unit/type/vpp_service_spec.rb | 56 | ||||
-rw-r--r-- | templates/startup.conf.erb | 25 |
20 files changed, 244 insertions, 334 deletions
diff --git a/lib/puppet/provider/vpp_config/vpp.rb b/lib/puppet/provider/vpp_config/vpp.rb new file mode 100644 index 0000000..2574d4c --- /dev/null +++ b/lib/puppet/provider/vpp_config/vpp.rb @@ -0,0 +1,118 @@ +Puppet::Type.type(:vpp_config).provide(:vpp) do + + def file_path + '/etc/vpp/startup.conf' + end + + def initialize(value={}) + super(value) + settings_arr = @resource[:setting].split('/') + @section = settings_arr[0] + @real_setting = settings_arr[1] + @dev = settings_arr[2] + + if @section.nil? || @real_setting.nil? + fail("#{@resource[:setting]} is not a valid setting string") + end + + if @dev + @search_regex = /^\s*dev\s+#{@dev}\s*({[^}]*})?/ + else + @search_regex = /^\s*#{@real_setting}\s+(\S+)?/ + end + + end + + def write_config(config) + if File.read(file_path) != config + File.open(file_path, 'w') do |fh| + fh.puts(config) + end + end + end + + def get_sections + vpp_config = File.read(file_path) + scanner = StringScanner.new vpp_config + + #first skip to section beginning + string = scanner.scan_until(/#{@section}\s*{\s*/) + + #if we can't find the section, add it to the end + return vpp_config+"\n#{@section} {", "", "}\n" unless string + + level = 1 + before = string + after = '' + section_config = '' + + while current_char = scanner.getch + case current_char + when '{' + level += 1 + section_config << current_char + when '}' + level -= 1 + if level == 0 + after = current_char + scanner.post_match + break + else + section_config << current_char + end + else + section_config << current_char + end + end + + fail("Failed to parse VPP config: #{vpp_config}") unless level == 0 + return before, section_config, after + end + + def add_setting(value) + before, section_config, after = get_sections + + if @dev + if value.to_s.empty? + setting_string = "#{@real_setting} #{@dev}" + else + setting_string = "#{@real_setting} #{@dev} {#{value}}" + end + else + setting_string = "#{@real_setting} #{value}" + end + + if section_config =~ @search_regex + section_config.sub!(@search_regex, " #{setting_string}") + else + section_config.rstrip! + section_config << "\n #{setting_string}\n" + end + + write_config(before+section_config+after) + end + + def create + add_setting(@resource[:value]) + end + + def destroy + before, section_config, after = get_sections + section_config.sub!(@search_regex, "") + write_config(before+section_config+after) + end + + def exists? + before, section_config, after = get_sections + @search_regex.match(section_config) + end + + def value + before, section_config, after = get_sections + @search_regex.match(section_config) { |m| m[1] } + end + + def value=(value) + add_setting(value) + end + +end diff --git a/lib/puppet/provider/vpp_service/vpp.rb b/lib/puppet/provider/vpp_service/vpp.rb deleted file mode 100644 index a887404..0000000 --- a/lib/puppet/provider/vpp_service/vpp.rb +++ /dev/null @@ -1,113 +0,0 @@ -Puppet::Type.type(:vpp_service).provide :vpp do - - commands :vppctlcmd => "vppctl" - commands :systemctlcmd => "systemctl" - - def get_int_prefix(name) - if %r{([[:alpha:]]*#{name})\s+} =~ `vppctl show int` - return $1 - else - raise Puppet::Error.new("Cannot find vpp interface matching: #{name}") - end - end - - def convert_pci_addr(pci_dev) - if pci_dev =~ /\p{XDigit}+:(\p{XDigit}+):(\p{XDigit}+)\.(\p{XDigit}+)/ - return "%x/%x/%x" % ["0x#{$1}".hex, "0x#{$2}".hex, "0x#{$3}".hex] - else - raise Puppet::Error.new("Incorrect pci dev format: #{pci_dev}") - end - end - - def vpp_pre_config - @resource[:pci_devs].each do |pci_dev| - Facter.value(:interfaces).split(',').each do |kernel_nic| - if pci_dev == `ethtool -i #{kernel_nic} | grep bus-info | awk '{print $2}'`.strip - unless system("ip link set dev #{kernel_nic} down") - raise Puppet::Error.new("Failed to shut down kernel nic #{kernel_nic}") - end - - #Disable NIC on boot - file_data = "" - onboot_exists = false - if File.exist?("/etc/sysconfig/network-scripts/ifcfg-#{kernel_nic}") - IO.foreach("/etc/sysconfig/network-scripts/ifcfg-#{kernel_nic}") do |line| - if /ONBOOT/.match(line) - onboot_exists = true - file_data += "ONBOOT=no\n" - else - file_data += line - end - end - unless onboot_exists - file_data += "ONBOOT=no" - end - File.open("/etc/sysconfig/network-scripts/ifcfg-#{kernel_nic}", "w") {|file| file.puts file_data} - end - - if Facter.value("ipaddress_#{kernel_nic}") - @int_ip_mapping[pci_dev] = Facter.value("ipaddress_#{kernel_nic}") + "/" + Facter.value("netmask_#{kernel_nic}") - end - end - end - end - end - - def configure_vpp_interfaces - @resource[:pci_devs].each do |pci_dev| - vpp_int_name= get_int_prefix(convert_pci_addr(pci_dev)) - vppctlcmd "set int state", vpp_int_name, @resource[:state] - if @resource[:copy_kernel_nic_ip] && @int_ip_mapping.has_key?(pci_dev) - vppctlcmd "set int ip address", vpp_int_name, @int_ip_mapping[pci_dev] - end - end - end - - def create - @int_ip_mapping = {} - vpp_pre_config - - #Bring up VPP service - systemctlcmd "restart", "vpp" - systemctlcmd "enable", "vpp" - sleep 10 - - #Configure VPP interfaces - configure_vpp_interfaces - end - - def destroy - systemctlcmd "stop", "vpp" - systemctlcmd "disable", "vpp" - end - - def exists? - if system("systemctl is-active vpp --quiet") - @resource[:pci_devs].each do |pci_dev| - int_name_str = convert_pci_addr(pci_dev) - if %r{([[:alpha:]]*#{int_name_str})\s+} !~ `vppctl show int` - return false - end - end - else - return false - end - return true - end - - def state - @resource[:pci_devs].each do |pci_dev| - vpp_int_output = `vppctl show int #{get_int_prefix(convert_pci_addr(pci_dev))}` - if ! /\s+up\s+/.match(vpp_int_output) - return "down" - end - end - return "up" - end - - def state=(value) - @resource[:pci_devs].each do |pci_dev| - vppctlcmd "set int state", get_int_prefix(convert_pci_addr(pci_dev)), value - end - end -end
\ No newline at end of file diff --git a/lib/puppet/type/vpp_config.rb b/lib/puppet/type/vpp_config.rb new file mode 100644 index 0000000..17c910f --- /dev/null +++ b/lib/puppet/type/vpp_config.rb @@ -0,0 +1,14 @@ +Puppet::Type.newtype(:vpp_config) do + + ensurable + + newparam(:setting, :namevar => true) do + end + + newproperty(:value) do + munge do |value| + value.strip if value.is_a? String + end + end + +end diff --git a/lib/puppet/type/vpp_service.rb b/lib/puppet/type/vpp_service.rb deleted file mode 100644 index c1c818f..0000000 --- a/lib/puppet/type/vpp_service.rb +++ /dev/null @@ -1,46 +0,0 @@ -Puppet::Type.newtype(:vpp_service) do - - ensurable - - newparam(:name) do - end - - newparam(:pci_devs, :array_matching => :all) do - desc "PCI dev addresses to be bound to VPP" - def insync?(is) - is.sort == should.sort - end - - validate do |values| - values = [values] unless values.is_a?(Array) - values.map! do |value| - if value =~ /\p{XDigit}+:(\p{XDigit}+):(\p{XDigit}+)\.(\p{XDigit}+)/ - value - else - raise(Puppet::Error, "Incorrect PCI dev address #{value}") - end - end - end - - munge do |values| - if values.is_a?(Array) - values - else - [values] - end - end - end - - newproperty(:state) do - desc "VPP interface state" - defaultto :up - newvalues(:up, :down) - end - - newparam(:copy_kernel_nic_ip) do - desc "Whether to configure VPP interface with kernel NIC's IP settings" - defaultto :true - newvalues(:true, :false) - end - -end diff --git a/manifests/config.pp b/manifests/config.pp index aeac676..b74f6d4 100644 --- a/manifests/config.pp +++ b/manifests/config.pp @@ -3,14 +3,21 @@ # This class handles fdio config changes. # class fdio::config { - file { '/etc/vpp/startup.conf': - content => template('fdio/startup.conf.erb'), + + 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 ${::fdio::vpp_dpdk_uio_driver}", + command => "modprobe ${fdio::vpp_dpdk_uio_driver}", + unless => "lsmod | grep ${dpdk_pmd_real}", path => '/bin:/sbin', } } diff --git a/manifests/config/vpp_devices.pp b/manifests/config/vpp_devices.pp new file mode 100644 index 0000000..f36a66e --- /dev/null +++ b/manifests/config/vpp_devices.pp @@ -0,0 +1,15 @@ +# == Define: fdio::config::vpp_devices +# +# Defined type to configure device in VPP configuration file +# +# === Parameters: +# [*pci_address*] +# (required) The PCI address of the device. +# +define fdio::config::vpp_devices ( + $pci_address = $title +) { + vpp_config { + "dpdk/dev/${pci_address}": ensure => 'present'; + } +}
\ No newline at end of file diff --git a/manifests/honeycomb.pp b/manifests/honeycomb.pp index ccad9ca..07923d5 100644 --- a/manifests/honeycomb.pp +++ b/manifests/honeycomb.pp @@ -75,7 +75,7 @@ class fdio::honeycomb ( enable => true, hasstatus => true, hasrestart => true, - require => [ Vpp_service['vpp'], Package['honeycomb'] ], + require => [ 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 index 7f2d09d..fbdc453 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -4,7 +4,8 @@ # # === Parameters: # [*repo_branch*] -# (optional) fd.io repo branch, valid values are 'release', 'master', and stable branch such as 'stable.1609'. +# (optional) fd.io repo branch. +# Valid values are 'release', 'master' and stable branch like 'stable.1609'. # Defaults to 'release'. # # [*vpp_dpdk_devs*] @@ -15,17 +16,21 @@ # (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_dpdk_dev_default_options*] +# (optional) VPP interface default options configuration. +# This will configure dev default {options}. It should be a string +# containing all of the desired options. +# Example: 'vlan-strip-offload on num-rx-queues 3' +# Default to undef. # # [*vpp_cpu_main_core*] -# (optional) VPP main thread pinning. +# (optional) VPP main thread pinning core. # Defaults to undef (no pinning) # # [*vpp_cpu_corelist_workers*] -# (optional) List of cores for VPP worker thread pinning in string format. +# (optional) Comma separated list of cores for VPP worker thread pinning in +# string format. +# Example: '2,3'. # Defaults to undef (no pinning) # # [*copy_kernel_nic_ip*] @@ -33,18 +38,16 @@ # 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, + $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_dpdk_dev_default_options = $::fdio::params::vpp_dpdk_dev_default_options, + $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 { diff --git a/manifests/params.pp b/manifests/params.pp index 9dae301..9adba11 100644 --- a/manifests/params.pp +++ b/manifests/params.pp @@ -6,7 +6,7 @@ class fdio::params { $repo_branch = 'release' $vpp_dpdk_devs = [] $vpp_dpdk_uio_driver = 'uio_pci_generic' - $vpp_vlan_enabled = false + $vpp_dpdk_dev_default_options = undef $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 index cb08721..e36133e 100644 --- a/manifests/service.pp +++ b/manifests/service.pp @@ -3,11 +3,8 @@ # 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, + service { 'vpp' : + ensure => running, + enable => true, } } - diff --git a/scripts/ci-beaker.sh b/scripts/ci-beaker.sh index ae6f58b..fad9ba3 100755 --- a/scripts/ci-beaker.sh +++ b/scripts/ci-beaker.sh @@ -9,7 +9,7 @@ os=$1 sudo sysctl -w vm.nr_hugepages=1024 cat /proc/meminfo | grep Huge -mkdir .bundled_gems +mkdir -p .bundled_gems export GEM_HOME=`pwd`/.bundled_gems gem install bundler --no-rdoc --no-ri --verbose $GEM_HOME/bin/bundle install --retry 3 diff --git a/scripts/ci-unit-tests.sh b/scripts/ci-unit-tests.sh index a8d57ff..1585d66 100755 --- a/scripts/ci-unit-tests.sh +++ b/scripts/ci-unit-tests.sh @@ -10,7 +10,7 @@ if [ "$puppet_version" != "latest" ]; then export PUPPET_GEM_VERSION="~> $puppet_version.0" fi -mkdir .bundled_gems +mkdir -p .bundled_gems export GEM_HOME=`pwd`/.bundled_gems gem install bundler --no-rdoc --no-ri --verbose $GEM_HOME/bin/bundle install --retry 3 diff --git a/spec/acceptance/fdio_spec.rb b/spec/acceptance/fdio_spec.rb index 5c30de1..168c085 100644 --- a/spec/acceptance/fdio_spec.rb +++ b/spec/acceptance/fdio_spec.rb @@ -20,7 +20,6 @@ describe 'fdio' do describe file('/etc/vpp/startup.conf') do it { is_expected.to exist } its(:content) { should match /uio-driver\s+uio_pci_generic/ } - its(:content) { should_not match /dev/ } end describe service('vpp') do diff --git a/spec/classes/fdio_spec.rb b/spec/classes/fdio_spec.rb index 0cc065a..4b65779 100644 --- a/spec/classes/fdio_spec.rb +++ b/spec/classes/fdio_spec.rb @@ -46,9 +46,10 @@ describe 'fdio' do shared_examples_for 'fdio - config' do it { - should contain_file('/etc/vpp/startup.conf').with( - 'path' => '/etc/vpp/startup.conf', - ) + should contain_vpp_config('dpdk/uio-driver').with_value('uio_pci_generic') + should contain_vpp_config('dpdk/dev/default') + should contain_vpp_config('cpu/main-core') + should contain_vpp_config('cpu/corelist-workers') } it { should contain_exec('insert_dpdk_kmod').with( @@ -60,24 +61,12 @@ describe 'fdio' do shared_examples_for 'fdio - service' do it { - should contain_vpp_service('vpp').with( - 'ensure' => 'present', - 'pci_devs' => [], - 'state' => 'up', + should contain_service('vpp').with( + 'ensure' => 'running', + 'enable' => true, ) } - context 'with pci dev' do - let(:params) {{:vpp_dpdk_devs => ['0000:00:07.0']}} - - it { - should contain_vpp_service('vpp').with( - 'ensure' => 'present', - 'pci_devs' => ['0000:00:07.0'], - 'state' => 'up', - ) - } - end end context 'on RedHat platforms' do diff --git a/spec/classes/honeycomb_spec.rb b/spec/classes/honeycomb_spec.rb index 8ba367a..fcd31f6 100644 --- a/spec/classes/honeycomb_spec.rb +++ b/spec/classes/honeycomb_spec.rb @@ -15,7 +15,7 @@ describe 'fdio::honeycomb' do it { should contain_file('honeycomb.json').that_requires('Package[honeycomb]') } it { should contain_file('honeycomb.json').that_notifies('Service[honeycomb]') } it { should contain_service('honeycomb').that_requires('Package[honeycomb]') } - it { should contain_service('honeycomb').that_requires('Vpp_service[vpp]') } + it { should contain_service('honeycomb').that_requires('Service[vpp]') } it { should contain_file('honeycomb.json').with( 'ensure' => 'file', diff --git a/spec/unit/provider/vpp_config/vpp_spec.rb b/spec/unit/provider/vpp_config/vpp_spec.rb new file mode 100644 index 0000000..913d795 --- /dev/null +++ b/spec/unit/provider/vpp_config/vpp_spec.rb @@ -0,0 +1,37 @@ +require 'puppet' +require 'puppet/provider/vpp_config/vpp' +require 'spec_helper' + +provider_class = Puppet::Type.type(:vpp_config).provider(:vpp) + +describe 'Puppet::Type.type(:vpp_config).provider(:vpp)' do + + let :vpp_attrs do + { + :setting => 'dpdk/dev/0000:00:07.0', + :ensure => 'present', + } + end + + let :resource do + Puppet::Type::Vpp_config.new(vpp_attrs) + end + + let :provider do + provider_class.new(resource) + end + + describe 'on create' do + it 'should call add_setting' do + provider.expects(:add_setting) + provider.create + end + end + + describe "when changing value" do + it 'should change value' do + provider.expects(:add_setting).with('vlan-strip-offload on') + provider.value = 'vlan-strip-offload on' + end + end +end
\ No newline at end of file diff --git a/spec/unit/provider/vpp_service/vpp_spec.rb b/spec/unit/provider/vpp_service/vpp_spec.rb deleted file mode 100644 index f75f80c..0000000 --- a/spec/unit/provider/vpp_service/vpp_spec.rb +++ /dev/null @@ -1,44 +0,0 @@ -require 'puppet' -require 'puppet/provider/vpp_service/vpp' -require 'spec_helper' - -provider_class = Puppet::Type.type(:vpp_service).provider(:vpp) - -describe 'Puppet::Type.type(:vpp_service).provider(:vpp)' do - - let :vpp_attrs do - { - :name => 'vpp service config', - :pci_devs => '0000:00:07.0', - :ensure => 'present', - :state => 'up', - :copy_kernel_nic_ip => 'false', - } - end - - let :resource do - Puppet::Type::Vpp_service.new(vpp_attrs) - end - - let :provider do - provider_class.new(resource) - end - - describe 'on create' do - it 'should call service restart' do - provider.expects(:vpp_pre_config) - provider.expects(:configure_vpp_interfaces) - provider.expects(:systemctlcmd).with('restart', 'vpp') - provider.expects(:systemctlcmd).with('enable', 'vpp') - provider.create - end - end - - describe "when changing state" do - it 'should change state' do - provider.stubs(:get_int_prefix).returns('GigabitEthernet0/7/0') - provider.expects(:vppctlcmd).with('set int state', 'GigabitEthernet0/7/0', 'down') - provider.state = 'down' - end - end -end
\ No newline at end of file diff --git a/spec/unit/type/vpp_config_spec.rb b/spec/unit/type/vpp_config_spec.rb new file mode 100644 index 0000000..d25061f --- /dev/null +++ b/spec/unit/type/vpp_config_spec.rb @@ -0,0 +1,15 @@ +require 'puppet' +require 'puppet/type/vpp_config' +require 'spec_helper' + +describe 'Puppet::Type.type(:vpp_config)' do + + before :each do + @vpp_conf = Puppet::Type.type(:vpp_config).new(:setting => 'dpdk/test_setting') + end + + it 'should accept value' do + Puppet::Type.type(:vpp_config).new(:setting => 'dpdk/test_setting', :value => 'test_value') + end + +end diff --git a/spec/unit/type/vpp_service_spec.rb b/spec/unit/type/vpp_service_spec.rb deleted file mode 100644 index 9b08ffa..0000000 --- a/spec/unit/type/vpp_service_spec.rb +++ /dev/null @@ -1,56 +0,0 @@ -require 'puppet' -require 'puppet/type/vpp_service' -require 'spec_helper' - -describe 'Puppet::Type.type(:neutron_config)' do - - before :each do - @vpp_service = Puppet::Type.type(:vpp_service).new(:name => 'vpp service config') - end - - it 'should have default values' do - expect(@vpp_service[:state]).to eq(:up) - expect(@vpp_service[:copy_kernel_nic_ip]).to eq(:true) - end - - it 'should accept a single pci dev' do - Puppet::Type.type(:vpp_service).new(:name => 'vpp service config', :pci_devs => '0000:00:07.0') - end - - it 'should accept array of pci devs' do - Puppet::Type.type(:vpp_service).new(:name => 'vpp service config', :pci_devs => ['0000:00:07.0', '0000:00:08.0']) - end - - it 'should not accept invalid pci dev format' do - expect { - Puppet::Type.type(:vpp_service).new(:name => 'vpp service config', :pci_devs => ['0/7/0', '0000:00:08.0']) - }.to raise_error(Puppet::Error, /Incorrect PCI dev address/) - end - - it 'should accept valid states' do - @vpp_service[:state] = :up - expect(@vpp_service[:state]).to eq(:up) - @vpp_service[:state] = :down - expect(@vpp_service[:state]).to eq(:down) - end - - it 'should not accept invalid state' do - expect { - @vpp_service[:state] = :shut - }.to raise_error(Puppet::Error, /Invalid value/) - end - - it 'should accept valid copy_kernel_nic_ip' do - @vpp_service[:copy_kernel_nic_ip] = :true - expect(@vpp_service[:copy_kernel_nic_ip]).to eq(:true) - @vpp_service[:copy_kernel_nic_ip] = :false - expect(@vpp_service[:copy_kernel_nic_ip]).to eq(:false) - end - - it 'should not accept invalid copy_kernel_nic_ip' do - expect { - @vpp_service[:copy_kernel_nic_ip] = :yes - }.to raise_error(Puppet::Error, /Invalid value/) - end - -end diff --git a/templates/startup.conf.erb b/templates/startup.conf.erb deleted file mode 100644 index 46894d0..0000000 --- a/templates/startup.conf.erb +++ /dev/null @@ -1,25 +0,0 @@ -unix { - nodaemon - log /tmp/vpp.log - full-coredump -} - -dpdk { - <% if scope['fdio::vpp_dpdk_devs'].is_a? Array -%><% scope['fdio::vpp_dpdk_devs'].each do |n| -%> - dev <%=n-%> <% if scope['fdio::vpp_vlan_enabled'] && system("lspci -s #{n} | grep VIC") -%> {vlan-strip-offload off}<%end%> - <% end -%><% end -%> - uio-driver <%=scope['fdio::vpp_dpdk_uio_driver']%> -} - -cpu { - <% if scope['fdio::vpp_cpu_main_core'] -%>main-core <%=scope['fdio::vpp_cpu_main_core']%> <%end%> - <% if scope['fdio::vpp_cpu_corelist_workers'] -%>corelist-workers <%=scope['fdio::vpp_cpu_corelist_workers']%> <%end%> -} - -api-trace { - on -} - -api-segment { - gid vpp -} |