summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-04 22:02:26 +0100
committerChristian Poessinger <christian@poessinger.com>2020-03-04 22:02:26 +0100
commit10ef1bb6c4a8e02081660eddf5918c92151382b7 (patch)
tree31885f0a2b32b0db18f9e44b634e9176c5de54f0 /python
parent1257c0126bdc10bba605652f624815b2e0350ca2 (diff)
parent153d1535d954f59cc48ed26f6cc552703b8cbd73 (diff)
downloadvyos-1x-10ef1bb6c4a8e02081660eddf5918c92151382b7.tar.gz
vyos-1x-10ef1bb6c4a8e02081660eddf5918c92151382b7.zip
Merge branch 't31-vrf' of github.com:c-po/vyos-1x into current
* 't31-vrf' of github.com:c-po/vyos-1x: vrf: T31: enable vrf support for dummy interface templates: T2099: make op-mode path completion helper working vrf: T31: reorder routing table lookups vrf: T31: adding unreachable routes to the routing tables vrf: T31: prior to the v4.8 kernel iif and oif rules are needed vrf: T31: create iproute2 table to name mapping reference vrf: T31: rename 'vrf disable-bind-to-all ipv4' to 'vrf bind-to-all' vrf: T31: support add/remove of interfaces from vrf vrf: T31: remove superfluous vyos.vrf library functions vrf: T31: reduce script complexity vrf: T31: no need to use sudo calls in vrf.py vrf: T31: make 'show vrf' command behave like other 'show interface commands' xml: include: description: adjust help message vrf: T31: improve help for routing table vrf: T31: reuse interface-description.xml.i for instance description vrf: T31: use embedded regex on 'vrf name' instead of python script vrf: T31: initial support for a VRF backend in XML/Python ifconfig: T2057: generic interface option setting
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig.py28
1 files changed, 27 insertions, 1 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index afcf4e96f..7f03befeb 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -202,6 +202,12 @@ 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 {value}',
+ },
}
_sysfs_get = {
@@ -344,7 +350,7 @@ class Interface(Control):
self.del_addr(addr)
# ---------------------------------------------------------------------
- # A code refactoring is required as this type check is present as
+ # A code refactoring is required as this type check is present as
# Interface implement behaviour for one of it's sub-class.
# It is required as the current pattern for vlan is:
@@ -404,6 +410,26 @@ 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):
+ """
+ Remove interface from given VRF instance.
+
+ Example:
+ >>> from vyos.ifconfig import Interface
+ >>> Interface('eth0').del_vrf('foo')
+ """
+ self.set_interface('del_vrf', vrf)
+
def set_arp_cache_tmo(self, tmo):
"""
Set ARP cache timeout value in seconds. Internal Kernel representation