Merge pull request #18396 from pguibert6WIND/srv6l3vpn_to_bgp_vrf_redistribute

Add BGP redistribution in SRv6 BGP
This commit is contained in:
Russ White 2025-04-03 08:25:32 -04:00 committed by GitHub
commit ab67e5544e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
108 changed files with 1948 additions and 590 deletions

View file

@ -3182,8 +3182,7 @@ static int install_evpn_route_entry_in_vrf(struct bgp *bgp_vrf,
/* Gateway IP nexthop should be resolved */
if (bre && bre->type == OVERLAY_INDEX_GATEWAY_IP) {
if (bgp_find_or_add_nexthop(bgp_vrf, bgp_vrf, afi, safi, pi,
NULL, 0, NULL))
if (bgp_find_or_add_nexthop(bgp_vrf, bgp_vrf, afi, safi, pi, NULL, 0, NULL, NULL))
bgp_path_info_set_flag(dest, pi, BGP_PATH_VALID);
else {
if (BGP_DEBUG(nht, NHT)) {

View file

@ -94,10 +94,8 @@ int bgp_peer_reg_with_nht(struct peer *peer)
connected = 1;
return bgp_find_or_add_nexthop(peer->bgp, peer->bgp,
family2afi(
peer->connection->su.sa.sa_family),
SAFI_UNICAST, NULL, peer, connected,
NULL);
family2afi(peer->connection->su.sa.sa_family), SAFI_UNICAST,
NULL, peer, connected, NULL, NULL);
}
static void peer_xfer_stats(struct peer *peer_dst, struct peer *peer_src)

View file

@ -1088,10 +1088,8 @@ static bool leak_update_nexthop_valid(struct bgp *to_bgp, struct bgp_dest *bn,
/* the route is defined with the "network <prefix>" command */
if (CHECK_FLAG(bgp_nexthop->flags, BGP_FLAG_IMPORT_CHECK))
nh_valid = bgp_find_or_add_nexthop(to_bgp, bgp_nexthop,
afi, SAFI_UNICAST,
bpi_ultimate, NULL,
0, p);
nh_valid = bgp_find_or_add_nexthop(to_bgp, bgp_nexthop, afi, SAFI_UNICAST,
bpi_ultimate, NULL, 0, p, bpi_ultimate);
else
/* if "no bgp network import-check" is set,
* then mark the nexthop as valid.
@ -1105,18 +1103,22 @@ static bool leak_update_nexthop_valid(struct bgp *to_bgp, struct bgp_dest *bn,
* TBD do we need to do anything about the
* 'connected' parameter?
*/
nh_valid = bgp_find_or_add_nexthop(to_bgp, bgp_nexthop, afi,
safi, bpi, NULL, 0, p);
/* VPN paths: the new bpi may be altered like
* with 'nexthop vpn export' command. Use the bpi_ultimate
* to find the original nexthop
*/
nh_valid = bgp_find_or_add_nexthop(to_bgp, bgp_nexthop, afi, safi, bpi, NULL, 0, p,
bpi_ultimate);
/*
* If you are using SRv6 VPN instead of MPLS, it need to check
* the SID allocation. If the sid is not allocated, the rib
* will be invalid.
* If the SID per VRF is not available, also consider the rib as
* invalid.
*/
if (to_bgp->srv6_enabled &&
(!new_attr->srv6_l3vpn && !new_attr->srv6_vpn)) {
nh_valid = false;
}
if (to_bgp->srv6_enabled && nh_valid)
nh_valid = is_pi_srv6_valid(bpi, bgp_nexthop, afi, safi);
if (debug)
zlog_debug("%s: %pFX nexthop is %svalid (in %s)", __func__, p,
@ -1594,8 +1596,8 @@ vpn_leak_from_vrf_get_per_nexthop_label(afi_t afi, struct bgp_path_info *pi,
bgp_nexthop = from_bgp;
nh_afi = BGP_ATTR_NH_AFI(afi, pi->attr);
nh_valid = bgp_find_or_add_nexthop(from_bgp, bgp_nexthop, nh_afi,
SAFI_UNICAST, pi, NULL, 0, NULL);
nh_valid = bgp_find_or_add_nexthop(from_bgp, bgp_nexthop, nh_afi, SAFI_UNICAST, pi, NULL, 0,
NULL, NULL);
if (!nh_valid && is_bgp_static_route &&
!CHECK_FLAG(from_bgp->flags, BGP_FLAG_IMPORT_CHECK)) {
@ -2337,8 +2339,8 @@ static void vpn_leak_to_vrf_update_onevrf(struct bgp *to_bgp, /* to */
break;
}
if (bpi && leak_update_nexthop_valid(to_bgp, bn, &static_attr, afi, safi,
path_vpn, bpi, src_vrf, p, debug))
if (bpi && leak_update_nexthop_valid(to_bgp, bn, &static_attr, afi, safi, path_vpn, bpi,
src_vrf, p, debug))
SET_FLAG(static_attr.nh_flags, BGP_ATTR_NH_VALID);
else
UNSET_FLAG(static_attr.nh_flags, BGP_ATTR_NH_VALID);

View file

@ -342,6 +342,37 @@ static inline bool is_pi_family_vpn(struct bgp_path_info *pi)
is_pi_family_matching(pi, AFI_IP6, SAFI_MPLS_VPN));
}
/*
* If you are using SRv6 VPN instead of MPLS, it need to check
* the SID allocation. If the sid is not allocated, the rib
* will be invalid.
* If the SID per VRF is not available, also consider the rib as
* invalid.
*/
static inline bool is_pi_srv6_valid(struct bgp_path_info *pi, struct bgp *bgp_nexthop, afi_t afi,
safi_t safi)
{
if (!pi->attr->srv6_l3vpn && !pi->attr->srv6_vpn)
return false;
/* imported paths from VPN: srv6 enabled and nht reachability
* are enough to know if that path is valid
*/
if (safi == SAFI_UNICAST)
return true;
if (bgp_nexthop->vpn_policy[afi].tovpn_sid == NULL && bgp_nexthop->tovpn_sid == NULL)
return false;
if (bgp_nexthop->tovpn_sid_index == 0 &&
!CHECK_FLAG(bgp_nexthop->vrf_flags, BGP_VRF_TOVPN_SID_AUTO) &&
bgp_nexthop->vpn_policy[afi].tovpn_sid_index == 0 &&
!CHECK_FLAG(bgp_nexthop->vpn_policy[afi].flags, BGP_VPN_POLICY_TOVPN_SID_AUTO))
return false;
return true;
}
extern void vpn_policy_routemap_event(const char *rmap_name);
extern vrf_id_t get_first_vrf_for_redirect_with_rt(struct ecommunity *eckey);

View file

@ -38,7 +38,8 @@ extern struct zclient *zclient;
static void register_zebra_rnh(struct bgp_nexthop_cache *bnc);
static void unregister_zebra_rnh(struct bgp_nexthop_cache *bnc);
static bool make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p);
static bool make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p,
struct bgp *bgp_nexthop, struct bgp_path_info *pi_source);
static void bgp_nht_ifp_initial(struct event *thread);
DEFINE_HOOK(bgp_nht_path_update, (struct bgp *bgp, struct bgp_path_info *pi, bool valid),
@ -297,10 +298,9 @@ void bgp_unlink_nexthop_by_peer(struct peer *peer)
* A route and its nexthop might belong to different VRFs. Therefore,
* we need both the bgp_route and bgp_nexthop pointers.
*/
int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
afi_t afi, safi_t safi, struct bgp_path_info *pi,
struct peer *peer, int connected,
const struct prefix *orig_prefix)
int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop, afi_t afi, safi_t safi,
struct bgp_path_info *pi, struct peer *peer, int connected,
const struct prefix *orig_prefix, struct bgp_path_info *source_pi)
{
struct bgp_nexthop_cache_head *tree = NULL;
struct bgp_nexthop_cache *bnc;
@ -330,7 +330,7 @@ int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop,
/* This will return true if the global IPv6 NH is a link local
* addr */
if (!make_prefix(afi, pi, &p))
if (!make_prefix(afi, pi, &p, bgp_nexthop, source_pi))
return 1;
/*
@ -994,7 +994,8 @@ void bgp_cleanup_nexthops(struct bgp *bgp)
* make_prefix - make a prefix structure from the path (essentially
* path's node.
*/
static bool make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p)
static bool make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p,
struct bgp *bgp_nexthop, struct bgp_path_info *source_pi)
{
int is_bgp_static = ((pi->type == ZEBRA_ROUTE_BGP)
@ -1004,8 +1005,19 @@ static bool make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p)
struct bgp_dest *net = pi->net;
const struct prefix *p_orig = bgp_dest_get_prefix(net);
struct in_addr ipv4;
struct peer *peer = pi->peer;
struct attr *attr = pi->attr;
struct peer *peer;
struct attr *attr;
bool local_sid = false;
struct bgp *bgp = bgp_get_default();
struct prefix_ipv6 tmp_prefix;
if (source_pi) {
attr = source_pi->attr;
peer = source_pi->peer;
} else {
peer = pi->peer;
attr = pi->attr;
}
if (p_orig->family == AF_FLOWSPEC) {
if (!peer)
@ -1035,37 +1047,50 @@ static bool make_prefix(int afi, struct bgp_path_info *pi, struct prefix *p)
break;
case AFI_IP6:
p->family = AF_INET6;
if (attr->srv6_l3vpn) {
if (bgp && bgp->srv6_locator && bgp->srv6_enabled && pi->attr->srv6_l3vpn) {
tmp_prefix.family = AF_INET6;
tmp_prefix.prefixlen = IPV6_MAX_BITLEN;
tmp_prefix.prefix = pi->attr->srv6_l3vpn->sid;
if (bgp_nexthop->vpn_policy[afi].tovpn_sid_locator &&
bgp_nexthop->vpn_policy[afi].tovpn_sid)
local_sid = prefix_match(&bgp_nexthop->vpn_policy[afi]
.tovpn_sid_locator->prefix,
&tmp_prefix);
else if (bgp_nexthop->tovpn_sid_locator && bgp_nexthop->tovpn_sid)
local_sid = prefix_match(&bgp_nexthop->tovpn_sid_locator->prefix,
&tmp_prefix);
}
if (local_sid == false && pi->attr->srv6_l3vpn) {
p->prefixlen = IPV6_MAX_BITLEN;
if (attr->srv6_l3vpn->transposition_len != 0 &&
if (pi->attr->srv6_l3vpn->transposition_len != 0 &&
BGP_PATH_INFO_NUM_LABELS(pi)) {
IPV6_ADDR_COPY(&p->u.prefix6, &attr->srv6_l3vpn->sid);
IPV6_ADDR_COPY(&p->u.prefix6, &pi->attr->srv6_l3vpn->sid);
transpose_sid(&p->u.prefix6,
decode_label(&pi->extra->labels->label[0]),
attr->srv6_l3vpn->transposition_offset,
attr->srv6_l3vpn->transposition_len);
pi->attr->srv6_l3vpn->transposition_offset,
pi->attr->srv6_l3vpn->transposition_len);
} else
IPV6_ADDR_COPY(&(p->u.prefix6), &(attr->srv6_l3vpn->sid));
IPV6_ADDR_COPY(&(p->u.prefix6), &(pi->attr->srv6_l3vpn->sid));
} else if (is_bgp_static) {
p->u.prefix6 = p_orig->u.prefix6;
p->prefixlen = p_orig->prefixlen;
} else {
} else if (attr) {
/* If we receive MP_REACH nexthop with ::(LL)
* or LL(LL), use LL address as nexthop cache.
*/
if (attr && attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL &&
if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL &&
(IN6_IS_ADDR_UNSPECIFIED(&attr->mp_nexthop_global) ||
IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_global)))
p->u.prefix6 = attr->mp_nexthop_local;
/* If we receive MR_REACH with (GA)::(LL)
* then check for route-map to choose GA or LL
*/
else if (attr && attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
else if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL_AND_LL) {
if (CHECK_FLAG(attr->nh_flags, BGP_ATTR_NH_MP_PREFER_GLOBAL))
p->u.prefix6 = attr->mp_nexthop_global;
else
p->u.prefix6 = attr->mp_nexthop_local;
} else if (attr && attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL &&
} else if (attr->mp_nexthop_len == BGP_ATTR_NHLEN_IPV6_GLOBAL &&
IN6_IS_ADDR_LINKLOCAL(&attr->mp_nexthop_global)) {
/* If we receive MP_REACH with GUA as LL, we should
* check if we have Link-Local Next Hop capability also.

View file

@ -25,11 +25,10 @@ extern void bgp_nexthop_update(struct vrf *vrf, struct prefix *match,
* peer - The BGP peer associated with this NHT
* connected - True if NH MUST be a connected route
*/
extern int bgp_find_or_add_nexthop(struct bgp *bgp_route,
struct bgp *bgp_nexthop, afi_t a,
safi_t safi, struct bgp_path_info *p,
struct peer *peer, int connected,
const struct prefix *orig_prefix);
extern int bgp_find_or_add_nexthop(struct bgp *bgp_route, struct bgp *bgp_nexthop, afi_t a,
safi_t safi, struct bgp_path_info *p, struct peer *peer,
int connected, const struct prefix *orig_prefix,
struct bgp_path_info *source_pi);
/**
* bgp_unlink_nexthop() - Unlink the nexthop object from the path structure.

View file

@ -4937,6 +4937,7 @@ bgp_update_nexthop_reachability_check(struct bgp *bgp, struct peer *peer, struct
{
bool connected;
afi_t nh_afi;
struct bgp_path_info *bpi_ultimate = NULL;
if (((afi == AFI_IP || afi == AFI_IP6) &&
(safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST ||
@ -4952,13 +4953,16 @@ bgp_update_nexthop_reachability_check(struct bgp *bgp, struct peer *peer, struct
struct bgp *bgp_nexthop = bgp;
if (pi->extra && pi->extra->vrfleak && pi->extra->vrfleak->bgp_orig)
if (pi->extra && pi->extra->vrfleak && pi->extra->vrfleak->bgp_orig) {
bgp_nexthop = pi->extra->vrfleak->bgp_orig;
if (pi->sub_type == BGP_ROUTE_IMPORTED)
bpi_ultimate = bgp_get_imported_bpi_ultimate(pi);
}
nh_afi = BGP_ATTR_NH_AFI(afi, pi->attr);
if (bgp_find_or_add_nexthop(bgp, bgp_nexthop, nh_afi, safi, pi, NULL, connected,
bgp_nht_param_prefix) ||
bgp_nht_param_prefix, bpi_ultimate) ||
CHECK_FLAG(peer->flags, PEER_FLAG_IS_RFAPI_HD)) {
if (accept_own)
bgp_path_info_set_flag(dest, pi, BGP_PATH_ACCEPT_OWN);
@ -7332,8 +7336,8 @@ static void bgp_nexthop_reachability_check(afi_t afi, safi_t safi,
/* Nexthop reachability check. */
if (safi == SAFI_UNICAST || safi == SAFI_LABELED_UNICAST) {
if (CHECK_FLAG(bgp->flags, BGP_FLAG_IMPORT_CHECK)) {
if (bgp_find_or_add_nexthop(bgp, bgp_nexthop, afi, safi,
bpi, NULL, 0, p))
if (bgp_find_or_add_nexthop(bgp, bgp_nexthop, afi, safi, bpi, NULL, 0, p,
NULL))
bgp_path_info_set_flag(dest, bpi,
BGP_PATH_VALID);
else {

View file

@ -1,8 +0,0 @@
frr defaults traditional
!
hostname ce1
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -0,0 +1,18 @@
frr defaults traditional
!
interface eth0
ipv6 address 2001:1::2/64
!
ip forwarding
ipv6 forwarding
!
router bgp 65500
bgp router-id 1.1.2.1
no bgp network import-check
neighbor 2001:1::1 remote-as 65500
address-family ipv6 unicast
network 2011:1::1/64
neighbor 2001:1::1 activate
exit-address-family
exit

View file

@ -2,24 +2,23 @@
"::/0": [
{
"prefix": "::/0",
"protocol": "static",
"protocol": "bgp",
"vrfId": 0,
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 1,
"distance": 200,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 73,
"internalFlags": 13,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"ip": "2001:1::1",
"afi": "ipv6",
"interfaceName": "eth0",
"active": true,

View file

@ -1,14 +0,0 @@
log file zebra.log
!
hostname ce1
!
interface eth0
ipv6 address 2001:1::2/64
!
ip forwarding
ipv6 forwarding
!
ipv6 route ::/0 2001:1::1
!
line vty
!

View file

@ -1,8 +0,0 @@
frr defaults traditional
!
hostname ce2
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -0,0 +1,17 @@
frr defaults traditional
!
interface eth0
ipv6 address 2001:2::2/64
!
ip forwarding
ipv6 forwarding
!
router bgp 65501
bgp router-id 1.1.20.1
neighbor 2001:2::1 remote-as 65501
address-family ipv6 unicast
neighbor 2001:2::1 activate
exit-address-family
exit

View file

@ -2,24 +2,23 @@
"::/0": [
{
"prefix": "::/0",
"protocol": "static",
"protocol": "bgp",
"vrfId": 0,
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 1,
"distance": 200,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 73,
"internalFlags": 13,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"ip": "2001:2::1",
"afi": "ipv6",
"interfaceName": "eth0",
"active": true,
@ -54,5 +53,32 @@
}
]
}
],
"2011:1::/64": [
{
"prefix": "2011:1::/64",
"protocol": "bgp",
"vrfId": 0,
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 200,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 13,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"afi": "ipv6",
"interfaceName": "eth0",
"active": true
}
]
}
]
}

View file

@ -1,14 +0,0 @@
log file zebra.log
!
hostname ce2
!
interface eth0
ipv6 address 2001:2::2/64
!
ip forwarding
ipv6 forwarding
!
ipv6 route ::/0 2001:2::1
!
line vty
!

View file

@ -1,8 +0,0 @@
frr defaults traditional
!
hostname ce3
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -0,0 +1,16 @@
frr defaults traditional
!
interface eth0
ipv6 address 2001:3::2/64
!
ip forwarding
ipv6 forwarding
!
router bgp 65500
bgp router-id 1.1.3.1
neighbor 2001:3::1 remote-as 65500
address-family ipv6 unicast
neighbor 2001:3::1 activate
exit-address-family
exit

View file

@ -2,24 +2,23 @@
"::/0": [
{
"prefix": "::/0",
"protocol": "static",
"protocol": "bgp",
"vrfId": 0,
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 1,
"distance": 200,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 73,
"internalFlags": 13,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"ip": "2001:3::1",
"afi": "ipv6",
"interfaceName": "eth0",
"active": true,

View file

@ -1,14 +0,0 @@
log file zebra.log
!
hostname ce3
!
interface eth0
ipv6 address 2001:3::2/64
!
ip forwarding
ipv6 forwarding
!
ipv6 route ::/0 2001:3::1
!
line vty
!

View file

@ -1,8 +0,0 @@
frr defaults traditional
!
hostname ce4
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -0,0 +1,16 @@
frr defaults traditional
!
interface eth0
ipv6 address 2001:4::2/64
!
ip forwarding
ipv6 forwarding
!
router bgp 65501
bgp router-id 1.1.4.1
neighbor 2001:4::1 remote-as 65501
address-family ipv6 unicast
neighbor 2001:4::1 activate
exit-address-family
exit

View file

@ -2,24 +2,23 @@
"::/0": [
{
"prefix": "::/0",
"protocol": "static",
"protocol": "bgp",
"vrfId": 0,
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 1,
"distance": 200,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 73,
"internalFlags": 13,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"ip": "2001:4::1",
"afi": "ipv6",
"interfaceName": "eth0",
"active": true,

View file

@ -1,14 +0,0 @@
log file zebra.log
!
hostname ce4
!
interface eth0
ipv6 address 2001:4::2/64
!
ip forwarding
ipv6 forwarding
!
ipv6 route ::/0 2001:4::1
!
line vty
!

View file

@ -1,8 +0,0 @@
frr defaults traditional
!
hostname ce5
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -0,0 +1,16 @@
frr defaults traditional
!
interface eth0
ipv6 address 2001:5::2/64
!
ip forwarding
ipv6 forwarding
!
router bgp 65500
bgp router-id 1.1.5.1
neighbor 2001:5::1 remote-as 65500
address-family ipv6 unicast
neighbor 2001:5::1 activate
exit-address-family
exit

View file

@ -2,24 +2,23 @@
"::/0": [
{
"prefix": "::/0",
"protocol": "static",
"protocol": "bgp",
"vrfId": 0,
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 1,
"distance": 200,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 73,
"internalFlags": 13,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"ip": "2001:5::1",
"afi": "ipv6",
"interfaceName": "eth0",
"active": true,

View file

@ -1,14 +0,0 @@
log file zebra.log
!
hostname ce5
!
interface eth0
ipv6 address 2001:5::2/64
!
ip forwarding
ipv6 forwarding
!
ipv6 route ::/0 2001:5::1
!
line vty
!

View file

@ -1,8 +0,0 @@
frr defaults traditional
!
hostname ce6
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -0,0 +1,16 @@
frr defaults traditional
!
interface eth0
ipv6 address 2001:6::2/64
!
ip forwarding
ipv6 forwarding
!
router bgp 65501
bgp router-id 1.1.6.1
neighbor 2001:6::1 remote-as 65501
address-family ipv6 unicast
neighbor 2001:6::1 activate
exit-address-family
exit

View file

@ -2,24 +2,23 @@
"::/0": [
{
"prefix": "::/0",
"protocol": "static",
"protocol": "bgp",
"vrfId": 0,
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 1,
"distance": 200,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 73,
"internalFlags": 13,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"ip": "2001:6::1",
"afi": "ipv6",
"interfaceName": "eth0",
"active": true,

View file

@ -1,14 +0,0 @@
log file zebra.log
!
hostname ce6
!
interface eth0
ipv6 address 2001:6::2/64
!
ip forwarding
ipv6 forwarding
!
ipv6 route ::/0 2001:6::1
!
line vty
!

View file

@ -0,0 +1,97 @@
! debug zebra packet
! debug zebra dplane
! debug zebra kernel
! debug bgp neighbor-events
! debug bgp zebra
! debug bgp vnc verbose
! debug bgp update-groups
! debug bgp updates in
! debug bgp updates out
! debug bgp vpn label
! debug bgp vpn leak-from-vrf
! debug bgp vpn leak-to-vrf
! debug bgp vpn rmap-event
!
interface eth0
ipv6 address 2001::1/64
!
interface eth1 vrf vrf10
ipv6 address 2001:1::1/64
!
interface eth2 vrf vrf10
ipv6 address 2001:3::1/64
!
interface eth3 vrf vrf20
ipv6 address 2001:5::1/64
!
segment-routing
srv6
locators
locator loc1
prefix 2001:db8:1:1::/64 func-bits 8
!
!
!
ip forwarding
ipv6 forwarding
!
ipv6 route 2001:db8:2:1::/64 2001::2
ipv6 route 2001:db8:2:2::/64 2001::2
ipv6 route 2001:db8:2:3::/64 2001::2
!
line vty
!
no bgp send-extra-data-zebra
router bgp 65500
bgp router-id 1.1.1.1
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
neighbor 2001::2 remote-as 65501
neighbor 2001::2 timers 3 10
neighbor 2001::2 timers connect 1
!
address-family ipv6 vpn
neighbor 2001::2 activate
exit-address-family
!
segment-routing srv6
locator loc1
!
!
router bgp 65500 vrf vrf10
bgp router-id 1.1.1.1
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
!
neighbor 2001:1::2 remote-as 65500
neighbor 2001:3::2 remote-as 65500
address-family ipv6 unicast
neighbor 2001:1::2 activate
neighbor 2001:1::2 default-originate
neighbor 2001:3::2 activate
neighbor 2001:3::2 default-originate
sid vpn export auto
rd vpn export 1:10
rt vpn both 99:99
import vpn
export vpn
redistribute connected
exit-address-family
!
router bgp 65500 vrf vrf20
bgp router-id 1.1.1.1
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
neighbor 2001:5::2 remote-as 65500
!
address-family ipv6 unicast
neighbor 2001:5::2 activate
neighbor 2001:5::2 default-originate
sid vpn export auto
rd vpn export 1:20
rt vpn both 88:88
import vpn
export vpn
redistribute connected
exit-address-family
!

View file

@ -3,7 +3,7 @@
"vrfName": "default",
"routerId": "1.1.1.1",
"defaultLocPrf": 100,
"localAS": 1,
"localAS": 65500,
"routes": {
"routeDistinguishers": {
"1:10": {
@ -58,6 +58,32 @@
}
]
}
],
"2011:1::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2011:1::",
"prefixLen": 64,
"network": "2011:1::/64",
"metric": 0,
"weight": 0,
"peerId": "(unspec)",
"path": "",
"origin": "IGP",
"announceNexthopSelf": true,
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "2001:1::2",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"1:20": {
@ -101,7 +127,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"path": "65501",
"origin": "incomplete",
"nexthops": [
{
@ -127,7 +153,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"path": "65501",
"origin": "incomplete",
"nexthops": [
{
@ -151,7 +177,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"path": "65501",
"origin": "incomplete",
"nexthops": [
{
@ -165,5 +191,7 @@
]
}
}
}
},
"totalRoutes": 7,
"totalPaths": 7
}

View file

@ -3,7 +3,7 @@
"vrfName": "default",
"routerId": "1.1.1.1",
"defaultLocPrf": 100,
"localAS": 1,
"localAS": 65500,
"routes": {
"routeDistinguishers": {
"1:10": {
@ -52,6 +52,29 @@
}
]
}
],
"2011:1::/64": [
{
"pathFrom": "external",
"prefix": "2011:1::",
"prefixLen": 64,
"network": "2011:1::/64",
"metric": 0,
"weight": 0,
"peerId": "(unspec)",
"path": "",
"origin": "IGP",
"announceNexthopSelf": true,
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "2001:1::2",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"1:20": {
@ -92,7 +115,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"path": "65501",
"origin": "incomplete",
"nexthops": [
{
@ -118,7 +141,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"path": "65501",
"origin": "incomplete",
"nexthops": [
{
@ -142,7 +165,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"path": "65501",
"origin": "incomplete",
"nexthops": [
{
@ -156,5 +179,7 @@
]
}
}
}
},
"totalRoutes": 7,
"totalPaths": 7
}

View file

@ -3,7 +3,7 @@
"vrfName": "default",
"routerId": "1.1.1.1",
"defaultLocPrf": 100,
"localAS": 1,
"localAS": 65500,
"routes": {
"routeDistinguishers": {
"1:10": {
@ -58,6 +58,32 @@
}
]
}
],
"2011:1::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2011:1::",
"prefixLen": 64,
"network": "2011:1::/64",
"metric": 0,
"weight": 0,
"peerId": "(unspec)",
"path": "",
"origin": "IGP",
"announceNexthopSelf": true,
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "2001:1::2",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"1:20": {
@ -101,7 +127,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"path": "65501",
"origin": "incomplete",
"nexthops": [
{
@ -127,7 +153,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"path": "65501",
"origin": "incomplete",
"nexthops": [
{
@ -151,7 +177,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"path": "65501",
"origin": "incomplete",
"nexthops": [
{
@ -165,5 +191,7 @@
]
}
}
}
},
"totalRoutes": 7,
"totalPaths": 7
}

View file

@ -53,8 +53,7 @@
"segs": "2001:db8:2:2:100::"
}
}
],
"asPath": "2"
]
}
],
"2001:3::/64": [

View file

@ -27,8 +27,7 @@
"segs": "2001:db8:2:2:200::"
}
}
],
"asPath": "2"
]
}
],
"2001:5::/64": [
@ -85,8 +84,7 @@
"segs": "2001:db8:2:2:200::"
}
}
],
"asPath": "2"
]
}
]
}

