2016-07-11 09:47:20 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'neutron::plugins::ml2::ovn' do
|
|
|
|
let :pre_condition do
|
2019-12-08 23:12:32 +01:00
|
|
|
"class { 'neutron::keystone::authtoken':
|
2016-11-07 23:58:22 -03:00
|
|
|
password => 'passw0rd',
|
|
|
|
}
|
|
|
|
class { 'neutron::server': }
|
2018-05-24 11:00:47 +08:00
|
|
|
class { 'neutron': }"
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
let :default_params do
|
|
|
|
{
|
|
|
|
:ovn_nb_connection => 'tcp:127.0.0.1:6641',
|
|
|
|
:ovn_sb_connection => 'tcp:127.0.0.1:6642',
|
2019-08-05 14:52:43 +02:00
|
|
|
:ovn_nb_private_key => 'nb_key',
|
|
|
|
:ovn_nb_certificate => 'nb_cert',
|
|
|
|
:ovn_nb_ca_cert => 'nb_ca_cert',
|
|
|
|
:ovn_sb_private_key => 'sb_key',
|
|
|
|
:ovn_sb_certificate => 'sb_cert',
|
|
|
|
:ovn_sb_ca_cert => 'sb_ca_cert',
|
2021-11-09 21:16:12 +09:00
|
|
|
:ovsdb_connection_timeout => 60,
|
|
|
|
:ovsdb_retry_max_interval => 180,
|
|
|
|
:ovsdb_probe_interval => 60000,
|
2016-07-11 09:47:20 +00:00
|
|
|
:neutron_sync_mode => 'log',
|
2017-12-21 13:00:36 +01:00
|
|
|
:dvr_enabled => false,
|
2018-06-01 15:35:36 +05:30
|
|
|
:dns_servers => ['8.8.8.8', '10.10.10.10'],
|
2019-10-10 10:39:39 +01:00
|
|
|
:ovn_emit_need_to_frag => false,
|
2016-07-11 09:47:20 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2018-11-28 17:43:42 +01:00
|
|
|
shared_examples 'neutron ovn plugin' do
|
2016-07-11 09:47:20 +00:00
|
|
|
|
|
|
|
let :params do
|
|
|
|
{}
|
|
|
|
end
|
|
|
|
|
|
|
|
before do
|
|
|
|
params.merge!(default_params)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'should perform default configuration of' do
|
2018-11-28 17:43:42 +01:00
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_connection').with_value(params[:ovn_nb_connection])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_connection').with_value(params[:ovn_sb_connection])
|
2019-08-05 14:52:43 +02:00
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_private_key').with_value(params[:ovn_nb_private_key])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_certificate').with_value(params[:ovn_nb_certificate])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_ca_cert').with_value(params[:ovn_nb_ca_cert])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_private_key').with_value(params[:ovn_sb_private_key])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_certificate').with_value(params[:ovn_sb_certificate])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_ca_cert').with_value(params[:ovn_sb_ca_cert])
|
2018-11-28 17:43:42 +01:00
|
|
|
should contain_neutron_plugin_ml2('ovn/ovsdb_connection_timeout').with_value(params[:ovsdb_connection_timeout])
|
2021-11-09 21:16:12 +09:00
|
|
|
should contain_neutron_plugin_ml2('ovn/ovsdb_retry_max_interval').with_value(params[:ovsdb_retry_max_interval])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovsdb_probe_interval').with_value(params[:ovsdb_probe_interval])
|
2018-11-28 17:43:42 +01:00
|
|
|
should contain_neutron_plugin_ml2('ovn/neutron_sync_mode').with_value(params[:neutron_sync_mode])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/enable_distributed_floating_ip').with_value(params[:dvr_enabled])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/dns_servers').with_value(params[:dns_servers].join(','))
|
2019-04-04 18:17:53 +05:30
|
|
|
should contain_neutron_plugin_ml2('ovn/vhost_sock_dir').with_value('<SERVICE DEFAULT>')
|
2019-10-10 10:39:39 +01:00
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_emit_need_to_frag').with_value(params[:ovn_emit_need_to_frag])
|
2021-08-11 11:48:17 +02:00
|
|
|
should contain_neutron_plugin_ml2('network_log/rate_limit').with_value('<SERVICE DEFAULT>')
|
|
|
|
should contain_neutron_plugin_ml2('network_log/burst_limit').with_value('<SERVICE DEFAULT>')
|
|
|
|
should contain_neutron_plugin_ml2('network_log/local_output_log_base').with_value('<SERVICE DEFAULT>')
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2018-11-28 17:43:42 +01:00
|
|
|
shared_examples 'Validating parameters' do
|
2016-07-11 09:47:20 +00:00
|
|
|
let :params do
|
|
|
|
{}
|
|
|
|
end
|
|
|
|
|
|
|
|
before :each do
|
|
|
|
params.clear
|
|
|
|
params.merge!(default_params)
|
2019-03-19 16:42:20 +05:30
|
|
|
params.merge!(:vhostuser_socket_dir => 'test')
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
it 'should fail with invalid neutron_sync_mode' do
|
|
|
|
params[:neutron_sync_mode] = 'invalid'
|
2018-11-28 17:43:42 +01:00
|
|
|
should raise_error(Puppet::Error, /Invalid value for neutron_sync_mode parameter/)
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
|
|
|
|
2019-03-19 16:42:20 +05:30
|
|
|
it 'should contain valid vhostuser socket dir' do
|
2019-04-04 18:17:53 +05:30
|
|
|
should contain_neutron_plugin_ml2('ovn/vhost_sock_dir').with_value('test')
|
2019-03-19 16:42:20 +05:30
|
|
|
end
|
|
|
|
|
2017-12-21 13:00:36 +01:00
|
|
|
context 'with DVR' do
|
|
|
|
before :each do
|
|
|
|
params.merge!(:dvr_enabled => true)
|
|
|
|
end
|
|
|
|
it 'should enable DVR mode' do
|
2018-11-28 17:43:42 +01:00
|
|
|
should contain_neutron_plugin_ml2('ovn/enable_distributed_floating_ip').with_value(params[:dvr_enabled])
|
2017-12-21 13:00:36 +01:00
|
|
|
end
|
|
|
|
end
|
2019-10-10 10:39:39 +01:00
|
|
|
|
|
|
|
context 'with emit need to fragment enabled' do
|
|
|
|
before :each do
|
|
|
|
params.merge!(:ovn_emit_need_to_frag => true)
|
|
|
|
end
|
|
|
|
it 'should enable emit need to fragment option' do
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_emit_need_to_frag').with_value(params[:ovn_emit_need_to_frag])
|
|
|
|
end
|
|
|
|
end
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
on_supported_os({
|
|
|
|
:supported_os => OSDefaults.get_supported_os
|
|
|
|
}).each do |os,facts|
|
|
|
|
context "on #{os}" do
|
|
|
|
let (:facts) do
|
|
|
|
facts.merge(OSDefaults.get_facts({:processorcount => 8}))
|
|
|
|
end
|
|
|
|
|
2018-11-28 17:43:42 +01:00
|
|
|
it_behaves_like 'neutron ovn plugin'
|
|
|
|
it_behaves_like 'Validating parameters'
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|