3 describe 'neutron::agents::ml2::ovs' do
6 "class { 'neutron': rabbit_password => 'passw0rd' }"
10 { :package_ensure => 'present',
12 :bridge_uplinks => [],
13 :bridge_mappings => [],
14 :integration_bridge => 'br-int',
15 :enable_tunneling => false,
17 :tunnel_bridge => 'br-tun',
18 :polling_interval => 2,
19 :l2_population => false,
20 :arp_responder => false,
21 :enable_distributed_routing => false,
22 :firewall_driver => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver' }
29 shared_examples_for 'neutron plugin ovs agent with ml2 plugin' do
31 default_params.merge(params)
34 it { should contain_class('neutron::params') }
36 it 'configures ovs_neutron_plugin.ini' do
37 should contain_neutron_plugin_ml2('agent/polling_interval').with_value(p[:polling_interval])
38 should contain_neutron_plugin_ml2('agent/l2_population').with_value(p[:l2_population])
39 should contain_neutron_plugin_ml2('agent/arp_responder').with_value(p[:arp_responder])
40 should contain_neutron_plugin_ml2('ovs/integration_bridge').with_value(p[:integration_bridge])
41 should contain_neutron_plugin_ml2('securitygroup/firewall_driver').\
42 with_value(p[:firewall_driver])
43 should contain_neutron_plugin_ml2('ovs/enable_tunneling').with_value(false)
44 should contain_neutron_plugin_ml2('ovs/tunnel_bridge').with_ensure('absent')
45 should contain_neutron_plugin_ml2('ovs/local_ip').with_ensure('absent')
48 it 'configures vs_bridge' do
49 should contain_vs_bridge(p[:integration_bridge]).with(
51 :before => 'Service[neutron-ovs-agent-service]'
53 should_not contain_vs_brige(p[:integration_bridge])
56 it 'installs neutron ovs agent package' do
57 if platform_params.has_key?(:ovs_agent_package)
58 should contain_package('neutron-ovs-agent').with(
59 :name => platform_params[:ovs_agent_package],
60 :ensure => p[:package_ensure]
62 should contain_package('neutron-ovs-agent').with_before(/Neutron_plugin_ml2\[.+\]/)
67 it 'configures neutron ovs agent service' do
68 should contain_service('neutron-ovs-agent-service').with(
69 :name => platform_params[:ovs_agent_service],
72 :require => 'Class[Neutron]'
76 context 'when supplying a firewall driver' do
78 params.merge!(:firewall_driver => false)
80 it 'should configure firewall driver' do
81 should contain_neutron_plugin_ml2('securitygroup/firewall_driver').with_ensure('absent')
85 context 'when enabling ARP responder' do
87 params.merge!(:arp_responder => true)
89 it 'should enable ARP responder' do
90 should contain_neutron_plugin_ml2('agent/arp_responder').with_value(true)
94 context 'when enabling DVR' do
96 params.merge!(:enable_distributed_routing => true,
97 :l2_population => true )
99 it 'should enable DVR' do
100 should contain_neutron_plugin_ml2('agent/enable_distributed_routing').with_value(true)
104 context 'when supplying bridge mappings for provider networks' do
106 params.merge!(:bridge_uplinks => ['br-ex:eth2'],:bridge_mappings => ['default:br-ex'])
109 it 'configures bridge mappings' do
110 should contain_neutron_plugin_ml2('ovs/bridge_mappings')
113 it 'should configure bridge mappings' do
114 should contain_neutron__plugins__ovs__bridge(params[:bridge_mappings].join(',')).with(
115 :before => 'Service[neutron-ovs-agent-service]'
119 it 'should configure bridge uplinks' do
120 should contain_neutron__plugins__ovs__port(params[:bridge_uplinks].join(',')).with(
121 :before => 'Service[neutron-ovs-agent-service]'
126 context 'when enabling tunneling' do
127 context 'without local ip address' do
129 params.merge!(:enable_tunneling => true)
134 end.to raise_error(Puppet::Error, /Local ip for ovs agent must be set when tunneling is enabled/)
137 context 'with default params' do
139 params.merge!(:enable_tunneling => true, :local_ip => '127.0.0.1' )
141 it 'should configure ovs for tunneling' do
142 should contain_neutron_plugin_ml2('ovs/enable_tunneling').with_value(true)
143 should contain_neutron_plugin_ml2('ovs/tunnel_bridge').with_value(default_params[:tunnel_bridge])
144 should contain_neutron_plugin_ml2('ovs/local_ip').with_value('127.0.0.1')
145 should contain_vs_bridge(default_params[:tunnel_bridge]).with(
146 :ensure => 'present',
147 :before => 'Service[neutron-ovs-agent-service]'
152 context 'with vxlan tunneling' do
154 params.merge!(:enable_tunneling => true,
155 :local_ip => '127.0.0.1',
156 :tunnel_types => ['vxlan'],
157 :vxlan_udp_port => '4789')
160 it 'should perform vxlan network configuration' do
161 should contain_neutron_plugin_ml2('agent/tunnel_types').with_value(params[:tunnel_types])
162 should contain_neutron_plugin_ml2('agent/vxlan_udp_port').with_value(params[:vxlan_udp_port])
166 context 'when l2 population is disabled and DVR enabled' do
168 params.merge!(:enable_distributed_routing => true,
169 :l2_population => false )
174 end.to raise_error(Puppet::Error, /L2 population must be enabled when DVR is enabled/)
180 context 'on Debian platforms' do
182 { :osfamily => 'Debian' }
185 let :platform_params do
186 { :ovs_agent_package => 'neutron-plugin-openvswitch-agent',
187 :ovs_agent_service => 'neutron-plugin-openvswitch-agent' }
190 it_configures 'neutron plugin ovs agent with ml2 plugin'
193 context 'on RedHat platforms' do
195 { :osfamily => 'RedHat' }
198 let :platform_params do
199 { :ovs_cleanup_service => 'neutron-ovs-cleanup',
200 :ovs_agent_service => 'neutron-openvswitch-agent' }
203 it_configures 'neutron plugin ovs agent with ml2 plugin'
205 it 'configures neutron ovs cleanup service' do
206 should contain_service('ovs-cleanup-service').with(
207 :name => platform_params[:ovs_cleanup_service],
210 should contain_package('neutron-ovs-agent').with_before(/Service\[ovs-cleanup-service\]/)
213 it 'links from ovs config to plugin config' do
214 should contain_file('/etc/neutron/plugins/openvswitch/ovs_neutron_plugin.ini').with(
216 :target => '/etc/neutron/plugins/ml2/ml2_conf.ini'