View file

@ -1,41 +0,0 @@
log file zebra.log
!
hostname r1
password zebra
!
log stdout notifications
log commands
!
! debug zebra packet
! debug zebra dplane
! debug zebra kernel
!
interface eth0
ipv6 address 2001::1/64
!
interface eth1 vrf vrf10
ipv6 address 2001:1::1/64
!
interface eth2 vrf vrf10
ipv6 address 2001:3::1/64
!
interface eth3 vrf vrf20
ipv6 address 2001:5::1/64
!
segment-routing
srv6
locators
locator loc1
prefix 2001:db8:1:1::/64 func-bits 8
!
!
!
ip forwarding
ipv6 forwarding
!
ipv6 route 2001:db8:2:1::/64 2001::2
ipv6 route 2001:db8:2:2::/64 2001::2
ipv6 route 2001:db8:2:3::/64 2001::2
!
line vty
!

View file

@ -0,0 +1,98 @@
! debug zebra packet
! debug zebra dplane
! debug zebra kernel
! debug bgp neighbor-events
! debug bgp zebra
! debug bgp vnc verbose
! debug bgp update-groups
! debug bgp updates in
! debug bgp updates out
! debug bgp updates
! debug bgp vpn label
! debug bgp vpn leak-from-vrf
! debug bgp vpn leak-to-vrf
! debug bgp vpn rmap-event
!
interface eth0
ipv6 address 2001::2/64
!
interface eth1 vrf vrf10
ipv6 address 2001:2::1/64
!
interface eth2 vrf vrf20
ipv6 address 2001:4::1/64
!
interface eth3 vrf vrf20
ipv6 address 2001:6::1/64
!
segment-routing
srv6
locators
locator loc1
prefix 2001:db8:2:2::/64 func-bits 8
!
!
!
ip forwarding
ipv6 forwarding
!
ipv6 route 2001:db8:1:1::/64 2001::1
ipv6 route 2001:db8:1:2::/64 2001::1
ipv6 route 2001:db8:1:3::/64 2001::1
!
line vty
!
no bgp send-extra-data-zebra
router bgp 65501
bgp router-id 2.2.2.2
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
neighbor 2001::1 remote-as 65500
neighbor 2001::1 timers 3 10
neighbor 2001::1 timers connect 1
!
address-family ipv6 vpn
neighbor 2001::1 activate
exit-address-family
!
segment-routing srv6
locator loc1
!
!
router bgp 65501 vrf vrf10
bgp router-id 2.2.2.2
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
!
neighbor 2001:2::2 remote-as 65501
address-family ipv6 unicast
neighbor 2001:2::2 activate
neighbor 2001:2::2 default-originate
sid vpn export auto
rd vpn export 2:10
rt vpn both 99:99
import vpn
export vpn
redistribute connected
exit-address-family
!
router bgp 65501 vrf vrf20
bgp router-id 2.2.2.2
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
neighbor 2001:4::2 remote-as 65501
neighbor 2001:6::2 remote-as 65501
!
address-family ipv6 unicast
neighbor 2001:4::2 activate
neighbor 2001:4::2 default-originate
neighbor 2001:6::2 activate
neighbor 2001:6::2 default-originate
sid vpn export auto
rd vpn export 2:20
rt vpn both 88:88
import vpn
export vpn
redistribute connected
exit-address-family
!

