Merge "Make vswitch optional for ovs agent configuration"

This commit is contained in:
Jenkins
2015-09-11 03:16:20 +00:00
committed by Gerrit Code Review
2 changed files with 51 additions and 7 deletions

View File

@@ -97,6 +97,14 @@
# flow tables resetting
# Defaults to false
#
# [*manage_vswitch*]
# (optional) This boolean is used to indicate if this class should manage the
# vswitch software installation and the ovs bridges/ports from the
# $bridge_mappings parameter. If manage_vswitch is set to true, then we will
# require the vswitch::ovs and configure the ovs bridges/ports using the
# mappings provided as part of the $bridge_mappings parameters.
# Defaults to true
#
class neutron::agents::ml2::ovs (
$package_ensure = 'present',
$enabled = true,
@@ -115,10 +123,13 @@ class neutron::agents::ml2::ovs (
$firewall_driver = 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver',
$enable_distributed_routing = false,
$drop_flows_on_start = false,
$manage_vswitch = true,
) {
include ::neutron::params
require vswitch::ovs
if $manage_vswitch {
require vswitch::ovs
}
if $enable_tunneling and ! $local_ip {
fail('Local ip for ovs agent must be set when tunneling is enabled')
@@ -149,11 +160,13 @@ class neutron::agents::ml2::ovs (
neutron_agent_ovs {
'ovs/bridge_mappings': value => $br_map_str;
}
neutron::plugins::ovs::bridge{ $bridge_mappings:
before => Service['neutron-ovs-agent-service'],
}
neutron::plugins::ovs::port{ $bridge_uplinks:
before => Service['neutron-ovs-agent-service'],
if ($manage_vswitch) {
neutron::plugins::ovs::bridge{ $bridge_mappings:
before => Service['neutron-ovs-agent-service'],
}
neutron::plugins::ovs::port{ $bridge_uplinks:
before => Service['neutron-ovs-agent-service'],
}
}
}

View File

@@ -20,7 +20,8 @@ describe 'neutron::agents::ml2::ovs' do
:arp_responder => false,
:drop_flows_on_start => false,
:enable_distributed_routing => false,
:firewall_driver => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver' }
:firewall_driver => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver',
:manage_vswitch => true }
end
let :default_facts do
@@ -116,6 +117,10 @@ describe 'neutron::agents::ml2::ovs' do
params.merge!(:bridge_uplinks => ['br-ex:eth2'],:bridge_mappings => ['default:br-ex'])
end
it 'should require vswitch::ovs' do
is_expected.to contain_class('vswitch::ovs')
end
it 'configures bridge mappings' do
is_expected.to contain_neutron_agent_ovs('ovs/bridge_mappings')
end
@@ -133,6 +138,32 @@ describe 'neutron::agents::ml2::ovs' do
end
end
context 'when supplying bridge mappings for provider networks with manage vswitch set to false' do
before :each do
params.merge!(:bridge_uplinks => ['br-ex:eth2'],:bridge_mappings => ['default:br-ex'], :manage_vswitch => false)
end
it 'should not require vswitch::ovs' do
is_expected.not_to contain_class('vswitch::ovs')
end
it 'configures bridge mappings' do
is_expected.to contain_neutron_agent_ovs('ovs/bridge_mappings')
end
it 'should not configure bridge mappings' do
is_expected.not_to contain_neutron__plugins__ovs__bridge(params[:bridge_mappings].join(',')).with(
:before => 'Service[neutron-ovs-agent-service]'
)
end
it 'should not configure bridge uplinks' do
is_expected.not_to contain_neutron__plugins__ovs__port(params[:bridge_uplinks].join(',')).with(
:before => 'Service[neutron-ovs-agent-service]'
)
end
end
context 'when enabling tunneling' do
context 'without local ip address' do
before :each do