return pim_show_nexthop_lookup_cmd_helper(vrf, vty, source, group);
}
-DEFUN (show_ip_pim_interface_traffic,
+DEFPY (show_ip_pim_interface_traffic,
show_ip_pim_interface_traffic_cmd,
- "show ip pim [vrf NAME] interface traffic [WORD] [json]",
+ "show ip pim [vrf NAME] interface traffic [WORD$if_name] [json$json]",
SHOW_STR
IP_STR
PIM_STR
"Interface name\n"
JSON_STR)
{
- int idx = 2;
- struct vrf *vrf = pim_cmd_lookup_vrf(vty, argv, argc, &idx);
- bool uj = use_json(argc, argv);
-
- if (!vrf)
- return CMD_WARNING;
-
- if (argv_find(argv, argc, "WORD", &idx))
- pim_show_interface_traffic_single(vrf->info, vty,
- argv[idx]->arg, uj);
- else
- pim_show_interface_traffic(vrf->info, vty, uj);
-
- return CMD_SUCCESS;
+ return pim_show_interface_traffic_helper(vrf, if_name, vty, !!json);
}
DEFUN (show_ip_pim_bsm_db,
else if (!found_ifname)
vty_out(vty, "%% No such interface\n");
}
+
+int pim_show_interface_traffic_helper(const char *vrf, const char *if_name,
+ struct vty *vty, bool uj)
+{
+ struct pim_instance *pim;
+ struct vrf *v;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ pim = pim_get_pim_instance(v->vrf_id);
+
+ if (!pim) {
+ vty_out(vty, "%% Unable to find pim instance\n");
+ return CMD_WARNING;
+ }
+
+ if (if_name)
+ pim_show_interface_traffic_single(v->info, vty, if_name, uj);
+ else
+ pim_show_interface_traffic(v->info, vty, uj);
+
+ return CMD_SUCCESS;
+}
bool uj);
void pim_show_interface_traffic(struct pim_instance *pim, struct vty *vty,
bool uj);
+int pim_show_interface_traffic_helper(const char *vrf, const char *if_name,
+ struct vty *vty, bool uj);
/*
* Special Macro to allow us to get the correct pim_instance;
*/