bgpd: fix update-group show commands

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
This commit is contained in:
Quentin Young 2018-03-01 13:43:54 -05:00
parent c98f4d81aa
commit dc64bdec91
No known key found for this signature in database
GPG Key ID: DAF48E0F57E0834F

View File

@ -10300,227 +10300,43 @@ static void show_bgp_updgrps_adj_info_aux(struct vty *vty, const char *name,
} }
} }
DEFUN (show_ip_bgp_updgrps_adj, DEFPY(show_ip_bgp_instance_updgrps_adj_s,
show_ip_bgp_updgrps_adj_cmd,
"show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
"Detailed info about dynamic update groups\n"
"Advertisement queue\n"
"Announced routes\n"
"Packet queue\n")
{
int idx_type = 4;
show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST,
argv[idx_type]->arg, 0);
return CMD_SUCCESS;
}
DEFUN (show_ip_bgp_instance_updgrps_adj,
show_ip_bgp_instance_updgrps_adj_cmd,
"show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
BGP_INSTANCE_HELP_STR
"Detailed info about dynamic update groups\n"
"Advertisement queue\n"
"Announced routes\n"
"Packet queue\n")
{
int idx_word = 4;
int idx_type = 6;
show_bgp_updgrps_adj_info_aux(vty, argv[idx_word]->arg, AFI_IP,
SAFI_UNICAST, argv[idx_type]->arg, 0);
return CMD_SUCCESS;
}
DEFUN (show_bgp_updgrps_afi_adj,
show_bgp_updgrps_afi_adj_cmd,
"show [ip] bgp "BGP_AFI_SAFI_CMD_STR" update-groups <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
BGP_AFI_SAFI_HELP_STR
"Detailed info about dynamic update groups\n"
"Advertisement queue\n"
"Announced routes\n"
"Packet queue\n")
{
int idx_afi = 2;
int idx_safi = 3;
int idx_type = 5;
show_bgp_updgrps_adj_info_aux(
vty, NULL, bgp_vty_afi_from_str(argv[idx_afi]->text),
bgp_vty_safi_from_str(argv[idx_safi]->text),
argv[idx_type]->arg, 0);
return CMD_SUCCESS;
}
DEFUN (show_bgp_updgrps_adj,
show_bgp_updgrps_adj_cmd,
"show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
"Detailed info about dynamic update groups\n"
"Advertisement queue\n"
"Announced routes\n"
"Packet queue\n")
{
int idx_type = 3;
show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST,
argv[idx_type]->arg, 0);
return CMD_SUCCESS;
}
DEFUN (show_bgp_instance_updgrps_adj,
show_bgp_instance_updgrps_adj_cmd,
"show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
BGP_INSTANCE_HELP_STR
"Detailed info about dynamic update groups\n"
"Advertisement queue\n"
"Announced routes\n"
"Packet queue\n")
{
int idx_word = 3;
int idx_type = 5;
show_bgp_updgrps_adj_info_aux(vty, argv[idx_word]->arg, AFI_IP6,
SAFI_UNICAST, argv[idx_type]->arg, 0);
return CMD_SUCCESS;
}
DEFUN (show_ip_bgp_updgrps_adj_s,
show_ip_bgp_updgrps_adj_s_cmd,
"show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
"Detailed info about dynamic update groups\n"
"Specific subgroup to display info for\n"
"Advertisement queue\n"
"Announced routes\n"
"Packet queue\n")
{
int idx_subgroup_id = 4;
int idx_type = 5;
uint64_t subgrp_id;
subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST,
argv[idx_type]->arg, subgrp_id);
return CMD_SUCCESS;
}
DEFUN (show_ip_bgp_instance_updgrps_adj_s,
show_ip_bgp_instance_updgrps_adj_s_cmd, show_ip_bgp_instance_updgrps_adj_s_cmd,
"show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>", "show [ip]$ip bgp [<view|vrf> VIEWVRFNAME$vrf] [<ipv4|ipv6>$afi <unicast|multicast|vpn>$safi] update-groups [SUBGROUP-ID]$sgid <advertise-queue|advertised-routes|packet-queue>$rtq",
SHOW_STR SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
IP_STR BGP_SAFI_HELP_STR
BGP_STR
BGP_INSTANCE_HELP_STR
"Detailed info about dynamic update groups\n" "Detailed info about dynamic update groups\n"
"Specific subgroup to display info for\n" "Specific subgroup to display info for\n"
"Advertisement queue\n" "Advertisement queue\n"
"Announced routes\n" "Announced routes\n"
"Packet queue\n") "Packet queue\n")
{ {
int idx_vrf = 4; uint64_t subgrp_id = 0;
int idx_subgroup_id = 6; afi_t afiz;
int idx_type = 7; safi_t safiz;
uint64_t subgrp_id; if (sgid)
subgrp_id = strtoull(sgid, NULL, 10);
subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10); if (!ip && !afi)
afiz = AFI_IP6;
if (!ip && afi)
afiz = bgp_vty_afi_from_str(afi);
if (ip && !afi)
afiz = AFI_IP;
if (ip && afi) {
afiz = bgp_vty_afi_from_str(afi);
if (afiz != AFI_IP)
vty_out(vty,
"%% Cannot specify both 'ip' and 'ipv6'\n");
return CMD_WARNING;
}
show_bgp_updgrps_adj_info_aux(vty, argv[idx_vrf]->arg, AFI_IP, safiz = safi ? bgp_vty_safi_from_str(safi) : SAFI_UNICAST;
SAFI_UNICAST, argv[idx_type]->arg,
subgrp_id); show_bgp_updgrps_adj_info_aux(vty, vrf, afiz, safiz, rtq, subgrp_id);
return CMD_SUCCESS; return CMD_SUCCESS;
} }
DEFUN (show_bgp_updgrps_afi_adj_s,
show_bgp_updgrps_afi_adj_s_cmd,
"show [ip] bgp "BGP_AFI_SAFI_CMD_STR" update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
BGP_AFI_SAFI_HELP_STR
"Detailed info about dynamic update groups\n"
"Specific subgroup to display info for\n"
"Advertisement queue\n"
"Announced routes\n"
"Packet queue\n")
{
int idx_afi = 2;
int idx_safi = 3;
int idx_subgroup_id = 5;
int idx_type = 6;
uint64_t subgrp_id;
subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
show_bgp_updgrps_adj_info_aux(
vty, NULL, bgp_vty_afi_from_str(argv[idx_afi]->text),
bgp_vty_safi_from_str(argv[idx_safi]->text),
argv[idx_type]->arg, subgrp_id);
return CMD_SUCCESS;
}
DEFUN (show_bgp_updgrps_adj_s,
show_bgp_updgrps_adj_s_cmd,
"show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
"Detailed info about dynamic update groups\n"
"Specific subgroup to display info for\n"
"Advertisement queue\n"
"Announced routes\n"
"Packet queue\n")
{
int idx_subgroup_id = 3;
int idx_type = 4;
uint64_t subgrp_id;
subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST,
argv[idx_type]->arg, subgrp_id);
return CMD_SUCCESS;
}
DEFUN (show_bgp_instance_updgrps_adj_s,
show_bgp_instance_updgrps_adj_s_cmd,
"show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
SHOW_STR
IP_STR
BGP_STR
BGP_INSTANCE_HELP_STR
"Detailed info about dynamic update groups\n"
"Specific subgroup to display info for\n"
"Advertisement queue\n"
"Announced routes\n"
"Packet queue\n")
{
int idx_vrf = 3;
int idx_subgroup_id = 5;
int idx_type = 6;
uint64_t subgrp_id;
subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
show_bgp_updgrps_adj_info_aux(vty, argv[idx_vrf]->arg, AFI_IP6,
SAFI_UNICAST, argv[idx_type]->arg,
subgrp_id);
return CMD_SUCCESS;
}
static int bgp_show_one_peer_group(struct vty *vty, struct peer_group *group) static int bgp_show_one_peer_group(struct vty *vty, struct peer_group *group)
{ {
struct listnode *node, *nnode; struct listnode *node, *nnode;
@ -12435,19 +12251,10 @@ void bgp_vty_init(void)
/* "show [ip] bgp summary" commands. */ /* "show [ip] bgp summary" commands. */
install_element(VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd); install_element(VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
install_element(VIEW_NODE, &show_bgp_instance_updgrps_adj_cmd);
install_element(VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
install_element(VIEW_NODE, &show_bgp_instance_updgrps_stats_cmd); install_element(VIEW_NODE, &show_bgp_instance_updgrps_stats_cmd);
install_element(VIEW_NODE, &show_bgp_updgrps_adj_cmd);
install_element(VIEW_NODE, &show_bgp_updgrps_adj_s_cmd);
install_element(VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd);
install_element(VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
install_element(VIEW_NODE, &show_bgp_updgrps_stats_cmd); install_element(VIEW_NODE, &show_bgp_updgrps_stats_cmd);
install_element(VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd);
install_element(VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd); install_element(VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd);
install_element(VIEW_NODE, &show_ip_bgp_summary_cmd); install_element(VIEW_NODE, &show_ip_bgp_summary_cmd);
install_element(VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd);
install_element(VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd);
install_element(VIEW_NODE, &show_ip_bgp_updgrps_cmd); install_element(VIEW_NODE, &show_ip_bgp_updgrps_cmd);
/* "show [ip] bgp neighbors" commands. */ /* "show [ip] bgp neighbors" commands. */