summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/ifconfig/interface.py25
-rw-r--r--python/vyos/ifconfig_vlan.py7
2 files changed, 7 insertions, 25 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index 9de24d729..718fe93db 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -85,12 +85,6 @@ class Interface(Control):
'validate': assert_mac,
'shellcmd': 'ip link set dev {ifname} address {value}',
},
- 'add_vrf': {
- 'shellcmd': 'ip link set dev {ifname} master {value}',
- },
- 'del_vrf': {
- 'shellcmd': 'ip link set dev {ifname} nomaster',
- },
'vrf': {
'force': True,
'convert': lambda v: f'master {v}' if v else 'nomaster',
@@ -303,25 +297,16 @@ class Interface(Control):
"""
self.set_interface('mac', mac)
- def add_vrf(self, vrf):
- """
- Add interface to given VRF instance.
-
- Example:
- >>> from vyos.ifconfig import Interface
- >>> Interface('eth0').add_vrf('foo')
- """
- self.set_interface('add_vrf', vrf)
-
- def del_vrf(self, vrf=''):
+ def set_vrf(self, vrf=''):
"""
- Remove interface from given VRF instance.
+ Add/Remove interface from given VRF instance.
Example:
>>> from vyos.ifconfig import Interface
- >>> Interface('eth0').del_vrf('foo')
+ >>> Interface('eth0').set_vrf('foo')
+ >>> Interface('eth0').set_vrf()
"""
- self.set_interface('del_vrf', vrf)
+ self.set_interface('vrf', vrf)
def set_arp_cache_tmo(self, tmo):
"""
diff --git a/python/vyos/ifconfig_vlan.py b/python/vyos/ifconfig_vlan.py
index 1d57283ac..fe94a5af4 100644
--- a/python/vyos/ifconfig_vlan.py
+++ b/python/vyos/ifconfig_vlan.py
@@ -68,11 +68,8 @@ def apply_vlan_config(vlan, config):
# Maximum Transmission Unit (MTU)
vlan.set_mtu(config['mtu'])
- # assign to VRF
- if config['vrf']:
- vlan.add_vrf(config['vrf'])
- else:
- vlan.del_vrf(config['vrf'])
+ # assign/remove VRF
+ vlan.set_vrf(config['vrf'])
# Change VLAN interface MAC address
if config['mac']: