summaryrefslogtreecommitdiffstats
path: root/lib/northbound.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2019-09-18 15:55:55 +0200
committerRenato Westphal <renato@opensourcerouting.org>2019-09-18 19:35:10 +0200
commit6f4e5eddc0a5ce84fd0546bb8cb21c7530ff0693 (patch)
tree561cb1604ebcbe41598be9b6521523c396b9fa3f /lib/northbound.c
parentlib: fix ordering issues in the northbound (diff)
downloadfrr-6f4e5eddc0a5ce84fd0546bb8cb21c7530ff0693.tar.xz
frr-6f4e5eddc0a5ce84fd0546bb8cb21c7530ff0693.zip
lib: add an exception in the northbound for operational data callbacks
During initialization, the northbound detects if any required callback is missing (fatal error) or if any unneeded callback is present (warning). There are three callbacks, however, that should require special handling: get_next(), get_keys() and lookup_entry(). These callbacks are normally unneeded for configuration lists. But, if a configuration list is augmented with new state nodes by another module, then the three callbacks mentioned above become required. In this case, never log a warning when these callbacks are implemented when they are not needed, since this depends on context (e.g. some daemons might augment "frr-interface" while others don't). Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/northbound.c')
-rw-r--r--lib/northbound.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/lib/northbound.c b/lib/northbound.c
index 42fd1fba5..1b332fb1e 100644
--- a/lib/northbound.c
+++ b/lib/northbound.c
@@ -183,7 +183,18 @@ static int nb_node_validate_cb(const struct nb_node *nb_node,
valid = nb_operation_is_valid(operation, nb_node->snode);
- if (!valid && callback_implemented)
+ /*
+ * Add an exception for operational data callbacks. A rw list usually
+ * doesn't need any associated operational data callbacks. But if this
+ * rw list is augmented by another module which adds state nodes under
+ * it, then this list will need to have the 'get_next()', 'get_keys()'
+ * and 'lookup_entry()' callbacks. As such, never log a warning when
+ * these callbacks are implemented when they are not needed, since this
+ * depends on context (e.g. some daemons might augment "frr-interface"
+ * while others don't).
+ */
+ if (!valid && callback_implemented && operation != NB_OP_GET_NEXT
+ && operation != NB_OP_GET_KEYS && operation != NB_OP_LOOKUP_ENTRY)
flog_warn(EC_LIB_NB_CB_UNNEEDED,
"unneeded '%s' callback for '%s'",
nb_operation_name(operation), nb_node->xpath);