return node;
}
+/*
+ * 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
*/
/*
* 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 */
.cbs.get_elem = frr_test_module_vrfs_vrf_interfaces_interface_get_elem,
.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,
},
{
.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,