bgpd: make _vpnv4 static handling SAFI-agnostic
This changes the existing _vpnv4 functions for MPLS-VPN into
SAFI-agnostic functions, renaming them from *_vpnv4 to *_safi.
Also adds route-map support while at it.
Signed-off-by: Lou Berger <lberger@labn.net>
Reviewed-by: David Lamparter <equinox@opensourcerouting.org>
diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c
index 0c4533b..3eab76f 100644
--- a/bgpd/bgp_mplsvpn.c
+++ b/bgpd/bgp_mplsvpn.c
@@ -315,7 +315,22 @@
"BGP tag\n"
"tag value\n")
{
- return bgp_static_set_vpnv4 (vty, argv[0], argv[1], argv[2]);
+ return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2], NULL);
+}
+
+DEFUN (vpnv4_network_route_map,
+ vpnv4_network_route_map_cmd,
+ "network A.B.C.D/M rd ASN:nn_or_IP-address:nn tag WORD route-map WORD",
+ "Specify a network to announce via BGP\n"
+ "IP prefix <network>/<length>, e.g., 35.0.0.0/8\n"
+ "Specify Route Distinguisher\n"
+ "VPN Route Distinguisher\n"
+ "BGP tag\n"
+ "tag value\n"
+ "route map\n"
+ "route map name\n")
+{
+ return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2], argv[3]);
}
/* For testing purpose, static route of MPLS-VPN. */
@@ -330,7 +345,7 @@
"BGP tag\n"
"tag value\n")
{
- return bgp_static_unset_vpnv4 (vty, argv[0], argv[1], argv[2]);
+ return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[0], argv[1], argv[2]);
}
static int
@@ -743,6 +758,7 @@
bgp_mplsvpn_init (void)
{
install_element (BGP_VPNV4_NODE, &vpnv4_network_cmd);
+ install_element (BGP_VPNV4_NODE, &vpnv4_network_route_map_cmd);
install_element (BGP_VPNV4_NODE, &no_vpnv4_network_cmd);