2016-07-11 09:47:20 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
describe 'neutron::plugins::ml2::ovn' do
|
|
|
|
let :pre_condition do
|
2016-11-07 23:58:22 -03:00
|
|
|
"class { '::neutron::keystone::authtoken':
|
|
|
|
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',
|
2016-07-11 09:47:20 +00:00
|
|
|
:ovsdb_connection_timeout => '60',
|
|
|
|
:neutron_sync_mode => 'log',
|
|
|
|
:ovn_l3_mode => true,
|
|
|
|
:vif_type => 'ovs',
|
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'],
|
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])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/neutron_sync_mode').with_value(params[:neutron_sync_mode])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_l3_mode').with_value(params[:ovn_l3_mode])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/vif_type').with_value(params[:vif_type])
|
|
|
|
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>')
|
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
|
|
|
|
|
|
|
|
it 'should fail with invalid vif_type' do
|
|
|
|
params[:vif_type] = 'invalid'
|
2018-11-28 17:43:42 +01:00
|
|
|
should raise_error(Puppet::Error, /Invalid value for vif_type parameter/)
|
2016-07-11 09:47:20 +00:00
|
|
|
params.delete(:vif_type)
|
2018-11-28 17:43:42 +01:00
|
|
|
should contain_neutron_plugin_ml2('ovn/vif_type').with_value('<SERVICE DEFAULT>')
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
2017-12-21 13:00:36 +01:00
|
|
|
|
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
|
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
|