summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configtree.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/python/vyos/configtree.py b/python/vyos/configtree.py
index 743600a56..6791b1c29 100644
--- a/python/vyos/configtree.py
+++ b/python/vyos/configtree.py
@@ -579,6 +579,32 @@ def diff_compare(left, right, path=None, commands=False, libpath=LIBPATH):
return res
+def diff_show(rt, left, right, path=None, libpath=LIBPATH):
+ if not (isinstance(left, ConfigTree) and isinstance(right, ConfigTree)):
+ raise TypeError('Arguments must be instances of ConfigTree')
+ path = path or []
+
+ check_path(path)
+ path_str = ' '.join(map(str, path)).encode()
+
+ __lib = cdll.LoadLibrary(libpath)
+ __diff_show = __lib.diff_show
+ __diff_show.argtypes = [c_void_p, c_void_p, c_void_p, c_char_p]
+ __diff_show.restype = c_char_p
+ __get_error = __lib.get_error
+ __get_error.argtypes = []
+ __get_error.restype = c_char_p
+
+ res = __diff_show(rt.get_tree(), left.get_tree(), right.get_tree(), path_str)
+ res = res.decode()
+ if res == '#1@':
+ msg = __get_error().decode()
+ raise ConfigTreeError(msg)
+
+ res = unescape_backslash(res)
+ return res
+
+
def union(left, right, libpath=LIBPATH):
if left is None:
left = ConfigTree(config_string='\n')