diff --git a/manifests/plugins/ml2.pp b/manifests/plugins/ml2.pp index 79db23e4c..179c703eb 100644 --- a/manifests/plugins/ml2.pp +++ b/manifests/plugins/ml2.pp @@ -27,7 +27,7 @@ # from the neutron.ml2.type_drivers namespace. # Could be an array that can have these elements: # local, flat, vlan, gre, vxlan -# Defaults to ['local', 'flat', 'vlan', 'gre', 'vxlan']. +# Defaults to ['local', 'flat', 'vlan', 'gre', 'vxlan', 'geneve']. # # [*extension_drivers*] # (optional) Ordered list of extension driver entrypoints to be loaded @@ -129,6 +129,11 @@ # in the ml2 config. # Defaults to false. # +# [*max_header_size*] +# (optional) Geneve encapsulation header size is dynamic, this value is used to calculate +# the maximum MTU for the driver. +# Defaults to $::os_service_default +# class neutron::plugins::ml2 ( $type_drivers = ['local', 'flat', 'vlan', 'gre', 'vxlan'], @@ -148,6 +153,7 @@ class neutron::plugins::ml2 ( $physical_network_mtus = $::os_service_default, $path_mtu = 0, $purge_config = false, + $max_header_size = $::os_service_default ) { include ::neutron::deps @@ -204,6 +210,7 @@ class neutron::plugins::ml2 ( network_vlan_ranges => $network_vlan_ranges, vni_ranges => $vni_ranges, vxlan_group => $vxlan_group, + max_header_size => $max_header_size } neutron::plugins::ml2::mech_driver { $mechanism_drivers: diff --git a/manifests/plugins/ml2/type_driver.pp b/manifests/plugins/ml2/type_driver.pp index 86b1f0b61..78c085da7 100644 --- a/manifests/plugins/ml2/type_driver.pp +++ b/manifests/plugins/ml2/type_driver.pp @@ -39,12 +39,17 @@ # [*vxlan_group*] # (required) Multicast group for VXLAN. If unset, disables VXLAN multicast mode. # +# [*max_header_size*] +# (optional) Geneve encapsulation header size is dynamic, this value is used to calculate +# the maximum MTU for the driver. +# define neutron::plugins::ml2::type_driver ( $flat_networks, $tunnel_id_ranges, $network_vlan_ranges, $vni_ranges, - $vxlan_group + $vxlan_group, + $max_header_size ){ include ::neutron::deps @@ -113,6 +118,16 @@ define neutron::plugins::ml2::type_driver ( elsif ($name == 'midonet') or ($name == 'uplink') { # midonet type driver has its own class separate from this one } + elsif ($name == 'geneve') { + validate_vni_ranges($vni_ranges) + if !is_service_default($max_header_size) { + validate_integer($max_header_size) + } + neutron_plugin_ml2 { + 'ml2_type_geneve/max_header_size': value => $max_header_size; + 'ml2_type_geneve/vni_ranges': value => join($vni_ranges,','); + } + } else { # detect an invalid type_drivers value fail('type_driver unknown.') diff --git a/releasenotes/notes/add_geneve_type_driver_configs-e285075b3238b49d.yaml b/releasenotes/notes/add_geneve_type_driver_configs-e285075b3238b49d.yaml new file mode 100644 index 000000000..04019cd0b --- /dev/null +++ b/releasenotes/notes/add_geneve_type_driver_configs-e285075b3238b49d.yaml @@ -0,0 +1,4 @@ +--- +features: + - Added geneve config options in type_drivers. + - Added max_header_size parameter to ml2 plugin for use in geneve configuration. diff --git a/spec/classes/neutron_plugins_ml2_spec.rb b/spec/classes/neutron_plugins_ml2_spec.rb index 6b76cd861..e29e3c784 100644 --- a/spec/classes/neutron_plugins_ml2_spec.rb +++ b/spec/classes/neutron_plugins_ml2_spec.rb @@ -209,6 +209,21 @@ describe 'neutron::plugins::ml2' do it_raises 'a Puppet::Error', /vni ranges are invalid./ end + context 'when using geneve driver' do + before :each do + params.merge!(:type_drivers => ['local', 'flat', 'vlan', 'gre', 'vxlan', 'geneve'], + :vni_ranges => ['40:300','500:1000'], + :max_header_size => 50 + ) + end + + it 'configures geneve with valid values' do + is_expected.to contain_neutron_plugin_ml2('ml2/type_drivers').with_value(p[:type_drivers].join(',')) + is_expected.to contain_neutron_plugin_ml2('ml2_type_geneve/vni_ranges').with_value([p[:vni_ranges].join(',')]) + is_expected.to contain_neutron_plugin_ml2('ml2_type_geneve/max_header_size').with_value(p[:max_header_size]) + end + end + context 'with path_mtu set' do before :each do params.merge!(:path_mtu => '9000')