mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 14:34:22 +00:00
pimd, pim6d: Using ttable for displaying "show ip/ipv6 pim upstream-rpf" command output.
Signed-off-by: Abhishek N R <abnr@vmware.com>
This commit is contained in:
parent
090f833975
commit
802ba0fb94
@ -1579,15 +1579,23 @@ void pim_show_join_desired(struct pim_instance *pim, struct vty *vty, bool uj)
|
|||||||
void pim_show_upstream_rpf(struct pim_instance *pim, struct vty *vty, bool uj)
|
void pim_show_upstream_rpf(struct pim_instance *pim, struct vty *vty, bool uj)
|
||||||
{
|
{
|
||||||
struct pim_upstream *up;
|
struct pim_upstream *up;
|
||||||
|
struct ttable *tt = NULL;
|
||||||
|
char *table = NULL;
|
||||||
json_object *json = NULL;
|
json_object *json = NULL;
|
||||||
json_object *json_group = NULL;
|
json_object *json_group = NULL;
|
||||||
json_object *json_row = NULL;
|
json_object *json_row = NULL;
|
||||||
|
|
||||||
if (uj)
|
if (uj)
|
||||||
json = json_object_new_object();
|
json = json_object_new_object();
|
||||||
else
|
else {
|
||||||
vty_out(vty,
|
/* Prepare table. */
|
||||||
"Source Group RpfIface RibNextHop RpfAddress \n");
|
tt = ttable_new(&ttable_styles[TTSTYLE_BLANK]);
|
||||||
|
ttable_add_row(tt,
|
||||||
|
"Source|Group|RpfIface|RibNextHop|RpfAddress");
|
||||||
|
tt->style.cell.rpad = 2;
|
||||||
|
tt->style.corner = '+';
|
||||||
|
ttable_restyle(tt);
|
||||||
|
}
|
||||||
|
|
||||||
frr_each (rb_pim_upstream, &pim->upstream_head, up) {
|
frr_each (rb_pim_upstream, &pim->upstream_head, up) {
|
||||||
struct pim_rpf *rpf;
|
struct pim_rpf *rpf;
|
||||||
@ -1629,16 +1637,22 @@ void pim_show_upstream_rpf(struct pim_instance *pim, struct vty *vty, bool uj)
|
|||||||
&rpf->rpf_addr);
|
&rpf->rpf_addr);
|
||||||
json_object_object_add(json_group, src_str, json_row);
|
json_object_object_add(json_group, src_str, json_row);
|
||||||
} else {
|
} else {
|
||||||
vty_out(vty,
|
ttable_add_row(tt, "%pPAs|%pPAs|%s|%pPA|%pPA",
|
||||||
"%-15pPAs %-15pPAs %-16s %-15pPA %-15pPA\n",
|
&up->sg.src, &up->sg.grp, rpf_ifname,
|
||||||
&up->sg.src, &up->sg.grp, rpf_ifname,
|
&rpf->source_nexthop.mrib_nexthop_addr,
|
||||||
&rpf->source_nexthop.mrib_nexthop_addr,
|
&rpf->rpf_addr);
|
||||||
&rpf->rpf_addr);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (uj)
|
if (uj)
|
||||||
vty_json(vty, json);
|
vty_json(vty, json);
|
||||||
|
else {
|
||||||
|
/* Dump the generated table. */
|
||||||
|
table = ttable_dump(tt, "\n");
|
||||||
|
vty_out(vty, "%s\n", table);
|
||||||
|
XFREE(MTYPE_TMP, table);
|
||||||
|
ttable_del(tt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pim_show_join_helper(struct vty *vty, struct pim_interface *pim_ifp,
|
static void pim_show_join_helper(struct vty *vty, struct pim_interface *pim_ifp,
|
||||||
|
Loading…
Reference in New Issue
Block a user