Merge pull request #1812 from qlyoung/bgpd-fix-update-group-commands

bgpd: fix update-group show commands
This commit is contained in:
Christian Franke 2018-03-07 14:50:50 +01:00 committed by GitHub
commit 5fe3789f98
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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_instance_updgrps_adj_s_cmd,
"show [ip] bgp update-groups <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 "Detailed info about dynamic update groups\n"
"Detailed info about dynamic update groups\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_type = 4; uint64_t subgrp_id = 0;
show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST, afi_t afiz;
argv[idx_type]->arg, 0); safi_t safiz;
if (sgid)
subgrp_id = strtoull(sgid, 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;
}
safiz = safi ? bgp_vty_safi_from_str(safi) : SAFI_UNICAST;
show_bgp_updgrps_adj_info_aux(vty, vrf, afiz, safiz, rtq, subgrp_id);
return CMD_SUCCESS; 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 <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 = 4;
int idx_subgroup_id = 6;
int idx_type = 7;
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_IP,
SAFI_UNICAST, argv[idx_type]->arg,
subgrp_id);
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. */