diff --git a/bgpd/bgp_evpn.c b/bgpd/bgp_evpn.c index ecb61dad55..90c196ac91 100644 --- a/bgpd/bgp_evpn.c +++ b/bgpd/bgp_evpn.c @@ -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)) { diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index 1a830abd90..f5d62828a1 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -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) diff --git a/bgpd/bgp_mplsvpn.c b/bgpd/bgp_mplsvpn.c index 7a454d8109..0260cc2c3b 100644 --- a/bgpd/bgp_mplsvpn.c +++ b/bgpd/bgp_mplsvpn.c @@ -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 " 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); diff --git a/bgpd/bgp_mplsvpn.h b/bgpd/bgp_mplsvpn.h index 56dd33f9b1..75c0264987 100644 --- a/bgpd/bgp_mplsvpn.h +++ b/bgpd/bgp_mplsvpn.h @@ -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); diff --git a/bgpd/bgp_nht.c b/bgpd/bgp_nht.c index bd27562134..5220c728f1 100644 --- a/bgpd/bgp_nht.c +++ b/bgpd/bgp_nht.c @@ -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. diff --git a/bgpd/bgp_nht.h b/bgpd/bgp_nht.h index 345089ac5a..76536d6ebf 100644 --- a/bgpd/bgp_nht.h +++ b/bgpd/bgp_nht.h @@ -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. diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index 4e458fbe4b..5dd474c4e7 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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 { diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/bgpd.conf deleted file mode 100644 index 3459796629..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/bgpd.conf +++ /dev/null @@ -1,8 +0,0 @@ -frr defaults traditional -! -hostname ce1 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/frr.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/frr.conf new file mode 100644 index 0000000000..ca28d55409 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/frr.conf @@ -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 + diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/ipv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/ipv6_rib.json index d19e315772..b68f1a1112 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/ipv6_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/ipv6_rib.json @@ -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, diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/zebra.conf deleted file mode 100644 index 665808a0e7..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce1/zebra.conf +++ /dev/null @@ -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 -! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/bgpd.conf deleted file mode 100644 index 8ed9978749..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/bgpd.conf +++ /dev/null @@ -1,8 +0,0 @@ -frr defaults traditional -! -hostname ce2 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/frr.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/frr.conf new file mode 100644 index 0000000000..a15c5b48e0 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/frr.conf @@ -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 + + diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/ipv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/ipv6_rib.json index 35ff14efad..51076ee194 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/ipv6_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/ipv6_rib.json @@ -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 + } + ] + } ] } diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/zebra.conf deleted file mode 100644 index cc9b90a3b0..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce2/zebra.conf +++ /dev/null @@ -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 -! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/bgpd.conf deleted file mode 100644 index a85d9701c7..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/bgpd.conf +++ /dev/null @@ -1,8 +0,0 @@ -frr defaults traditional -! -hostname ce3 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/frr.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/frr.conf new file mode 100644 index 0000000000..947a4a2551 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/frr.conf @@ -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 + diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/ipv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/ipv6_rib.json index 2f2931f80f..6a373a80b8 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/ipv6_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/ipv6_rib.json @@ -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, diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/zebra.conf deleted file mode 100644 index beca0b1211..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce3/zebra.conf +++ /dev/null @@ -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 -! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/bgpd.conf deleted file mode 100644 index 93fb32fd1b..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/bgpd.conf +++ /dev/null @@ -1,8 +0,0 @@ -frr defaults traditional -! -hostname ce4 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/frr.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/frr.conf new file mode 100644 index 0000000000..3eaf47961e --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/frr.conf @@ -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 + diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/ipv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/ipv6_rib.json index 8a98768e0d..da6bd55231 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/ipv6_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/ipv6_rib.json @@ -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, diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/zebra.conf deleted file mode 100644 index 7b21074df0..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce4/zebra.conf +++ /dev/null @@ -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 -! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/bgpd.conf deleted file mode 100644 index 2ab6f2d2a7..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/bgpd.conf +++ /dev/null @@ -1,8 +0,0 @@ -frr defaults traditional -! -hostname ce5 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/frr.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/frr.conf new file mode 100644 index 0000000000..5adfc7cfeb --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/frr.conf @@ -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 + diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/ipv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/ipv6_rib.json index 80ff52ad6e..f8ab84d17a 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/ipv6_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/ipv6_rib.json @@ -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, diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/zebra.conf deleted file mode 100644 index b5ad48e709..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce5/zebra.conf +++ /dev/null @@ -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 -! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/bgpd.conf deleted file mode 100644 index e0b6540514..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/bgpd.conf +++ /dev/null @@ -1,8 +0,0 @@ -frr defaults traditional -! -hostname ce6 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/frr.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/frr.conf new file mode 100644 index 0000000000..3870bd84a3 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/frr.conf @@ -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 + diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/ipv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/ipv6_rib.json index ace6136f06..71ca42e396 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/ipv6_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/ipv6_rib.json @@ -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, diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/zebra.conf deleted file mode 100644 index 7d19d9880b..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/ce6/zebra.conf +++ /dev/null @@ -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 -! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/frr.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/frr.conf new file mode 100644 index 0000000000..ef05460b22 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/frr.conf @@ -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 +! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib.json index 0fdd3d6dc0..afa713e37f 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib.json @@ -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 } diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib_locator_deleted.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib_locator_deleted.json index f2df9be49d..a3a5f0438a 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib_locator_deleted.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib_locator_deleted.json @@ -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 } diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib_locator_recreated.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib_locator_recreated.json index 0fdd3d6dc0..afa713e37f 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib_locator_recreated.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vpnv6_rib_locator_recreated.json @@ -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 } diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vrf10_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vrf10_rib.json index 141c1cb957..aee6905d95 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vrf10_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vrf10_rib.json @@ -53,8 +53,7 @@ "segs": "2001:db8:2:2:100::" } } - ], - "asPath": "2" + ] } ], "2001:3::/64": [ diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vrf20_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vrf20_rib.json index e20998061f..0f3c970afe 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vrf20_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/vrf20_rib.json @@ -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" + ] } ] } diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/zebra.conf deleted file mode 100644 index c84106f2bb..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/zebra.conf +++ /dev/null @@ -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 -! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/frr.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/frr.conf new file mode 100644 index 0000000000..1bef01d0b3 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/frr.conf @@ -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 +! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib.json index 03bbcc008d..e7695281d9 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib.json @@ -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 } diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib_locator_deleted.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib_locator_deleted.json index 25cdf031c3..caa5803bfe 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib_locator_deleted.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib_locator_deleted.json @@ -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 } diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib_locator_recreated.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib_locator_recreated.json index 03bbcc008d..e7695281d9 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib_locator_recreated.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vpnv6_rib_locator_recreated.json @@ -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 } diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vrf10_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vrf10_rib.json index 7f8a930d00..407dfb9fb4 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vrf10_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vrf10_rib.json @@ -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::" + } + } + ] } ] } diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vrf20_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vrf20_rib.json index 104bdc30d2..90e0413db2 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vrf20_rib.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/vrf20_rib.json @@ -53,8 +53,7 @@ "segs": "2001:db8:1:1:200::" } } - ], - "asPath": "1" + ] } ], "2001:6::/64": [ diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/zebra.conf deleted file mode 100644 index 5c12429ff2..0000000000 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/zebra.conf +++ /dev/null @@ -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 -! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py index a6938668ad..c30410d4dc 100755 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/test_bgp_srv6l3vpn_to_bgp_vrf.py @@ -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 """ diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce1/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce1/bgpd.conf index 3459796629..188ec7a86c 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce1/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce1/bgpd.conf @@ -1,8 +1,3 @@ frr defaults traditional -! -hostname ce1 -password zebra -! -log stdout notifications -log commands -log file bgpd.log + + diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce1/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce1/zebra.conf index 447d1b40c1..6c9abca36f 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce1/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce1/zebra.conf @@ -1,7 +1,3 @@ -log file zebra.log -! -hostname ce1 -! interface eth0 ip address 192.168.1.2/24 ! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce2/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce2/bgpd.conf index 8ed9978749..05268f8878 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce2/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce2/bgpd.conf @@ -1,8 +1,2 @@ frr defaults traditional -! -hostname ce2 -password zebra -! -log stdout notifications -log commands -log file bgpd.log + diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce2/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce2/zebra.conf index 11652252a4..b0e6470307 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce2/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce2/zebra.conf @@ -1,7 +1,3 @@ -log file zebra.log -! -hostname ce2 -! interface eth0 ip address 192.168.2.2/24 ! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce3/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce3/bgpd.conf index a85d9701c7..cd72007f46 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce3/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce3/bgpd.conf @@ -1,8 +1 @@ frr defaults traditional -! -hostname ce3 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce3/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce3/zebra.conf index 299c6597c7..f0fd4f497a 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce3/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce3/zebra.conf @@ -1,7 +1,3 @@ -log file zebra.log -! -hostname ce3 -! interface eth0 ip address 192.168.3.2/24 ! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce4/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce4/bgpd.conf index 93fb32fd1b..cd72007f46 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce4/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce4/bgpd.conf @@ -1,8 +1 @@ frr defaults traditional -! -hostname ce4 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce4/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce4/zebra.conf index 30f3736fe3..da745f2bd0 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce4/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce4/zebra.conf @@ -1,7 +1,3 @@ -log file zebra.log -! -hostname ce4 -! interface eth0 ip address 192.168.4.2/24 ! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce5/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce5/bgpd.conf index 2ab6f2d2a7..cd72007f46 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce5/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce5/bgpd.conf @@ -1,8 +1 @@ frr defaults traditional -! -hostname ce5 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce5/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce5/zebra.conf index 208dcb1a7a..37391ebb49 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce5/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce5/zebra.conf @@ -1,7 +1,3 @@ -log file zebra.log -! -hostname ce5 -! interface eth0 ip address 192.168.5.2/24 ! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce6/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce6/bgpd.conf index e0b6540514..cd72007f46 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce6/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce6/bgpd.conf @@ -1,8 +1 @@ frr defaults traditional -! -hostname ce6 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce6/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce6/zebra.conf index d68a008e3a..9696993c33 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce6/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/ce6/zebra.conf @@ -1,7 +1,3 @@ -log file zebra.log -! -hostname ce6 -! interface eth0 ip address 192.168.6.2/24 ! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r1/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r1/bgpd.conf index 12b9e8fd00..d4be6c7d6a 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r1/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r1/bgpd.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r1/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r1/zebra.conf index f202493c53..64e6af0c1b 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r1/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r1/zebra.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r2/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r2/bgpd.conf index db36c180a0..5ff570069c 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r2/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r2/bgpd.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r2/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r2/zebra.conf index 9dfed4f2d6..22b689d538 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r2/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf2/r2/zebra.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce1/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce1/bgpd.conf index 3459796629..cd72007f46 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce1/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce1/bgpd.conf @@ -1,8 +1 @@ frr defaults traditional -! -hostname ce1 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce1/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce1/zebra.conf index 58e851d752..a6eab175f5 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce1/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce1/zebra.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce2/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce2/bgpd.conf index 8ed9978749..cd72007f46 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce2/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce2/bgpd.conf @@ -1,8 +1 @@ frr defaults traditional -! -hostname ce2 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce2/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce2/zebra.conf index 0612c53223..3be205a8c9 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce2/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce2/zebra.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce3/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce3/bgpd.conf index a85d9701c7..cd72007f46 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce3/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce3/bgpd.conf @@ -1,8 +1 @@ frr defaults traditional -! -hostname ce3 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce3/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce3/zebra.conf index d08fdadc3c..2fb86c74de 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce3/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce3/zebra.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce4/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce4/bgpd.conf index 93fb32fd1b..cd72007f46 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce4/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce4/bgpd.conf @@ -1,8 +1 @@ frr defaults traditional -! -hostname ce4 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce4/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce4/zebra.conf index 897ed46c27..3bbbd08558 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce4/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce4/zebra.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce5/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce5/bgpd.conf index 2ab6f2d2a7..cd72007f46 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce5/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce5/bgpd.conf @@ -1,8 +1 @@ frr defaults traditional -! -hostname ce5 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce6/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce6/bgpd.conf index e0b6540514..cd72007f46 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce6/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce6/bgpd.conf @@ -1,8 +1 @@ frr defaults traditional -! -hostname ce6 -password zebra -! -log stdout notifications -log commands -log file bgpd.log diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce6/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce6/zebra.conf index 5a83e901e8..d39a6a6bcb 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce6/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/ce6/zebra.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/bgpd.conf index 57c19e25d7..5e78e5e1a1 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/bgpd.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv4_rib_locator_deleted.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv4_rib_locator_deleted.json index 5645540fbb..4e803a0514 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv4_rib_locator_deleted.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv4_rib_locator_deleted.json @@ -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 + } + ] + } + ] } } } diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv4_rib_sid_vpn_export_disabled.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv4_rib_sid_vpn_export_disabled.json index 205079574c..d49c357432 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv4_rib_sid_vpn_export_disabled.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv4_rib_sid_vpn_export_disabled.json @@ -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": [ { diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv6_rib_locator_deleted.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv6_rib_locator_deleted.json index f2df9be49d..547b262d4b 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv6_rib_locator_deleted.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv6_rib_locator_deleted.json @@ -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", diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv6_rib_sid_vpn_export_disabled.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv6_rib_sid_vpn_export_disabled.json index e289df1d44..8cfe223101 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv6_rib_sid_vpn_export_disabled.json +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/vpnv6_rib_sid_vpn_export_disabled.json @@ -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": [ { diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/zebra.conf index dd8a756a6e..a7515e12d3 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r1/zebra.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r2/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r2/bgpd.conf index abf4971a9b..bf04fbc7aa 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r2/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r2/bgpd.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r2/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r2/zebra.conf index 3c9e4e3b25..27919cc63f 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r2/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/r2/zebra.conf @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/test_bgp_srv6l3vpn_to_bgp_vrf3.py b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/test_bgp_srv6l3vpn_to_bgp_vrf3.py index 530537646b..9e588d1d71 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/test_bgp_srv6l3vpn_to_bgp_vrf3.py +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf3/test_bgp_srv6l3vpn_to_bgp_vrf3.py @@ -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") diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/bgpd.conf new file mode 100644 index 0000000000..a2f5aef51e --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/bgpd.conf @@ -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 + ! +! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/ip_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/ip_rib.json new file mode 100644 index 0000000000..352c48b1b2 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/ip_rib.json @@ -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" + } + ] +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/ipv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/ipv6_rib.json new file mode 100644 index 0000000000..fd10ee326f --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/ipv6_rib.json @@ -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" + } + ] +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/setup.sh b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/setup.sh new file mode 100644 index 0000000000..88bdcbda82 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/setup.sh @@ -0,0 +1 @@ +ip link add dum0 type dummy diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/zebra.conf new file mode 100644 index 0000000000..16102a055d --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce1/zebra.conf @@ -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 +! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/bgpd.conf new file mode 100644 index 0000000000..e6b40c4bfe --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/bgpd.conf @@ -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 + ! +! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/ip_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/ip_rib.json new file mode 100644 index 0000000000..936f239ea6 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/ip_rib.json @@ -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 + } + ] + } + ] +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/ipv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/ipv6_rib.json new file mode 100644 index 0000000000..260adbc20c --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/ipv6_rib.json @@ -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 + } + ] + } + ] +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/setup.sh b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/setup.sh new file mode 100644 index 0000000000..88bdcbda82 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/setup.sh @@ -0,0 +1 @@ +ip link add dum0 type dummy diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/zebra.conf new file mode 100644 index 0000000000..f17e96a0da --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/ce2/zebra.conf @@ -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 +! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/bgpd.conf similarity index 61% rename from tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/bgpd.conf rename to tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/bgpd.conf index 8079bb0c2a..d0be14f007 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r1/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/bgpd.conf @@ -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 ! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/setup.sh b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/setup.sh new file mode 100644 index 0000000000..ac1844f733 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/setup.sh @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vpnv4_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vpnv4_rib.json new file mode 100644 index 0000000000..6cdeac2991 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vpnv4_rib.json @@ -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 + } + ] + } + ] + } + } + } +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vpnv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vpnv6_rib.json new file mode 100644 index 0000000000..77b272de65 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vpnv6_rib.json @@ -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 + } + ] + } + ] + } + } + } +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vrf10v4_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vrf10v4_rib.json new file mode 100644 index 0000000000..f7da30637b --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vrf10v4_rib.json @@ -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" + } + ] +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vrf10v6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vrf10v6_rib.json new file mode 100644 index 0000000000..12e7087060 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/vrf10v6_rib.json @@ -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" + } + ] +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/zebra.conf new file mode 100644 index 0000000000..42e3f5bd89 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r1/zebra.conf @@ -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 +! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/bgpd.conf similarity index 61% rename from tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/bgpd.conf rename to tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/bgpd.conf index c2e8530273..31cf9f9b5d 100644 --- a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf/r2/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/bgpd.conf @@ -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 ! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/setup.sh b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/setup.sh new file mode 100644 index 0000000000..ac1844f733 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/setup.sh @@ -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 diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vpnv4_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vpnv4_rib.json new file mode 100644 index 0000000000..c1f67a771c --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vpnv4_rib.json @@ -0,0 +1,64 @@ +{ + "vrfId": 0, + "vrfName": "default", + "routerId": "2.2.2.2", + "defaultLocPrf": 100, + "localAS": 2, + "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": "2001::1", + "path": "1 65001", + "origin": "IGP", + "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": "(unspec)", + "path": "65002", + "origin": "IGP", + "nhVrfName": "vrf10", + "nexthops": [ + { + "ip": "2001::2", + "hostname": "r2", + "afi": "ipv6", + "used": true + } + ] + } + ] + } + } + } +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vpnv6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vpnv6_rib.json new file mode 100644 index 0000000000..da3ddd0699 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vpnv6_rib.json @@ -0,0 +1,63 @@ +{ + "vrfId": 0, + "vrfName": "default", + "routerId": "2.2.2.2", + "defaultLocPrf": 100, + "localAS": 2, + "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": "2001::1", + "path": "1 65001", + "origin": "IGP", + "nexthops": [ + { + "ip": "2001::1", + "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": "(unspec)", + "path": "65002", + "origin": "IGP", + "nhVrfName": "vrf10", + "nexthops": [ + { + "hostname": "r2", + "afi": "ipv6", + "used": true + } + ] + } + ] + } + } + } +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vrf10v4_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vrf10v4_rib.json new file mode 100644 index 0000000000..5cc093fea8 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vrf10v4_rib.json @@ -0,0 +1,63 @@ +{ + "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": "eth0", + "vrf": "default", + "active": true, + "seg6": { + "segs": "2001:db8:1:1:1::" + } + } + ], + "asPath": "1 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": "eth1", + "active": true, + "weight": 1 + } + ], + "asPath": "65002" + } + ] +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vrf10v6_rib.json b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vrf10v6_rib.json new file mode 100644 index 0000000000..5e8114e17b --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/vrf10v6_rib.json @@ -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": "eth0", + "vrf": "default", + "active": true, + "seg6": { + "segs": "2001:db8:1:1:1::" + } + } + ], + "asPath": "1 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": "eth1", + "active": true, + "weight": 1 + } + ], + "asPath": "65002" + } + ] +} diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/zebra.conf b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/zebra.conf new file mode 100644 index 0000000000..551e7d7692 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/r2/zebra.conf @@ -0,0 +1,21 @@ +interface eth0 + ipv6 address 2001::2/64 +! +interface eth1 vrf vrf10 + ipv6 address fd02::1/64 +! +segment-routing + srv6 + locators + locator loc1 + prefix 2001:db8:2:2::/64 + ! + ! +! +ip forwarding +ipv6 forwarding +! +ipv6 route 2001:db8:1:1::/64 2001::1 +! +line vty +! diff --git a/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/test_bgp_srv6l3vpn_to_bgp_vrf4.py b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/test_bgp_srv6l3vpn_to_bgp_vrf4.py new file mode 100644 index 0000000000..88bc9847f3 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_to_bgp_vrf4/test_bgp_srv6l3vpn_to_bgp_vrf4.py @@ -0,0 +1,143 @@ +#!/usr/bin/env python +# SPDX-License-Identifier: ISC + +# Copyright (c) 2025, Onvox LLC +# Authored by Jonathan Voss +# +# Test SRv6 L3VPN with CE BGP peers within a VRF +# + +import os +import re +import sys +import json +import functools +import pytest + +CWD = os.path.dirname(os.path.realpath(__file__)) +sys.path.append(os.path.join(CWD, "../")) + +# pylint: disable=C0413 +# Import topogen and topotest helpers +from lib import topotest +from lib.topogen import Topogen, TopoRouter, get_topogen +from lib.topolog import logger +from lib.common_config import required_linux_kernel_version +from lib.checkping import check_ping + +pytestmark = [pytest.mark.bgpd] + + +def build_topo(tgen): + tgen.add_router("r1") + tgen.add_router("r2") + tgen.add_router("ce1") + tgen.add_router("ce2") + + tgen.add_link(tgen.gears["r1"], tgen.gears["r2"], "eth0", "eth0") + tgen.add_link(tgen.gears["ce1"], tgen.gears["r1"], "eth0", "eth1") + tgen.add_link(tgen.gears["ce2"], tgen.gears["r2"], "eth0", "eth1") + + +def setup_module(mod): + result = required_linux_kernel_version("5.14") + if result is not True: + pytest.skip("Kernel requirements are not met") + + tgen = Topogen(build_topo, mod.__name__) + tgen.start_topology() + 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)) + ) + + tgen.start_router() + + +def teardown_module(mod): + tgen = get_topogen() + tgen.stop_topology() + + +def open_json_file(filename): + try: + with open(filename, "r") as f: + return json.load(f) + except IOError: + 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): + 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) + _, 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("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("r2", "show ip route vrf vrf10 json", "r2/vrf10v4_rib.json") + check_rib("ce1", "show ip route json", "ce1/ip_rib.json") + check_rib("ce2", "show ip route json", "ce2/ip_rib.json") + + check_rib("r1", "show bgp ipv6 vpn json", "r1/vpnv6_rib.json") + check_rib("r2", "show bgp ipv6 vpn json", "r2/vpnv6_rib.json") + check_rib("r1", "show ipv6 route vrf vrf10 json", "r1/vrf10v6_rib.json") + check_rib("r2", "show ipv6 route vrf vrf10 json", "r2/vrf10v6_rib.json") + check_rib("ce1", "show ipv6 route json", "ce1/ipv6_rib.json") + check_rib("ce2", "show ipv6 route json", "ce2/ipv6_rib.json") + + +def test_ping(): + # IPv4 CE1 to CE2 + check_ping("ce1", "192.168.2.1", True, 10, 3, "192.168.1.1") + # IPv4 CE2 to CE1 + check_ping("ce2", "192.168.1.1", True, 10, 3, "192.168.2.1") + # IPv6 CE1 to CE2 + check_ping("ce1", "2001:2::1", True, 10, 3, "2001:1::1") + # IPv6 CE2 to CE1 + check_ping("ce2", "2001:1::1", True, 10, 3, "2001:2::1") + + +def test_ce_neighbor_reset(): + # Clear CE to R peerings and ensure route exports after + # re-established propogate to VPNv4/VPNv6 and function correctly + tgen = get_topogen() + + for router in ["ce1", "ce2"]: + tgen.gears[router].vtysh_cmd("clear bgp *") + + test_ping() + test_rib() + + +def test_pe_neighbor_reset(): + # Clear R to R peering and ensure route exports after + # re-established propogate to VPNv4/VPNv6 and function correctly + tgen = get_topogen() + + tgen.gears["r1"].vtysh_cmd("clear bgp *") + + test_ping() + test_rib() + + +if __name__ == "__main__": + args = ["-s"] + sys.argv[1:] + sys.exit(pytest.main(args)) diff --git a/tests/topotests/lib/bgp.py b/tests/topotests/lib/bgp.py index 632aa4a10b..01fe2b3714 100644 --- a/tests/topotests/lib/bgp.py +++ b/tests/topotests/lib/bgp.py @@ -5,6 +5,7 @@ # ("NetDEF") in this file. # +import json import ipaddress import sys import traceback @@ -5658,3 +5659,34 @@ def bgp_configure_prefixes(router, asn, safi, prefixes, vrf=None, update=True): ] logger.debug(f"setting prefix: ipv{ip.version} {safi} {ip}") router.vtysh_cmd("".join(cmd)) + + +# compare exact fields of 'show bgp ipv4 vpn' and related commands +# after having removed some attributes that are not relevant. +def bgp_vpn_router_json_cmp_exact_filter(router, cmd, expected): + output = router.vtysh_cmd(cmd) + logger.info("{}: {}\n{}".format(router.name, cmd, output)) + + json_output = json.loads(output) + + # filter out tableVersion, version and nhVrfID + json_output.pop("tableVersion") + if "totalRoutes" in json_output: + json_output.pop("totalRoutes") + if "totalPaths" in json_output: + json_output.pop("totalPaths") + for rd, data in json_output["routes"]["routeDistinguishers"].items(): + for _, attrs in data.items(): + for attr in attrs: + if "nhVrfId" in attr: + attr.pop("nhVrfId") + if "version" in attr: + attr.pop("version") + + # filter out RD with no data (e.g. "444:3": {}) + json_tmp = deepcopy(json_output) + for rd, data in json_tmp["routes"]["routeDistinguishers"].items(): + if len(data.keys()) == 0: + json_output["routes"]["routeDistinguishers"].pop(rd) + + return topotest.json_cmp(json_output, expected, exact=True)