Merge "Use native property to set mac table size"
This commit is contained in:
commit
4f58f3ccd3
|
@ -187,8 +187,9 @@ class ovn::controller(
|
|||
|
||||
if $manage_ovs_bridge {
|
||||
ovn::controller::bridge { $ovn_bridge_mappings:
|
||||
before => Service['controller'],
|
||||
require => Service['openvswitch']
|
||||
mac_table_size => $mac_table_size,
|
||||
before => Service['controller'],
|
||||
require => Service['openvswitch']
|
||||
}
|
||||
ovn::controller::port { $bridge_interface_mappings:
|
||||
before => Service['controller'],
|
||||
|
@ -227,33 +228,4 @@ class ovn::controller(
|
|||
}
|
||||
create_resources('vs_config', merge($config_items, $chassis_mac_map, $bridge_items, $tz_items, $datapath_config, $ovn_match_northd))
|
||||
Service['openvswitch'] -> Vs_config<||> -> Service['controller']
|
||||
|
||||
if !empty($ovn_bridge_mappings) {
|
||||
# For each provider bridge, set the mac table size.
|
||||
$ovn_bridge_mappings.each |String $mappings| {
|
||||
$mapping = split($mappings, ':')
|
||||
$br = $mapping[1]
|
||||
if !empty($br) and $manage_ovs_bridge {
|
||||
# TODO(numans): Right now puppet-vswitch's vs_bridge doesn't support
|
||||
# setting the column 'other-config' for the Bridge table.
|
||||
# Switch to using vs_bridge once the support is available.
|
||||
if $mac_table_size != undef {
|
||||
exec { $br:
|
||||
command => "ovs-vsctl --timeout=5 set Bridge ${br} other-config:mac-table-size=${mac_table_size}",
|
||||
unless => "ovs-vsctl get bridge ${br} other-config:mac-table-size | grep -q -w ${mac_table_size}",
|
||||
path => '/usr/sbin:/usr/bin:/sbin:/bin',
|
||||
onlyif => "ovs-vsctl br-exists ${br}",
|
||||
require => [ Service['openvswitch'], Vs_bridge[$br] ],
|
||||
}
|
||||
} else {
|
||||
exec { $br:
|
||||
command => "ovs-vsctl --timeout=5 remove Bridge ${br} other-config mac-table-size",
|
||||
path => '/usr/sbin:/usr/bin:/sbin:/bin',
|
||||
onlyif => ["ovs-vsctl br-exists ${br}", "ovs-vsctl get bridge ${br} other-config:mac-table-size"],
|
||||
require => [ Service['openvswitch'], Vs_bridge[$br] ],
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,21 @@
|
|||
# Bridge settings for ovn controller bridge mappings
|
||||
# $name is OVN bridge mapping in the format network-name:bridge-name
|
||||
#
|
||||
define ovn::controller::bridge {
|
||||
# === Parameters:
|
||||
#
|
||||
# [*mac_table_size*]
|
||||
# Set the mac table size for the provider bridges
|
||||
# Defaults to undef
|
||||
#
|
||||
define ovn::controller::bridge(
|
||||
$mac_table_size = undef,
|
||||
){
|
||||
$map_split = split($name, ':')
|
||||
$bridge = $map_split[1]
|
||||
|
||||
vs_bridge { $bridge:
|
||||
ensure => present,
|
||||
external_ids => "bridge-id=${bridge}"
|
||||
ensure => present,
|
||||
mac_table_size => $mac_table_size,
|
||||
external_ids => "bridge-id=${bridge}"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -117,15 +117,6 @@ describe 'ovn::controller' do
|
|||
end
|
||||
end
|
||||
|
||||
it 'clears mac_table_size' do
|
||||
is_expected.to contain_exec('br-1').with(
|
||||
:command => 'ovs-vsctl --timeout=5 remove Bridge br-1 other-config mac-table-size',
|
||||
:path => '/usr/sbin:/usr/bin:/sbin:/bin',
|
||||
:onlyif => [ 'ovs-vsctl br-exists br-1', 'ovs-vsctl get bridge br-1 other-config:mac-table-size'],
|
||||
:require => [ 'Service[openvswitch]', 'Vs_bridge[br-1]' ],
|
||||
)
|
||||
end
|
||||
|
||||
context 'when ovn_chassis_mac_map is a hash' do
|
||||
before :each do
|
||||
params.merge!({
|
||||
|
@ -150,13 +141,13 @@ describe 'ovn::controller' do
|
|||
end
|
||||
|
||||
it 'configures mac_table_size' do
|
||||
is_expected.to contain_exec('br-1').with(
|
||||
:command => 'ovs-vsctl --timeout=5 set Bridge br-1 other-config:mac-table-size=20000',
|
||||
:unless => 'ovs-vsctl get bridge br-1 other-config:mac-table-size | grep -q -w 20000',
|
||||
:path => '/usr/sbin:/usr/bin:/sbin:/bin',
|
||||
:onlyif => [ 'ovs-vsctl br-exists br-1' ],
|
||||
:require => [ 'Service[openvswitch]', 'Vs_bridge[br-1]' ],
|
||||
)
|
||||
params[:ovn_bridge_mappings].each do |mapping|
|
||||
is_expected.to contain_ovn__controller__bridge(mapping).with(
|
||||
:mac_table_size => 20000,
|
||||
:before => 'Service[controller]',
|
||||
:require => 'Service[openvswitch]'
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in New Issue