diff options
author | SIN3R6Y <alex@triadic.us> | 2020-06-22 15:21:27 -0400 |
---|---|---|
committer | SIN3R6Y <alex@triadic.us> | 2020-06-22 15:21:27 -0400 |
commit | 93909887097aac4a0595f7065f087a937dfe0130 (patch) | |
tree | 903dbe72b89f15ea44e33c8f48af2a4ffe003b03 /python/vyos/ifconfig | |
parent | 7945c491fb7ed2ba7462dd2e12051ad8ce9b7e56 (diff) | |
download | vyos-1x-93909887097aac4a0595f7065f087a937dfe0130.tar.gz vyos-1x-93909887097aac4a0595f7065f087a937dfe0130.zip |
vxlan: T2629: fix multiple configuration issues
Diffstat (limited to 'python/vyos/ifconfig')
-rw-r--r-- | python/vyos/ifconfig/vxlan.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/python/vyos/ifconfig/vxlan.py b/python/vyos/ifconfig/vxlan.py index f9f2e38e9..cd9026bf8 100644 --- a/python/vyos/ifconfig/vxlan.py +++ b/python/vyos/ifconfig/vxlan.py @@ -66,24 +66,26 @@ class VXLANIf(Interface): 'ifname': 'add', 'vni': 'id', 'port': 'dstport', - 'src_address': 'nolearning local', + 'src_address': 'local', + 'src_interface': 'dev', } def _create(self): - cmdline = set() - if self.config['remote']: - cmdline = ('ifname', 'type', 'remote', 'src_interface', 'vni', 'port') - - elif self.config['src_address']: - cmdline = ('ifname', 'type', 'src_address', 'vni', 'port') + cmdline = ['ifname', 'type', 'vni', 'port'] - elif self.config['group'] and self.config['src_interface']: - cmdline = ('ifname', 'type', 'group', 'src_interface', 'vni', 'port') + if self.config['src_address']: + cmdline.append('src_address') - else: - ifname = self.config['ifname'] - raise ConfigError( - f'VXLAN "{ifname}" is missing mandatory underlay interface for a multicast network.') + if self.config['remote']: + cmdline.append('remote') + + if self.config['group'] or self.config['src_interface']: + if self.config['group'] and self.config['src_interface']: + cmdline.append('group', 'src_interface') + else: + ifname = self.config['ifname'] + raise ConfigError( + f'VXLAN "{ifname}" is missing mandatory underlay multicast group or source interface for a multicast network.') cmd = 'ip link' for key in cmdline: |