Add support for configuring permitted_ethertypes on OVS agent

Neutron recently added support for configuring non-IP ethernet types to
be allowed through firewalls through SECURITYGROUP/permitted_ethertypes.
This adds support for configuring this feature on the ML2/OVS agent.
See https://review.opendev.org/#/c/668224 for related neutron change.

Conflicts:
  spec/classes/neutron_agents_ml2_ovs_spec.rb

Related-Bug: #1832758
Change-Id: I9ed539745a705936d9a5110a9cfb05c2f28b0bbb
(cherry picked from commit def07975c6)
(cherry picked from commit 853c5a1568)
This commit is contained in:
Brent Eagles 2019-07-09 19:14:21 +00:00 committed by Nate Johnston
parent fedd77e759
commit bedb9ca987
3 changed files with 28 additions and 0 deletions

View File

@ -145,6 +145,11 @@
# groups or not.
# Defaults to $::os_service_default
#
# [*permitted_ethertypes*]
# (optional) List of additional ethernet types to be configured
# on the firewall.
# Defaults to $::os_service_default
#
# [*minimize_polling*]
# (optional) Minimize polling by monitoring ovsdb for interface
# changes. (boolean value)
@ -189,6 +194,7 @@ class neutron::agents::ml2::ovs (
$purge_config = false,
$enable_dpdk = false,
$enable_security_group = $::os_service_default,
$permitted_ethertypes = $::os_service_default,
$minimize_polling = $::os_service_default,
$tunnel_csum = $::os_service_default,
# DEPRECATED PARAMETERS
@ -210,6 +216,13 @@ class neutron::agents::ml2::ovs (
fail('vhost user socket directory for ovs agent must be set when DPDK is enabled')
}
if ! is_service_default($permitted_ethertypes) {
validate_legacy(Array, 'validate_array', $permitted_ethertypes)
neutron_agent_ovs {
'securitygroup/permitted_ethertypes': value => join($permitted_ethertypes, ',');
}
}
if $manage_vswitch {
if $enable_dpdk {
require ::vswitch::dpdk

View File

@ -0,0 +1,5 @@
---
features:
- |
Add support for configuring security group permitted_ethertypes on the
Neutron OVS agent.

View File

@ -56,6 +56,7 @@ describe 'neutron::agents::ml2::ovs' do
with_value(p[:firewall_driver])
is_expected.to contain_neutron_agent_ovs('securitygroup/enable_security_group').\
with_value(['<SERVICE DEFAULT>'])
is_expected.not_to contain_neutron_agent_ovs('securitygroup/permitted_ethertypes')
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')
@ -94,6 +95,15 @@ describe 'neutron::agents::ml2::ovs' do
end
end
context 'when supplying permitted ethertypes' do
before :each do
params.merge!(:permitted_ethertypes => ['0x4008', '0x5'])
end
it 'should configured ethertypes' do
is_expected.to contain_neutron_agent_ovs('securitygroup/permitted_ethertypes').with_value('0x4008,0x5')
end
end
context 'when supplying a firewall driver' do
before :each do
params.merge!(:firewall_driver => false)