3 describe 'neutron::agents::ovs' do
6 "class { 'neutron': rabbit_password => 'passw0rd' }\n" +
7 "class { 'neutron::plugins::ovs': network_vlan_ranges => 'physnet1:1000:2000' }"
10 let :default_params do
11 { :package_ensure => 'present',
12 :manage_service => true,
14 :bridge_uplinks => [],
15 :bridge_mappings => [],
16 :integration_bridge => 'br-int',
17 :enable_tunneling => false,
19 :tunnel_bridge => 'br-tun',
20 :polling_interval => 2,
21 :firewall_driver => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver',
30 shared_examples_for 'neutron plugin ovs agent' do
32 default_params.merge(params)
35 it { should contain_class('neutron::params') }
37 it 'configures ovs_neutron_plugin.ini' do
38 should contain_neutron_plugin_ovs('AGENT/polling_interval').with_value(p[:polling_interval])
39 should contain_neutron_plugin_ovs('OVS/integration_bridge').with_value(p[:integration_bridge])
40 should contain_neutron_plugin_ovs('SECURITYGROUP/firewall_driver').\
41 with_value(p[:firewall_driver])
42 should contain_neutron_plugin_ovs('OVS/enable_tunneling').with_value(false)
43 should contain_neutron_plugin_ovs('OVS/tunnel_bridge').with_ensure('absent')
44 should contain_neutron_plugin_ovs('OVS/local_ip').with_ensure('absent')
45 should contain_neutron_plugin_ovs('AGENT/veth_mtu').with_ensure('absent')
48 it 'configures vs_bridge' do
49 should contain_vs_bridge(p[:integration_bridge]).with_ensure('present')
52 it 'installs neutron ovs agent package' do
53 if platform_params.has_key?(:ovs_agent_package)
54 should contain_package('neutron-plugin-ovs-agent').with(
55 :name => platform_params[:ovs_agent_package],
56 :ensure => p[:package_ensure]
58 should contain_package('neutron-plugin-ovs-agent').with_before(/Neutron_plugin_ovs\[.+\]/)
60 should contain_package('neutron-plugin-ovs').with_before(/Neutron_plugin_ovs\[.+\]/)
64 it 'configures neutron ovs agent service' do
65 should contain_service('neutron-plugin-ovs-service').with(
66 :name => platform_params[:ovs_agent_service],
69 :require => 'Class[Neutron]'
73 context 'with veth_mtu set' do
75 params.merge(:veth_mtu => '9000')
78 it 'should set the veth_mtu on the ovs agent' do
79 should contain_neutron_plugin_ovs('AGENT/veth_mtu').with_value(params[:veth_mtu])
83 context 'when not installing ovs agent package' do
85 params.merge!(:package_ensure => 'absent')
87 it 'uninstalls neutron ovs agent package' do
88 if platform_params.has_key?(:ovs_agent_package)
89 should contain_package('neutron-plugin-ovs-agent').with(
90 :name => platform_params[:ovs_agent_package],
91 :ensure => p[:package_ensure]
97 context 'when supplying a firewall driver' do
99 params.merge!(:firewall_driver => false)
101 it 'should configure firewall driver' do
102 should contain_neutron_plugin_ovs('SECURITYGROUP/firewall_driver').with_ensure('absent')
106 context 'when supplying bridge mappings for provider networks' do
108 params.merge!(:bridge_uplinks => ['br-ex:eth2'],:bridge_mappings => ['default:br-ex'])
111 it 'configures bridge mappings' do
112 should contain_neutron_plugin_ovs('OVS/bridge_mappings')
115 it 'should configure bridge mappings' do
116 should contain_neutron__plugins__ovs__bridge(params[:bridge_mappings].join(',')).with(
117 :before => 'Service[neutron-plugin-ovs-service]'
121 it 'should configure bridge uplinks' do
122 should contain_neutron__plugins__ovs__port(params[:bridge_uplinks].join(',')).with(
123 :before => 'Service[neutron-plugin-ovs-service]'
128 context 'when enabling tunneling' do
129 context 'without local ip address' do
131 params.merge!(:enable_tunneling => true)
136 end.to raise_error(Puppet::Error, /Local ip for ovs agent must be set when tunneling is enabled/)
139 context 'with default params' do
141 params.merge!(:enable_tunneling => true, :local_ip => '127.0.0.1' )
143 it 'should configure ovs for tunneling' do
144 should contain_neutron_plugin_ovs('OVS/enable_tunneling').with_value(true)
145 should contain_neutron_plugin_ovs('OVS/tunnel_bridge').with_value(default_params[:tunnel_bridge])
146 should contain_neutron_plugin_ovs('OVS/local_ip').with_value('127.0.0.1')
147 should contain_vs_bridge(default_params[:tunnel_bridge]).with_ensure('present')
151 context 'with vxlan tunneling' do
153 params.merge!(:enable_tunneling => true,
154 :local_ip => '127.0.0.1',
155 :tunnel_types => ['vxlan'],
156 :vxlan_udp_port => '4789')
159 it 'should perform vxlan network configuration' do
160 should contain_neutron_plugin_ovs('agent/tunnel_types').with_value(params[:tunnel_types])
161 should contain_neutron_plugin_ovs('agent/vxlan_udp_port').with_value(params[:vxlan_udp_port])
167 context 'on Debian platforms' do
169 { :osfamily => 'Debian' }
172 let :platform_params do
173 { :ovs_agent_package => 'neutron-plugin-openvswitch-agent',
174 :ovs_agent_service => 'neutron-plugin-openvswitch-agent' }
177 it_configures 'neutron plugin ovs agent'
180 context 'on RedHat platforms' do
182 { :osfamily => 'RedHat' }
185 let :platform_params do
186 { :ovs_cleanup_service => 'neutron-ovs-cleanup',
187 :ovs_agent_service => 'neutron-openvswitch-agent' }
190 it_configures 'neutron plugin ovs agent'
191 it 'configures neutron ovs cleanup service' do
192 should contain_service('ovs-cleanup-service').with(
193 :name => platform_params[:ovs_cleanup_service],
196 should contain_package('neutron-plugin-ovs').with_before(/Service\[ovs-cleanup-service\]/)