View file

@ -3,7 +3,7 @@
"vrfName": "default",
"routerId": "2.2.2.2",
"defaultLocPrf": 100,
"localAS": 2,
"localAS": 65501,
"routes": {
"routeDistinguishers": {
"1:10": {
@ -19,7 +19,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::1",
"path": "1",
"path": "65500",
"origin": "incomplete",
"nexthops": [
{
@ -43,7 +43,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::1",
"path": "1",
"path": "65500",
"origin": "incomplete",
"nexthops": [
{
@ -54,6 +54,30 @@
}
]
}
],
"2011:1::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2011:1::",
"prefixLen": 64,
"network": "2011:1::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::1",
"path": "65500",
"origin": "IGP",
"nexthops": [
{
"ip": "2001::1",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"1:20": {
@ -69,7 +93,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::1",
"path": "1",
"path": "65500",
"origin": "incomplete",
"nexthops": [
{
@ -165,5 +189,7 @@
]
}
}
}
},
"totalRoutes": 7,
"totalPaths": 7
}

View file

@ -3,7 +3,7 @@
"vrfName": "default",
"routerId": "2.2.2.2",
"defaultLocPrf": 100,
"localAS": 2,
"localAS": 65501,
"routes": {
"routeDistinguishers": {
"2:10": {
@ -89,5 +89,7 @@
]
}
}
}
},
"totalRoutes": 3,
"totalPaths": 3
}

