summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-11 07:58:13 +0200
committerChristian Poessinger <christian@poessinger.com>2022-07-18 08:14:33 +0200
commit3bcc6df1a917e027998052223ba7db5424bfd370 (patch)
tree148bd3f1f0e30ba5c4c5cf2182ce34573a055a80 /python/vyos
parent57d54b249ff04f70177b31fae0c10ac6677148ee (diff)
downloadvyos-1x-3bcc6df1a917e027998052223ba7db5424bfd370.tar.gz
vyos-1x-3bcc6df1a917e027998052223ba7db5424bfd370.zip
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. (cherry picked from commit fdeae251431cb747e8f60d96269b4365b7401807)
Diffstat (limited to 'python/vyos')
-rw-r--r--python/vyos/configdict.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index cc50c5167..37cf2e114 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -228,8 +228,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 : {}})
old_level = conf.set_level(old_level)
return ret_val