sfc: Accept array for drivers

The drivers option in networking-sfc both accept list values, which
defines ordered lists of drivers.

Change-Id: Iecc9cfda8bd74c758b4dbf433fed2ea293725afd
Signed-off-by: Takashi Kajinami <kajinamit@oss.nttdata.com>
This commit is contained in:
Takashi Kajinami
2025-07-22 16:40:29 +09:00
parent 26700693ed
commit 5a3a9128cf
3 changed files with 58 additions and 8 deletions

View File

@@ -25,12 +25,12 @@
# Whether to install the sfc extension package
# Default to 'present'
#
# [*sfc_driver*]
# (optional) SFC driver to use
# [*sfc_drivers*]
# (optional) An ordered list of service chain drivers
# Defaults to $facts['os_service_default']
#
# [*fc_driver*]
# (optional) Flow classifier driver to use
# [*fc_drivers*]
# (optional) An ordered list of flow classifier drivers
# Defaults to $facts['os_service_default']
#
# [*sync_db*]
@@ -42,17 +42,44 @@
# in the sfc config.
# Default to false.
#
# DEPRECATED PARAMETERS
#
# [*sfc_driver*]
# (optional) SFC driver to use
# Defaults to $facts['os_service_default']
#
# [*fc_driver*]
# (optional) Flow classifier driver to use
# Defaults to $facts['os_service_default']
#
class neutron::services::sfc (
$package_ensure = 'present',
$sfc_driver = $facts['os_service_default'],
$fc_driver = $facts['os_service_default'],
$sfc_drivers = $facts['os_service_default'],
$fc_drivers = $facts['os_service_default'],
Boolean $sync_db = false,
$purge_config = false,
# DEPRECATED PARAMETERS
$sfc_driver = undef,
$fc_driver = undef,
) {
include neutron::deps
include neutron::params
if $sfc_driver != undef {
warning('The sfc_driver parameter is deprecated. Use the sfc_drivers parameter instead.')
$sfc_drivers_real = $sfc_driver
} else {
$sfc_drivers_real = $sfc_drivers
}
if $fc_driver != undef {
warning('The fc_driver parameter is deprecated. Use the fc_drivers parameter instead.')
$fc_drivers_real = $fc_driver
} else {
$fc_drivers_real = $fc_drivers
}
package { 'python-networking-sfc':
ensure => $package_ensure,
name => $::neutron::params::sfc_package,
@@ -60,8 +87,8 @@ class neutron::services::sfc (
}
neutron_sfc_service_config {
'sfc/drivers': value => $sfc_driver;
'flowclassifier/drivers': value => $fc_driver;
'sfc/drivers': value => join(any2array($sfc_drivers_real), ',');
'flowclassifier/drivers': value => join(any2array($fc_drivers_real), ',');
}
resources { 'neutron_sfc_service_config':

View File

@@ -0,0 +1,9 @@
---
features:
- |
The ``neutron::servics::sfc::sfc_driver`` parameter has been deprecated,
in favor of the new ``sfc_drivers`` parameter.
- |
The ``neutron::servics::sfc::fc_driver`` parameter has been deprecated,
in favor of the new ``fc_drivers`` parameter.

View File

@@ -59,6 +59,20 @@ describe 'neutron::services::sfc' do
end
context 'with sfc and classifier drivers' do
let :params do
{
:sfc_drivers => 'odl_v2',
:fc_drivers => 'odl_v2'
}
end
it 'configures networking-sfc.conf' do
should contain_neutron_sfc_service_config('sfc/drivers').with_value('odl_v2')
should contain_neutron_sfc_service_config('flowclassifier/drivers').with_value('odl_v2')
end
end
context 'with sfc and classifier drivers (deprecated parameters)' do
let :params do
{
:sfc_driver => 'odl_v2',