summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2026-04-12 15:09:11 -0500
committerJohn Estabrook <jestabro@vyos.io>2026-05-11 09:03:23 -0500
commit7a49b5bde4cc220977bd5719a1ecd2ffabe03ca9 (patch)
treef1fc88f2e5357c41a7904e2dff8046d065a2a97b /python
parent136152dc252c5e25b364359cbb5064a5a4a21abf (diff)
downloadvyos-1x-7a49b5bde4cc220977bd5719a1ecd2ffabe03ca9.tar.gz
vyos-1x-7a49b5bde4cc220977bd5719a1ecd2ffabe03ca9.zip
T8488: add wrapper for mask_exclusive
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configtree.py29
1 files changed, 27 insertions, 2 deletions
diff --git a/python/vyos/configtree.py b/python/vyos/configtree.py
index 61ef6428c..2876130cf 100644
--- a/python/vyos/configtree.py
+++ b/python/vyos/configtree.py
@@ -584,13 +584,38 @@ def mask_inclusive(left, right, libpath=LIBPATH):
try:
__lib = cdll.LoadLibrary(libpath)
__mask_tree = __lib.mask_tree
- __mask_tree.argtypes = [c_void_p, c_void_p]
+ __mask_tree.argtypes = [c_void_p, c_void_p, c_bool]
__mask_tree.restype = c_void_p
__get_error = __lib.get_error
__get_error.argtypes = []
__get_error.restype = c_char_p
- res = __mask_tree(left.get_tree(), right.get_tree())
+ res = __mask_tree(left.get_tree(), right.get_tree(), False)
+ except Exception as e:
+ raise ConfigTreeError(e)
+ if not res:
+ msg = __get_error().decode()
+ raise ConfigTreeError(msg)
+
+ tree = ConfigTree(address=res)
+
+ return tree
+
+
+def mask_exclusive(left, right, libpath=LIBPATH):
+ if not (isinstance(left, ConfigTree) and isinstance(right, ConfigTree)):
+ raise TypeError('Arguments must be instances of ConfigTree')
+
+ try:
+ __lib = cdll.LoadLibrary(libpath)
+ __mask_tree = __lib.mask_tree
+ __mask_tree.argtypes = [c_void_p, c_void_p, c_bool]
+ __mask_tree.restype = c_void_p
+ __get_error = __lib.get_error
+ __get_error.argtypes = []
+ __get_error.restype = c_char_p
+
+ res = __mask_tree(left.get_tree(), right.get_tree(), True)
except Exception as e:
raise ConfigTreeError(e)
if not res: