diff --git a/manifests/controller.pp b/manifests/controller.pp index b120ae7..06bab85 100644 --- a/manifests/controller.pp +++ b/manifests/controller.pp @@ -62,6 +62,20 @@ # If the value is nonzero, then it will be forced to a value of at least 5s. # Defaults to 60 # +# [*ovn_chassis_mac_map*] +# (optional) A list or a hash of key-value pairs that map a chassis specific mac to +# a physical network name. An example value mapping two chassis macs to +# two physical network names would be: +# physnet1:aa:bb:cc:dd:ee:ff,physnet2:a1:b2:c3:d4:e5:f6 or +# { +# physnet1 => aa:bb:cc:dd:ee:ff, +# physnet2 => a1:b2:c3:d4:e5:f6 +# } +# These are the macs that ovn-controller will replace a router port +# mac with, if packet is going from a distributed router port on +# vlan type logical switch. +# Defaults to empty list +# class ovn::controller( $ovn_remote, $ovn_encap_ip, @@ -76,6 +90,7 @@ class ovn::controller( $enable_dpdk = false, $ovn_remote_probe_interval = 60000, $ovn_openflow_probe_interval = 60, + $ovn_chassis_mac_map = [], ) { include ::ovn::params @@ -120,6 +135,20 @@ class ovn::controller( 'external_ids:ovn-openflow-probe-interval' => { 'value' => "${ovn_openflow_probe_interval}" }, } + if !empty($ovn_chassis_mac_map) { + if $ovn_chassis_mac_map =~ Hash { + $chassis_mac_map = { + 'external_ids:ovn-chassis-mac-mappings' => { 'value' => join(join_keys_to_values($ovn_chassis_mac_map, ':'), ',') } + } + } else { + $chassis_mac_map = { + 'external_ids:ovn-chassis-mac-mappings' => { 'value' => join(any2array($ovn_chassis_mac_map), ',') } + } + } + } else { + $chassis_mac_map = {} + } + if !empty($ovn_bridge_mappings) { $bridge_items = { 'external_ids:ovn-bridge-mappings' => { 'value' => join(any2array($ovn_bridge_mappings), ',') } @@ -149,7 +178,7 @@ class ovn::controller( $datapath_config = {} } - create_resources('vs_config', merge($config_items, $bridge_items, $hw_offload, $datapath_config)) + create_resources('vs_config', merge($config_items, $chassis_mac_map, $bridge_items, $hw_offload, $datapath_config)) Service['openvswitch'] -> Vs_config<||> -> Service['controller'] if !empty($ovn_bridge_mappings) { diff --git a/releasenotes/notes/ovn_chassis_mac_map-8ea1fa442ca20522.yaml b/releasenotes/notes/ovn_chassis_mac_map-8ea1fa442ca20522.yaml new file mode 100644 index 0000000..efaa502 --- /dev/null +++ b/releasenotes/notes/ovn_chassis_mac_map-8ea1fa442ca20522.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + The new ``ovn::controller::ovn_chassis_mac_map`` parameter has been added. + For distributed vlan in ovn we need to set mac addresses per compute in + external_ids:ovn-chassis-mac-mappings diff --git a/spec/classes/ovn_controller_spec.rb b/spec/classes/ovn_controller_spec.rb index bcaadf0..574b89d 100644 --- a/spec/classes/ovn_controller_spec.rb +++ b/spec/classes/ovn_controller_spec.rb @@ -14,6 +14,8 @@ describe 'ovn::controller' do :mac_table_size => 20000, :ovn_remote_probe_interval => 30000, :ovn_openflow_probe_interval => 8, + :ovn_chassis_mac_map => ['physnet1:aa:bb:cc:dd:ee:ff', + 'physnet2:bb:aa:cc:dd:ee:ff'] } end @@ -72,6 +74,10 @@ describe 'ovn::controller' do is_expected.to contain_vs_config('external_ids:ovn-openflow-probe-interval').with( :value => params[:ovn_openflow_probe_interval], ) + + is_expected.to contain_vs_config('external_ids:ovn-chassis-mac-mappings').with( + :value => 'physnet1:aa:bb:cc:dd:ee:ff,physnet2:bb:aa:cc:dd:ee:ff', + ) end it 'configures bridge mappings' do @@ -89,6 +95,22 @@ describe 'ovn::controller' do :require => 'Service[openvswitch]' ) end + + context 'when ovn_chassis_mac_map is a hash' do + before :each do + params.merge!({ + :ovn_chassis_mac_map => { + 'physnet1' => 'aa:bb:cc:dd:ee:ff', + 'physnet2' => 'bb:aa:cc:dd:ee:ff' } + }) + end + + it 'configures ovsdb' do + is_expected.to contain_vs_config('external_ids:ovn-chassis-mac-mappings').with( + :value => 'physnet1:aa:bb:cc:dd:ee:ff,physnet2:bb:aa:cc:dd:ee:ff', + ) + end + end end on_supported_os({