mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-17 21:38:11 +00:00
bgpd: add some show commands for vpnv6
Some show commands are added for handling vpnv6. As the commands was present for vpnv4, but not vpnv6, the handler routine for vty vpnv4 have been extended for vpnv6. Signed-off-by: Philippe Guibert <philippe.guibert@6wind.com>
This commit is contained in:
parent
af37568a48
commit
3f22717225
@ -35,11 +35,35 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|||||||
#include "bgpd/bgp_attr.h"
|
#include "bgpd/bgp_attr.h"
|
||||||
#include "bgpd/bgp_mplsvpn.h"
|
#include "bgpd/bgp_mplsvpn.h"
|
||||||
#include "bgpd/bgp_packet.h"
|
#include "bgpd/bgp_packet.h"
|
||||||
|
#include "bgpd/bgp_vty.h"
|
||||||
|
|
||||||
#if ENABLE_BGP_VNC
|
#if ENABLE_BGP_VNC
|
||||||
#include "bgpd/rfapi/rfapi_backend.h"
|
#include "bgpd/rfapi/rfapi_backend.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define BGP_VPNVX_HELP_STR \
|
||||||
|
"Address Family \n" \
|
||||||
|
"Address Family \n"
|
||||||
|
|
||||||
|
static int
|
||||||
|
argv_find_and_parse_vpnvx(struct cmd_token **argv, int argc, int *index, afi_t *afi)
|
||||||
|
{
|
||||||
|
int ret = 0;
|
||||||
|
if (argv_find (argv, argc, "vpnv4", index))
|
||||||
|
{
|
||||||
|
ret = 1;
|
||||||
|
if (afi)
|
||||||
|
*afi = AFI_IP;
|
||||||
|
}
|
||||||
|
else if (argv_find (argv, argc, "vpnv6", index))
|
||||||
|
{
|
||||||
|
ret = 1;
|
||||||
|
if (afi)
|
||||||
|
*afi = AFI_IP6;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
u_int16_t
|
u_int16_t
|
||||||
decode_rd_type (u_char *pnt)
|
decode_rd_type (u_char *pnt)
|
||||||
{
|
{
|
||||||
@ -548,7 +572,7 @@ DEFUN (no_vpnv6_network,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u_char use_json)
|
show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u_char use_json, afi_t afi)
|
||||||
{
|
{
|
||||||
struct bgp *bgp;
|
struct bgp *bgp;
|
||||||
struct bgp_table *table;
|
struct bgp_table *table;
|
||||||
@ -591,7 +615,7 @@ show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u
|
|||||||
json_object_string_add(json_ocode, "incomplete", "?");
|
json_object_string_add(json_ocode, "incomplete", "?");
|
||||||
}
|
}
|
||||||
|
|
||||||
for (rn = bgp_table_top (bgp->rib[AFI_IP][SAFI_MPLS_VPN]); rn;
|
for (rn = bgp_table_top (bgp->rib[afi][SAFI_MPLS_VPN]); rn;
|
||||||
rn = bgp_route_next (rn))
|
rn = bgp_route_next (rn))
|
||||||
{
|
{
|
||||||
if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
|
if (prd && memcmp (rn->p.u.val, prd->val, 8) != 0)
|
||||||
@ -948,35 +972,9 @@ bgp_show_mpls_vpn (struct vty *vty, afi_t afi, struct prefix_rd *prd,
|
|||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_bgp_ivp4_vpn,
|
DEFUN (show_bgp_ip_vpn_rd,
|
||||||
show_bgp_ipv4_vpn_cmd,
|
show_bgp_ip_vpn_rd_cmd,
|
||||||
"show [ip] bgp ipv4 vpn [json]",
|
"show [ip] bgp "BGP_AFI_CMD_STR" vpn [rd ASN:nn_or_IP-address:nn] [json]",
|
||||||
SHOW_STR
|
|
||||||
IP_STR
|
|
||||||
BGP_STR
|
|
||||||
"Address Family\n"
|
|
||||||
"Display VPN NLRI specific information\n"
|
|
||||||
JSON_STR)
|
|
||||||
{
|
|
||||||
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (show_bgp_ipv6_vpn,
|
|
||||||
show_bgp_ipv6_vpn_cmd,
|
|
||||||
"show [ip] bgp ipv6 vpn [json]",
|
|
||||||
SHOW_STR
|
|
||||||
IP_STR
|
|
||||||
BGP_STR
|
|
||||||
"Address Family\n"
|
|
||||||
"Display VPN NLRI specific information\n"
|
|
||||||
JSON_STR)
|
|
||||||
{
|
|
||||||
return bgp_show_mpls_vpn (vty, AFI_IP6, NULL, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (show_bgp_ipv4_vpn_rd,
|
|
||||||
show_bgp_ipv4_vpn_rd_cmd,
|
|
||||||
"show [ip] bgp ipv4 vpn rd ASN:nn_or_IP-address:nn [json]",
|
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
@ -989,97 +987,103 @@ DEFUN (show_bgp_ipv4_vpn_rd,
|
|||||||
int idx_ext_community = 5;
|
int idx_ext_community = 5;
|
||||||
int ret;
|
int ret;
|
||||||
struct prefix_rd prd;
|
struct prefix_rd prd;
|
||||||
|
afi_t afi;
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
|
if (argv_find_and_parse_afi (argv, argc, &idx, &afi))
|
||||||
if (! ret)
|
|
||||||
{
|
{
|
||||||
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
if (argv[idx_ext_community]->arg)
|
||||||
return CMD_WARNING;
|
{
|
||||||
|
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
|
||||||
|
if (! ret)
|
||||||
|
{
|
||||||
|
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_bgp_ipv6_vpn_rd,
|
DEFUN (show_ip_bgp_vpn_all,
|
||||||
show_bgp_ipv6_vpn_rd_cmd,
|
show_ip_bgp_vpn_all_cmd,
|
||||||
"show [ip] bgp ipv6 vpn rd ASN:nn_or_IP-address:nn [json]",
|
"show [ip] bgp <vpnv4|vpnv6>",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address Family\n"
|
"Address Family\n"
|
||||||
"Display VPN NLRI specific information\n"
|
BGP_VPNVX_HELP_STR)
|
||||||
"Display information for a route distinguisher\n"
|
|
||||||
"VPN Route Distinguisher\n"
|
|
||||||
JSON_STR)
|
|
||||||
{
|
{
|
||||||
int idx_ext_community = 5;
|
afi_t afi;
|
||||||
int ret;
|
int idx = 0;
|
||||||
struct prefix_rd prd;
|
|
||||||
|
|
||||||
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
|
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
|
||||||
if (!ret)
|
return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_normal, NULL, 0, 0);
|
||||||
{
|
return CMD_SUCCESS;
|
||||||
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bgp_show_mpls_vpn (vty, AFI_IP6, &prd, bgp_show_type_normal, NULL, 0, use_json (argc, argv));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_vpnv4_all,
|
DEFUN (show_ip_bgp_vpn_rd,
|
||||||
show_ip_bgp_vpnv4_all_cmd,
|
show_ip_bgp_vpn_rd_cmd,
|
||||||
"show [ip] bgp vpnv4 all",
|
"show [ip] bgp <vpnv4|vpnv6> rd ASN:nn_or_IP-address:nn",
|
||||||
SHOW_STR
|
|
||||||
IP_STR
|
|
||||||
BGP_STR
|
|
||||||
"Address Family\n"
|
|
||||||
"Display information about all VPNv4 NLRIs\n")
|
|
||||||
{
|
|
||||||
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 0, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_vpnv4_rd,
|
|
||||||
show_ip_bgp_vpnv4_rd_cmd,
|
|
||||||
"show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn",
|
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address Family\n"
|
"Address Family\n"
|
||||||
|
BGP_VPNVX_HELP_STR
|
||||||
"Display information for a route distinguisher\n"
|
"Display information for a route distinguisher\n"
|
||||||
"VPN Route Distinguisher\n")
|
"VPN Route Distinguisher\n")
|
||||||
{
|
{
|
||||||
int idx_ext_community = 5;
|
int idx_ext_community = 5;
|
||||||
int ret;
|
int ret;
|
||||||
struct prefix_rd prd;
|
struct prefix_rd prd;
|
||||||
|
afi_t afi;
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
|
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
|
||||||
if (! ret)
|
|
||||||
{
|
{
|
||||||
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
|
||||||
return CMD_WARNING;
|
if (! ret)
|
||||||
|
{
|
||||||
|
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_normal, NULL, 0, 0);
|
||||||
}
|
}
|
||||||
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 0, 0);
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_vpnv4_all_tags,
|
DEFUN (show_ip_bgp_vpn_all_tags,
|
||||||
show_ip_bgp_vpnv4_all_tags_cmd,
|
show_ip_bgp_vpn_all_tags_cmd,
|
||||||
"show [ip] bgp vpnv4 all tags",
|
"show [ip] bgp <vpnv4|vpnv6> all tags",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address Family\n"
|
"Address Family\n"
|
||||||
"Display information about all VPNv4 NLRIs\n"
|
BGP_VPNVX_HELP_STR
|
||||||
|
"Display information about all VPNv4/VPNV6 NLRIs\n"
|
||||||
"Display BGP tags for prefixes\n")
|
"Display BGP tags for prefixes\n")
|
||||||
{
|
{
|
||||||
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_normal, NULL, 1, 0);
|
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, 1, 0);
|
||||||
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_vpnv4_rd_tags,
|
DEFUN (show_ip_bgp_vpn_rd_tags,
|
||||||
show_ip_bgp_vpnv4_rd_tags_cmd,
|
show_ip_bgp_vpn_rd_tags_cmd,
|
||||||
"show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn tags",
|
"show [ip] bgp <vpnv4|vpnv6> rd ASN:nn_or_IP-address:nn tags",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address Family\n"
|
"Address Family\n"
|
||||||
|
BGP_VPNVX_HELP_STR
|
||||||
"Display information for a route distinguisher\n"
|
"Display information for a route distinguisher\n"
|
||||||
"VPN Route Distinguisher\n"
|
"VPN Route Distinguisher\n"
|
||||||
"Display BGP tags for prefixes\n")
|
"Display BGP tags for prefixes\n")
|
||||||
@ -1087,24 +1091,31 @@ DEFUN (show_ip_bgp_vpnv4_rd_tags,
|
|||||||
int idx_ext_community = 5;
|
int idx_ext_community = 5;
|
||||||
int ret;
|
int ret;
|
||||||
struct prefix_rd prd;
|
struct prefix_rd prd;
|
||||||
|
afi_t afi;
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
|
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
|
||||||
if (! ret)
|
|
||||||
{
|
{
|
||||||
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
|
||||||
return CMD_WARNING;
|
if (! ret)
|
||||||
|
{
|
||||||
|
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
|
}
|
||||||
|
return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_normal, NULL, 1, 0);
|
||||||
}
|
}
|
||||||
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_normal, NULL, 1, 0);
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
|
DEFUN (show_ip_bgp_vpn_all_neighbor_routes,
|
||||||
show_ip_bgp_vpnv4_all_neighbor_routes_cmd,
|
show_ip_bgp_vpn_all_neighbor_routes_cmd,
|
||||||
"show [ip] bgp vpnv4 all neighbors A.B.C.D routes [json]",
|
"show [ip] bgp <vpnv4|vpnv6> all neighbors A.B.C.D routes [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address Family\n"
|
"Address Family\n"
|
||||||
"Display information about all VPNv4 NLRIs\n"
|
BGP_VPNVX_HELP_STR
|
||||||
|
"Display information about all VPNv4/VPNv6 NLRIs\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
"Display routes learned from neighbor\n"
|
"Display routes learned from neighbor\n"
|
||||||
@ -1115,49 +1126,56 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_routes,
|
|||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
int ret;
|
int ret;
|
||||||
u_char uj = use_json(argc, argv);
|
u_char uj = use_json(argc, argv);
|
||||||
|
afi_t afi;
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
|
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
|
||||||
if (ret < 0)
|
|
||||||
{
|
{
|
||||||
if (uj)
|
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
|
||||||
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
json_object *json_no = NULL;
|
if (uj)
|
||||||
json_no = json_object_new_object();
|
{
|
||||||
json_object_string_add(json_no, "warning", "Malformed address");
|
json_object *json_no = NULL;
|
||||||
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
json_no = json_object_new_object();
|
||||||
json_object_free(json_no);
|
json_object_string_add(json_no, "warning", "Malformed address");
|
||||||
|
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
||||||
|
json_object_free(json_no);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
peer = peer_lookup (NULL, &su);
|
peer = peer_lookup (NULL, &su);
|
||||||
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
|
if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
|
||||||
{
|
|
||||||
if (uj)
|
|
||||||
{
|
{
|
||||||
json_object *json_no = NULL;
|
if (uj)
|
||||||
json_no = json_object_new_object();
|
{
|
||||||
json_object_string_add(json_no, "warning", "No such neighbor or address family");
|
json_object *json_no = NULL;
|
||||||
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
json_no = json_object_new_object();
|
||||||
json_object_free(json_no);
|
json_object_string_add(json_no, "warning", "No such neighbor or address family");
|
||||||
|
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
||||||
|
json_object_free(json_no);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bgp_show_mpls_vpn (vty, AFI_IP, NULL, bgp_show_type_neighbor, &su, 0, uj);
|
return bgp_show_mpls_vpn (vty, afi, NULL, bgp_show_type_neighbor, &su, 0, uj);
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
|
DEFUN (show_ip_bgp_vpn_rd_neighbor_routes,
|
||||||
show_ip_bgp_vpnv4_rd_neighbor_routes_cmd,
|
show_ip_bgp_vpn_rd_neighbor_routes_cmd,
|
||||||
"show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes [json]",
|
"show [ip] bgp <vpnv4|vpnv6> rd ASN:nn_or_IP-address:nn neighbors A.B.C.D routes [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address Family\n"
|
"Address Family\n"
|
||||||
|
BGP_VPNVX_HELP_STR
|
||||||
"Display information for a route distinguisher\n"
|
"Display information for a route distinguisher\n"
|
||||||
"VPN Route Distinguisher\n"
|
"VPN Route Distinguisher\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
@ -1172,66 +1190,73 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_routes,
|
|||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
struct prefix_rd prd;
|
struct prefix_rd prd;
|
||||||
u_char uj = use_json(argc, argv);
|
u_char uj = use_json(argc, argv);
|
||||||
|
afi_t afi;
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
|
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
|
||||||
if (! ret)
|
|
||||||
{
|
{
|
||||||
if (uj)
|
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
|
||||||
|
if (! ret)
|
||||||
{
|
{
|
||||||
json_object *json_no = NULL;
|
if (uj)
|
||||||
json_no = json_object_new_object();
|
{
|
||||||
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
|
json_object *json_no = NULL;
|
||||||
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
json_no = json_object_new_object();
|
||||||
json_object_free(json_no);
|
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
|
||||||
|
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
||||||
|
json_object_free(json_no);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
|
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
|
||||||
if (uj)
|
|
||||||
{
|
{
|
||||||
json_object *json_no = NULL;
|
if (uj)
|
||||||
json_no = json_object_new_object();
|
{
|
||||||
json_object_string_add(json_no, "warning", "Malformed address");
|
json_object *json_no = NULL;
|
||||||
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
json_no = json_object_new_object();
|
||||||
json_object_free(json_no);
|
json_object_string_add(json_no, "warning", "Malformed address");
|
||||||
|
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
||||||
|
json_object_free(json_no);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
peer = peer_lookup (NULL, &su);
|
peer = peer_lookup (NULL, &su);
|
||||||
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
|
if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
|
||||||
{
|
|
||||||
if (uj)
|
|
||||||
{
|
{
|
||||||
json_object *json_no = NULL;
|
if (uj)
|
||||||
json_no = json_object_new_object();
|
{
|
||||||
json_object_string_add(json_no, "warning", "No such neighbor or address family");
|
json_object *json_no = NULL;
|
||||||
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
json_no = json_object_new_object();
|
||||||
json_object_free(json_no);
|
json_object_string_add(json_no, "warning", "No such neighbor or address family");
|
||||||
|
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
||||||
|
json_object_free(json_no);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
return bgp_show_mpls_vpn (vty, AFI_IP, &prd, bgp_show_type_neighbor, &su, 0, uj);
|
return bgp_show_mpls_vpn (vty, afi, &prd, bgp_show_type_neighbor, &su, 0, uj);
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
|
DEFUN (show_ip_bgp_vpn_all_neighbor_advertised_routes,
|
||||||
show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd,
|
show_ip_bgp_vpn_all_neighbor_advertised_routes_cmd,
|
||||||
"show [ip] bgp vpnv4 all neighbors A.B.C.D advertised-routes [json]",
|
"show [ip] bgp <vpnv4|vpnv6> all neighbors A.B.C.D advertised-routes [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address Family\n"
|
"Address Family\n"
|
||||||
"Display information about all VPNv4 NLRIs\n"
|
BGP_VPNVX_HELP_STR
|
||||||
|
"Display information about all VPNv4/VPNv6 NLRIs\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
"Neighbor to display information about\n"
|
"Neighbor to display information about\n"
|
||||||
"Display the routes advertised to a BGP neighbor\n"
|
"Display the routes advertised to a BGP neighbor\n"
|
||||||
@ -1242,48 +1267,55 @@ DEFUN (show_ip_bgp_vpnv4_all_neighbor_advertised_routes,
|
|||||||
struct peer *peer;
|
struct peer *peer;
|
||||||
union sockunion su;
|
union sockunion su;
|
||||||
u_char uj = use_json(argc, argv);
|
u_char uj = use_json(argc, argv);
|
||||||
|
afi_t afi;
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
|
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
|
||||||
if (ret < 0)
|
|
||||||
{
|
{
|
||||||
if (uj)
|
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
|
||||||
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
json_object *json_no = NULL;
|
if (uj)
|
||||||
json_no = json_object_new_object();
|
{
|
||||||
json_object_string_add(json_no, "warning", "Malformed address");
|
json_object *json_no = NULL;
|
||||||
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
json_no = json_object_new_object();
|
||||||
json_object_free(json_no);
|
json_object_string_add(json_no, "warning", "Malformed address");
|
||||||
|
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
||||||
|
json_object_free(json_no);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
else
|
peer = peer_lookup (NULL, &su);
|
||||||
vty_out (vty, "Malformed address: %s%s", argv[idx_ipv4]->arg, VTY_NEWLINE);
|
if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
peer = peer_lookup (NULL, &su);
|
|
||||||
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
|
|
||||||
{
|
|
||||||
if (uj)
|
|
||||||
{
|
{
|
||||||
json_object *json_no = NULL;
|
if (uj)
|
||||||
json_no = json_object_new_object();
|
{
|
||||||
json_object_string_add(json_no, "warning", "No such neighbor or address family");
|
json_object *json_no = NULL;
|
||||||
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
json_no = json_object_new_object();
|
||||||
json_object_free(json_no);
|
json_object_string_add(json_no, "warning", "No such neighbor or address family");
|
||||||
|
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
||||||
|
json_object_free(json_no);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
return show_adj_route_vpn (vty, peer, NULL, uj);
|
return show_adj_route_vpn (vty, peer, NULL, uj, afi);
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
|
DEFUN (show_ip_bgp_vpn_rd_neighbor_advertised_routes,
|
||||||
show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd,
|
show_ip_bgp_vpn_rd_neighbor_advertised_routes_cmd,
|
||||||
"show [ip] bgp vpnv4 rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes [json]",
|
"show [ip] bgp <vpnv4|vpnv6> rd ASN:nn_or_IP-address:nn neighbors A.B.C.D advertised-routes [json]",
|
||||||
SHOW_STR
|
SHOW_STR
|
||||||
IP_STR
|
IP_STR
|
||||||
BGP_STR
|
BGP_STR
|
||||||
"Address Family\n"
|
"Address Family\n"
|
||||||
|
BGP_VPNVX_HELP_STR
|
||||||
"Display information for a route distinguisher\n"
|
"Display information for a route distinguisher\n"
|
||||||
"VPN Route Distinguisher\n"
|
"VPN Route Distinguisher\n"
|
||||||
"Detailed information on TCP and BGP neighbor connections\n"
|
"Detailed information on TCP and BGP neighbor connections\n"
|
||||||
@ -1298,55 +1330,61 @@ DEFUN (show_ip_bgp_vpnv4_rd_neighbor_advertised_routes,
|
|||||||
struct prefix_rd prd;
|
struct prefix_rd prd;
|
||||||
union sockunion su;
|
union sockunion su;
|
||||||
u_char uj = use_json(argc, argv);
|
u_char uj = use_json(argc, argv);
|
||||||
|
afi_t afi;
|
||||||
|
int idx = 0;
|
||||||
|
|
||||||
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
|
if (argv_find_and_parse_vpnvx (argv, argc, &idx, &afi))
|
||||||
if (ret < 0)
|
|
||||||
{
|
{
|
||||||
if (uj)
|
ret = str2sockunion (argv[idx_ipv4]->arg, &su);
|
||||||
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
json_object *json_no = NULL;
|
if (uj)
|
||||||
json_no = json_object_new_object();
|
{
|
||||||
json_object_string_add(json_no, "warning", "Malformed address");
|
json_object *json_no = NULL;
|
||||||
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
json_no = json_object_new_object();
|
||||||
json_object_free(json_no);
|
json_object_string_add(json_no, "warning", "Malformed address");
|
||||||
|
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
||||||
|
json_object_free(json_no);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
else
|
peer = peer_lookup (NULL, &su);
|
||||||
vty_out (vty, "Malformed address: %s%s", argv[idx_ext_community]->arg, VTY_NEWLINE);
|
if (! peer || ! peer->afc[afi][SAFI_MPLS_VPN])
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
peer = peer_lookup (NULL, &su);
|
|
||||||
if (! peer || ! peer->afc[AFI_IP][SAFI_MPLS_VPN])
|
|
||||||
{
|
|
||||||
if (uj)
|
|
||||||
{
|
{
|
||||||
json_object *json_no = NULL;
|
if (uj)
|
||||||
json_no = json_object_new_object();
|
{
|
||||||
json_object_string_add(json_no, "warning", "No such neighbor or address family");
|
json_object *json_no = NULL;
|
||||||
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
json_no = json_object_new_object();
|
||||||
json_object_free(json_no);
|
json_object_string_add(json_no, "warning", "No such neighbor or address family");
|
||||||
|
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
||||||
|
json_object_free(json_no);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
vty_out (vty, "%% No such neighbor or address family%s", VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
|
ret = str2prefix_rd (argv[idx_ext_community]->arg, &prd);
|
||||||
if (! ret)
|
if (! ret)
|
||||||
{
|
|
||||||
if (uj)
|
|
||||||
{
|
{
|
||||||
json_object *json_no = NULL;
|
if (uj)
|
||||||
json_no = json_object_new_object();
|
{
|
||||||
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
|
json_object *json_no = NULL;
|
||||||
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
json_no = json_object_new_object();
|
||||||
json_object_free(json_no);
|
json_object_string_add(json_no, "warning", "Malformed Route Distinguisher");
|
||||||
|
vty_out (vty, "%s%s", json_object_to_json_string(json_no), VTY_NEWLINE);
|
||||||
|
json_object_free(json_no);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
||||||
|
return CMD_WARNING;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
vty_out (vty, "%% Malformed Route Distinguisher%s", VTY_NEWLINE);
|
|
||||||
return CMD_WARNING;
|
|
||||||
}
|
|
||||||
|
|
||||||
return show_adj_route_vpn (vty, peer, &prd, uj);
|
return show_adj_route_vpn (vty, peer, &prd, uj, afi);
|
||||||
|
}
|
||||||
|
return CMD_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1356,21 +1394,17 @@ bgp_mplsvpn_init (void)
|
|||||||
install_element (BGP_VPNV4_NODE, &vpnv4_network_route_map_cmd);
|
install_element (BGP_VPNV4_NODE, &vpnv4_network_route_map_cmd);
|
||||||
install_element (BGP_VPNV4_NODE, &no_vpnv4_network_cmd);
|
install_element (BGP_VPNV4_NODE, &no_vpnv4_network_cmd);
|
||||||
|
|
||||||
install_element (VIEW_NODE, &show_bgp_ipv4_vpn_cmd);
|
|
||||||
install_element (VIEW_NODE, &show_bgp_ipv4_vpn_rd_cmd);
|
|
||||||
|
|
||||||
install_element (BGP_VPNV6_NODE, &vpnv6_network_cmd);
|
install_element (BGP_VPNV6_NODE, &vpnv6_network_cmd);
|
||||||
install_element (BGP_VPNV6_NODE, &vpnv6_network_route_map_cmd);
|
install_element (BGP_VPNV6_NODE, &vpnv6_network_route_map_cmd);
|
||||||
install_element (BGP_VPNV6_NODE, &no_vpnv6_network_cmd);
|
install_element (BGP_VPNV6_NODE, &no_vpnv6_network_cmd);
|
||||||
|
|
||||||
install_element (VIEW_NODE, &show_bgp_ipv6_vpn_cmd);
|
install_element (VIEW_NODE, &show_bgp_ip_vpn_rd_cmd);
|
||||||
install_element (VIEW_NODE, &show_bgp_ipv6_vpn_rd_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_vpn_all_cmd);
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_cmd);
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_vpn_all_tags_cmd);
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_tags_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_tags_cmd);
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_tags_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_vpn_all_neighbor_routes_cmd);
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbor_routes_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_neighbor_routes_cmd);
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbor_routes_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_vpn_all_neighbor_advertised_routes_cmd);
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_neighbor_advertised_routes_cmd);
|
install_element (VIEW_NODE, &show_ip_bgp_vpn_rd_neighbor_advertised_routes_cmd);
|
||||||
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_rd_neighbor_advertised_routes_cmd);
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user