summaryrefslogtreecommitdiff
path: root/lib/northbound.h
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2018-12-08 17:31:16 -0200
committerRenato Westphal <renato@opensourcerouting.org>2018-12-09 13:58:53 -0200
commit99fb518fef7d40c20921ce63764e7578d1149fa8 (patch)
treec2f15f9d552ed00f4cc1b5f8bbf3dbbc30a71b26 /lib/northbound.h
parentca6541963cd00cc24d53debee2c570810c609aec (diff)
lib, tests: add support for keyless YANG lists
YANG allows lists without keys for operational data, in which case the list elements are uniquely identified using a positional index (starting from one). This commit does the following: * Remove the need to implement the 'get_keys' and 'lookup_entry' callbacks for keyless lists. * Extend nb_oper_data_iter_list() so that it special-cases keyless lists appropriately. Since both the CLI and the sysrepo plugin use nb_oper_data_iterate() to fetch operational data, both these northbound clients automatically gain the ability to understand keyless lists without additional changes. * Extend the confd plugin to special-case keyless lists as well. This was a bit painful to implement given ConfD's clumsy API, but keyless lists should work ok now. * Update the "test_oper_data" unit test to test keyless YANG lists in addition to regular lists. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'lib/northbound.h')
-rw-r--r--lib/northbound.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/northbound.h b/lib/northbound.h
index c8e8d75701..9d35a4e64a 100644
--- a/lib/northbound.h
+++ b/lib/northbound.h
@@ -254,7 +254,8 @@ struct nb_callbacks {
* Operational data callback for YANG lists.
*
* The callback function should fill the 'keys' parameter based on the
- * given list_entry.
+ * given list_entry. Keyless lists don't need to implement this
+ * callback.
*
* list_entry
* Pointer to list entry.
@@ -272,7 +273,8 @@ struct nb_callbacks {
* Operational data callback for YANG lists.
*
* The callback function should return a list entry based on the list
- * keys given as a parameter.
+ * keys given as a parameter. Keyless lists don't need to implement this
+ * callback.
*
* parent_list_entry
* Pointer to parent list entry.
@@ -367,6 +369,8 @@ struct nb_node {
};
/* The YANG container or list contains only config data. */
#define F_NB_NODE_CONFIG_ONLY 0x01
+/* The YANG list doesn't contain key leafs. */
+#define F_NB_NODE_KEYLESS_LIST 0x02
struct frr_yang_module_info {
/* YANG module name. */