View file

@ -3,7 +3,7 @@
"vrfName": "default",
"routerId": "2.2.2.2",
"defaultLocPrf": 100,
"localAS": 2,
"localAS": 65501,
"routes": {
"routeDistinguishers": {
"1:10": {
@ -19,7 +19,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::1",
"path": "1",
"path": "65500",
"origin": "incomplete",
"nexthops": [
{
@ -43,7 +43,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::1",
"path": "1",
"path": "65500",
"origin": "incomplete",
"nexthops": [
{
@ -54,6 +54,30 @@
}
]
}
],
"2011:1::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2011:1::",
"prefixLen": 64,
"network": "2011:1::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::1",
"path": "65500",
"origin": "IGP",
"nexthops": [
{
"ip": "2001::1",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"1:20": {
@ -69,7 +93,7 @@
"metric": 0,
"weight": 0,
"peerId": "2001::1",
"path": "1",
"path": "65500",
"origin": "incomplete",
"nexthops": [
{
@ -165,5 +189,7 @@
]
}
}
}
},
"totalRoutes": 7,
"totalPaths": 7
}

View file

@ -27,8 +27,7 @@
"segs": "2001:db8:1:1:100::"
}
}
],
"asPath": "1"
]
}
],
"2001:2::/64": [
@ -85,8 +84,38 @@
"segs": "2001:db8:1:1:100::"
}
}
],
"asPath": "1"
]
}
],
"2011:1::/64": [
{
"prefix": "2011:1::/64",
"protocol": "bgp",
"vrfName": "vrf10",
"selected": true,
"destSelected": true,
"distance": 20,
"metric": 0,
"installed": true,
"table": 10,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"afi": "ipv6",
"interfaceName": "eth0",
"vrf": "default",
"active": true,
"weight": 1,
"seg6": {
"segs": "2001:db8:1:1:100::"
}
}
]
}
]
}

