summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-06-05 20:20:30 +0200
committerDaniil Baturin <daniil@baturin.org>2018-06-05 20:20:30 +0200
commit9aec42029aff0d81c9f27a6d6df6eae401446c76 (patch)
treec0fc8650237e54da7fefc22d22f8113b796b30d0 /python
parent28db29e42fca939f8157041cbedc52378ce3622e (diff)
downloadvyos-1x-9aec42029aff0d81c9f27a6d6df6eae401446c76.tar.gz
vyos-1x-9aec42029aff0d81c9f27a6d6df6eae401446c76.zip
T684: add bindings for the commands formatter and scripts for converting configs to commands.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/configtree.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/python/vyos/configtree.py b/python/vyos/configtree.py
index e0d46260f..4b46a1fb3 100644
--- a/python/vyos/configtree.py
+++ b/python/vyos/configtree.py
@@ -96,6 +96,10 @@ class ConfigTree(object):
self.__to_string.argtypes = [c_void_p]
self.__to_string.restype = c_char_p
+ self.__to_commands = self.__lib.to_commands
+ self.__to_commands.argtypes = [c_void_p]
+ self.__to_commands.restype = c_char_p
+
self.__set_add_value = self.__lib.set_add_value
self.__set_add_value.argtypes = [c_void_p, c_char_p, c_char_p]
self.__set_add_value.restype = c_int
@@ -162,6 +166,9 @@ class ConfigTree(object):
config_string = "{0}\n{1}".format(config_string, self.__comments)
return config_string
+ def to_commands(self):
+ return self.__to_commands(self.__config).decode()
+
def set(self, path, value=None, replace=True):
check_path(path)
path_str = " ".join(map(str, path)).encode()