diff --git a/manifests/plugins/ml2/ovn.pp b/manifests/plugins/ml2/ovn.pp index 480da1f46..2860c3bdf 100644 --- a/manifests/plugins/ml2/ovn.pp +++ b/manifests/plugins/ml2/ovn.pp @@ -95,6 +95,21 @@ # Type: String # Defaults to $facts['os_service_default'] # +# [*dhcp_default_lease_time*] +# (optional) Default lease time (in seconds) to use with OVN's native DHCP +# service. +# Defaults to $facts['os_service_default'] +# +# [*ovn_dhcp4_global_options*] +# (optional) Global DHCP6 options which will be automatically set on each +# subnet upon creation and on all existing subnets when Neutron starts. +# Defaults to $facts['os_service_default'] +# +# [*ovn_dhcp6_global_options*] +# (optional) Global DHCP6 options which will be automatically set on each +# subnet upon creation and on all existing subnets when Neutron starts. +# Defaults to $facts['os_service_default'] +# # [*ovn_emit_need_to_frag*] # (optional) Configure OVN to emit "need to frag" packets in case # of MTU mismatch. Before enabling this configuration make @@ -170,6 +185,9 @@ class neutron::plugins::ml2::ovn( $disable_ovn_dhcp_for_baremetal_ports = $facts['os_service_default'], $dns_servers = $facts['os_service_default'], $vhostuser_socket_dir = $facts['os_service_default'], + $dhcp_default_lease_time = $facts['os_service_default'], + $ovn_dhcp4_global_options = $facts['os_service_default'], + $ovn_dhcp6_global_options = $facts['os_service_default'], $ovn_emit_need_to_frag = $facts['os_service_default'], $localnet_learn_fdb = $facts['os_service_default'], $fdb_age_threshold = $facts['os_service_default'], @@ -189,6 +207,15 @@ class neutron::plugins::ml2::ovn( fail( 'Invalid value for neutron_sync_mode parameter' ) } + $ovn_dhcp4_global_options_real = $ovn_dhcp4_global_options ? { + Hash => join(join_keys_to_values($ovn_dhcp4_global_options, ':'), ','), + default => join(any2array($ovn_dhcp4_global_options), ',') + } + $ovn_dhcp6_global_options_real = $ovn_dhcp6_global_options ? { + Hash => join(join_keys_to_values($ovn_dhcp6_global_options, ':'), ','), + default => join(any2array($ovn_dhcp6_global_options), ',') + } + neutron_plugin_ml2 { 'ovn/ovn_nb_connection' : value => join(any2array($ovn_nb_connection), ','); 'ovn/ovn_sb_connection' : value => join(any2array($ovn_sb_connection), ','); @@ -207,6 +234,9 @@ class neutron::plugins::ml2::ovn( 'ovn/disable_ovn_dhcp_for_baremetal_ports': value => $disable_ovn_dhcp_for_baremetal_ports; 'ovn/dns_servers' : value => join(any2array($dns_servers), ','); 'ovn/vhost_sock_dir' : value => $vhostuser_socket_dir; + 'ovn/dhcp_default_lease_time' : value => $dhcp_default_lease_time; + 'ovn/ovn_dhcp4_global_options' : value => $ovn_dhcp4_global_options_real; + 'ovn/ovn_dhcp6_global_options' : value => $ovn_dhcp6_global_options_real; 'ovn/ovn_emit_need_to_frag' : value => $ovn_emit_need_to_frag; 'ovn/localnet_learn_fdb' : value => $localnet_learn_fdb; 'ovn/fdb_age_threshold' : value => $fdb_age_threshold; diff --git a/releasenotes/notes/ovn-dhcp-opts-8acee43ac2c627b7.yaml b/releasenotes/notes/ovn-dhcp-opts-8acee43ac2c627b7.yaml new file mode 100644 index 000000000..44252b053 --- /dev/null +++ b/releasenotes/notes/ovn-dhcp-opts-8acee43ac2c627b7.yaml @@ -0,0 +1,9 @@ +--- +features: + - | + The following parameters have been added to + the ``neutron::plugins::ml2::ovn`` class. + + - ``dhcp_default_lease_time`` + - ``ovn_dhcp4_global_options`` + - ``ovn_dhcp6_global_options`` diff --git a/spec/classes/neutron_plugins_ml2_ovn_spec.rb b/spec/classes/neutron_plugins_ml2_ovn_spec.rb index 255f98286..30acaa872 100644 --- a/spec/classes/neutron_plugins_ml2_ovn_spec.rb +++ b/spec/classes/neutron_plugins_ml2_ovn_spec.rb @@ -27,6 +27,9 @@ describe 'neutron::plugins::ml2::ovn' do :disable_ovn_dhcp_for_baremetal_ports => '', :dns_servers => '', :vhostuser_socket_dir => '', + :dhcp_default_lease_time => '', + :ovn_dhcp4_global_options => '', + :ovn_dhcp6_global_options => '', :ovn_emit_need_to_frag => '', :localnet_learn_fdb => '', :fdb_age_threshold => '', @@ -68,6 +71,9 @@ describe 'neutron::plugins::ml2::ovn' do should contain_neutron_plugin_ml2('ovn/disable_ovn_dhcp_for_baremetal_ports').with_value(p[:disable_ovn_dhcp_for_baremetal_ports]) 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/dhcp_default_lease_time').with_value(p[:dhcp_default_lease_time]) + should contain_neutron_plugin_ml2('ovn/ovn_dhcp4_global_options').with_value(p[:ovn_dhcp4_global_options]) + should contain_neutron_plugin_ml2('ovn/ovn_dhcp6_global_options').with_value(p[:ovn_dhcp6_global_options]) should contain_neutron_plugin_ml2('ovn/ovn_emit_need_to_frag').with_value(p[:ovn_emit_need_to_frag]) should contain_neutron_plugin_ml2('ovn/localnet_learn_fdb').with_value(p[:localnet_learn_fdb]) should contain_neutron_plugin_ml2('ovn/fdb_age_threshold').with_value(p[:fdb_age_threshold]) @@ -99,6 +105,10 @@ describe 'neutron::plugins::ml2::ovn' do :dvr_enabled => false, :disable_ovn_dhcp_for_baremetal_ports => false, :dns_servers => '8.8.8.8,10.10.10.10', + :vhostuser_socket_dir => '/var/run/openvswitch', + :dhcp_default_lease_time => 43200, + :ovn_dhcp4_global_options => 'ntp_server:1.2.3.4', + :ovn_dhcp6_global_options => 'ntp_server:5.6.7.8', :ovn_emit_need_to_frag => false, :localnet_learn_fdb => false, :fdb_age_threshold => 10, @@ -126,6 +136,9 @@ describe 'neutron::plugins::ml2::ovn' do should contain_neutron_plugin_ml2('ovn/disable_ovn_dhcp_for_baremetal_ports').with_value(p[:disable_ovn_dhcp_for_baremetal_ports]) 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/dhcp_default_lease_time').with_value(p[:dhcp_default_lease_time]) + should contain_neutron_plugin_ml2('ovn/ovn_dhcp4_global_options').with_value(p[:ovn_dhcp4_global_options]) + should contain_neutron_plugin_ml2('ovn/ovn_dhcp6_global_options').with_value(p[:ovn_dhcp6_global_options]) should contain_neutron_plugin_ml2('ovn/ovn_emit_need_to_frag').with_value(p[:ovn_emit_need_to_frag]) should contain_neutron_plugin_ml2('ovn/localnet_learn_fdb').with_value(p[:localnet_learn_fdb]) should contain_neutron_plugin_ml2('ovn/fdb_age_threshold').with_value(p[:fdb_age_threshold]) @@ -154,9 +167,11 @@ describe 'neutron::plugins::ml2::ovn' do context 'with parameters set by arrays' do let :params do { - :ovn_nb_connection => ['tcp:192.0.2.11:6641', 'tcp:192.0.2.12:6641'], - :ovn_sb_connection => ['tcp:192.0.2.11:6642', 'tcp:192.0.2.12:6642'], - :dns_servers => ['8.8.8.8', '10.10.10.10'], + :ovn_nb_connection => ['tcp:192.0.2.11:6641', 'tcp:192.0.2.12:6641'], + :ovn_sb_connection => ['tcp:192.0.2.11:6642', 'tcp:192.0.2.12:6642'], + :dns_servers => ['8.8.8.8', '10.10.10.10'], + :ovn_dhcp4_global_options => ['ntp_server:1.2.3.4', 'wpad:1.2.3.5'], + :ovn_dhcp6_global_options => ['ntp_server:5.6.7.8', 'wpad:5.6.7.9'], } end @@ -164,6 +179,8 @@ describe 'neutron::plugins::ml2::ovn' do should contain_neutron_plugin_ml2('ovn/ovn_nb_connection').with_value(p[:ovn_nb_connection].join(',')) should contain_neutron_plugin_ml2('ovn/ovn_sb_connection').with_value(p[:ovn_sb_connection].join(',')) should contain_neutron_plugin_ml2('ovn/dns_servers').with_value(p[:dns_servers].join(',')) + should contain_neutron_plugin_ml2('ovn/ovn_dhcp4_global_options').with_value(p[:ovn_dhcp4_global_options].join(',')) + should contain_neutron_plugin_ml2('ovn/ovn_dhcp6_global_options').with_value(p[:ovn_dhcp6_global_options].join(',')) end end end