diff --git a/manifests/controller.pp b/manifests/controller.pp index 823b635..9811995 100644 --- a/manifests/controller.pp +++ b/manifests/controller.pp @@ -38,6 +38,11 @@ # Hardware Offload. This feature is # supported from ovs 2.8.0. # Defaults to False. +# +# [*mac_table_size*] +# Set the mac table size for the provider bridges if defined in ovn_bridge_mappings +# Defaults to 50000 + class ovn::controller( $ovn_remote, $ovn_encap_ip, @@ -47,6 +52,7 @@ class ovn::controller( $hostname = $::fqdn, $ovn_bridge = 'br-int', $enable_hw_offload = false, + $mac_table_size = 50000, ) { include ::ovn::params include ::vswitch::ovs @@ -103,4 +109,29 @@ class ovn::controller( create_resources('vs_config', merge($config_items, $bridge_items, $hw_offload)) 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) { + # 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. + 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', + require => Service['openvswitch'] + } + } + } + } else { + # ovn-bridge-mappings is not defined. Clear the existing value if configured. + vs_config { 'external_ids:ovn-bridge-mappings': + ensure => absent, + require => Service['openvswitch'] + } + } } diff --git a/spec/classes/ovn_controller_spec.rb b/spec/classes/ovn_controller_spec.rb index 1b42bf4..1057546 100644 --- a/spec/classes/ovn_controller_spec.rb +++ b/spec/classes/ovn_controller_spec.rb @@ -10,7 +10,8 @@ describe 'ovn::controller' do :ovn_bridge => 'br-int', :bridge_interface_mappings => ['br-1:eth1'], :hostname => 'server1.example.com', - :enable_hw_offload => false + :enable_hw_offload => false, + :mac_table_size => 20000 } end