From 327ca85aa391b6a3c75f1da04b3d71c61869d90c Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Sun, 2 Sep 2018 13:07:27 +0200 Subject: T824: add Python bindings for the rename_node function to vyos.configtree --- python/vyos/configtree.py | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'python') diff --git a/python/vyos/configtree.py b/python/vyos/configtree.py index 4b46a1fb3..ad8fcef1a 100644 --- a/python/vyos/configtree.py +++ b/python/vyos/configtree.py @@ -112,6 +112,10 @@ class ConfigTree(object): self.__delete.argtypes = [c_void_p, c_char_p] self.__delete.restype = c_int + self.__rename = self.__lib.rename_node + self.__rename.argtypes = [c_void_p, c_char_p, c_char_p] + self.__rename.restype = c_int + self.__set_replace_value = self.__lib.set_replace_value self.__set_replace_value.argtypes = [c_void_p, c_char_p, c_char_p] self.__set_replace_value.restype = c_int @@ -193,6 +197,13 @@ class ConfigTree(object): self.__delete_value(self.__config, path_str, value.encode()) + def rename(self, path, newname): + check_path(path) + path_str = " ".join(map(str, path)).encode() + newname_str = newname.encode() + + self.__rename(self.__config, path_str, newname_str) + def exists(self, path): check_path(path) path_str = " ".join(map(str, path)).encode() -- cgit v1.2.3