summaryrefslogtreecommitdiff
path: root/lib/northbound.h
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-04-12 18:00:26 -0300
committerRenato Westphal <renato@opensourcerouting.org>2019-04-15 15:59:38 -0300
commit9eb2c0a1dc80c2693f3290df85e04dbe58f7575d (patch)
treef7b16bcf38283f6fe8afa6f632077396262f8e35 /lib/northbound.h
parente0cade1bbc408b96a60fbbe40cd2f32aa31e73f3 (diff)
lib: add fine-grained debugging in the northbound
Split the "debug northbound" command into the following commands: * debug northbound callbacks configuration * debug northbound callbacks state * debug northbound callbacks rpc * debug northbound notifications * debug northbound events * debug northbound client confd * debug northbound client sysrepo If "debug northbound" is entered alone, all of its suboptions are enabled. This commit also adds code to debug state/rpc callbacks and notifications (only configuration callbacks were logged before). Use the debugging infrastructure from "lib/debug.h" in order to benefit from its facilities (e.g. MT-safe debugging) and avoid code duplication. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/northbound.h')
-rw-r--r--lib/northbound.h29
1 files changed, 28 insertions, 1 deletions
diff --git a/lib/northbound.h b/lib/northbound.h
index bb6b62af7d..bfa28b3f65 100644
--- a/lib/northbound.h
+++ b/lib/northbound.h
@@ -33,6 +33,7 @@ extern "C" {
/* Forward declaration(s). */
struct vty;
+struct debug;
/* Northbound events. */
enum nb_event {
@@ -458,12 +459,38 @@ typedef int (*nb_oper_data_cb)(const struct lys_node *snode,
/* Iterate over direct child nodes only. */
#define NB_OPER_DATA_ITER_NORECURSE 0x0001
+/* Hooks. */
DECLARE_HOOK(nb_notification_send, (const char *xpath, struct list *arguments),
(xpath, arguments))
+DECLARE_HOOK(nb_client_debug_config_write, (struct vty *vty), (vty))
+DECLARE_HOOK(nb_client_debug_set_all, (uint32_t flags, bool set), (flags, set))
-extern int debug_northbound;
+/* Northbound debugging records */
+extern struct debug nb_dbg_cbs_config;
+extern struct debug nb_dbg_cbs_state;
+extern struct debug nb_dbg_cbs_rpc;
+extern struct debug nb_dbg_notif;
+extern struct debug nb_dbg_events;
+
+/* Global running configuration. */
extern struct nb_config *running_config;
+/* Wrappers for the northbound callbacks. */
+extern struct yang_data *nb_callback_get_elem(const struct nb_node *nb_node,
+ const char *xpath,
+ const void *list_entry);
+extern const void *nb_callback_get_next(const struct nb_node *nb_node,
+ const void *parent_list_entry,
+ const void *list_entry);
+extern int nb_callback_get_keys(const struct nb_node *nb_node,
+ const void *list_entry,
+ struct yang_list_keys *keys);
+extern const void *nb_callback_lookup_entry(const struct nb_node *nb_node,
+ const void *parent_list_entry,
+ const struct yang_list_keys *keys);
+extern int nb_callback_rpc(const struct nb_node *nb_node, const char *xpath,
+ const struct list *input, struct list *output);
+
/*
* Create a northbound node for all YANG schema nodes.
*/