diff options
Diffstat (limited to 'tests/lib/northbound/test_oper_data.c')
| -rw-r--r-- | tests/lib/northbound/test_oper_data.c | 41 |
1 files changed, 37 insertions, 4 deletions
diff --git a/tests/lib/northbound/test_oper_data.c b/tests/lib/northbound/test_oper_data.c index 3d700d8a19..0b334c6522 100644 --- a/tests/lib/northbound/test_oper_data.c +++ b/tests/lib/northbound/test_oper_data.c @@ -120,6 +120,26 @@ static const void *frr_test_module_vrfs_vrf_interfaces_interface_get_next( } /* + * XPath: /frr-test-module:frr-test-module/vrfs/vrf/interfaces/interface-new + */ +static enum nb_error frr_test_module_vrfs_vrf_interfaces_interface_new_get( + const struct nb_node *nb_node, const void *parent_list_entry, struct lyd_node *parent) +{ + const struct lysc_node *snode = nb_node->snode; + const struct tvrf *vrf; + struct listnode *node; + const char *interface; + LY_ERR err; + + vrf = listgetdata((struct listnode *)parent_list_entry); + for (ALL_LIST_ELEMENTS_RO(vrf->interfaces, node, interface)) { + err = lyd_new_term(parent, snode->module, snode->name, interface, false, NULL); + assert(err == LY_SUCCESS); + } + return NB_OK; +} + +/* * XPath: /frr-test-module:frr-test-module/vrfs/vrf/routes/route */ static const void * @@ -228,10 +248,19 @@ frr_test_module_c1value_get_elem(struct nb_cb_get_elem_args *args) /* * XPath: /frr-test-module:frr-test-module/c2cont/c2value */ -static struct yang_data * -frr_test_module_c2cont_c2value_get_elem(struct nb_cb_get_elem_args *args) +static enum nb_error frr_test_module_c2cont_c2value_get(const struct nb_node *nb_node, + const void *parent_list_entry, + struct lyd_node *parent) { - return yang_data_new_uint32(args->xpath, 0xAB010203); + const struct lysc_node *snode = nb_node->snode; + uint32_t value = 0xAB010203; + LY_ERR err; + + err = lyd_new_term_bin(parent, snode->module, snode->name, &value, sizeof(value), + LYD_NEW_PATH_UPDATE, NULL); + assert(err == LY_SUCCESS); + + return NB_OK; } /* clang-format off */ @@ -254,6 +283,10 @@ const struct frr_yang_module_info frr_test_module_info = { .cbs.get_next = frr_test_module_vrfs_vrf_interfaces_interface_get_next, }, { + .xpath = "/frr-test-module:frr-test-module/vrfs/vrf/interfaces/interface-new", + .cbs.get = frr_test_module_vrfs_vrf_interfaces_interface_new_get, + }, + { .xpath = "/frr-test-module:frr-test-module/vrfs/vrf/routes/route", .cbs.get_next = frr_test_module_vrfs_vrf_routes_route_get_next, }, @@ -287,7 +320,7 @@ const struct frr_yang_module_info frr_test_module_info = { }, { .xpath = "/frr-test-module:frr-test-module/c2cont/c2value", - .cbs.get_elem = frr_test_module_c2cont_c2value_get_elem, + .cbs.get = frr_test_module_c2cont_c2value_get, }, { .xpath = NULL, |
