From 3466941316a70ac840ebdcc7576230158be8a0fb Mon Sep 17 00:00:00 2001 From: jack9603301 Date: Tue, 10 Nov 2020 12:24:31 +0800 Subject: bridge: T3042: Support VLAN filter and VLAN sub-interface on the bridge --- python/vyos/configdict.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'python/vyos/configdict.py') 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 -- cgit v1.2.3