ml2+ovs: Accept a string value for permitted_ethertypes

... as is done for the other ListOpt parameters. Also, this change
ensures the parameter is properly purged instead of being unmanaged.

Change-Id: I49888ab1c9f7c82d79e685b2e30e93f84257709e
(cherry picked from commit dcb4622275)
(cherry picked from commit 69aee692c0)
This commit is contained in:
Takashi Kajinami 2022-06-20 20:46:52 +09:00
parent 7864f0a8dc
commit b59fca5c80
2 changed files with 13 additions and 9 deletions

View File

@ -287,13 +287,6 @@ 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
@ -394,6 +387,7 @@ class neutron::agents::ml2::ovs (
'ovs/datapath_type': value => $datapath_type;
'ovs/vhostuser_socket_dir': value => $vhostuser_socket_dir;
'securitygroup/enable_security_group': value => $enable_security_group;
'securitygroup/permitted_ethertypes': value => join(any2array($permitted_ethertypes), ',');
'ovs/bridge_mac_table_size': value => $bridge_mac_table_size;
'ovs/igmp_snooping_enable': value => $igmp_snooping_enable;
'network_log/rate_limit': value => $network_log_rate_limit;

View File

@ -59,7 +59,8 @@ describe 'neutron::agents::ml2::ovs' do
with_value(p[:firewall_driver])
should contain_neutron_agent_ovs('securitygroup/enable_security_group').\
with_value('<SERVICE DEFAULT>')
should_not contain_neutron_agent_ovs('securitygroup/permitted_ethertypes')
should contain_neutron_agent_ovs('securitygroup/permitted_ethertypes').\
with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('ovs/tunnel_bridge').with_ensure('absent')
should contain_neutron_agent_ovs('ovs/local_ip').with_ensure('absent')
should contain_neutron_agent_ovs('ovs/int_peer_patch_port').with_ensure('absent')
@ -110,7 +111,7 @@ describe 'neutron::agents::ml2::ovs' do
end
end
context 'when supplying permitted ethertypes' do
context 'when supplying permitted ethertypes by an array' do
before :each do
params.merge!(:permitted_ethertypes => ['0x4008', '0x5'])
end
@ -119,6 +120,15 @@ describe 'neutron::agents::ml2::ovs' do
end
end
context 'when supplying permitted ethertypes by a string' do
before :each do
params.merge!(:permitted_ethertypes => '0x4008,0x5')
end
it 'should configured ethertypes' do
should 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)