Skip to content

Commit

Permalink
zebra: rib operational model formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Chirag Shah <chirag@cumulusnetworks.com>
  • Loading branch information
chiragshah6 committed Apr 7, 2020
1 parent a30dab2 commit 4d13e84
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
12 changes: 6 additions & 6 deletions zebra/zebra_nb_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,8 @@ int lib_interface_zebra_ip_addrs_create(enum nb_event event,
char buf[PREFIX_STRLEN] = {0};

ifp = nb_running_get_entry(dnode, NULL, true);
// addr_family = yang_dnode_get_enum(dnode, "./address-family");
/* TODO: wrapper for identityref */
/* addr_family = yang_dnode_get_enum(dnode, "./address-family"); */
yang_dnode_get_prefix(&prefix, dnode, "./ip-prefix");
apply_mask(&prefix);

Expand Down Expand Up @@ -1324,7 +1325,6 @@ int lib_vrf_zebra_ribs_rib_create(enum nb_event event,
const struct lyd_node *dnode,
union nb_resource *resource)
{
// uint32_t table_id;
struct vrf *vrf;
afi_t afi = AFI_IP;
safi_t safi = SAFI_UNICAST;
Expand All @@ -1334,13 +1334,13 @@ int lib_vrf_zebra_ribs_rib_create(enum nb_event event,
vrf = nb_running_get_entry(dnode, NULL, false);
zvrf = vrf_info_lookup(vrf->vrf_id);

// TODO: parse afi-safi-name and table_id
// table_id = yang_dnode_get_uint32(dnode, "./table-id");
/* TODO: parse afi-safi-name and table_id
uint32_t table_id;
table_id = yang_dnode_get_uint32(dnode, "./table-id");
*/
zlog_debug("%s: vrf %s", __PRETTY_FUNCTION__, vrf->name);

zrt = zebra_router_find_zrt(zvrf, zvrf->table_id, afi, safi);
// table = zebra_vrf_lookup_table_with_table_id(afi, safi, vrf->vrf_id,
// zvrf->table_id);

switch (event) {
case NB_EV_VALIDATE:
Expand Down
17 changes: 5 additions & 12 deletions zebra/zebra_nb_state.c
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ lib_vrf_zebra_ribs_rib_lookup_entry(const void *parent_list_entry,
const struct yang_list_keys *keys)
{
struct vrf *vrf = (struct vrf *)parent_list_entry;
// uint32_t tableid = strtoul(keys->key[1], NULL, 10);
/* uint32_t tableid = strtoul(keys->key[1], NULL, 10); */
struct zebra_vrf *zvrf;
afi_t afi = AFI_IP;
safi_t safi = SAFI_UNICAST;
Expand All @@ -263,8 +263,8 @@ const void *lib_vrf_zebra_ribs_rib_route_get_next(const void *parent_list_entry,
{
const struct zebra_router_table *zrt = parent_list_entry;
const struct route_node *rn = list_entry;

char buf[PREFIX_STRLEN];

if (list_entry == NULL) {
rn = route_top(zrt->table);
} else {
Expand Down Expand Up @@ -667,11 +667,10 @@ lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_get_
struct nexthop *nexthop = (struct nexthop *)list_entry;
struct nhg_hash_entry *nhe = (struct nhg_hash_entry *)parent_list_entry;

if (list_entry == NULL) {
if (list_entry == NULL)
nexthop = (nhe->nhg.nexthop);
} else {
else
nexthop = nexthop_next(nexthop);
}

return nexthop;
}
Expand Down Expand Up @@ -763,19 +762,14 @@ lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_nh_t
switch (nexthop->type) {
case NEXTHOP_TYPE_IFINDEX:
return yang_data_new_string(xpath, "ifindex");
break;
case NEXTHOP_TYPE_IPV4:
return yang_data_new_string(xpath, "ip4");
break;
case NEXTHOP_TYPE_IPV4_IFINDEX:
return yang_data_new_string(xpath, "ip4-ifindex");
break;
case NEXTHOP_TYPE_IPV6:
return yang_data_new_string(xpath, "ip6");
break;
case NEXTHOP_TYPE_IPV6_IFINDEX:
return yang_data_new_string(xpath, "ip6-ifindex");
break;
default:
break;
}
Expand Down Expand Up @@ -824,7 +818,6 @@ lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_gate
case NEXTHOP_TYPE_IFINDEX:
/* No addr here */
return yang_data_new_string(xpath, "");
break;
default:
break;
}
Expand Down Expand Up @@ -869,11 +862,11 @@ lib_vrf_zebra_ribs_rib_route_route_entry_nexthop_group_frr_nexthops_nexthop_bh_t
const char *xpath, const void *list_entry)
{
struct nexthop *nexthop = (struct nexthop *)list_entry;
char type_str[PREFIX2STR_BUFFER] = {'\0'};

if (nexthop->type != NEXTHOP_TYPE_BLACKHOLE)
return NULL;

char type_str[PREFIX2STR_BUFFER] = {'\0'};
switch (nexthop->bh_type) {
case BLACKHOLE_NULL:
strlcpy(type_str, "null", 12);
Expand Down

0 comments on commit 4d13e84

Please sign in to comment.