From 93909887097aac4a0595f7065f087a937dfe0130 Mon Sep 17 00:00:00 2001 From: SIN3R6Y Date: Mon, 22 Jun 2020 15:21:27 -0400 Subject: vxlan: T2629: fix multiple configuration issues --- python/vyos/ifconfig/vxlan.py | 28 +++++++++++++++------------- 1 file changed, 15 insertions(+), 13 deletions(-) (limited to 'python/vyos/ifconfig') 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: -- cgit v1.2.3