Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Master: bgp show vpn/encap and RFAPI fixes #113

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 1 addition & 17 deletions bgpd/bgp_encap.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,23 +324,7 @@ show_adj_route_encap (struct vty *vty, struct peer *peer, struct prefix_rd *prd)
return CMD_SUCCESS;
}

enum bgp_show_type
{
bgp_show_type_normal,
bgp_show_type_regexp,
bgp_show_type_prefix_list,
bgp_show_type_filter_list,
bgp_show_type_neighbor,
bgp_show_type_cidr_only,
bgp_show_type_prefix_longer,
bgp_show_type_community_all,
bgp_show_type_community,
bgp_show_type_community_exact,
bgp_show_type_community_list,
bgp_show_type_community_list_exact
};

static int
int
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't @pguibert6WIND have a commit that modifies this too?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hello, I think the bgp_show_type should be moved to a single place.
I proposed it in #111

If 113 does it, it is perfect, i wil adapt.

bgp_show_encap (
struct vty *vty,
afi_t afi,
Expand Down
4 changes: 3 additions & 1 deletion bgpd/bgp_encap.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,11 @@

#ifndef _QUAGGA_BGP_ENCAP_H
#define _QUAGGA_BGP_ENCAP_H
#include "bgpd/bgp_route.h"

extern void bgp_encap_init (void);
extern int bgp_nlri_parse_encap (struct peer *, struct attr *, struct bgp_nlri *);

extern int bgp_show_encap (struct vty *vty, afi_t afi, struct prefix_rd *prd,
enum bgp_show_type type, void *output_arg, int tags);
#include "bgp_encap_types.h"
#endif /* _QUAGGA_BGP_ENCAP_H */
65 changes: 25 additions & 40 deletions bgpd/bgp_mplsvpn.c
Original file line number Diff line number Diff line change
Expand Up @@ -717,23 +717,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u
return CMD_SUCCESS;
}

enum bgp_show_type
{
bgp_show_type_normal,
bgp_show_type_regexp,
bgp_show_type_prefix_list,
bgp_show_type_filter_list,
bgp_show_type_neighbor,
bgp_show_type_cidr_only,
bgp_show_type_prefix_longer,
bgp_show_type_community_all,
bgp_show_type_community,
bgp_show_type_community_exact,
bgp_show_type_community_list,
bgp_show_type_community_list_exact
};

static int
int
bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
enum bgp_show_type type, void *output_arg, int tags, u_char use_json)
{
Expand Down Expand Up @@ -951,8 +935,8 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
return CMD_SUCCESS;
}

DEFUN (show_bgp_ip_vpn_rd,
show_bgp_ip_vpn_rd_cmd,
DEFUN (show_bgp_ip_vpn_all_rd,
show_bgp_ip_vpn_all_rd_cmd,
"show bgp "BGP_AFI_CMD_STR" vpn all [rd ASN:nn_or_IP-address:nn] [json]",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

show [ip] bgp

SHOW_STR
IP_STR
Expand Down Expand Up @@ -989,34 +973,17 @@ DEFUN (show_bgp_ip_vpn_rd,
return CMD_SUCCESS;
}

#ifdef KEEP_OLD_VPN_COMMANDS
DEFUN (show_ip_bgp_vpn_all,
show_ip_bgp_vpn_all_cmd,
"show [ip] bgp <vpnv4|vpnv6>",
SHOW_STR
IP_STR
BGP_STR
BGP_VPNVX_HELP_STR)
{
afi_t afi;
int idx = 0;

if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, 0);
return CMD_SUCCESS;
}

DEFUN (show_ip_bgp_vpn_rd,
show_ip_bgp_vpn_rd_cmd,
"show [ip] bgp <vpnv4|vpnv6> rd ASN:nn_or_IP-address:nn",
"show [ip] bgp "BGP_AFI_CMD_STR" vpn rd ASN:nn_or_IP-address:nn",
SHOW_STR
IP_STR
BGP_STR
BGP_VPNVX_HELP_STR
BGP_AFI_HELP_STR
"Display information for a route distinguisher\n"
"VPN Route Distinguisher\n")
{
int idx_ext_community = 5;
int idx_ext_community = argc-1;
int ret;
struct prefix_rd prd;
afi_t afi;
Expand All @@ -1035,6 +1002,23 @@ DEFUN (show_ip_bgp_vpn_rd,
return CMD_SUCCESS;
}

#ifdef KEEP_OLD_VPN_COMMANDS
DEFUN (show_ip_bgp_vpn_all,
show_ip_bgp_vpn_all_cmd,
"show [ip] bgp <vpnv4|vpnv6>",
SHOW_STR
IP_STR
BGP_STR
BGP_VPNVX_HELP_STR)
{
afi_t afi;
int idx = 0;

if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, 0);
return CMD_SUCCESS;
}

DEFUN (show_ip_bgp_vpn_all_tags,
show_ip_bgp_vpn_all_tags_cmd,
"show [ip] bgp <vpnv4|vpnv6> all tags",
Expand Down Expand Up @@ -1370,7 +1354,8 @@ bgp_mplsvpn_init (void)
install_element (BGP_VPNV6_NODE, &vpnv6_network_cmd);
install_element (BGP_VPNV6_NODE, &no_vpnv6_network_cmd);

install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_cmd);
install_element (VIEW_NODE, &show_bgp_ip_vpn_all_rd_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_cmd);
#ifdef KEEP_OLD_VPN_COMMANDS
install_element (VIEW_NODE, &show_ip_bgp_vpn_all_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_cmd);
Expand Down
10 changes: 7 additions & 3 deletions bgpd/bgp_mplsvpn.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
#ifndef _QUAGGA_BGP_MPLSVPN_H
#define _QUAGGA_BGP_MPLSVPN_H

#include "bgpd/bgp_route.h"

#define RD_TYPE_AS 0
#define RD_TYPE_IP 1
#define RD_TYPE_AS4 2
Expand Down Expand Up @@ -56,8 +58,8 @@ typedef enum {
(label) == MPLS_LABEL_IMPLICIT_NULL)

#define BGP_VPNVX_HELP_STR \
"Address Family \n" \
"Address Family \n"
"Address Family\n" \
"Address Family\n"

struct rd_as
{
Expand Down Expand Up @@ -100,5 +102,7 @@ extern char *prefix_rd2str (struct prefix_rd *, char *, size_t);

extern int
argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc, int *index, afi_t *afi);

extern int
bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
enum bgp_show_type type, void *output_arg, int tags, u_char use_json);
#endif /* _QUAGGA_BGP_MPLSVPN_H */
Loading