summaryrefslogtreecommitdiff
path: root/python/vyos/validate.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-14 20:13:53 +0200
committerChristian Poessinger <christian@poessinger.com>2022-07-15 07:10:29 +0200
commit87d2dff241d9ab4de9f3a2c7fbf9852934557aef (patch)
tree39bf7c96ecc1da71dcab6cdebe1111412dd8e6a2 /python/vyos/validate.py
parent4ed198048756e3d39a69d62e314a946bf4a3e2d5 (diff)
downloadvyos-1x-87d2dff241d9ab4de9f3a2c7fbf9852934557aef.tar.gz
vyos-1x-87d2dff241d9ab4de9f3a2c7fbf9852934557aef.zip
bond: bridge: T4534: error out if member interface is assigned to a VRF instance
It makes no sense to enslave an interface to a bond or a bridge device if it is bound to a given VRF. If VRFs should be used - the encapuslating/master interface should be part of the VRF. Error out if the member interface is part of a VRF.
Diffstat (limited to 'python/vyos/validate.py')
-rw-r--r--python/vyos/validate.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/python/vyos/validate.py b/python/vyos/validate.py
index e005da0e4..a83193363 100644
--- a/python/vyos/validate.py
+++ b/python/vyos/validate.py
@@ -264,3 +264,22 @@ def has_address_configured(conf, intf):
conf.set_level(old_level)
return ret
+
+def has_vrf_configured(conf, intf):
+ """
+ Checks if interface has a VRF configured.
+
+ Returns True if interface has VRF configured, False if it doesn't.
+ """
+ from vyos.ifconfig import Section
+ ret = False
+
+ old_level = conf.get_level()
+ conf.set_level([])
+
+ tmp = ['interfaces', Section.get_config_path(intf), 'vrf']
+ if conf.exists(tmp):
+ ret = True
+
+ conf.set_level(old_level)
+ return ret