diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-06-23 18:42:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 18:42:42 +0200 |
commit | 7e4bd9459dc7a319604922dc4df4549163b82fcb (patch) | |
tree | 65be764d6f56a5efc24e1219257a204513d9fd82 /python/vyos/ifconfig | |
parent | 0c692045bf9b8d72a1bef056847562db1bafe983 (diff) | |
parent | 93909887097aac4a0595f7065f087a937dfe0130 (diff) | |
download | vyos-1x-7e4bd9459dc7a319604922dc4df4549163b82fcb.tar.gz vyos-1x-7e4bd9459dc7a319604922dc4df4549163b82fcb.zip |
Merge pull request #468 from SIN3R6Y/current
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: |