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
|
|
|
|
{
|
2022-07-19 22:07:52 -05:00
|
|
|
:ovn_nb_connection => '<SERVICE DEFAULT>',
|
|
|
|
:ovn_sb_connection => '<SERVICE DEFAULT>',
|
|
|
|
:ovn_nb_private_key => '<SERVICE DEFAULT>',
|
|
|
|
:ovn_nb_certificate => '<SERVICE DEFAULT>',
|
|
|
|
:ovn_nb_ca_cert => '<SERVICE DEFAULT>',
|
|
|
|
:ovn_sb_private_key => '<SERVICE DEFAULT>',
|
|
|
|
:ovn_sb_certificate => '<SERVICE DEFAULT>',
|
|
|
|
:ovn_sb_ca_cert => '<SERVICE DEFAULT>',
|
|
|
|
:ovsdb_connection_timeout => '<SERVICE DEFAULT>',
|
|
|
|
:ovsdb_retry_max_interval => '<SERVICE DEFAULT>',
|
|
|
|
:ovsdb_probe_interval => '<SERVICE DEFAULT>',
|
|
|
|
:neutron_sync_mode => '<SERVICE DEFAULT>',
|
|
|
|
:dvr_enabled => '<SERVICE DEFAULT>',
|
|
|
|
:disable_ovn_dhcp_for_baremetal_ports => '<SERVICE DEFAULT>',
|
|
|
|
:dns_servers => '<SERVICE DEFAULT>',
|
|
|
|
:vhostuser_socket_dir => '<SERVICE DEFAULT>',
|
|
|
|
:ovn_emit_need_to_frag => '<SERVICE DEFAULT>',
|
|
|
|
:network_log_rate_limit => '<SERVICE DEFAULT>',
|
|
|
|
:network_log_burst_limit => '<SERVICE DEFAULT>',
|
|
|
|
:network_log_local_output_log_base => '<SERVICE DEFAULT>',
|
2016-07-11 09:47:20 +00:00
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2022-06-16 12:22:52 +09:00
|
|
|
shared_examples 'neutron::plugins::ml2::ovn' do
|
2016-07-11 09:47:20 +00:00
|
|
|
|
|
|
|
let :params do
|
|
|
|
{}
|
|
|
|
end
|
|
|
|
|
2022-06-16 12:22:52 +09:00
|
|
|
let :p do
|
|
|
|
default_params.merge(params)
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
|
|
|
|
2022-06-16 12:22:52 +09:00
|
|
|
context 'with defaults' do
|
|
|
|
it 'should configure defaults' do
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_connection').with_value(p[:ovn_nb_connection])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_connection').with_value(p[:ovn_sb_connection])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_private_key').with_value(p[:ovn_nb_private_key])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_certificate').with_value(p[:ovn_nb_certificate])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_ca_cert').with_value(p[:ovn_nb_ca_cert])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_private_key').with_value(p[:ovn_sb_private_key])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_certificate').with_value(p[:ovn_sb_certificate])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_ca_cert').with_value(p[:ovn_sb_ca_cert])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovsdb_connection_timeout').with_value(p[:ovsdb_connection_timeout])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovsdb_retry_max_interval').with_value(p[:ovsdb_retry_max_interval])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovsdb_probe_interval').with_value(p[:ovsdb_probe_interval])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/neutron_sync_mode').with_value(p[:neutron_sync_mode])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/enable_distributed_floating_ip').with_value(p[:dvr_enabled])
|
2022-07-19 22:07:52 -05:00
|
|
|
should contain_neutron_plugin_ml2('ovn/disable_ovn_dhcp_for_baremetal_ports').with_value(p[:disable_ovn_dhcp_for_baremetal_ports])
|
2022-06-16 12:22:52 +09:00
|
|
|
should contain_neutron_plugin_ml2('ovn/dns_servers').with_value(p[:dns_servers])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/vhost_sock_dir').with_value(p[:vhostuser_socket_dir])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_emit_need_to_frag').with_value(p[:ovn_emit_need_to_frag])
|
|
|
|
should contain_neutron_plugin_ml2('network_log/rate_limit').with_value(p[:network_log_rate_limit])
|
|
|
|
should contain_neutron_plugin_ml2('network_log/burst_limit').with_value(p[:network_log_burst_limit])
|
|
|
|
should contain_neutron_plugin_ml2('network_log/local_output_log_base').with_value(p[:network_log_local_output_log_base])
|
|
|
|
end
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
|
|
|
|
2022-06-16 12:22:52 +09:00
|
|
|
context 'with parameters' do
|
|
|
|
let :params do
|
|
|
|
{
|
2022-07-19 22:07:52 -05:00
|
|
|
:ovn_nb_connection => 'tcp:127.0.0.1:6641',
|
|
|
|
:ovn_sb_connection => 'tcp:127.0.0.1:6642',
|
|
|
|
: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',
|
|
|
|
:ovsdb_connection_timeout => 60,
|
|
|
|
:ovsdb_retry_max_interval => 180,
|
|
|
|
:ovsdb_probe_interval => 60000,
|
|
|
|
:neutron_sync_mode => 'log',
|
|
|
|
:dvr_enabled => false,
|
|
|
|
:disable_ovn_dhcp_for_baremetal_ports => false,
|
|
|
|
:dns_servers => '8.8.8.8,10.10.10.10',
|
|
|
|
:ovn_emit_need_to_frag => false,
|
2022-06-16 12:22:52 +09:00
|
|
|
}
|
|
|
|
end
|
2016-07-11 09:47:20 +00:00
|
|
|
|
2022-06-16 12:22:52 +09:00
|
|
|
it 'should configure given values' do
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_connection').with_value(p[:ovn_nb_connection])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_connection').with_value(p[:ovn_sb_connection])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_private_key').with_value(p[:ovn_nb_private_key])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_certificate').with_value(p[:ovn_nb_certificate])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_nb_ca_cert').with_value(p[:ovn_nb_ca_cert])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_private_key').with_value(p[:ovn_sb_private_key])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_certificate').with_value(p[:ovn_sb_certificate])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_sb_ca_cert').with_value(p[:ovn_sb_ca_cert])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovsdb_connection_timeout').with_value(p[:ovsdb_connection_timeout])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovsdb_retry_max_interval').with_value(p[:ovsdb_retry_max_interval])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovsdb_probe_interval').with_value(p[:ovsdb_probe_interval])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/neutron_sync_mode').with_value(p[:neutron_sync_mode])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/enable_distributed_floating_ip').with_value(p[:dvr_enabled])
|
2022-07-19 22:07:52 -05:00
|
|
|
should contain_neutron_plugin_ml2('ovn/disable_ovn_dhcp_for_baremetal_ports').with_value(p[:disable_ovn_dhcp_for_baremetal_ports])
|
2022-06-16 12:22:52 +09:00
|
|
|
should contain_neutron_plugin_ml2('ovn/dns_servers').with_value(p[:dns_servers])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/vhost_sock_dir').with_value(p[:vhostuser_socket_dir])
|
|
|
|
should contain_neutron_plugin_ml2('ovn/ovn_emit_need_to_frag').with_value(p[:ovn_emit_need_to_frag])
|
|
|
|
should contain_neutron_plugin_ml2('network_log/rate_limit').with_value(p[:network_log_rate_limit])
|
|
|
|
should contain_neutron_plugin_ml2('network_log/burst_limit').with_value(p[:network_log_burst_limit])
|
|
|
|
should contain_neutron_plugin_ml2('network_log/local_output_log_base').with_value(p[:network_log_local_output_log_base])
|
|
|
|
end
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
|
|
|
|
2022-06-16 12:22:52 +09:00
|
|
|
context 'with invalid neutron_sync_mode' do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:neutron_sync_mode => 'invalid'
|
|
|
|
}
|
|
|
|
end
|
2016-07-11 09:47:20 +00:00
|
|
|
|
2022-06-16 12:22:52 +09:00
|
|
|
it {
|
|
|
|
should raise_error(Puppet::Error, /Invalid value for neutron_sync_mode parameter/)
|
|
|
|
}
|
2019-03-19 16:42:20 +05:30
|
|
|
end
|
|
|
|
|
2022-06-16 12:22:52 +09:00
|
|
|
context 'with parameters set by arrays' do
|
|
|
|
let :params do
|
|
|
|
{
|
|
|
|
:dns_servers => ['8.8.8.8', '10.10.10.10'],
|
|
|
|
}
|
2017-12-21 13:00:36 +01:00
|
|
|
end
|
2019-10-10 10:39:39 +01:00
|
|
|
|
2022-06-16 12:22:52 +09:00
|
|
|
it 'should configure comma-separated strings' do
|
|
|
|
should contain_neutron_plugin_ml2('ovn/dns_servers').with_value(p[:dns_servers].join(','))
|
2019-10-10 10:39:39 +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
|
2022-06-16 12:22:52 +09:00
|
|
|
facts.merge(OSDefaults.get_facts())
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
|
|
|
|
2022-06-16 12:22:52 +09:00
|
|
|
it_behaves_like 'neutron::plugins::ml2::ovn'
|
2016-07-11 09:47:20 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|