summaryrefslogtreecommitdiff
path: root/python/vyos/configdict.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@vyos.io>2022-09-15 15:22:05 +0100
committerGitHub <noreply@github.com>2022-09-15 15:22:05 +0100
commit435016fdb353b79577c40baa23af8e01fcadd098 (patch)
tree12b9acdc00ba63041b96d54bdeb339c3264959dd /python/vyos/configdict.py
parente57146723fd791d71ac9659f9247a8827c151c97 (diff)
parent87894a2fa32933400a930783edcce74a8b4792a4 (diff)
downloadvyos-1x-435016fdb353b79577c40baa23af8e01fcadd098.tar.gz
vyos-1x-435016fdb353b79577c40baa23af8e01fcadd098.zip
Merge pull request #1519 from c-po/t4630-equuleus-peth-macsec
T4630: disallow same source-interface for macsec and pseudo-ethernet
Diffstat (limited to 'python/vyos/configdict.py')
-rw-r--r--python/vyos/configdict.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/python/vyos/configdict.py b/python/vyos/configdict.py
index 53bd1a13e..785207c7f 100644
--- a/python/vyos/configdict.py
+++ b/python/vyos/configdict.py
@@ -309,12 +309,18 @@ def is_source_interface(conf, interface, intftype=None):
"""
ret_val = None
intftypes = ['macsec', 'pppoe', 'pseudo-ethernet', 'tunnel', 'vxlan']
- if intftype not in intftypes + [None]:
+ if not intftype:
+ intftype = intftypes
+
+ if isinstance(intftype, str):
+ intftype = [intftype]
+ elif not isinstance(intftype, list):
+ raise ValueError(f'Interface type "{type(intftype)}" must be either str or list!')
+
+ if not all(x in intftypes for x in intftype):
raise ValueError(f'unknown interface type "{intftype}" or it can not '
'have a source-interface')
- intftype = intftypes if intftype == None else [intftype]
-
# set config level to root
old_level = conf.get_level()
conf.set_level([])