"interface name\n"
JSON_STR)
{
- struct vrf *v;
- bool uj = !!json;
- json_object *json_parent = NULL;
-
- v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
-
- if (!v)
- return CMD_WARNING;
-
- if (uj)
- json_parent = json_object_new_object();
-
- if (interface)
- pim_show_interfaces_single(v->info, vty, interface, false,
- json_parent);
- else
- pim_show_interfaces(v->info, vty, false, json_parent);
-
- if (uj)
- vty_json(vty, json_parent);
-
- return CMD_SUCCESS;
+ return pim_show_interface_cmd_helper(vrf, vty, !!json, false,
+ interface);
}
DEFPY (show_ipv6_pim_interface_vrf_all,
"interface name\n"
JSON_STR)
{
- struct vrf *v;
- bool uj = !!json;
- bool is_mlag = !!mlag;
- json_object *json_parent = NULL;
-
- v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
-
- if (!v)
- return CMD_WARNING;
-
- if (uj)
- json_parent = json_object_new_object();
-
- if (interface)
- pim_show_interfaces_single(v->info, vty, interface, is_mlag,
- json_parent);
- else
- pim_show_interfaces(v->info, vty, is_mlag, json_parent);
-
- if (uj)
- vty_json(vty, json_parent);
-
- return CMD_SUCCESS;
+ return pim_show_interface_cmd_helper(vrf, vty, !!json, !!mlag,
+ interface);
}
DEFPY (show_ip_pim_interface_vrf_all,
return CMD_SUCCESS;
}
+int pim_show_interface_cmd_helper(const char *vrf, struct vty *vty, bool uj,
+ bool mlag, const char *interface)
+{
+ struct vrf *v;
+ json_object *json_parent = NULL;
+
+ v = vrf_lookup_by_name(vrf ? vrf : VRF_DEFAULT_NAME);
+
+ if (!v)
+ return CMD_WARNING;
+
+ if (uj)
+ json_parent = json_object_new_object();
+
+ if (interface)
+ pim_show_interfaces_single(v->info, vty, interface, mlag,
+ json_parent);
+ else
+ pim_show_interfaces(v->info, vty, mlag, json_parent);
+
+ if (uj)
+ vty_json(vty, json_parent);
+
+ return CMD_SUCCESS;
+}
+
void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag,
json_object *json)
{
void pim_show_membership(struct pim_instance *pim, struct vty *vty, bool uj);
void pim_show_channel(struct pim_instance *pim, struct vty *vty, bool uj);
int pim_show_channel_cmd_helper(const char *vrf, struct vty *vty, bool uj);
+int pim_show_interface_cmd_helper(const char *vrf, struct vty *vty, bool uj,
+ bool mlag, const char *interface);
void pim_show_interfaces(struct pim_instance *pim, struct vty *vty, bool mlag,
json_object *json);
void pim_show_interfaces_single(struct pim_instance *pim, struct vty *vty,