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

ospfd: Displaying GR helper enabled router-id list in 'show ip ospf g… #9317

Closed
wants to merge 1 commit into from
Closed
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
31 changes: 31 additions & 0 deletions ospfd/ospf_vty.c
Original file line number Diff line number Diff line change
Expand Up @@ -10125,6 +10125,25 @@ static int ospf_print_vty_helper_dis_rtr_walkcb(struct hash_bucket *bucket,
return HASHWALK_CONTINUE;
}

static int ospf_print_json_helper_dis_rtr_walkcb(struct hash_bucket *bucket,
void *arg)
{
struct advRtr *rtr = bucket->data;
struct json_object *json_rid_array = (struct json_object *)arg;
struct json_object *json_rid;
char buf[PREFIX_STRLEN];

json_rid = json_object_new_object();

json_object_string_add(
json_rid, "routerId",
inet_ntop(AF_INET, &rtr->advRtrAddr, buf, sizeof(buf)));
json_object_array_add(json_rid_array, json_rid);

return HASHWALK_CONTINUE;
}


static int ospf_show_gr_helper_details(struct vty *vty, struct ospf *ospf,
uint8_t use_vrf, json_object *json,
bool uj, bool detail)
Expand Down Expand Up @@ -10244,6 +10263,18 @@ CPP_NOTICE("Remove JSON object commands with keys starting with capital")
if (ospf->active_restarter_cnt)
json_object_int_add(json_vrf, "activeRestarterCnt",
ospf->active_restarter_cnt);

if (OSPF_HELPER_ENABLE_RTR_COUNT(ospf)) {
struct json_object *json_rid_array =
json_object_new_array();

json_object_object_add(json_vrf, "grEnabledRouterIds",
json_rid_array);

hash_walk(ospf->enable_rtr_list,
ospf_print_json_helper_dis_rtr_walkcb,
json_rid_array);
}
}


Expand Down