mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-13 16:26:10 +00:00
pimd, pim6d: Using ttable for displaying "show ip/ipv6 multicast count" command.
Signed-off-by: Abhishek N R <abnr@vmware.com>
This commit is contained in:
parent
ac2f410c37
commit
7f0dc57f8e
@ -3285,13 +3285,22 @@ void show_multicast_interfaces(struct pim_instance *pim, struct vty *vty,
|
|||||||
json_object *json)
|
json_object *json)
|
||||||
{
|
{
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
struct ttable *tt = NULL;
|
||||||
|
char *table = NULL;
|
||||||
json_object *json_row = NULL;
|
json_object *json_row = NULL;
|
||||||
|
|
||||||
vty_out(vty, "\n");
|
vty_out(vty, "\n");
|
||||||
|
|
||||||
if (!json)
|
if (!json) {
|
||||||
vty_out(vty,
|
/* Prepare table. */
|
||||||
"Interface Address ifi Vif PktsIn PktsOut BytesIn BytesOut\n");
|
tt = ttable_new(&ttable_styles[TTSTYLE_BLANK]);
|
||||||
|
ttable_add_row(
|
||||||
|
tt,
|
||||||
|
"Interface|Address|ifi|Vif|PktsIn|PktsOut|BytesIn|BytesOut");
|
||||||
|
tt->style.cell.rpad = 2;
|
||||||
|
tt->style.corner = '+';
|
||||||
|
ttable_restyle(tt);
|
||||||
|
}
|
||||||
|
|
||||||
FOR_ALL_INTERFACES (pim->vrf, ifp) {
|
FOR_ALL_INTERFACES (pim->vrf, ifp) {
|
||||||
struct pim_interface *pim_ifp;
|
struct pim_interface *pim_ifp;
|
||||||
@ -3347,16 +3356,22 @@ void show_multicast_interfaces(struct pim_instance *pim, struct vty *vty,
|
|||||||
(unsigned long)vreq.obytes);
|
(unsigned long)vreq.obytes);
|
||||||
json_object_object_add(json, ifp->name, json_row);
|
json_object_object_add(json, ifp->name, json_row);
|
||||||
} else {
|
} else {
|
||||||
vty_out(vty,
|
ttable_add_row(tt, "%s|%pPAs|%d|%d|%lu|%lu|%lu|%lu",
|
||||||
"%-16s %-15pPAs %3d %3d %7lu %7lu %10lu %10lu\n",
|
ifp->name, &pim_ifp->primary_address,
|
||||||
ifp->name, &pim_ifp->primary_address,
|
ifp->ifindex, pim_ifp->mroute_vif_index,
|
||||||
ifp->ifindex, pim_ifp->mroute_vif_index,
|
(unsigned long)vreq.icount,
|
||||||
(unsigned long)vreq.icount,
|
(unsigned long)vreq.ocount,
|
||||||
(unsigned long)vreq.ocount,
|
(unsigned long)vreq.ibytes,
|
||||||
(unsigned long)vreq.ibytes,
|
(unsigned long)vreq.obytes);
|
||||||
(unsigned long)vreq.obytes);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* Dump the generated table. */
|
||||||
|
if (!json) {
|
||||||
|
table = ttable_dump(tt, "\n");
|
||||||
|
vty_out(vty, "%s\n", table);
|
||||||
|
XFREE(MTYPE_TMP, table);
|
||||||
|
ttable_del(tt);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void pim_cmd_show_ip_multicast_helper(struct pim_instance *pim, struct vty *vty)
|
void pim_cmd_show_ip_multicast_helper(struct pim_instance *pim, struct vty *vty)
|
||||||
|
Loading…
Reference in New Issue
Block a user