3 describe 'neutron::agents::l3' do
6 "class { 'neutron': rabbit_password => 'passw0rd' }"
10 { :package_ensure => 'present',
13 :external_network_bridge => 'br-ex',
14 :use_namespaces => true,
15 :interface_driver => 'neutron.agent.linux.interface.OVSInterfaceDriver',
17 :gateway_external_network_id => nil,
18 :handle_internal_only_routers => true,
19 :metadata_port => '9697',
20 :send_arp_for_ha => '3',
21 :periodic_interval => '40',
22 :periodic_fuzzy_delay => '5',
23 :enable_metadata_proxy => true,
24 :network_device_mtu => nil,
25 :router_delete_namespaces => false,
27 :ha_vrrp_auth_type => 'PASS',
28 :ha_vrrp_auth_password => nil,
29 :ha_vrrp_advert_int => '3',
30 :agent_mode => 'legacy',
31 :allow_automatic_l3agent_failover => false }
38 shared_examples_for 'neutron l3 agent' do
40 default_params.merge(params)
43 it { should contain_class('neutron::params') }
45 it 'configures l3_agent.ini' do
46 should contain_neutron_l3_agent_config('DEFAULT/debug').with_value(p[:debug])
47 should contain_neutron_l3_agent_config('DEFAULT/external_network_bridge').with_value(p[:external_network_bridge])
48 should contain_neutron_l3_agent_config('DEFAULT/use_namespaces').with_value(p[:use_namespaces])
49 should contain_neutron_l3_agent_config('DEFAULT/interface_driver').with_value(p[:interface_driver])
50 should contain_neutron_l3_agent_config('DEFAULT/router_id').with_value(p[:router_id])
51 should contain_neutron_l3_agent_config('DEFAULT/gateway_external_network_id').with_value(p[:gateway_external_network_id])
52 should contain_neutron_l3_agent_config('DEFAULT/handle_internal_only_routers').with_value(p[:handle_internal_only_routers])
53 should contain_neutron_l3_agent_config('DEFAULT/metadata_port').with_value(p[:metadata_port])
54 should contain_neutron_l3_agent_config('DEFAULT/send_arp_for_ha').with_value(p[:send_arp_for_ha])
55 should contain_neutron_l3_agent_config('DEFAULT/periodic_interval').with_value(p[:periodic_interval])
56 should contain_neutron_l3_agent_config('DEFAULT/periodic_fuzzy_delay').with_value(p[:periodic_fuzzy_delay])
57 should contain_neutron_l3_agent_config('DEFAULT/enable_metadata_proxy').with_value(p[:enable_metadata_proxy])
58 should contain_neutron_l3_agent_config('DEFAULT/network_device_mtu').with_ensure('absent')
59 should contain_neutron_l3_agent_config('DEFAULT/router_delete_namespaces').with_value(p[:router_delete_namespaces])
60 should contain_neutron_l3_agent_config('DEFAULT/allow_automatic_l3agent_failover').with_value(p[:allow_automatic_l3agent_failover])
63 it 'installs neutron l3 agent package' do
64 if platform_params.has_key?(:l3_agent_package)
65 should contain_package('neutron-l3').with(
66 :name => platform_params[:l3_agent_package],
67 :ensure => p[:package_ensure],
68 :require => 'Package[neutron]'
70 should contain_package('neutron-l3').with_before(/Neutron_l3_agent_config\[.+\]/)
72 should contain_package('neutron').with_before(/Neutron_l3_agent_config\[.+\]/)
76 it 'configures neutron l3 agent service' do
77 should contain_service('neutron-l3').with(
78 :name => platform_params[:l3_agent_service],
81 :require => 'Class[Neutron]'
85 context 'with manage_service as false' do
87 params.merge!(:manage_service => false)
89 it 'should not start/stop service' do
90 should contain_service('neutron-l3').without_ensure
96 params.merge!(:agent_mode => 'dvr')
98 it 'should enable DVR mode' do
99 should contain_neutron_l3_agent_config('DEFAULT/agent_mode').with_value(p[:agent_mode])
103 context 'with HA routers' do
105 params.merge!(:ha_enabled => true,
106 :ha_vrrp_auth_password => 'secrete')
108 it 'should configure VRRP' do
109 should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_type').with_value(p[:ha_vrrp_auth_type])
110 should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_auth_password').with_value(p[:ha_vrrp_auth_password])
111 should contain_neutron_l3_agent_config('DEFAULT/ha_vrrp_advert_int').with_value(p[:ha_vrrp_advert_int])
116 shared_examples_for 'neutron l3 agent with network_device_mtu specified' do
119 :network_device_mtu => 9999
122 it 'configures network_device_mtu' do
123 should contain_neutron_l3_agent_config('DEFAULT/network_device_mtu').with_value(params[:network_device_mtu])
127 context 'on Debian platforms' do
129 { :osfamily => 'Debian' }
132 let :platform_params do
133 { :l3_agent_package => 'neutron-l3-agent',
134 :l3_agent_service => 'neutron-l3-agent' }
137 it_configures 'neutron l3 agent'
138 it_configures 'neutron l3 agent with network_device_mtu specified'
141 context 'on RedHat platforms' do
143 { :osfamily => 'RedHat' }
146 let :platform_params do
147 { :l3_agent_service => 'neutron-l3-agent' }
150 it_configures 'neutron l3 agent'
151 it_configures 'neutron l3 agent with network_device_mtu specified'