summaryrefslogtreecommitdiff
path: root/python/vyos/configtree.py
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-09-02 13:07:27 +0200
committerDaniil Baturin <daniil@baturin.org>2018-09-02 13:07:27 +0200
commit327ca85aa391b6a3c75f1da04b3d71c61869d90c (patch)
tree75a8ed96391325a55aceeaf37265f7acbebdc4bc /python/vyos/configtree.py
parent55f464ab2642951251da668d3d38d7dad9225629 (diff)
downloadvyos-1x-327ca85aa391b6a3c75f1da04b3d71c61869d90c.tar.gz
vyos-1x-327ca85aa391b6a3c75f1da04b3d71c61869d90c.zip
T824: add Python bindings for the rename_node function to vyos.configtree
Diffstat (limited to 'python/vyos/configtree.py')
-rw-r--r--python/vyos/configtree.py11
1 files changed, 11 insertions, 0 deletions
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()