diff --git a/examples/neutron.pp b/examples/neutron.pp index 94af5ff51..53865c1ab 100644 --- a/examples/neutron.pp +++ b/examples/neutron.pp @@ -32,8 +32,8 @@ class { '::neutron::agents::metering': } # This plugin configures Neutron for OVS on the server # Agent class { '::neutron::agents::ml2::ovs': - local_ip => '192.168.1.1', - enable_tunneling => true, + local_ip => '192.168.1.1', + tunnel_types => ['vxlan'] } # ml2 plugin with vxlan as ml2 driver and ovs as mechanism driver @@ -58,6 +58,6 @@ class { '::neutron': # The agent/plugin combo also needs installed on clients # Agent class { '::neutron::agents::ml2::ovs': - local_ip => '192.168.1.11', - enable_tunneling => true, + local_ip => '192.168.1.11', + tunnel_types => ['vxlan'] } diff --git a/manifests/agents/ml2/ovs.pp b/manifests/agents/ml2/ovs.pp index b8b0e6b5b..de440093c 100644 --- a/manifests/agents/ml2/ovs.pp +++ b/manifests/agents/ml2/ovs.pp @@ -46,14 +46,10 @@ # (optional) Integration bridge in OVS # Defaults to 'br-int' # -# [*enable_tunneling*] -# (optional) Enable or not tunneling -# Defaults to false -# # [*tunnel_types*] # (optional) List of types of tunnels to use when utilizing tunnels, # either 'gre' or 'vxlan'. -# Defaults to false +# Defaults to empty list # # [*local_ip*] # (optional) Local IP address of GRE tunnel endpoints. @@ -141,6 +137,10 @@ # (optional) Enable or not ARP Spoofing Protection # Defaults to $::os_service_default # +# [*enable_tunneling*] +# (optional) Enable or not tunneling +# Defaults to false +# class neutron::agents::ml2::ovs ( $package_ensure = 'present', $enabled = true, @@ -149,7 +149,6 @@ class neutron::agents::ml2::ovs ( $bridge_uplinks = [], $bridge_mappings = [], $integration_bridge = 'br-int', - $enable_tunneling = false, $tunnel_types = [], $local_ip = false, $tunnel_bridge = 'br-tun', @@ -169,6 +168,7 @@ class neutron::agents::ml2::ovs ( $purge_config = false, # DEPRECATED PARAMETERS $prevent_arp_spoofing = $::os_service_default, + $enable_tunneling = false, ) { include ::neutron::deps @@ -177,11 +177,22 @@ class neutron::agents::ml2::ovs ( require ::vswitch::ovs } - if $enable_tunneling and ! $local_ip { + if $enable_tunneling { + warning('The enable_tunneling parameter is deprecated. Please set tunnel_types with the desired type to enable tunneling.') + } + + validate_array($tunnel_types) + if $enable_tunneling or (size($tunnel_types) > 0) { + $enable_tunneling_real = true + } else { + $enable_tunneling_real = false + } + + if $enable_tunneling_real and ! $local_ip { fail('Local ip for ovs agent must be set when tunneling is enabled') } - if ($enable_tunneling) and (!is_service_default($enable_distributed_routing)) and (!is_service_default($l2_population)) { + if ($enable_tunneling_real) and (!is_service_default($enable_distributed_routing)) and (!is_service_default($l2_population)) { if $enable_distributed_routing and ! $l2_population { fail('L2 population must be enabled when DVR and tunneling are enabled') } @@ -248,20 +259,15 @@ class neutron::agents::ml2::ovs ( neutron_agent_ovs { 'securitygroup/firewall_driver': ensure => absent } } - if $enable_tunneling { + if $enable_tunneling_real { neutron_agent_ovs { - 'ovs/enable_tunneling': value => true; 'ovs/tunnel_bridge': value => $tunnel_bridge; 'ovs/local_ip': value => $local_ip; 'ovs/int_peer_patch_port': value => $int_peer_patch_port; 'ovs/tun_peer_patch_port': value => $tun_peer_patch_port; + 'agent/tunnel_types': value => join($tunnel_types, ','); } - if size($tunnel_types) > 0 { - neutron_agent_ovs { - 'agent/tunnel_types': value => join($tunnel_types, ','); - } - } if 'vxlan' in $tunnel_types { validate_vxlan_udp_port($vxlan_udp_port) neutron_agent_ovs { @@ -270,7 +276,6 @@ class neutron::agents::ml2::ovs ( } } else { neutron_agent_ovs { - 'ovs/enable_tunneling': value => false; 'ovs/tunnel_bridge': ensure => absent; 'ovs/local_ip': ensure => absent; 'ovs/int_peer_patch_port': ensure => absent; diff --git a/releasenotes/notes/newton_deprecate_enable_tunneling-d7f6e2de1091b458.yaml b/releasenotes/notes/newton_deprecate_enable_tunneling-d7f6e2de1091b458.yaml new file mode 100644 index 000000000..b4e48ed6f --- /dev/null +++ b/releasenotes/notes/newton_deprecate_enable_tunneling-d7f6e2de1091b458.yaml @@ -0,0 +1,7 @@ +--- +deprecations: + - The option enable_tunneling has been deprecated as it is no longer used. + In order to enable tunneling, tunnel_types should be set to + the desired type. + If tunnel_types is not set, tunneling will be disabled. + diff --git a/spec/acceptance/basic_neutron_spec.rb b/spec/acceptance/basic_neutron_spec.rb index 80b4c4da4..4c4a07e6b 100644 --- a/spec/acceptance/basic_neutron_spec.rb +++ b/spec/acceptance/basic_neutron_spec.rb @@ -71,7 +71,6 @@ describe 'basic neutron' do } class { '::neutron::agents::metering': debug => true } class { '::neutron::agents::ml2::ovs': - enable_tunneling => true, local_ip => '127.0.0.1', tunnel_types => ['vxlan'], } diff --git a/spec/classes/neutron_agents_ml2_ovs_spec.rb b/spec/classes/neutron_agents_ml2_ovs_spec.rb index 3c31ba954..363835381 100644 --- a/spec/classes/neutron_agents_ml2_ovs_spec.rb +++ b/spec/classes/neutron_agents_ml2_ovs_spec.rb @@ -12,8 +12,8 @@ describe 'neutron::agents::ml2::ovs' do :bridge_uplinks => [], :bridge_mappings => [], :integration_bridge => 'br-int', - :enable_tunneling => false, :local_ip => false, + :tunnel_types => [], :tunnel_bridge => 'br-tun', :drop_flows_on_start => false, :firewall_driver => 'neutron.agent.linux.iptables_firewall.OVSHybridIptablesFirewallDriver', @@ -58,7 +58,6 @@ describe 'neutron::agents::ml2::ovs' do is_expected.to contain_neutron_agent_ovs('ovs/integration_bridge').with_value(p[:integration_bridge]) is_expected.to contain_neutron_agent_ovs('securitygroup/firewall_driver').\ with_value(p[:firewall_driver]) - is_expected.to contain_neutron_agent_ovs('ovs/enable_tunneling').with_value(false) is_expected.to contain_neutron_agent_ovs('ovs/tunnel_bridge').with_ensure('absent') is_expected.to contain_neutron_agent_ovs('ovs/local_ip').with_ensure('absent') is_expected.to contain_neutron_agent_ovs('ovs/int_peer_patch_port').with_ensure('absent') @@ -209,17 +208,16 @@ describe 'neutron::agents::ml2::ovs' do context 'when enabling tunneling' do context 'without local ip address' do before :each do - params.merge!(:enable_tunneling => true) + params.merge!(:tunnel_types => ['vxlan']) end it_raises 'a Puppet::Error', /Local ip for ovs agent must be set when tunneling is enabled/ end context 'with default params' do before :each do - params.merge!(:enable_tunneling => true, :local_ip => '127.0.0.1' ) + params.merge!(:tunnel_types => ['vxlan'], :local_ip => '127.0.0.1' ) end it 'should configure ovs for tunneling' do - is_expected.to contain_neutron_agent_ovs('ovs/enable_tunneling').with_value(true) is_expected.to contain_neutron_agent_ovs('ovs/tunnel_bridge').with_value(default_params[:tunnel_bridge]) is_expected.to contain_neutron_agent_ovs('ovs/local_ip').with_value('127.0.0.1') is_expected.to contain_neutron_agent_ovs('ovs/int_peer_patch_port').with_value('') @@ -229,8 +227,7 @@ describe 'neutron::agents::ml2::ovs' do context 'with vxlan tunneling' do before :each do - params.merge!(:enable_tunneling => true, - :local_ip => '127.0.0.1', + params.merge!(:local_ip => '127.0.0.1', :tunnel_types => ['vxlan'], :vxlan_udp_port => '4789') end @@ -245,7 +242,7 @@ describe 'neutron::agents::ml2::ovs' do before :each do params.merge!(:enable_distributed_routing => true, :l2_population => false, - :enable_tunneling => true, + :tunnel_types => ['vxlan'], :local_ip => '127.0.0.1' ) end @@ -256,7 +253,7 @@ describe 'neutron::agents::ml2::ovs' do before :each do params.merge!(:enable_distributed_routing => true, :l2_population => false, - :enable_tunneling => false ) + :tunnel_types => [] ) end it 'should enable DVR without L2 population' do