Skip to content

Commit 5f9f8b3

Browse files
authored
Merge pull request #1838 from qlyoung/bgpd-fix-update-group-commands-4.0
bgpd: fix update-group show commands [4.0]
2 parents 0885dda + 33bb241 commit 5f9f8b3

File tree

1 file changed

+31
-224
lines changed

1 file changed

+31
-224
lines changed

bgpd/bgp_vty.c

Lines changed: 31 additions & 224 deletions
Original file line numberDiff line numberDiff line change
@@ -10288,227 +10288,43 @@ static void show_bgp_updgrps_adj_info_aux(struct vty *vty, const char *name,
1028810288
}
1028910289
}
1029010290

10291-
DEFUN (show_ip_bgp_updgrps_adj,
10292-
show_ip_bgp_updgrps_adj_cmd,
10293-
"show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
10294-
SHOW_STR
10295-
IP_STR
10296-
BGP_STR
10297-
"Detailed info about dynamic update groups\n"
10298-
"Advertisement queue\n"
10299-
"Announced routes\n"
10300-
"Packet queue\n")
10301-
{
10302-
int idx_type = 4;
10303-
show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST,
10304-
argv[idx_type]->arg, 0);
10305-
return CMD_SUCCESS;
10306-
}
10307-
10308-
DEFUN (show_ip_bgp_instance_updgrps_adj,
10309-
show_ip_bgp_instance_updgrps_adj_cmd,
10310-
"show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
10311-
SHOW_STR
10312-
IP_STR
10313-
BGP_STR
10314-
BGP_INSTANCE_HELP_STR
10315-
"Detailed info about dynamic update groups\n"
10316-
"Advertisement queue\n"
10317-
"Announced routes\n"
10318-
"Packet queue\n")
10319-
{
10320-
int idx_word = 4;
10321-
int idx_type = 6;
10322-
show_bgp_updgrps_adj_info_aux(vty, argv[idx_word]->arg, AFI_IP,
10323-
SAFI_UNICAST, argv[idx_type]->arg, 0);
10324-
return CMD_SUCCESS;
10325-
}
10326-
10327-
DEFUN (show_bgp_updgrps_afi_adj,
10328-
show_bgp_updgrps_afi_adj_cmd,
10329-
"show [ip] bgp "BGP_AFI_SAFI_CMD_STR" update-groups <advertise-queue|advertised-routes|packet-queue>",
10330-
SHOW_STR
10331-
IP_STR
10332-
BGP_STR
10333-
BGP_AFI_SAFI_HELP_STR
10334-
"Detailed info about dynamic update groups\n"
10335-
"Advertisement queue\n"
10336-
"Announced routes\n"
10337-
"Packet queue\n")
10338-
{
10339-
int idx_afi = 2;
10340-
int idx_safi = 3;
10341-
int idx_type = 5;
10342-
show_bgp_updgrps_adj_info_aux(
10343-
vty, NULL, bgp_vty_afi_from_str(argv[idx_afi]->text),
10344-
bgp_vty_safi_from_str(argv[idx_safi]->text),
10345-
argv[idx_type]->arg, 0);
10346-
return CMD_SUCCESS;
10347-
}
10348-
10349-
DEFUN (show_bgp_updgrps_adj,
10350-
show_bgp_updgrps_adj_cmd,
10351-
"show [ip] bgp update-groups <advertise-queue|advertised-routes|packet-queue>",
10352-
SHOW_STR
10353-
IP_STR
10354-
BGP_STR
10355-
"Detailed info about dynamic update groups\n"
10356-
"Advertisement queue\n"
10357-
"Announced routes\n"
10358-
"Packet queue\n")
10359-
{
10360-
int idx_type = 3;
10361-
show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST,
10362-
argv[idx_type]->arg, 0);
10363-
return CMD_SUCCESS;
10364-
}
10365-
10366-
DEFUN (show_bgp_instance_updgrps_adj,
10367-
show_bgp_instance_updgrps_adj_cmd,
10368-
"show [ip] bgp <view|vrf> VIEWVRFNAME update-groups <advertise-queue|advertised-routes|packet-queue>",
10369-
SHOW_STR
10370-
IP_STR
10371-
BGP_STR
10372-
BGP_INSTANCE_HELP_STR
10373-
"Detailed info about dynamic update groups\n"
10374-
"Advertisement queue\n"
10375-
"Announced routes\n"
10376-
"Packet queue\n")
10377-
{
10378-
int idx_word = 3;
10379-
int idx_type = 5;
10380-
show_bgp_updgrps_adj_info_aux(vty, argv[idx_word]->arg, AFI_IP6,
10381-
SAFI_UNICAST, argv[idx_type]->arg, 0);
10382-
return CMD_SUCCESS;
10383-
}
10384-
10385-
DEFUN (show_ip_bgp_updgrps_adj_s,
10386-
show_ip_bgp_updgrps_adj_s_cmd,
10387-
"show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
10388-
SHOW_STR
10389-
IP_STR
10390-
BGP_STR
10391-
"Detailed info about dynamic update groups\n"
10392-
"Specific subgroup to display info for\n"
10393-
"Advertisement queue\n"
10394-
"Announced routes\n"
10395-
"Packet queue\n")
10291+
DEFPY(show_ip_bgp_instance_updgrps_adj_s,
10292+
show_ip_bgp_instance_updgrps_adj_s_cmd,
10293+
"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",
10294+
SHOW_STR IP_STR BGP_STR BGP_INSTANCE_HELP_STR BGP_AFI_HELP_STR
10295+
BGP_SAFI_HELP_STR
10296+
"Detailed info about dynamic update groups\n"
10297+
"Specific subgroup to display info for\n"
10298+
"Advertisement queue\n"
10299+
"Announced routes\n"
10300+
"Packet queue\n")
1039610301
{
10397-
int idx_subgroup_id = 4;
10398-
int idx_type = 5;
10399-
uint64_t subgrp_id;
10400-
10401-
subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
10402-
10403-
show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP, SAFI_UNICAST,
10404-
argv[idx_type]->arg, subgrp_id);
10405-
return CMD_SUCCESS;
10406-
}
10407-
10408-
DEFUN (show_ip_bgp_instance_updgrps_adj_s,
10409-
show_ip_bgp_instance_updgrps_adj_s_cmd,
10410-
"show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
10411-
SHOW_STR
10412-
IP_STR
10413-
BGP_STR
10414-
BGP_INSTANCE_HELP_STR
10415-
"Detailed info about dynamic update groups\n"
10416-
"Specific subgroup to display info for\n"
10417-
"Advertisement queue\n"
10418-
"Announced routes\n"
10419-
"Packet queue\n")
10420-
{
10421-
int idx_vrf = 4;
10422-
int idx_subgroup_id = 6;
10423-
int idx_type = 7;
10424-
uint64_t subgrp_id;
10425-
10426-
subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
10427-
10428-
show_bgp_updgrps_adj_info_aux(vty, argv[idx_vrf]->arg, AFI_IP,
10429-
SAFI_UNICAST, argv[idx_type]->arg,
10430-
subgrp_id);
10431-
return CMD_SUCCESS;
10432-
}
10433-
10434-
DEFUN (show_bgp_updgrps_afi_adj_s,
10435-
show_bgp_updgrps_afi_adj_s_cmd,
10436-
"show [ip] bgp "BGP_AFI_SAFI_CMD_STR" update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
10437-
SHOW_STR
10438-
IP_STR
10439-
BGP_STR
10440-
BGP_AFI_SAFI_HELP_STR
10441-
"Detailed info about dynamic update groups\n"
10442-
"Specific subgroup to display info for\n"
10443-
"Advertisement queue\n"
10444-
"Announced routes\n"
10445-
"Packet queue\n")
10446-
{
10447-
int idx_afi = 2;
10448-
int idx_safi = 3;
10449-
int idx_subgroup_id = 5;
10450-
int idx_type = 6;
10451-
uint64_t subgrp_id;
10452-
10453-
subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
10454-
10455-
show_bgp_updgrps_adj_info_aux(
10456-
vty, NULL, bgp_vty_afi_from_str(argv[idx_afi]->text),
10457-
bgp_vty_safi_from_str(argv[idx_safi]->text),
10458-
argv[idx_type]->arg, subgrp_id);
10459-
return CMD_SUCCESS;
10460-
}
10461-
10462-
DEFUN (show_bgp_updgrps_adj_s,
10463-
show_bgp_updgrps_adj_s_cmd,
10464-
"show [ip] bgp update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
10465-
SHOW_STR
10466-
IP_STR
10467-
BGP_STR
10468-
"Detailed info about dynamic update groups\n"
10469-
"Specific subgroup to display info for\n"
10470-
"Advertisement queue\n"
10471-
"Announced routes\n"
10472-
"Packet queue\n")
10473-
{
10474-
int idx_subgroup_id = 3;
10475-
int idx_type = 4;
10476-
uint64_t subgrp_id;
10477-
10478-
subgrp_id = strtoull(argv[idx_subgroup_id]->arg, NULL, 10);
10479-
10480-
show_bgp_updgrps_adj_info_aux(vty, NULL, AFI_IP6, SAFI_UNICAST,
10481-
argv[idx_type]->arg, subgrp_id);
10482-
return CMD_SUCCESS;
10483-
}
10484-
10485-
DEFUN (show_bgp_instance_updgrps_adj_s,
10486-
show_bgp_instance_updgrps_adj_s_cmd,
10487-
"show [ip] bgp <view|vrf> VIEWVRFNAME update-groups SUBGROUP-ID <advertise-queue|advertised-routes|packet-queue>",
10488-
SHOW_STR
10489-
IP_STR
10490-
BGP_STR
10491-
BGP_INSTANCE_HELP_STR
10492-
"Detailed info about dynamic update groups\n"
10493-
"Specific subgroup to display info for\n"
10494-
"Advertisement queue\n"
10495-
"Announced routes\n"
10496-
"Packet queue\n")
10497-
{
10498-
int idx_vrf = 3;
10499-
int idx_subgroup_id = 5;
10500-
int idx_type = 6;
10501-
uint64_t subgrp_id;
10302+
uint64_t subgrp_id = 0;
10303+
afi_t afiz;
10304+
safi_t safiz;
10305+
if (sgid)
10306+
subgrp_id = strtoull(sgid, NULL, 10);
10307+
10308+
if (!ip && !afi)
10309+
afiz = AFI_IP6;
10310+
if (!ip && afi)
10311+
afiz = bgp_vty_afi_from_str(afi);
10312+
if (ip && !afi)
10313+
afiz = AFI_IP;
10314+
if (ip && afi) {
10315+
afiz = bgp_vty_afi_from_str(afi);
10316+
if (afiz != AFI_IP)
10317+
vty_out(vty,
10318+
"%% Cannot specify both 'ip' and 'ipv6'\n");
10319+
return CMD_WARNING;
10320+
}
1050210321

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

10505-
show_bgp_updgrps_adj_info_aux(vty, argv[idx_vrf]->arg, AFI_IP6,
10506-
SAFI_UNICAST, argv[idx_type]->arg,
10507-
subgrp_id);
10324+
show_bgp_updgrps_adj_info_aux(vty, vrf, afiz, safiz, rtq, subgrp_id);
1050810325
return CMD_SUCCESS;
1050910326
}
1051010327

