Skip to content

Commit

Permalink
Merge pull request #1812 from qlyoung/bgpd-fix-update-group-commands
Browse files Browse the repository at this point in the history
bgpd: fix update-group show commands
  • Loading branch information
cfra committed Mar 7, 2018
2 parents 97a346e + dc64bde commit 5fe3789
Showing 1 changed file with 31 additions and 224 deletions.
255 changes: 31 additions & 224 deletions bgpd/bgp_vty.c
Expand Up @@ -10300,227 +10300,43 @@ static void show_bgp_updgrps_adj_info_aux(struct vty *vty, const char *name,
}
}

DEFUN (show_ip_bgp_updgrps_adj,
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")
DEFPY(show_ip_bgp_instance_updgrps_adj_s,
show_ip_bgp_instance_updgrps_adj_s_cmd,
"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 IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
BGP_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_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;
uint64_t subgrp_id = 0;
afi_t afiz;
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;
}

subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
safiz = safi ? bgp_vty_safi_from_str(safi) : SAFI_UNICAST;

show_bgp_updgrps_adj_info_aux(vty, argv[idx_vrf]->arg, AFI_IP6,
SAFI_UNICAST, argv[idx_type]->arg,
subgrp_id);
show_bgp_updgrps_adj_info_aux(vty, vrf, afiz, safiz, rtq, subgrp_id);
return CMD_SUCCESS;
}


static int bgp_show_one_peer_group(struct vty *vty, struct peer_group *group)
{
struct listnode *node, *nnode;
Expand Down Expand Up @@ -12435,19 +12251,10 @@ void bgp_vty_init(void)

/* "show [ip] bgp summary" commands. */
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_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_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_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);

/* "show [ip] bgp neighbors" commands. */
Expand Down

0 comments on commit 5fe3789

Please sign in to comment.