From e6a9d2eccef9fcb5ac69241801765d7c00b67996 Mon Sep 17 00:00:00 2001 From: Brent Eagles Date: Thu, 25 Aug 2016 17:33:52 -0230 Subject: [PATCH] Adding support for overlay_ip_version Neutron recently added support for configuring the IP version used for overlay network endpoints. Change-Id: I5bc8a4529e7441e7eb53ae74fc448b1fc01815f3 --- manifests/plugins/ml2.pp | 11 ++++++++ ...d-overlay-ip-version-6759f0d61c50011c.yaml | 3 ++ spec/classes/neutron_plugins_ml2_spec.rb | 28 +++++++++++++++++++ 3 files changed, 42 insertions(+) create mode 100644 releasenotes/notes/add-overlay-ip-version-6759f0d61c50011c.yaml diff --git a/manifests/plugins/ml2.pp b/manifests/plugins/ml2.pp index e725b77e2..4a22212ad 100644 --- a/manifests/plugins/ml2.pp +++ b/manifests/plugins/ml2.pp @@ -128,6 +128,11 @@ # the maximum MTU for the driver. # Defaults to $::os_service_default # +# [*overlay_ip_version*] +# (optional) Configures the IP version used for all overlay network endpoints. Valid values +# are 4 and 6. +# Defaults to $::os_service_default +# # DEPRECATED PARAMETERS # # [*sriov_agent_required*] @@ -152,6 +157,7 @@ class neutron::plugins::ml2 ( $path_mtu = 0, $purge_config = false, $max_header_size = $::os_service_default, + $overlay_ip_version = $::os_service_default, # DEPRECATED PARAMETERS $sriov_agent_required = undef, ) { @@ -167,6 +173,10 @@ class neutron::plugins::ml2 ( warning('Security groups will not work without properly set firewall_driver') } + if !is_service_default($overlay_ip_version) and !($overlay_ip_version in [4, 6]) { + fail('Invalid IP version for overlay_ip_version') + } + if $::operatingsystem == 'Ubuntu' { file_line { '/etc/default/neutron-server:NEUTRON_PLUGIN_CONFIG': path => '/etc/default/neutron-server', @@ -227,6 +237,7 @@ class neutron::plugins::ml2 ( 'ml2/mechanism_drivers': value => join(any2array($mechanism_drivers), ','); 'ml2/path_mtu': value => $path_mtu; 'ml2/extension_drivers': value => join(any2array($extension_drivers), ','); + 'ml2/overlay_ip_version': value => $overlay_ip_version; 'securitygroup/enable_security_group': value => $enable_security_group; 'securitygroup/firewall_driver': value => $firewall_driver; } diff --git a/releasenotes/notes/add-overlay-ip-version-6759f0d61c50011c.yaml b/releasenotes/notes/add-overlay-ip-version-6759f0d61c50011c.yaml new file mode 100644 index 000000000..ca74085bd --- /dev/null +++ b/releasenotes/notes/add-overlay-ip-version-6759f0d61c50011c.yaml @@ -0,0 +1,3 @@ +--- +features: + - Add `overlay_ip_version` options support to ml2 plugin settings. diff --git a/spec/classes/neutron_plugins_ml2_spec.rb b/spec/classes/neutron_plugins_ml2_spec.rb index 4a38952eb..9fdd617b2 100644 --- a/spec/classes/neutron_plugins_ml2_spec.rb +++ b/spec/classes/neutron_plugins_ml2_spec.rb @@ -77,6 +77,7 @@ describe 'neutron::plugins::ml2' do is_expected.to contain_neutron_plugin_ml2('ml2/extension_drivers').with_value('') is_expected.to contain_neutron_plugin_ml2('ml2/path_mtu').with_value(p[:path_mtu]) is_expected.to contain_neutron_plugin_ml2('ml2/physical_network_mtus').with_ensure('absent') + is_expected.to contain_neutron_plugin_ml2('ml2/overlay_ip_version').with_value('') is_expected.to contain_neutron_plugin_ml2('securitygroup/firewall_driver').with_value('') is_expected.to contain_neutron_plugin_ml2('securitygroup/enable_security_group').with_value('') end @@ -114,6 +115,33 @@ describe 'neutron::plugins::ml2' do end end + context 'when specifying IPv4 overlays' do + before :each do + params.merge!(:overlay_ip_version => 4) + end + it 'configures as IPv4' do + is_expected.to contain_neutron_plugin_ml2('ml2/overlay_ip_version').with_value(4) + end + end + + context 'when specifying IPv6 overlays' do + before :each do + params.merge!(:overlay_ip_version => 6) + end + it 'configures as IPv6' do + is_expected.to contain_neutron_plugin_ml2('ml2/overlay_ip_version').with_value(6) + end + end + + context 'when specifying an invalid overlay IP versions' do + before :each do + params.merge!(:overlay_ip_version => 10) + end + it 'fails to accept value' do + is_expected.to raise_error(Puppet::Error) + end + end + context 'when using extension drivers for ML2 plugin' do before :each do params.merge!(:extension_drivers => ['port_security','qos'])