Merge "only set network_vlan_ranges for vlan network types"
This commit is contained in:
commit
df12cf6d61
@ -5,13 +5,10 @@
|
|||||||
|
|
||||||
class quantum::plugins::ovs (
|
class quantum::plugins::ovs (
|
||||||
$package_ensure = 'present',
|
$package_ensure = 'present',
|
||||||
|
|
||||||
$sql_connection = 'sqlite:////var/lib/quantum/ovs.sqlite',
|
$sql_connection = 'sqlite:////var/lib/quantum/ovs.sqlite',
|
||||||
$sql_max_retries = 10,
|
$sql_max_retries = 10,
|
||||||
$reconnect_interval = 2,
|
$reconnect_interval = 2,
|
||||||
|
|
||||||
$tenant_network_type = 'vlan',
|
$tenant_network_type = 'vlan',
|
||||||
|
|
||||||
# NB: don't need tunnel ID range when using VLANs,
|
# NB: don't need tunnel ID range when using VLANs,
|
||||||
# *but* you do need the network vlan range regardless of type,
|
# *but* you do need the network vlan range regardless of type,
|
||||||
# because the list of networks there is still important
|
# because the list of networks there is still important
|
||||||
@ -54,7 +51,6 @@ class quantum::plugins::ovs (
|
|||||||
'DATABASE/sql_connection': value => $sql_connection;
|
'DATABASE/sql_connection': value => $sql_connection;
|
||||||
'DATABASE/sql_max_retries': value => $sql_max_retries;
|
'DATABASE/sql_max_retries': value => $sql_max_retries;
|
||||||
'DATABASE/reconnect_interval': value => $reconnect_interval;
|
'DATABASE/reconnect_interval': value => $reconnect_interval;
|
||||||
'OVS/network_vlan_ranges': value => $network_vlan_ranges;
|
|
||||||
'OVS/tenant_network_type': value => $tenant_network_type;
|
'OVS/tenant_network_type': value => $tenant_network_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,6 +64,14 @@ class quantum::plugins::ovs (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($tenant_network_type == 'vlan') or ($tenant_network_type == 'flat') {
|
||||||
|
quantum_plugin_ovs {
|
||||||
|
'OVS/network_vlan_ranges': value => $network_vlan_ranges;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
quantum_plugin_ovs { 'OVS/network_vlan_ranges': ensure => absent }
|
||||||
|
}
|
||||||
|
|
||||||
if $::osfamily == 'Redhat' {
|
if $::osfamily == 'Redhat' {
|
||||||
file {'/etc/quantum/plugin.ini':
|
file {'/etc/quantum/plugin.ini':
|
||||||
ensure => link,
|
ensure => link,
|
||||||
|
@ -6,13 +6,73 @@ describe 'quantum::plugins::ovs' do
|
|||||||
"class { 'quantum': rabbit_password => 'passw0rd' }"
|
"class { 'quantum': rabbit_password => 'passw0rd' }"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let :default_params do
|
||||||
|
{
|
||||||
|
:package_ensure => 'present',
|
||||||
|
:sql_connection => 'sqlite:////var/lib/quantum/ovs.sqlite',
|
||||||
|
:sql_max_retries => 10,
|
||||||
|
:reconnect_interval => 2,
|
||||||
|
:tenant_network_type => 'vlan',
|
||||||
|
:network_vlan_ranges => 'physnet1:1000:2000',
|
||||||
|
:tunnel_id_ranges => '1:1000'
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
|
let :params do
|
||||||
|
{}
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples_for 'quantum ovs plugin' do
|
||||||
|
|
||||||
|
let :p do
|
||||||
|
default_params.merge(params)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should perform default configuration of' do
|
||||||
|
should contain_quantum_plugin_ovs('OVS/network_vlan_ranges').\
|
||||||
|
with_value(p[:network_vlan_ranges])
|
||||||
|
should contain_quantum_plugin_ovs('DATABASE/sql_connection').with_value(p[:sql_connection])
|
||||||
|
should contain_quantum_plugin_ovs('DATABASE/sql_max_retries').with_value(p[:sql_max_retries])
|
||||||
|
should contain_quantum_plugin_ovs('DATABASE/reconnect_interval').with_value(p[:reconnect_interval])
|
||||||
|
should contain_quantum_plugin_ovs('OVS/tenant_network_type').with_value(p[:tenant_network_type])
|
||||||
|
should_not contain_quantum_plugin_ovs('OVS/tunnel_id_ranges')
|
||||||
|
should contain_quantum_plugin_ovs('OVS/network_vlan_ranges').with_value(p[:network_vlan_ranges])
|
||||||
|
should contain_package('quantum-plugin-ovs').with(
|
||||||
|
:name => platform_params[:ovs_server_package],
|
||||||
|
:ensure => p[:package_ensure]
|
||||||
|
)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'with gre tunneling' do
|
||||||
|
let :params do
|
||||||
|
{ :tenant_network_type => 'gre' }
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should perform gre network configuration' do
|
||||||
|
should contain_quantum_plugin_ovs('OVS/network_vlan_ranges').with_ensure('absent')
|
||||||
|
should contain_quantum_plugin_ovs('OVS/tenant_network_type').with_value(p[:tenant_network_type])
|
||||||
|
should contain_quantum_plugin_ovs('OVS/tunnel_id_ranges').with_value(p[:tunnel_id_ranges])
|
||||||
|
end
|
||||||
|
end
|
||||||
|
context 'with a flat network' do
|
||||||
|
let :params do
|
||||||
|
{ :tenant_network_type => 'flat' }
|
||||||
|
end
|
||||||
|
it { should contain_quantum_plugin_ovs('OVS/network_vlan_ranges').with_value(p[:network_vlan_ranges]) }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
context 'on Debian platforms' do
|
context 'on Debian platforms' do
|
||||||
let :facts do
|
let :facts do
|
||||||
{ :osfamily => 'Debian' }
|
{ :osfamily => 'Debian' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let :platform_params do
|
||||||
|
{ :ovs_server_package => 'quantum-plugin-openvswitch' }
|
||||||
|
end
|
||||||
|
|
||||||
it { should contain_class('quantum::plugins::ovs') }
|
it { should contain_class('quantum::plugins::ovs') }
|
||||||
|
it_configures 'quantum ovs plugin'
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'on RedHat platforms' do
|
context 'on RedHat platforms' do
|
||||||
@ -20,6 +80,18 @@ describe 'quantum::plugins::ovs' do
|
|||||||
{ :osfamily => 'RedHat' }
|
{ :osfamily => 'RedHat' }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
let :platform_params do
|
||||||
|
{ :ovs_server_package => 'openstack-quantum-openvswitch' }
|
||||||
|
end
|
||||||
|
|
||||||
it { should contain_class('quantum::plugins::ovs') }
|
it { should contain_class('quantum::plugins::ovs') }
|
||||||
|
it 'should perform redhat specific configuration' do
|
||||||
|
should contain_file('/etc/quantum/plugin.ini').with(
|
||||||
|
:ensure => 'link',
|
||||||
|
:target => '/etc/quantum/plugins/openvswitch/ovs_quantum_plugin.ini',
|
||||||
|
:require => 'Package[quantum-plugin-ovs]'
|
||||||
|
)
|
||||||
|
end
|
||||||
|
it_configures 'quantum ovs plugin'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user