View file

@ -53,8 +53,7 @@
"segs": "2001:db8:1:1:200::"
}
}
],
"asPath": "1"
]
}
],
"2001:6::/64": [

View file

@ -1,41 +0,0 @@
log file zebra.log
!
hostname r2
password zebra
!
log stdout notifications
log commands
!
! debug zebra packet
! debug zebra dplane
! debug zebra kernel
!
interface eth0
ipv6 address 2001::2/64
!
interface eth1 vrf vrf10
ipv6 address 2001:2::1/64
!
interface eth2 vrf vrf20
ipv6 address 2001:4::1/64
!
interface eth3 vrf vrf20
ipv6 address 2001:6::1/64
!
segment-routing
srv6
locators
locator loc1
prefix 2001:db8:2:2::/64 func-bits 8
!
!
!
ip forwarding
ipv6 forwarding
!
ipv6 route 2001:db8:1:1::/64 2001::1
ipv6 route 2001:db8:1:2::/64 2001::1
ipv6 route 2001:db8:1:3::/64 2001::1
!
line vty
!

View file

@ -92,14 +92,8 @@ def setup_module(mod):
tgen.start_topology()
router_list = tgen.routers()
for rname, router in tgen.routers().items():
if os.path.exists("{}/{}/setup.sh".format(CWD, rname)):
router.run("/bin/bash {}/{}/setup.sh".format(CWD, rname))
router.load_config(
TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname))
)
router.load_config(
TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname))
)
logger.info("Loading router %s" % rname)
router.load_frr_config(os.path.join(CWD, "{}/frr.conf".format(rname)))
tgen.gears["r1"].run("ip link add vrf10 type vrf table 10")
tgen.gears["r1"].run("ip link set vrf10 up")
@ -218,7 +212,7 @@ def test_bgp_locator_unset():
get_topogen().gears["r1"].vtysh_cmd(
"""
configure terminal
router bgp 1
router bgp 65500
segment-routing srv6
no locator loc1
"""
@ -233,7 +227,7 @@ def test_bgp_locator_reset():
get_topogen().gears["r1"].vtysh_cmd(
"""
configure terminal
router bgp 1
router bgp 65500
segment-routing srv6
locator loc1
"""
@ -248,7 +242,7 @@ def test_bgp_srv6_unset():
get_topogen().gears["r1"].vtysh_cmd(
"""
configure terminal
router bgp 1
router bgp 65500
no segment-routing srv6
"""
)
@ -262,7 +256,7 @@ def test_bgp_srv6_reset():
get_topogen().gears["r1"].vtysh_cmd(
"""
configure terminal
router bgp 1
router bgp 65500
segment-routing srv6
locator loc1
"""

View file

@ -1,8 +1,3 @@
frr defaults traditional
!
hostname ce1
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,7 +1,3 @@
log file zebra.log
!
hostname ce1
!
interface eth0
ip address 192.168.1.2/24
!

View file

@ -1,8 +1,2 @@
frr defaults traditional
!
hostname ce2
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,7 +1,3 @@
log file zebra.log
!
hostname ce2
!
interface eth0
ip address 192.168.2.2/24
!

View file

@ -1,8 +1 @@
frr defaults traditional
!
hostname ce3
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,7 +1,3 @@
log file zebra.log
!
hostname ce3
!
interface eth0
ip address 192.168.3.2/24
!

View file

@ -1,8 +1 @@
frr defaults traditional
!
hostname ce4
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,7 +1,3 @@
log file zebra.log
!
hostname ce4
!
interface eth0
ip address 192.168.4.2/24
!

View file

@ -1,8 +1 @@
frr defaults traditional
!
hostname ce5
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,7 +1,3 @@
log file zebra.log
!
hostname ce5
!
interface eth0
ip address 192.168.5.2/24
!

View file

@ -1,8 +1 @@
frr defaults traditional
!
hostname ce6
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,7 +1,3 @@
log file zebra.log
!
hostname ce6
!
interface eth0
ip address 192.168.6.2/24
!

View file

@ -1,13 +1,5 @@
frr defaults traditional
!
bgp send-extra-data zebra
!
hostname r1
password zebra
!
log stdout notifications
log commands
!
!debug bgp neighbor-events
!debug bgp zebra
!debug bgp vnc verbose

View file

@ -1,11 +1,3 @@
log file zebra.log
!
hostname r1
password zebra
!
log stdout notifications
log commands
!
!debug zebra packet
!debug zebra dplane
!debug zebra kernel

View file

@ -1,13 +1,5 @@
frr defaults traditional
!
bgp send-extra-data zebra
!
hostname r2
password zebra
!
log stdout notifications
log commands
!
!debug bgp neighbor-events
!debug bgp zebra
!debug bgp vnc verbose

View file

@ -1,11 +1,3 @@
log file zebra.log
!
hostname r2
password zebra
!
log stdout notifications
log commands
!
!debug zebra packet
!debug zebra dplane
!debug zebra kernel

View file

@ -1,8 +1 @@
frr defaults traditional
!
hostname ce1
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,7 +1,3 @@
log file zebra.log
!
hostname ce1
!
interface eth0
ip address 192.168.1.2/24
ipv6 address 2001:1::2/64

View file

@ -1,8 +1 @@
frr defaults traditional
!
hostname ce2
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,7 +1,3 @@
log file zebra.log
!
hostname ce2
!
interface eth0
ip address 192.168.2.2/24
ipv6 address 2001:2::2/64

View file

@ -1,8 +1 @@
frr defaults traditional
!
hostname ce3
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,7 +1,3 @@
log file zebra.log
!
hostname ce3
!
interface eth0
ip address 192.168.3.2/24
ipv6 address 2001:3::2/64

View file

@ -1,8 +1 @@
frr defaults traditional
!
hostname ce4
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,7 +1,3 @@
log file zebra.log
!
hostname ce4
!
interface eth0
ip address 192.168.4.2/24
ipv6 address 2001:4::2/64

View file

@ -1,8 +1 @@
frr defaults traditional
!
hostname ce5
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,8 +1 @@
frr defaults traditional
!
hostname ce6
password zebra
!
log stdout notifications
log commands
log file bgpd.log

View file

@ -1,7 +1,3 @@
log file zebra.log
!
hostname ce6
!
interface eth0
ip address 192.168.6.2/24
ipv6 address 2001:6::2/64

View file

@ -1,13 +1,5 @@
frr defaults traditional
!
bgp send-extra-data zebra
!
hostname r1
password zebra
!
log stdout notifications
log commands
!
!debug bgp neighbor-events
!debug bgp zebra
!debug bgp vnc verbose

View file

@ -9,9 +9,7 @@
"1:10": {
"192.168.1.0/24": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"multipath": true,
"pathFrom": "external",
"prefix": "192.168.1.0",
"prefixLen": 24,
@ -34,9 +32,7 @@
],
"192.168.3.0/24": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"multipath": true,
"pathFrom": "external",
"prefix": "192.168.3.0",
"prefixLen": 24,
@ -61,9 +57,7 @@
"1:20": {
"192.168.5.0/24": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"multipath": true,
"pathFrom": "external",
"prefix": "192.168.5.0",
"prefixLen": 24,
@ -84,6 +78,82 @@
]
}
]
},
"2:10": {
"192.168.2.0/24": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "192.168.2.0",
"prefixLen": 24,
"network": "192.168.2.0/24",
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::2",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
},
"2:20": {
"192.168.4.0/24": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "192.168.4.0",
"prefixLen": 24,
"network": "192.168.4.0/24",
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::2",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
],
"192.168.6.0/24": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "192.168.6.0",
"prefixLen": 24,
"network": "192.168.6.0/24",
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2",
"origin": "incomplete",
"nexthops": [
{
"ip": "2001::2",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
}
}
}

