From fdeae251431cb747e8f60d96269b4365b7401807 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Mon, 11 Jul 2022 07:58:13 +0200 Subject: vyos.configdict(): T4228: is_member() must split VLAN interfaces Commit 39157912 ("vyos.configdict(): T4228: is_member() must use the "real" hardware interface") added a bugfix on calling is_member() to retrieve the real physical information about an interface. It did not include a code path to also split up VLAN interfaces. This has been fixed. --- python/vyos/configdict.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'python') diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py index e9ef39930..29d89520c 100644 --- a/python/vyos/configdict.py +++ b/python/vyos/configdict.py @@ -222,8 +222,18 @@ def is_member(conf, interface, intftype=None): for intf in conf.list_nodes(base): member = base + [intf, 'member', 'interface', interface] if conf.exists(member): - if conf.exists(['interfaces', Section.section(interface), interface]): - ret_val.update({intf : {}}) + member_type = Section.section(interface) + # Check if it's a VLAN (QinQ) interface + interface = interface.split('.') + if len(interface) == 3: + if conf.exists(['interfaces', member_type, interface[0], 'vif-s', interface[1], 'vif-c', interface[2]]): + ret_val.update({intf : {}}) + elif len(interface) == 2: + if conf.exists(['interfaces', member_type, interface[0], 'vif', interface[1]]): + ret_val.update({intf : {}}) + else: + if conf.exists(['interfaces', member_type, interface[0]]): + ret_val.update({intf : {}}) return ret_val -- cgit v1.2.3