summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/vxlan.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/ifconfig/vxlan.py')
-rw-r--r--python/vyos/ifconfig/vxlan.py28
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: