Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: RIB operational northbound callbacks implementation #6172

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions yang/frr-zebra.yang
Original file line number Diff line number Diff line change
Expand Up @@ -630,6 +630,7 @@ module frr-zebra {
description
"The route's prefix.";
}

list route-entry {
key "protocol";
leaf protocol {
Expand Down Expand Up @@ -2045,10 +2046,12 @@ module frr-zebra {
augment "/frr-vrf:lib/frr-vrf:vrf" {
description
"Extends VRF model with Zebra-related parameters.";
uses ribs;
container zebra {
uses ribs;
}
}

augment "/frr-vrf:lib/frr-vrf:vrf/ribs/rib/route/route-entry/nexthop-group/frr-nexthops/nexthop" {
augment "/frr-vrf:lib/frr-vrf:vrf/frr-zebra:zebra/ribs/rib/route/route-entry/nexthop-group/frr-nexthops/nexthop" {
uses frr-nh:frr-nexthop-operational;
}

Expand Down
10 changes: 10 additions & 0 deletions zebra/rib.h
Original file line number Diff line number Diff line change
Expand Up @@ -251,12 +251,22 @@ DECLARE_LIST(re_list, struct route_entry, next);
(re) && ((next) = re_list_next(&((dest)->routes), (re)), 1); \
(re) = (next))

#define RE_DEST_FIRST_ROUTE(dest, re) \
((re) = (dest) ? re_list_first(&((dest)->routes)) : NULL)

#define RE_DEST_NEXT_ROUTE(dest, re) \
((re) = (dest) ? re_list_next(&((dest)->routes), (re)) : NULL)

#define RNODE_FOREACH_RE(rn, re) \
RE_DEST_FOREACH_ROUTE (rib_dest_from_rnode(rn), re)

#define RNODE_FOREACH_RE_SAFE(rn, re, next) \
RE_DEST_FOREACH_ROUTE_SAFE (rib_dest_from_rnode(rn), re, next)

#define RNODE_FIRST_RE(rn, re) RE_DEST_FIRST_ROUTE(rib_dest_from_rnode(rn), re)

#define RNODE_NEXT_RE(rn, re) RE_DEST_NEXT_ROUTE(rib_dest_from_rnode(rn), re)

#if defined(HAVE_RTADV)
/* Structure which hold status of router advertisement. */
struct rtadv {
Expand Down
168 changes: 84 additions & 84 deletions zebra/zebra_nb.c

Large diffs are not rendered by default.

206 changes: 66 additions & 140 deletions zebra/zebra_nb.h
Original file line number Diff line number Diff line change
Expand Up @@ -284,205 +284,131 @@ lib_interface_zebra_state_remote_vtep_get_elem(const char *xpath,
struct yang_data *
lib_interface_zebra_state_mcast_group_get_elem(const char *xpath,
const void *list_entry);
int lib_vrf_ribs_rib_create(enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource);
int lib_vrf_ribs_rib_destroy(enum nb_event event, const struct lyd_node *dnode);
const void *lib_vrf_ribs_rib_get_next(const void *parent_list_entry,
const void *list_entry);
int lib_vrf_ribs_rib_get_keys(const void *list_entry,
struct yang_list_keys *keys);
const void *lib_vrf_ribs_rib_lookup_entry(const void *parent_list_entry,
const struct yang_list_keys *keys);
const void *lib_vrf_ribs_rib_route_get_next(const void *parent_list_entry,
int lib_vrf_zebra_ribs_rib_create(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource);
int lib_vrf_zebra_ribs_rib_destroy(enum nb_event event,
const struct lyd_node *dnode);
const void *lib_vrf_zebra_ribs_rib_get_next(const void *parent_list_entry,
const void *list_entry);
int lib_vrf_ribs_rib_route_get_keys(const void *list_entry,
int lib_vrf_zebra_ribs_rib_get_keys(const void *list_entry,
struct yang_list_keys *keys);
const void *
lib_vrf_ribs_rib_route_lookup_entry(const void *parent_list_entry,
lib_vrf_zebra_ribs_rib_lookup_entry(const void *parent_list_entry,
const struct yang_list_keys *keys);
struct yang_data *
lib_vrf_ribs_rib_route_prefix_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_protocol_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_protocol_v6_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *lib_vrf_ribs_rib_route_vrf_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_distance_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_metric_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *lib_vrf_ribs_rib_route_tag_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_selected_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_installed_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_failed_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_queued_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_internal_flags_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_internal_status_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_uptime_get_elem(const char *xpath,
const void *list_entry);
const void *lib_vrf_zebra_ribs_rib_route_get_next(const void *parent_list_entry,
const void *list_entry);
int lib_vrf_zebra_ribs_rib_route_get_keys(const void *list_entry,
struct yang_list_keys *keys);
const void *
lib_vrf_ribs_rib_route_nexthop_group_get_next(const void *parent_list_entry,
const void *list_entry);
int lib_vrf_ribs_rib_route_nexthop_group_get_keys(const void *list_entry,
struct yang_list_keys *keys);
const void *lib_vrf_ribs_rib_route_nexthop_group_lookup_entry(
const void *parent_list_entry, const struct yang_list_keys *keys);
struct yang_data *
lib_vrf_ribs_rib_route_nexthop_group_name_get_elem(const char *xpath,
const void *list_entry);
const void *lib_vrf_ribs_rib_route_nexthop_group_frr_nexthops_nexthop_get_next(
const void *parent_list_entry, const void *list_entry);
int lib_vrf_ribs_rib_route_nexthop_group_frr_nexthops_nexthop_get_keys(
const void *list_entry, struct yang_list_keys *keys);
int lib_vrf_ribs_rib_create(enum nb_event event, const struct lyd_node *dnode,
union nb_resource *resource);
int lib_vrf_ribs_rib_destroy(enum nb_event event, const struct lyd_node *dnode);
const void *lib_vrf_ribs_rib_get_next(const void *parent_list_entry,
const void *list_entry);
int lib_vrf_ribs_rib_get_keys(const void *list_entry,
struct yang_list_keys *keys);
const void *lib_vrf_ribs_rib_lookup_entry(const void *parent_list_entry,
lib_vrf_zebra_ribs_rib_route_lookup_entry(const void *parent_list_entry,
const struct yang_list_keys *keys);
const void *lib_vrf_ribs_rib_route_get_next(const void *parent_list_entry,
const void *list_entry);
int lib_vrf_ribs_rib_route_get_keys(const void *list_entry,
struct yang_list_keys *keys);
const void *
lib_vrf_ribs_rib_route_lookup_entry(const void *parent_list_entry,
const struct yang_list_keys *keys);
struct yang_data *
lib_vrf_ribs_rib_route_prefix_get_elem(const char *xpath,
const void *list_entry);
lib_vrf_zebra_ribs_rib_route_prefix_get_elem(const char *xpath,
const void *list_entry);
const void *
lib_vrf_ribs_rib_route_route_entry_get_next(const void *parent_list_entry,
const void *list_entry);
int lib_vrf_ribs_rib_route_route_entry_get_keys(const void *list_entry,
struct yang_list_keys *keys);
const void *lib_vrf_ribs_rib_route_route_entry_lookup_entry(
lib_vrf_zebra_ribs_rib_route_route_entry_get_next(const void *parent_list_entry,
const void *list_entry);
int lib_vrf_zebra_ribs_rib_route_route_entry_get_keys(
const void *list_entry, struct yang_list_keys *keys);
const void *lib_vrf_zebra_ribs_rib_route_route_entry_lookup_entry(
const void *parent_list_entry, const struct yang_list_keys *keys);
struct yang_data *lib_vrf_zebra_ribs_rib_route_route_entry_protocol_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *lib_vrf_zebra_ribs_rib_route_route_entry_instance_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *lib_vrf_zebra_ribs_rib_route_route_entry_distance_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *lib_vrf_zebra_ribs_rib_route_route_entry_metric_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_protocol_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_instance_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_distance_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_metric_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_tag_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_selected_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_installed_get_elem(const char *xpath,
lib_vrf_zebra_ribs_rib_route_route_entry_tag_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *lib_vrf_zebra_ribs_rib_route_route_entry_selected_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *lib_vrf_zebra_ribs_rib_route_route_entry_installed_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *lib_vrf_zebra_ribs_rib_route_route_entry_failed_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *lib_vrf_zebra_ribs_rib_route_route_entry_queued_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_failed_get_elem(const char *xpath,
const void *list_entry);
lib_vrf_zebra_ribs_rib_route_route_entry_internal_flags_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_queued_get_elem(const char *xpath,
const void *list_entry);
struct yang_data *lib_vrf_ribs_rib_route_route_entry_internal_flags_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_internal_status_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *lib_vrf_ribs_rib_route_route_entry_internal_status_get_elem(
struct yang_data *lib_vrf_zebra_ribs_rib_route_route_entry_uptime_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_uptime_get_elem(const char *xpath,
const void *list_entry);
const void *lib_vrf_ribs_rib_route_route_entry_nexthop_group_get_next(
const void *lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_get_next(
const void *parent_list_entry, const void *list_entry);
int lib_vrf_ribs_rib_route_route_entry_nexthop_group_get_keys(
int lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_get_keys(
const void *list_entry, struct yang_list_keys *keys);
const void *lib_vrf_ribs_rib_route_route_entry_nexthop_group_lookup_entry(
const void *lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_lookup_entry(
const void *parent_list_entry, const struct yang_list_keys *keys);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_name_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_name_get_elem(
const char *xpath, const void *list_entry);
const void *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_get_next(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_get_next(
const void *parent_list_entry, const void *list_entry);
int lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_get_keys(
int lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_get_keys(
const void *list_entry, struct yang_list_keys *keys);
const void *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_lookup_entry(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_lookup_entry(
const void *parent_list_entry, const struct yang_list_keys *keys);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_nh_type_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_nh_type_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_vrf_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_vrf_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_gateway_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_gateway_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_interface_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_interface_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_bh_type_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_bh_type_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_onlink_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_onlink_get_elem(
const char *xpath, const void *list_entry);
const void *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_get_next(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_get_next(
const void *parent_list_entry, const void *list_entry);
int lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_get_keys(
int lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_get_keys(
const void *list_entry, struct yang_list_keys *keys);
const void *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_lookup_entry(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_lookup_entry(
const void *parent_list_entry, const struct yang_list_keys *keys);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_id_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_id_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_label_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_label_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_ttl_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_mpls_label_stack_entry_traffic_class_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_duplicate_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_duplicate_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_recursive_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_recursive_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_active_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_active_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_fib_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_fib_get_elem(
const char *xpath, const void *list_entry);
struct yang_data *
lib_vrf_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_weight_get_elem(
lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_weight_get_elem(
const char *xpath, const void *list_entry);

#endif
Loading