return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv4_prefixlen]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg);
}
+DEFUN (vpnv6_network,
+ vpnv6_network_cmd,
+ "network X:X::X:X/M rd ASN:nn_or_IP-address:nn tag WORD",
+ "Specify a network to announce via BGP\n"
+ "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
+ "Specify Route Distinguisher\n"
+ "VPN Route Distinguisher\n"
+ "BGP tag\n"
+ "tag value\n")
+{
+ int idx_ipv6_prefix = 1;
+ int idx_ext_community = 3;
+ int idx_word = 5;
+ return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, NULL);
+}
+
+DEFUN (vpnv6_network_route_map,
+ vpnv6_network_route_map_cmd,
+ "network X:X::X:X/M rd ASN:nn_or_IP-address:nn tag WORD route-map WORD",
+ "Specify a network to announce via BGP\n"
+ "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
+ "Specify Route Distinguisher\n"
+ "VPN Route Distinguisher\n"
+ "BGP tag\n"
+ "tag value\n"
+ "route map\n"
+ "route map name\n")
+{
+ int idx_ipv6_prefix = 1;
+ int idx_ext_community = 3;
+ int idx_word = 5;
+ int idx_word_2 = 7;
+ return bgp_static_set_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg, argv[idx_word_2]->arg);
+}
+
+/* For testing purpose, static route of MPLS-VPN. */
+DEFUN (no_vpnv6_network,
+ no_vpnv6_network_cmd,
+ "no network X:X::X:X/M rd ASN:nn_or_IP-address:nn tag WORD",
+ NO_STR
+ "Specify a network to announce via BGP\n"
+ "IPv6 prefix <network>/<length>, e.g., 3ffe::/16\n"
+ "Specify Route Distinguisher\n"
+ "VPN Route Distinguisher\n"
+ "BGP tag\n"
+ "tag value\n")
+{
+ int idx_ipv6_prefix = 2;
+ int idx_ext_community = 4;
+ int idx_word = 6;
+ return bgp_static_unset_safi (SAFI_MPLS_VPN, vty, argv[idx_ipv6_prefix]->arg, argv[idx_ext_community]->arg, argv[idx_word]->arg);
+}
+
static int
show_adj_route_vpn (struct vty *vty, struct peer *peer, struct prefix_rd *prd, u_char use_json)
{
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_route_map_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_ipv6_vpn_rd_cmd);
install_element (VIEW_NODE, &show_ip_bgp_vpnv4_all_cmd);
struct bgp_table *table;
struct bgp_static *bgp_static;
u_char tag[3];
+ afi_t afi;
ret = str2prefix (ip_str, &p);
if (! ret)
vty_out (vty, "%% Malformed tag%s", VTY_NEWLINE);
return CMD_WARNING;
}
-
- prn = bgp_node_get (bgp->route[AFI_IP][safi],
+ if (p.family == AF_INET)
+ afi = AFI_IP;
+ else if (p.family == AF_INET6)
+ afi = AFI_IP6;
+ else
+ {
+ vty_out (vty, "%% Non Supported prefix%s", VTY_NEWLINE);
+ return CMD_WARNING;
+ }
+ prn = bgp_node_get (bgp->route[afi][safi],
(struct prefix *)&prd);
if (prn->info == NULL)
- prn->info = bgp_table_init (AFI_IP, safi);
+ prn->info = bgp_table_init (afi, safi);
else
bgp_unlock_node (prn);
table = prn->info;
rn->info = bgp_static;
bgp_static->valid = 1;
- bgp_static_update_safi (bgp, &p, bgp_static, AFI_IP, safi);
+ bgp_static_update_safi (bgp, &p, bgp_static, afi, safi);
}
return CMD_SUCCESS;
/* also used for encap safi */
static int
-bgp_config_write_network_vpnv4 (struct vty *vty, struct bgp *bgp,
+bgp_config_write_network_vpn (struct vty *vty, struct bgp *bgp,
afi_t afi, safi_t safi, int *write)
{
struct bgp_node *prn;
struct bgp_aggregate *bgp_aggregate;
char buf[SU_ADDRSTRLEN];
- if (afi == AFI_IP && ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP)))
- return bgp_config_write_network_vpnv4 (vty, bgp, afi, safi, write);
+ if ((safi == SAFI_MPLS_VPN) || (safi == SAFI_ENCAP))
+ return bgp_config_write_network_vpn (vty, bgp, afi, safi, write);
/* Network configuration. */
for (rn = bgp_table_top (bgp->route[afi][safi]); rn; rn = bgp_route_next (rn))