View file

@ -6,6 +6,54 @@
"localAS": 1,
"routes": {
"routeDistinguishers": {
"1:10": {
"192.168.1.0/24": [
{
"multipath": true,
"pathFrom": "external",
"prefix": "192.168.1.0",
"prefixLen": 24,
"network": "192.168.1.0/24",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "2001::1",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
],
"192.168.3.0/24": [
{
"multipath": true,
"pathFrom": "external",
"prefix": "192.168.3.0",
"prefixLen": 24,
"network": "192.168.3.0/24",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "2001::1",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"1:20": {
"192.168.5.0/24": [
{

View file

@ -9,6 +9,7 @@
"1:10": {
"2001:1::/64": [
{
"multipath": true,
"pathFrom": "external",
"prefix": "2001:1::",
"prefixLen": 64,
@ -32,6 +33,7 @@
],
"2001:3::/64": [
{
"multipath": true,
"pathFrom": "external",
"prefix": "2001:3::",
"prefixLen": 64,
@ -57,6 +59,7 @@
"1:20": {
"2001:5::/64": [
{
"multipath": true,
"pathFrom": "external",
"prefix": "2001:5::",
"prefixLen": 64,
@ -131,7 +134,7 @@
}
],
"2001:6::/64": [
{
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",

View file

@ -6,6 +6,56 @@
"localAS": 1,
"routes": {
"routeDistinguishers": {
"1:10": {
"2001:1::/64": [
{
"multipath": true,
"pathFrom": "external",
"prefix": "2001:1::",
"prefixLen": 64,
"network": "2001:1::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "::",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
],
"2001:3::/64": [
{
"multipath": true,
"pathFrom": "external",
"prefix": "2001:3::",
"prefixLen": 64,
"network": "2001:3::/64",
"metric": 0,
"weight": 32768,
"peerId": "(unspec)",
"path": "",
"origin": "incomplete",
"announceNexthopSelf": true,
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "::",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"1:20": {
"2001:5::/64": [
{

View file

@ -1,11 +1,3 @@
log file zebra.log
!
hostname r1
password zebra
!
log stdout notifications
log commands
!
!debug zebra packet
!debug zebra dplane
!debug zebra kernel

View file

@ -1,13 +1,5 @@
frr defaults traditional
!
bgp send-extra-data zebra
!
hostname r2
password zebra
!
log stdout notifications
log commands
!
!debug bgp neighbor-events
!debug bgp zebra
!debug bgp vnc verbose

View file

@ -1,11 +1,3 @@
log file zebra.log
!
hostname r2
password zebra
!
log stdout notifications
log commands
!
!debug zebra packet
!debug zebra dplane
!debug zebra kernel

View file

@ -18,6 +18,7 @@ sys.path.append(os.path.join(CWD, "../"))
# pylint: disable=C0413
# Import topogen and topotest helpers
from lib import topotest
from lib.bgp import bgp_vpn_router_json_cmp_exact_filter
from lib.topogen import Topogen, TopoRouter, get_topogen
from lib.topolog import logger
from lib.common_config import required_linux_kernel_version
@ -95,24 +96,29 @@ def open_json_file(filename):
assert False, "Could not read file {}".format(filename)
def check_rib(name, cmd, expected_file, count=30, wait=0.5):
def _check(name, dest_addr, match):
def check_rib(name, cmd, expected_file, count=10, wait=0.5):
def _check(router, cmd, expected):
logger.info("polling")
tgen = get_topogen()
router = tgen.gears[name]
output = json.loads(router.vtysh_cmd(cmd))
expected = open_json_file("{}/{}".format(CWD, expected_file))
return topotest.json_cmp(output, expected)
logger.info('[+] check {} "{}" {}'.format(name, cmd, expected_file))
tgen = get_topogen()
func = functools.partial(_check, name, cmd, expected_file)
router = tgen.gears[name]
expected = open_json_file("{}/{}".format(CWD, expected_file))
if "show bgp" in cmd and "vpn" in cmd:
func = functools.partial(
bgp_vpn_router_json_cmp_exact_filter, tgen.gears[name], cmd, expected
)
else:
func = functools.partial(_check, router, cmd, expected)
_, result = topotest.run_and_expect(func, None, count, wait)
assert result is None, "Failed"
def test_rib():
check_rib("r1", "show bgp ipv4 vpn json", "r1/vpnv4_rib.json", 120, 1)
check_rib("r1", "show bgp ipv4 vpn json", "r1/vpnv4_rib.json", 10, 1)
check_rib("r2", "show bgp ipv4 vpn json", "r2/vpnv4_rib.json")
check_rib("r1", "show ip route vrf vrf10 json", "r1/vrf10v4_rib.json")
check_rib("r1", "show ip route vrf vrf20 json", "r1/vrf20v4_rib.json")

View file

@ -0,0 +1,35 @@
frr defaults traditional
bgp send-extra-data zebra
!debug bgp neighbor-events
!debug bgp zebra
!debug bgp vnc verbose
!debug bgp update-groups
!debug bgp updates in
!debug bgp updates out
!debug bgp vpn label
!debug bgp vpn leak-from-vrf
!debug bgp vpn leak-to-vrf
!debug bgp vpn rmap-event
!
router bgp 65001
bgp router-id 1.0.0.1
no bgp ebgp-requires-policy
!no bgp default ipv4-unicast
neighbor fd01::1 remote-as 1
neighbor fd01::1 timers 3 10
neighbor fd01::1 timers connect 1
neighbor fd01::1 interface eth0
neighbor fd01::1 update-source fd01::2
neighbor fd01::1 capability extended-nexthop
!
address-family ipv4 unicast
network 192.168.1.0 mask 255.255.255.0
neighbor fd01::1 activate
exit-address-family
!
address-family ipv6 unicast
network 2001:1::/64
neighbor fd01::1 activate
exit-address-family
!
!

View file

@ -0,0 +1,59 @@
{
"192.168.1.0/24": [
{
"prefix": "192.168.1.0/24",
"prefixLen": 24,
"protocol": "connected",
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 0,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"directlyConnected": true,
"interfaceName": "dum0",
"active": true,
"weight": 1
}
]
}
],
"192.168.2.0/24": [
{
"prefix": "192.168.2.0/24",
"prefixLen": 24,
"protocol": "bgp",
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 20,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"afi": "ipv6",
"interfaceName": "eth0",
"active": true,
"weight": 1
}
],
"asPath": "1 2 65002"
}
]
}

View file

@ -0,0 +1,59 @@
{
"2001:1::/64": [
{
"prefix": "2001:1::/64",
"prefixLen": 64,
"protocol": "connected",
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 0,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"directlyConnected": true,
"interfaceName": "dum0",
"active": true,
"weight": 1
}
]
}
],
"2001:2::/64": [
{
"prefix": "2001:2::/64",
"prefixLen": 64,
"protocol": "bgp",
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 20,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"afi": "ipv6",
"interfaceName": "eth0",
"active": true,
"weight": 1
}
],
"asPath": "1 2 65002"
}
]
}

View file

@ -0,0 +1 @@
ip link add dum0 type dummy

View file

@ -0,0 +1,12 @@
interface eth0
ipv6 address fd01::2/64
!
interface dum0
ip address 192.168.1.1/24
ipv6 address 2001:1::1/64
!
ip forwarding
ipv6 forwarding
!
line vty
!

View file

@ -0,0 +1,35 @@
frr defaults traditional
bgp send-extra-data zebra
!debug bgp neighbor-events
!debug bgp zebra
!debug bgp vnc verbose
!debug bgp update-groups
!debug bgp updates in
!debug bgp updates out
!debug bgp vpn label
!debug bgp vpn leak-from-vrf
!debug bgp vpn leak-to-vrf
!debug bgp vpn rmap-event
!
router bgp 65002
bgp router-id 2.0.0.2
no bgp ebgp-requires-policy
!no bgp default ipv4-unicast
neighbor fd02::1 remote-as 2
neighbor fd02::1 timers 3 10
neighbor fd02::1 timers connect 1
neighbor fd02::1 interface eth0
neighbor fd02::1 update-source fd02::2
neighbor fd02::1 capability extended-nexthop
!
address-family ipv4 unicast
network 192.168.2.0 mask 255.255.255.0
neighbor fd02::1 activate
exit-address-family
!
address-family ipv6 unicast
network 2001:2::/64
neighbor fd02::1 activate
exit-address-family
!
!

View file

@ -0,0 +1,59 @@
{
"192.168.1.0/24": [
{
"prefix": "192.168.1.0/24",
"prefixLen": 24,
"protocol": "bgp",
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 20,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"afi": "ipv6",
"interfaceName": "eth0",
"active": true,
"weight": 1
}
],
"asPath": "2 1 65001"
}
],
"192.168.2.0/24": [
{
"prefix": "192.168.2.0/24",
"prefixLen": 24,
"protocol": "connected",
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 0,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"directlyConnected": true,
"interfaceName": "dum0",
"active": true,
"weight": 1
}
]
}
]
}

View file

@ -0,0 +1,59 @@
{
"2001:1::/64": [
{
"prefix": "2001:1::/64",
"prefixLen": 64,
"protocol": "bgp",
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 20,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"afi": "ipv6",
"interfaceName": "eth0",
"active": true,
"weight": 1
}
],
"asPath": "2 1 65001"
}
],
"2001:2::/64": [
{
"prefix": "2001:2::/64",
"prefixLen": 64,
"protocol": "connected",
"vrfName": "default",
"selected": true,
"destSelected": true,
"distance": 0,
"metric": 0,
"installed": true,
"table": 254,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"directlyConnected": true,
"interfaceName": "dum0",
"active": true,
"weight": 1
}
]
}
]
}

View file

@ -0,0 +1 @@
ip link add dum0 type dummy

View file

@ -0,0 +1,12 @@
interface eth0
ipv6 address fd02::2/64
!
interface dum0
ip address 192.168.2.1/24
ipv6 address 2001:2::1/64
!
ip forwarding
ipv6 forwarding
!
line vty
!

View file

@ -1,14 +1,7 @@
frr defaults traditional
!
bgp send-extra-data zebra
!
hostname r1
password zebra
!
log stdout notifications
log commands
!
!debug bgp neighbor-events
!debug bgp nht
!debug bgp zebra
!debug bgp vnc verbose
!debug bgp update-groups
@ -21,11 +14,16 @@ log commands
!
router bgp 1
bgp router-id 1.1.1.1
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
no bgp ebgp-requires-policy
neighbor 2001::2 remote-as 2
neighbor 2001::2 timers 3 10
neighbor 2001::2 timers connect 1
neighbor 2001::2 capability extended-nexthop
!
address-family ipv4 vpn
neighbor 2001::2 activate
exit-address-family
!
address-family ipv6 vpn
neighbor 2001::2 activate
@ -38,28 +36,28 @@ router bgp 1
router bgp 1 vrf vrf10
bgp router-id 1.1.1.1
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
sid vpn per-vrf export auto
neighbor fd01::2 remote-as 65001
neighbor fd01::2 capability extended-nexthop
neighbor fd01::2 description ce1
neighbor fd01::2 interface eth1
neighbor fd01::2 update-source fd01::1
!
address-family ipv6 unicast
sid vpn export auto
address-family ipv4 unicast
nexthop vpn export 2001::1
rd vpn export 1:10
rt vpn both 99:99
import vpn
export vpn
redistribute connected
neighbor fd01::2 activate
exit-address-family
!
router bgp 1 vrf vrf20
bgp router-id 1.1.1.1
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
!
address-family ipv6 unicast
sid vpn export auto
rd vpn export 1:20
rt vpn both 88:88
nexthop vpn export 2001::1
rd vpn export 1:10
rt vpn both 99:99
import vpn
export vpn
redistribute connected
neighbor fd01::2 activate
exit-address-family
!

View file

@ -0,0 +1,4 @@
sysctl net.vrf.strict_mode=1
ip link add vrf10 type vrf table 10
ip link set vrf10 up
ip link set eth1 master vrf10

View file

@ -0,0 +1,64 @@
{
"vrfId": 0,
"vrfName": "default",
"routerId": "1.1.1.1",
"defaultLocPrf": 100,
"localAS": 1,
"routes": {
"routeDistinguishers": {
"1:10": {
"192.168.1.0/24": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "192.168.1.0",
"prefixLen": 24,
"network": "192.168.1.0/24",
"metric": 0,
"weight": 0,
"peerId": "(unspec)",
"path": "65001",
"origin": "IGP",
"nhVrfName": "vrf10",
"nexthops": [
{
"ip": "2001::1",
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"2:10": {
"192.168.2.0/24": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "192.168.2.0",
"prefixLen": 24,
"network": "192.168.2.0/24",
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2 65002",
"origin": "IGP",
"nexthops": [
{
"ip": "2001::2",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
}
}
}
}

View file

@ -0,0 +1,63 @@
{
"vrfId": 0,
"vrfName": "default",
"routerId": "1.1.1.1",
"defaultLocPrf": 100,
"localAS": 1,
"routes": {
"routeDistinguishers": {
"1:10": {
"2001:1::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:1::",
"prefixLen": 64,
"network": "2001:1::/64",
"metric": 0,
"weight": 0,
"peerId": "(unspec)",
"path": "65001",
"origin": "IGP",
"nhVrfName": "vrf10",
"nexthops": [
{
"hostname": "r1",
"afi": "ipv6",
"used": true
}
]
}
]
},
"2:10": {
"2001:2::/64": [
{
"valid": true,
"bestpath": true,
"selectionReason": "First path received",
"pathFrom": "external",
"prefix": "2001:2::",
"prefixLen": 64,
"network": "2001:2::/64",
"metric": 0,
"weight": 0,
"peerId": "2001::2",
"path": "2 65002",
"origin": "IGP",
"nexthops": [
{
"ip": "2001::2",
"hostname": "r2",
"afi": "ipv6",
"used": true
}
]
}
]
}
}
}
}

View file

@ -0,0 +1,62 @@
{
"192.168.1.0/24": [
{
"prefix": "192.168.1.0/24",
"prefixLen": 24,
"protocol": "bgp",
"vrfName": "vrf10",
"selected": true,
"destSelected": true,
"distance": 20,
"metric": 0,
"installed": true,
"table": 10,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"afi": "ipv6",
"interfaceName": "eth1",
"active": true
}
],
"asPath": "65001"
}
],
"192.168.2.0/24": [
{
"prefix": "192.168.2.0/24",
"prefixLen": 24,
"protocol": "bgp",
"vrfName": "vrf10",
"selected": true,
"destSelected": true,
"distance": 20,
"metric": 0,
"installed": true,
"table": 10,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"afi": "ipv6",
"interfaceName": "eth0",
"vrf": "default",
"active": true,
"seg6": {
"segs": "2001:db8:2:2:1::"
}
}
],
"asPath": "2 65002"
}
]
}

View file

@ -0,0 +1,63 @@
{
"2001:1::/64": [
{
"prefix": "2001:1::/64",
"prefixLen": 64,
"protocol": "bgp",
"vrfName": "vrf10",
"selected": true,
"destSelected": true,
"distance": 20,
"metric": 0,
"installed": true,
"table": 10,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"afi": "ipv6",
"interfaceName": "eth1",
"active": true,
"weight": 1
}
],
"asPath": "65001"
}
],
"2001:2::/64": [
{
"prefix": "2001:2::/64",
"prefixLen": 64,
"protocol": "bgp",
"vrfName": "vrf10",
"selected": true,
"destSelected": true,
"distance": 20,
"metric": 0,
"installed": true,
"table": 10,
"internalStatus": 16,
"internalFlags": 8,
"internalNextHopNum": 1,
"internalNextHopActiveNum": 1,
"nexthops": [
{
"flags": 3,
"fib": true,
"afi": "ipv6",
"interfaceName": "eth0",
"vrf": "default",
"active": true,
"seg6": {
"segs": "2001:db8:2:2:1::"
}
}
],
"asPath": "2 65002"
}
]
}

View file

@ -0,0 +1,21 @@
interface eth0
ipv6 address 2001::1/64
!
interface eth1 vrf vrf10
ipv6 address fd01::1/64
!
segment-routing
srv6
locators
locator loc1
prefix 2001:db8:1:1::/64
!
!
!
ip forwarding
ipv6 forwarding
!
ipv6 route 2001:db8:2:2::/64 2001::2
!
line vty
!

View file

@ -1,20 +1,12 @@
frr defaults traditional
!
bgp send-extra-data zebra
!
hostname r2
password zebra
!
log stdout notifications
log commands
!
!debug bgp neighbor-events
!debug bgp nht
!debug bgp zebra
!debug bgp vnc verbose
!debug bgp update-groups
!debug bgp updates in
!debug bgp updates out
!debug bgp updates
!debug bgp vpn label
!debug bgp vpn leak-from-vrf
!debug bgp vpn leak-to-vrf
@ -22,11 +14,16 @@ log commands
!
router bgp 2
bgp router-id 2.2.2.2
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
no bgp ebgp-requires-policy
neighbor 2001::1 remote-as 1
neighbor 2001::1 timers 3 10
neighbor 2001::1 timers connect 1
neighbor 2001::1 capability extended-nexthop
!
address-family ipv4 vpn
neighbor 2001::1 activate
exit-address-family
!
address-family ipv6 vpn
neighbor 2001::1 activate
@ -39,28 +36,28 @@ router bgp 2
router bgp 2 vrf vrf10
bgp router-id 2.2.2.2
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
sid vpn per-vrf export auto
neighbor fd02::2 remote-as 65002
neighbor fd02::2 capability extended-nexthop
neighbor fd02::2 description ce2
neighbor fd02::2 interface eth1
neighbor fd02::2 update-source fd02::1
!
address-family ipv6 unicast
sid vpn export auto
address-family ipv4 unicast
nexthop vpn export 2001::2
rd vpn export 2:10
rt vpn both 99:99
import vpn
export vpn
redistribute connected
neighbor fd02::2 activate
exit-address-family
!
router bgp 2 vrf vrf20
bgp router-id 2.2.2.2
no bgp ebgp-requires-policy
no bgp default ipv4-unicast
!
address-family ipv6 unicast
sid vpn export auto
rd vpn export 2:20
rt vpn both 88:88
nexthop vpn export 2001::2
rd vpn export 2:10
rt vpn both 99:99
import vpn
export vpn
redistribute connected
neighbor fd02::2 activate
exit-address-family
!

Some files were not shown because too many files have changed in this diff Show more