Set external_ids:ovn-chassis-mac-mappings
For distributed vlan in ovn we need to add support of creating mac addresses per compute and seting them in external_ids:ovn-chassis-mac-mappings. Related-Bug: #1881593 Co-Authored-By: Takashi Kajinami <tkajinam@redhat.com> Change-Id: Iddca7d8942bc52127525847f129eac8ea03934a1
This commit is contained in:
parent
3aa6ee0de9
commit
73a1d56922
@ -73,6 +73,20 @@
|
||||
# This need >= ovn2.13-20.09.0-17.
|
||||
# Default to false (keep the original behavior)
|
||||
#
|
||||
# [*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,
|
||||
@ -89,6 +103,7 @@ class ovn::controller(
|
||||
$ovn_openflow_probe_interval = 60,
|
||||
$ovn_transport_zones = [],
|
||||
$enable_ovn_match_northd = false,
|
||||
$ovn_chassis_mac_map = [],
|
||||
) {
|
||||
|
||||
include ovn::params
|
||||
@ -133,6 +148,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), ',') }
|
||||
@ -173,7 +202,7 @@ class ovn::controller(
|
||||
$ovn_match_northd = {
|
||||
'external_ids:ovn-match-northd-version' => { 'value' => bool2str($enable_ovn_match_northd) }
|
||||
}
|
||||
create_resources('vs_config', merge($config_items, $bridge_items, $tz_items, $hw_offload, $datapath_config, $ovn_match_northd))
|
||||
create_resources('vs_config', merge($config_items, $chassis_mac_map, $bridge_items, $tz_items, $hw_offload, $datapath_config, $ovn_match_northd))
|
||||
Service['openvswitch'] -> Vs_config<||> -> Service['controller']
|
||||
|
||||
if !empty($ovn_bridge_mappings) {
|
||||
|
@ -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
|
@ -16,6 +16,8 @@ describe 'ovn::controller' do
|
||||
:ovn_openflow_probe_interval => 8,
|
||||
:ovn_transport_zones => ['tz1'],
|
||||
:enable_ovn_match_northd => false,
|
||||
:ovn_chassis_mac_map => ['physnet1:aa:bb:cc:dd:ee:ff',
|
||||
'physnet2:bb:aa:cc:dd:ee:ff']
|
||||
}
|
||||
end
|
||||
|
||||
@ -82,7 +84,9 @@ describe 'ovn::controller' do
|
||||
is_expected.to contain_vs_config('external_ids:ovn-match-northd-version').with(
|
||||
:value => params[:enable_ovn_match_northd],
|
||||
)
|
||||
|
||||
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
|
||||
@ -100,6 +104,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({
|
||||
|
Loading…
x
Reference in New Issue
Block a user