ovs-agent: Avoid hard-coding defaults

This change removes the hard-coded defaults and let the service default
values used. The new configurations are effectively same but help us
reduce maintenance effort to keep puppet implementation up to date.

Change-Id: I17fdf2b98fde2149ac0be32c64674c3b6da26aaa
This commit is contained in:
Takashi Kajinami 2022-04-03 22:22:12 +09:00
parent 07f0bedd05
commit 91b9b468e8
2 changed files with 25 additions and 26 deletions

View File

@ -62,7 +62,7 @@
# #
# [*integration_bridge*] # [*integration_bridge*]
# (optional) Integration bridge in OVS # (optional) Integration bridge in OVS
# Defaults to 'br-int' # Defaults to $::os_service_default
# #
# [*tunnel_types*] # [*tunnel_types*]
# (optional) List of types of tunnels to use when utilizing tunnels, # (optional) List of types of tunnels to use when utilizing tunnels,
@ -76,11 +76,11 @@
# #
# [*tunnel_bridge*] # [*tunnel_bridge*]
# (optional) Bridge used to transport tunnels # (optional) Bridge used to transport tunnels
# Defaults to 'br-tun' # Defaults to $::os_service_default
# #
# [*vxlan_udp_port*] # [*vxlan_udp_port*]
# (optional) The UDP port to use for VXLAN tunnels. # (optional) The UDP port to use for VXLAN tunnels.
# Defaults to '4789' # Defaults to $::os_service_default
# #
# [*polling_interval*] # [*polling_interval*]
# (optional) The number of seconds the agent will wait between # (optional) The number of seconds the agent will wait between
@ -119,7 +119,7 @@
# [*drop_flows_on_start*] # [*drop_flows_on_start*]
# (optional) Set to True to drop all flows during agent start for a clean # (optional) Set to True to drop all flows during agent start for a clean
# flow tables resetting # flow tables resetting
# Defaults to false # Defaults to $::os_service_default
# #
# [*manage_vswitch*] # [*manage_vswitch*]
# (optional) This boolean is used to indicate if this class should manage the # (optional) This boolean is used to indicate if this class should manage the
@ -262,11 +262,11 @@ class neutron::agents::ml2::ovs (
$of_connect_timeout = $::os_service_default, $of_connect_timeout = $::os_service_default,
$of_request_timeout = $::os_service_default, $of_request_timeout = $::os_service_default,
$of_inactivity_probe = $::os_service_default, $of_inactivity_probe = $::os_service_default,
$integration_bridge = 'br-int', $integration_bridge = $::os_service_default,
$tunnel_types = [], $tunnel_types = [],
$local_ip = false, $local_ip = false,
$tunnel_bridge = 'br-tun', $tunnel_bridge = $::os_service_default,
$vxlan_udp_port = 4789, $vxlan_udp_port = $::os_service_default,
$polling_interval = $::os_service_default, $polling_interval = $::os_service_default,
$report_interval = $::os_service_default, $report_interval = $::os_service_default,
$rpc_response_max_timeout = $::os_service_default, $rpc_response_max_timeout = $::os_service_default,
@ -274,7 +274,7 @@ class neutron::agents::ml2::ovs (
$arp_responder = $::os_service_default, $arp_responder = $::os_service_default,
$firewall_driver = 'iptables_hybrid', $firewall_driver = 'iptables_hybrid',
$enable_distributed_routing = $::os_service_default, $enable_distributed_routing = $::os_service_default,
$drop_flows_on_start = false, $drop_flows_on_start = $::os_service_default,
$manage_vswitch = true, $manage_vswitch = true,
$int_peer_patch_port = $::os_service_default, $int_peer_patch_port = $::os_service_default,
$tun_peer_patch_port = $::os_service_default, $tun_peer_patch_port = $::os_service_default,
@ -499,7 +499,9 @@ class neutron::agents::ml2::ovs (
} }
if 'vxlan' in $tunnel_types { if 'vxlan' in $tunnel_types {
validate_vxlan_udp_port($vxlan_udp_port) if ! is_service_default($vxlan_udp_port) {
validate_vxlan_udp_port($vxlan_udp_port)
}
neutron_agent_ovs { neutron_agent_ovs {
'agent/vxlan_udp_port': value => $vxlan_udp_port; 'agent/vxlan_udp_port': value => $vxlan_udp_port;
} }

View File

@ -6,19 +6,16 @@ describe 'neutron::agents::ml2::ovs' do
end end
let :default_params do let :default_params do
{ :package_ensure => 'present', { :package_ensure => 'present',
:enabled => true, :enabled => true,
:bridge_uplinks => [], :bridge_uplinks => [],
:bridge_mappings => [], :bridge_mappings => [],
:integration_bridge => 'br-int', :local_ip => false,
:local_ip => false, :tunnel_types => [],
:tunnel_types => [], :firewall_driver => 'iptables_hybrid',
:tunnel_bridge => 'br-tun', :manage_vswitch => true,
:drop_flows_on_start => false, :purge_config => false,
:firewall_driver => 'iptables_hybrid', :enable_dpdk => false,
:manage_vswitch => true,
:purge_config => false,
:enable_dpdk => false,
} }
end end
@ -45,7 +42,7 @@ describe 'neutron::agents::ml2::ovs' do
should contain_neutron_agent_ovs('DEFAULT/rpc_response_max_timeout').with_value('<SERVICE DEFAULT>') should contain_neutron_agent_ovs('DEFAULT/rpc_response_max_timeout').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('agent/l2_population').with_value('<SERVICE DEFAULT>') should contain_neutron_agent_ovs('agent/l2_population').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('agent/arp_responder').with_value('<SERVICE DEFAULT>') should contain_neutron_agent_ovs('agent/arp_responder').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('agent/drop_flows_on_start').with_value(p[:drop_flows_on_start]) should contain_neutron_agent_ovs('agent/drop_flows_on_start').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('agent/extensions').with_value('<SERVICE DEFAULT>') should contain_neutron_agent_ovs('agent/extensions').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('agent/minimize_polling').with_value('<SERVICE DEFAULT>') should contain_neutron_agent_ovs('agent/minimize_polling').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('agent/tunnel_csum').with_value('<SERVICE DEFAULT>') should contain_neutron_agent_ovs('agent/tunnel_csum').with_value('<SERVICE DEFAULT>')
@ -55,7 +52,7 @@ describe 'neutron::agents::ml2::ovs' do
should contain_neutron_agent_ovs('ovs/of_connect_timeout').with_value('<SERVICE DEFAULT>') should contain_neutron_agent_ovs('ovs/of_connect_timeout').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('ovs/of_request_timeout').with_value('<SERVICE DEFAULT>') should contain_neutron_agent_ovs('ovs/of_request_timeout').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('ovs/of_inactivity_probe').with_value('<SERVICE DEFAULT>') should contain_neutron_agent_ovs('ovs/of_inactivity_probe').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('ovs/integration_bridge').with_value(p[:integration_bridge]) should contain_neutron_agent_ovs('ovs/integration_bridge').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('securitygroup/firewall_driver').\ should contain_neutron_agent_ovs('securitygroup/firewall_driver').\
with_value(p[:firewall_driver]) with_value(p[:firewall_driver])
should contain_neutron_agent_ovs('securitygroup/enable_security_group').\ should contain_neutron_agent_ovs('securitygroup/enable_security_group').\
@ -294,11 +291,11 @@ describe 'neutron::agents::ml2::ovs' do
}) })
end end
it 'should configure ovs for tunneling' do it 'should configure ovs for tunneling' do
should contain_neutron_agent_ovs('ovs/tunnel_bridge').with_value(default_params[:tunnel_bridge]) should contain_neutron_agent_ovs('ovs/tunnel_bridge').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('ovs/local_ip').with_value('127.0.0.1') should contain_neutron_agent_ovs('ovs/local_ip').with_value('127.0.0.1')
should contain_neutron_agent_ovs('ovs/int_peer_patch_port').with_value('<SERVICE DEFAULT>') should contain_neutron_agent_ovs('ovs/int_peer_patch_port').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('ovs/tun_peer_patch_port').with_value('<SERVICE DEFAULT>') should contain_neutron_agent_ovs('ovs/tun_peer_patch_port').with_value('<SERVICE DEFAULT>')
should contain_neutron_agent_ovs('agent/vxlan_udp_port').with_value(4789) should contain_neutron_agent_ovs('agent/vxlan_udp_port').with_value('<SERVICE DEFAULT>')
end end
end end