Files
puppet-nova/spec/classes/nova_compute_neutron_spec.rb
Sergii Golovatiuk 65fc70f4d8 Set force_snat_range parameter
Due to change 59ac254bf15bb059cca12a82c9d819c371ea5c6f merged in Juno
Nova-network checks whether network has external gateway and does
(which it has by default) and does not create SNAT rules for the instances
if list of force snat ranges is empty now.

This change sets force_snat_range to ANY network and thus
new code adds corresponding rules.

Change-Id: I339dd09543f2900cab3ba6164207e962229e4386
Closes-Bug: 1384661
Signed-off-by: Sergii Golovatiuk <sgolovatiuk@mirantis.com>
2014-11-14 15:02:04 +01:00

59 lines
2.0 KiB
Ruby

require 'spec_helper'
describe 'nova::compute::neutron' do
context 'with default parameters' do
it { should contain_nova_config('libvirt/vif_driver').with_value('nova.virt.libvirt.vif.LibvirtGenericVIFDriver')}
it { should contain_nova_config('DEFAULT/force_snat_range').with(:value => '0.0.0.0/0') }
end
context 'when overriding params' do
let :params do
{:libvirt_vif_driver => 'foo' }
end
it { should contain_nova_config('libvirt/vif_driver').with_value('foo')}
it { should contain_nova_config('DEFAULT/force_snat_range').with_ensure(:absent) }
end
context 'when overriding with a removed libvirt_vif_driver param' do
let :params do
{:libvirt_vif_driver => 'nova.virt.libvirt.vif.LibvirtOpenVswitchDriver' }
end
it 'should fails to configure libvirt_vif_driver with old OVS driver' do
expect { subject }.to raise_error(Puppet::Error, /nova.virt.libvirt.vif.LibvirtOpenVswitchDriver as vif_driver is removed from Icehouse/)
end
end
context 'with force_snat_range parameter set to false' do
let :params do
{ :force_snat_range => false, }
end
it { should contain_nova_config('DEFAULT/force_snat_range').with_ensure('absent') }
end
context 'with force_snat_range parameter set to 10.0.0.0/24' do
let :params do
{ :force_snat_range => '10.0.0.0/24', }
end
it { should contain_nova_config('DEFAULT/force_snat_range').with_value('10.0.0.0/24') }
end
context 'with force_snat_range parameter set to fe80::/64' do
let :params do
{ :force_snat_range => 'fe80::/64', }
end
it { should contain_nova_config('DEFAULT/force_snat_range').with_value('fe80::/64') }
end
context 'with force_snat_range parameter set ip without mask' do
let :params do
{ :force_snat_range => '10.0.0.0', }
end
it { expect { should contain_nova_config('DEFAULT/force_snat_range') }.to \
raise_error(Puppet::Error, /force_snat_range should be IPv4 or IPv6/) }
end
end