Add bridge_mappings option to linuxbridge agent

Change-Id: I40bb008d08a76bc72eb2d0d927faa304efca4796
This commit is contained in:
Sam Morrison 2018-04-05 12:10:47 +10:00
parent dfd67c27a3
commit fda3248092
3 changed files with 35 additions and 0 deletions

View File

@ -54,6 +54,10 @@
# tuples mapping physical network names to agent's node-specific physical
# network interfaces. Defaults to empty list.
#
# [*bridge_mappings*]
# (optional) List of <physical_network>:<bridge>
# Defaults to empty list
#
# [*firewall_driver*]
# (optional) Firewall driver for realizing neutron security group function.
# Defaults to 'iptables'.
@ -75,12 +79,14 @@ class neutron::agents::ml2::linuxbridge (
$polling_interval = $::os_service_default,
$l2_population = $::os_service_default,
$physical_interface_mappings = [],
$bridge_mappings = [],
$firewall_driver = 'iptables',
$purge_config = false,
) {
validate_array($tunnel_types)
validate_array($physical_interface_mappings)
validate_array($bridge_mappings)
include ::neutron::deps
include ::neutron::params
@ -119,6 +125,16 @@ class neutron::agents::ml2::linuxbridge (
}
}
if size($bridge_mappings) > 0 {
neutron_agent_linuxbridge {
'linux_bridge/bridge_mappings': value => join($bridge_mappings, ',');
}
} else {
neutron_agent_linuxbridge {
'linux_bridge/bridge_mappings': ensure => absent;
}
}
neutron_agent_linuxbridge {
'agent/polling_interval': value => $polling_interval;
'linux_bridge/physical_interface_mappings': value => join($physical_interface_mappings, ',');

View File

@ -0,0 +1,5 @@
---
features:
- |
Added a new paramater 'neutron::agents::ml2::linuxbridge::bridge_mappings' for
specifying the bridge_mappings in the linuxbridge agent.

View File

@ -13,6 +13,7 @@ describe 'neutron::agents::ml2::linuxbridge' do
:tunnel_types => [],
:local_ip => false,
:physical_interface_mappings => [],
:bridge_mappings => [],
:firewall_driver => 'iptables',
:purge_config => false,}
end
@ -41,6 +42,7 @@ describe 'neutron::agents::ml2::linuxbridge' do
it 'configures ml2_conf.ini' do
is_expected.to contain_neutron_agent_linuxbridge('agent/polling_interval').with_value('<SERVICE DEFAULT>')
is_expected.to contain_neutron_agent_linuxbridge('linux_bridge/physical_interface_mappings').with_value(default_params[:physical_interface_mappings].join(','))
is_expected.to contain_neutron_agent_linuxbridge('linux_bridge/bridge_mappings').with_ensure('absent')
is_expected.to contain_neutron_agent_linuxbridge('securitygroup/firewall_driver').with_value(default_params[:firewall_driver])
is_expected.to contain_neutron_agent_linuxbridge('agent/tunnel_types').with_ensure('absent')
end
@ -139,6 +141,18 @@ describe 'neutron::agents::ml2::linuxbridge' do
end
end
context 'when providing the bridge_mappings parameter' do
before do
params.merge!(:bridge_mappings => ['physnet0:br0', 'physnet1:br1'])
end
it 'configures bridge mappings' do
is_expected.to contain_neutron_agent_linuxbridge('linux_bridge/bridge_mappings').with_value(
params[:bridge_mappings].join(',')
)
end
end
context 'with firewall_driver parameter set to false' do
before :each do
params.merge!(:firewall_driver => false)