10511-
1051210328
static int bgp_show_one_peer_group(struct vty *vty, struct peer_group *group)
1051310329
{
1051410330
struct listnode *node, *nnode;
@@ -12422,19 +12238,10 @@ void bgp_vty_init(void)
1242212238

1242312239
/* "show [ip] bgp summary" commands. */
1242412240
install_element(VIEW_NODE, &show_bgp_instance_all_ipv6_updgrps_cmd);
12425-
install_element(VIEW_NODE, &show_bgp_instance_updgrps_adj_cmd);
12426-
install_element(VIEW_NODE, &show_bgp_instance_updgrps_adj_s_cmd);
1242712241
install_element(VIEW_NODE, &show_bgp_instance_updgrps_stats_cmd);
12428-
install_element(VIEW_NODE, &show_bgp_updgrps_adj_cmd);
12429-
install_element(VIEW_NODE, &show_bgp_updgrps_adj_s_cmd);
12430-
install_element(VIEW_NODE, &show_bgp_updgrps_afi_adj_cmd);
12431-
install_element(VIEW_NODE, &show_bgp_updgrps_afi_adj_s_cmd);
1243212242
install_element(VIEW_NODE, &show_bgp_updgrps_stats_cmd);
12433-
install_element(VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_cmd);
1243412243
install_element(VIEW_NODE, &show_ip_bgp_instance_updgrps_adj_s_cmd);
1243512244
install_element(VIEW_NODE, &show_ip_bgp_summary_cmd);
12436-
install_element(VIEW_NODE, &show_ip_bgp_updgrps_adj_cmd);
12437-
install_element(VIEW_NODE, &show_ip_bgp_updgrps_adj_s_cmd);
1243812245
install_element(VIEW_NODE, &show_ip_bgp_updgrps_cmd);
1243912246

1244012247
/* "show [ip] bgp neighbors" commands. */

0 commit comments

Comments
 (0)