summaryrefslogtreecommitdiffstats
path: root/lib/yang.h
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2020-05-14 17:30:34 +0200
committerRenato Westphal <renato@opensourcerouting.org>2020-05-29 00:22:54 +0200
commitdf5eda3d8783a3436f43821a2840911d610fd89d (patch)
tree49cef5931b240472e6ac5b1c78da9fad2ccee0cf /lib/yang.h
parentlib: introduce the northbound context structure (diff)
downloadfrr-df5eda3d8783a3436f43821a2840911d610fd89d.tar.xz
frr-df5eda3d8783a3436f43821a2840911d610fd89d.zip
lib: return human-readable error messages to the northbound clients
Instead of returning only error codes (e.g. NB_ERR_VALIDATION) to the northbound clients, do better than that and also return a human-readable error message. This should make FRR more automation-friendly since operators won't need to dig into system logs to find out what went wrong in the case of an error. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/yang.h')
-rw-r--r--lib/yang.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/yang.h b/lib/yang.h
index 126521707..2f3017e8a 100644
--- a/lib/yang.h
+++ b/lib/yang.h
@@ -497,6 +497,24 @@ extern struct ly_ctx *yang_ctx_new_setup(bool embedded_modules);
extern void yang_debugging_set(bool enable);
/*
+ * Print libyang error messages into the provided buffer.
+ *
+ * ly_ctx
+ * libyang context to operate on.
+ *
+ * buf
+ * Buffer to store the libyang error messages.
+ *
+ * buf_len
+ * Size of buf.
+ *
+ * Returns:
+ * The provided buffer.
+ */
+extern const char *yang_print_errors(struct ly_ctx *ly_ctx, char *buf,
+ size_t buf_len);
+
+/*
* Initialize the YANG subsystem. Should be called only once during the
* daemon initialization process.
*