From ac2d7693e02a11d80879ccd80dc33a4f213295e6 Mon Sep 17 00:00:00 2001 From: Feng Pan Date: Sun, 19 Feb 2017 15:14:40 -0500 Subject: Add support for inline config changes This patch changes VPP configuration from file template to inline change directly. This prevents issue with overwriting existing VPP config. Change-Id: I4133be8ebe689d9288e3a8e64cca43afd7e42e64 Signed-off-by: Feng Pan --- manifests/config.pp | 15 +++++++++++---- manifests/config/vpp_devices.pp | 15 +++++++++++++++ manifests/honeycomb.pp | 2 +- manifests/init.pp | 35 +++++++++++++++++++---------------- manifests/params.pp | 2 +- manifests/service.pp | 9 +++------ 6 files changed, 50 insertions(+), 28 deletions(-) create mode 100644 manifests/config/vpp_devices.pp (limited to 'manifests') 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, } } - -- cgit 1.2.3-korg