summaryrefslogtreecommitdiff
path: root/python/vyos/configdict.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-10-17 22:55:02 +0200
committerChristian Poessinger <christian@poessinger.com>2020-10-17 22:55:02 +0200
commit183130bcfa3c6bf5dbf73c38c1609c7b6bf21d3f (patch)
treec86c0fb198a3d560e6f6749cd803563f92165362 /python/vyos/configdict.py
parent60109764cc18ae50802313716ce9197c9bd36e15 (diff)
parentb90041af38c1d872210d3720c258721247d313a5 (diff)
downloadvyos-1x-183130bcfa3c6bf5dbf73c38c1609c7b6bf21d3f.tar.gz
vyos-1x-183130bcfa3c6bf5dbf73c38c1609c7b6bf21d3f.zip
Merge branch 'bridge' of github.com:c-po/vyos-1x into current
* 'bridge' of github.com:c-po/vyos-1x: smoketest: add IPv6 option tests to BasicInterfaceTest ifconfig: T2985: support on demand bridge creation geneve: T1799: add IPv6 CLI options op-mode: add "show arp" command
Diffstat (limited to 'python/vyos/configdict.py')
-rw-r--r--python/vyos/configdict.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 02006465c..62df3334c 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -194,11 +194,9 @@ def is_member(conf, interface, intftype=None):
interface name -> Interface is a member of this interface
False -> interface type cannot have members
"""
- from vyos.xml import is_tag
- from vyos.xml import is_leaf
-
ret_val = None
intftypes = ['bonding', 'bridge']
+
if intftype not in intftypes + [None]:
raise ValueError((
f'unknown interface type "{intftype}" or it cannot '
@@ -210,19 +208,13 @@ def is_member(conf, interface, intftype=None):
old_level = conf.get_level()
conf.set_level([])
- for it in intftype:
- base = ['interfaces', it]
+ for iftype in intftype:
+ base = ['interfaces', iftype]
for intf in conf.list_nodes(base):
- memberintf = base + [intf, 'member', 'interface']
- if is_tag(memberintf):
- if interface in conf.list_nodes(memberintf):
- ret_val = intf
- break
- elif is_leaf(memberintf):
- if ( conf.exists(memberintf) and
- interface in conf.return_values(memberintf) ):
- ret_val = intf
- break
+ member = base + [intf, 'member', 'interface', interface]
+ if conf.exists(member):
+ tmp = conf.get_config_dict(member, key_mangling=('-', '_'), get_first_key=True)
+ ret_val = {intf : tmp}
old_level = conf.set_level(old_level)
return ret_val