summaryrefslogtreecommitdiff
path: root/python/vyos/configdict.py
diff options
context:
space:
mode:
authorjack9603301 <jack9603301@163.com>2020-11-10 12:24:31 +0800
committerjack9603301 <jack9603301@163.com>2020-11-10 12:24:49 +0800
commit3466941316a70ac840ebdcc7576230158be8a0fb (patch)
tree73a00197f3a37d729e17e5446db0e5ebbc14ac31 /python/vyos/configdict.py
parentad856600ca29ba463de2b288189d3f40b9e91846 (diff)
downloadvyos-1x-3466941316a70ac840ebdcc7576230158be8a0fb.tar.gz
vyos-1x-3466941316a70ac840ebdcc7576230158be8a0fb.zip
bridge: T3042: Support VLAN filter and VLAN sub-interface on the bridge
Diffstat (limited to 'python/vyos/configdict.py')
-rw-r--r--python/vyos/configdict.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index e43b68f6f..0b03dfc7d 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -219,6 +219,28 @@ def is_member(conf, interface, intftype=None):
old_level = conf.set_level(old_level)
return ret_val
+def has_vlan_subinterface_configured(conf, intf):
+ """
+ Checks if interface has an VLAN subinterface configured.
+ Checks the following config nodes:
+ 'vif', 'vif-s'
+
+ Returns True if interface has VLAN subinterface configured, False if it doesn't.
+ """
+ from vyos.ifconfig import Section
+ ret = False
+
+ old_level = conf.get_level()
+ conf.set_level([])
+
+ intfpath = 'interfaces ' + Section.get_config_path(intf)
+ if ( conf.exists(f'{intfpath} vif') or
+ conf.exists(f'{intfpath} vif-s')):
+ ret = True
+
+ conf.set_level(old_level)
+ return ret
+
def is_source_interface(conf, interface, intftype=None):
"""
Checks if passed interface is configured as source-interface of other