Add vpnaas_agent_package parameter to FWaaS

On debian platforms, when using both VPNaaS and FWaaS, puppet will
remove neutron-vpn-agent and install neutron-l3-agent instead.
This behavior brokes VPNaaS.

As neutron-vpn-agent package is a superset of neutron-l3-agent, we
should install neutron-vpn-agent instead of neutron-l3-agent when
needed.

This patch will add a boolean parameter called vpnaas_agent_package
to neutron::services::fwaas in order to give the choice to install
neutron-vpn-agent package instead of neutron-l3-agent package on
debian platforms.

Change-Id: I812dc1b53c77fe2e01ccd8a4e3f718c9a990f77c
Closes-Bug: 1328534
This commit is contained in:
Arnaud Morin 2014-06-11 20:09:49 +02:00
parent 837e27cec8
commit a6102c07db
2 changed files with 59 additions and 14 deletions

View File

@ -30,18 +30,35 @@
# (optional) FWaaS Driver to use
# Defaults to 'neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver'
#
# [*vpnaas_agent_package*]
# (optional) Use VPNaaS agent package instead of L3 agent package on debian platforms
# RedHat platforms won't take care of this parameter
# true/false
# Defaults to false
#
class neutron::services::fwaas (
$enabled = true,
$driver = 'neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver'
$enabled = true,
$driver = 'neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver',
$vpnaas_agent_package = false
) {
include neutron::params
if $::neutron::params::l3_agent_package {
ensure_resource( 'package', $::neutron::params::l3_agent_package,
{ 'ensure' => $neutron::package_ensure })
Package[$::neutron::params::l3_agent_package] -> Neutron_fwaas_service_config<||>
} else {
if ($::osfamily == 'Debian') {
# Debian platforms
if $vpnaas_agent_package {
ensure_resource( 'package', $::neutron::params::vpnaas_agent_package,
{ 'ensure' => $neutron::package_ensure })
Package[$::neutron::params::vpnaas_agent_package] -> Neutron_fwaas_service_config<||>
}
else {
ensure_resource( 'package', $::neutron::params::l3_agent_package,
{ 'ensure' => $neutron::package_ensure })
Package[$::neutron::params::l3_agent_package] -> Neutron_fwaas_service_config<||>
}
} elsif($::osfamily == 'Redhat') {
# RH platforms
ensure_resource( 'package', $::neutron::params::package_name,
{ 'ensure' => $neutron::package_ensure })
Package[$::neutron::params::package_name] -> Neutron_fwaas_service_config<||>

View File

@ -21,13 +21,18 @@
require 'spec_helper'
describe 'neutron::services::fwaas' do
let :pre_condition do
"class { 'neutron': rabbit_password => 'passw0rd' }"
end
let :params do
{}
end
let :default_params do
{ :driver => 'neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver',
:enabled => true }
{ :driver => 'neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver',
:enabled => true,
:vpnaas_agent_package => false }
end
shared_examples_for 'neutron fwaas service plugin' do
@ -36,10 +41,8 @@ describe 'neutron::services::fwaas' do
end
it 'configures driver in fwaas_driver.ini' do
params_hash.each_pair do |config,value|
should contain_neutron_fwaas_service_config('fwaas/driver').with_value('neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver')
should contain_neutron_fwaas_service_config('fwaas/enabled').with_value('true')
end
should contain_neutron_fwaas_service_config('fwaas/driver').with_value('neutron.services.firewall.drivers.linux.iptables_fwaas.IptablesFwaasDriver')
should contain_neutron_fwaas_service_config('fwaas/enabled').with_value('true')
end
end
@ -49,11 +52,36 @@ describe 'neutron::services::fwaas' do
end
let :platform_params do
{ :l3_agent_package => 'neutron-l3-agent' }
{ :l3_agent_package => 'neutron-l3-agent',
:vpnaas_agent_package => 'neutron-vpn-agent'}
end
it_configures 'neutron fwaas service plugin'
it 'installs neutron l3 agent package' do
should contain_package('neutron-l3-agent').with_ensure('present')
end
end
context 'on Debian platforms with VPNaaS' do
let :facts do
{ :osfamily => 'Debian' }
end
let :platform_params do
{ :l3_agent_package => 'neutron-l3-agent',
:vpnaas_agent_package => 'neutron-vpn-agent' }
end
let :params do
{ :vpnaas_agent_package => true }
end
it_configures 'neutron fwaas service plugin'
it 'installs neutron vpnaas agent package' do
should contain_package('neutron-vpn-agent').with_ensure('present')
end
end
context 'on Red Hat platforms' do