diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-09 22:16:54 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-04-09 22:16:54 +0200 |
commit | 235ccf39efc58fd07a3504dc0add379ba0c5a98a (patch) | |
tree | a184cc5e4bb0540d962c8cecb33673d121c5472a /python | |
parent | 5212c3626a715d9af54cea1e236169fdfcee0a60 (diff) | |
download | vyos-1x-235ccf39efc58fd07a3504dc0add379ba0c5a98a.tar.gz vyos-1x-235ccf39efc58fd07a3504dc0add379ba0c5a98a.zip |
vxlan: T2172: add source-address option
This is a base requirement for l2vpn evpn. When source-address is configured,
the option "local <source-addr> nolearning" is appended when creating the
interface as mentioned here: https://vincent.bernat.ch/en/blog/2017-vxlan-bgp-evpn
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/ifconfig/vxlan.py | 25 |
1 files changed, 16 insertions, 9 deletions
diff --git a/python/vyos/ifconfig/vxlan.py b/python/vyos/ifconfig/vxlan.py index 5678ad62e..f47ae17cc 100644 --- a/python/vyos/ifconfig/vxlan.py +++ b/python/vyos/ifconfig/vxlan.py @@ -43,12 +43,13 @@ class VXLANIf(Interface): default = { 'type': 'vxlan', - 'vni': 0, - 'dev': '', 'group': '', - 'remote': '', 'port': 8472, # The Linux implementation of VXLAN pre-dates # the IANA's selection of a standard destination port + 'remote': '', + 'src_address': '', + 'src_interface': '', + 'vni': 0 } definition = { **Interface.definition, @@ -58,24 +59,30 @@ class VXLANIf(Interface): 'bridgeable': True, } } - options = ['group', 'remote', 'dev', 'port', 'vni'] + options = ['group', 'remote', 'src_interface', 'port', 'vni', 'src_address'] mapping = { 'ifname': 'add', 'vni': 'id', 'port': 'dstport', + 'src_address': 'nolearning local', } def _create(self): cmdline = set() if self.config['remote']: - cmdline = ('ifname', 'type', 'remote', 'dev', 'vni', 'port') - elif self.config['group'] and self.config['dev']: - cmdline = ('ifname', 'type', 'group', 'dev', 'vni', 'port') + cmdline = ('ifname', 'type', 'remote', 'src_interface', 'vni', 'port') + + elif self.config['src_address']: + cmdline = ('ifname', 'type', 'src_address', 'vni', 'port') + + elif self.config['group'] and self.config['src_interface']: + cmdline = ('ifname', 'type', 'group', 'src_interface', 'vni', 'port') + else: - intf = self.config['intf'] + ifname = self.config['ifname'] raise ConfigError( - f'VXLAN "{intf}" is missing mandatory underlay interface for a multicast network.') + f'VXLAN "{ifname}" is missing mandatory underlay interface for a multicast network.') cmd = 'ip link' for key in cmdline: |