Added geneve type_driver config options

Geneve type driver uses the vni_ranges and a new parameter
called max_header_size.

Change-Id: I968762e6078ab8ee4e073ac99527ddde6cc96bdc
This commit is contained in:
Matthew J Black 2016-06-30 12:37:13 -04:00
parent 4cbf6d1cba
commit 4731f243ea
4 changed files with 43 additions and 2 deletions

View File

@ -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:

View File

@ -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.')

View File

@ -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.

View File

@ -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')