diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-03-23 02:35:46 +0000 |
---|---|---|
committer | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-03-23 04:14:21 +0000 |
commit | f71a7461e44a98e862810bed3d0b9d280ee5dae0 (patch) | |
tree | cc3e0e36146821045133a36ed0c23957dc951990 /python/vyos/ifconfig | |
parent | f06d9b22a6d9b355b4faa0271d31d4c2f58369a7 (diff) | |
download | vyos-1x-f71a7461e44a98e862810bed3d0b9d280ee5dae0.tar.gz vyos-1x-f71a7461e44a98e862810bed3d0b9d280ee5dae0.zip |
tunnel: T31: add support for vrf on tunnels
Diffstat (limited to 'python/vyos/ifconfig')
-rw-r--r-- | python/vyos/ifconfig/control.py | 4 | ||||
-rw-r--r-- | python/vyos/ifconfig/interface.py | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/python/vyos/ifconfig/control.py b/python/vyos/ifconfig/control.py index 635b626e8..89deba40a 100644 --- a/python/vyos/ifconfig/control.py +++ b/python/vyos/ifconfig/control.py @@ -48,7 +48,7 @@ class Control: """ Using the defined names, set data write to sysfs. """ - if not value: + if not value and not self._command_set[name].get('force', False): return None # the code can pass int as int @@ -108,7 +108,7 @@ class Control: """ Using the defined names, set data write to sysfs. """ - if not value: + if not value and not self._sysfs_set[name].get('force', False): return None # the code can pass int as int diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index 21ffa88f6..9de24d729 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -89,7 +89,12 @@ class Interface(Control): 'shellcmd': 'ip link set dev {ifname} master {value}', }, 'del_vrf': { - 'shellcmd': 'ip link set dev {ifname} nomaster {value}', + 'shellcmd': 'ip link set dev {ifname} nomaster', + }, + 'vrf': { + 'force': True, + 'convert': lambda v: f'master {v}' if v else 'nomaster', + 'shellcmd': 'ip link set dev {ifname} {value}', }, } @@ -308,7 +313,7 @@ class Interface(Control): """ self.set_interface('add_vrf', vrf) - def del_vrf(self, vrf): + def del_vrf(self, vrf=''): """ Remove interface from given VRF instance. |