diff options
Diffstat (limited to 'tests')
111 files changed, 1950 insertions, 588 deletions
diff --git a/tests/isisd/test_common.c b/tests/isisd/test_common.c index e47456965e..e22ee21365 100644 --- a/tests/isisd/test_common.c +++ b/tests/isisd/test_common.c @@ -33,11 +33,11 @@ test_topology_find_node(const struct isis_topology *topology, } const struct isis_topology * -test_topology_find(struct isis_topology *test_topologies, uint16_t number) +test_topology_find(struct isis_topology *topologies, uint16_t number) { - for (size_t i = 0; test_topologies[i].number; i++) - if (test_topologies[i].number == number) - return &test_topologies[i]; + for (size_t i = 0; topologies[i].number; i++) + if (topologies[i].number == number) + return &topologies[i]; return NULL; } diff --git a/tests/isisd/test_fuzz_isis_tlv.c b/tests/isisd/test_fuzz_isis_tlv.c index 48a2caacce..2a8a5bc5d7 100644 --- a/tests/isisd/test_fuzz_isis_tlv.c +++ b/tests/isisd/test_fuzz_isis_tlv.c @@ -161,7 +161,7 @@ static int test(FILE *input, FILE *output) struct listnode *node; for (ALL_LIST_ELEMENTS_RO(fragments, node, tlvs)) { stream_reset(s); - int rv = isis_pack_tlvs(tlvs, s, (size_t)-1, false, false); + rv = isis_pack_tlvs(tlvs, s, (size_t)-1, false, false); if (rv) { fprintf(output, "Could not pack fragment, too large.\n"); assert(0); diff --git a/tests/lib/test_darr.c b/tests/lib/test_darr.c index be319db1c1..d980db505d 100644 --- a/tests/lib/test_darr.c +++ b/tests/lib/test_darr.c @@ -157,12 +157,17 @@ static void test_int(void) assert(!memcmp(da2, a1, sizeof(a1))); - assert(darr_pop(da2) == 4); - assert(darr_pop(da2) == 3); - assert(darr_pop(da2) == 2); + i = darr_pop(da2); + assert(i == 4); + i = darr_pop(da2); + assert(i == 3); + i = darr_pop(da2); + assert(i == 2); assert(darr_len(da2) == 2); - assert(darr_pop(da2) == 1); - assert(darr_pop(da2) == 0); + i = darr_pop(da2); + assert(i == 1); + i = darr_pop(da2); + assert(i == 0); assert(darr_len(da2) == 0); darr_free(da2); @@ -323,38 +328,47 @@ static void test_string(void) char *da2 = NULL; const char **strings = NULL; uint sum = 0; + uint i; - assert(darr_strlen(da1) == 0); + i = darr_strlen(da1); + assert(i == 0); da1 = darr_strdup(src); - assert(darr_strlen(da1) == strlen(da1)); - assert(darr_strlen(da1) == srclen); + i = darr_strlen(da1); + assert(i == strlen(da1)); + i = darr_strlen(da1); + assert(i == srclen); assert(darr_len(da1) == srclen + 1); assert(darr_ilen(da1) == (int)srclen + 1); assert(darr_cap(da1) >= 8); assert(darr_last(da1) == darr_strnul(da1)); - assert(darr_strnul(da1) == da1 + darr_strlen(da1)); + i = darr_strlen(da1); + assert(darr_strnul(da1) == da1 + i); da2 = da1; darr_in_strdup(da1, src); assert(da1 == da2); - assert(darr_strlen(da1) == strlen(da1)); - assert(darr_strlen(da1) == srclen); + i = darr_strlen(da1); + assert(i == strlen(da1)); + assert(i == srclen); assert(darr_len(da1) == srclen + 1); darr_free(da1); assert(da1 == NULL); da1 = darr_strdup_cap(src, 128); - assert(darr_strlen(da1) == srclen); + i = darr_strlen(da1); + assert(i == srclen); assert(darr_cap(da1) >= 128); darr_in_strdup_cap(da1, src, 256); - assert(darr_strlen(da1) == srclen); + i = darr_strlen(da1); + assert(i == srclen); assert(darr_cap(da1) >= 256); darr_free(da1); da1 = darr_strdup_cap(add, 2); - assert(darr_strlen(da1) == addlen); + i = darr_strlen(da1); + assert(i == addlen); assert(darr_cap(da1) >= 8); darr_in_strdup(da1, "ab"); @@ -377,7 +391,8 @@ static void test_string(void) da2 = darr_strdup(add); darr_in_strcat_tail(da1, da2); assert(!strcmp("abHIJ", da1)); - assert(darr_strlen(da1) == 5); + i = darr_strlen(da1); + assert(i == 5); assert(darr_len(da1) == 6); darr_free(da1); darr_free(da2); @@ -386,14 +401,16 @@ static void test_string(void) da2 = darr_strdup(add); darr_in_strcat_tail(da1, da2); assert(!strcmp("abcde", da1)); - assert(darr_strlen(da1) == 5); + i = darr_strlen(da1); + assert(i == 5); assert(darr_len(da1) == 6); darr_free(da1); darr_free(da2); da1 = darr_sprintf("0123456789: %08X", 0xDEADBEEF); assert(!strcmp(da1, "0123456789: DEADBEEF")); - assert(darr_strlen(da1) == 20); + i = darr_strlen(da1); + assert(i == 20); assert(darr_cap(da1) == 128); da2 = da1; darr_in_sprintf(da1, "9876543210: %08x", 0x0BADF00D); @@ -405,11 +422,13 @@ static void test_string(void) da1 = NULL; darr_in_sprintf(da1, "0123456789: %08X", 0xDEADBEEF); assert(!strcmp(da1, "0123456789: DEADBEEF")); - assert(darr_strlen(da1) == 20); + i = darr_strlen(da1); + assert(i == 20); assert(darr_cap(da1) == 128); da1[5] = 0; - assert(darr_strlen_fixup(da1) == 5); + i = darr_strlen_fixup(da1); + assert(i == 5); darr_free(da1); da1 = darr_sprintf("0123456789: %08x", 0xDEADBEEF); diff --git a/tests/lib/test_printfrr.c b/tests/lib/test_printfrr.c index a81ebcdbcd..c915587c13 100644 --- a/tests/lib/test_printfrr.c +++ b/tests/lib/test_printfrr.c @@ -107,7 +107,7 @@ static int printchk(const char *ref, const char *fmt, ...) errors++; } - for (size_t i = 0; i < fb.outpos_i; i++) + for (i = 0; i < fb.outpos_i; i++) printf("\t[%zu: %u..%u] = \"%.*s\"\n", i, outpos[i].off_start, outpos[i].off_end, diff --git a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py index 80903b134e..3cecf9d946 100644 --- a/tests/topotests/all_protocol_startup/test_all_protocol_startup.py +++ b/tests/topotests/all_protocol_startup/test_all_protocol_startup.py @@ -38,7 +38,6 @@ from lib.topogen import Topogen, get_topogen from lib.common_config import ( required_linux_kernel_version, ) -from lib.topolog import logger import json import functools @@ -420,9 +419,9 @@ def route_get_nhg_id(route_str): test_func = functools.partial(get_func, route_str) _, nhg_id = topotest.run_and_expect_type(test_func, int, count=30, wait=1) - if nhg_id == None: + if nhg_id is None: fatal_error = "Nexthop Group ID not found for route {}".format(route_str) - assert nhg_id != None, fatal_error + assert nhg_id is not None, fatal_error else: return nhg_id @@ -710,7 +709,8 @@ def test_rip_status(): refTableFile = "{}/r{}/rip_status.ref".format(thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file - expected = open(refTableFile).read().rstrip() + with open(refTableFile) as file: + expected = file.read().rstrip() # Fix newlines (make them all the same) expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) @@ -771,7 +771,8 @@ def test_ripng_status(): refTableFile = "{}/r{}/ripng_status.ref".format(thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file - expected = open(refTableFile).read().rstrip() + with open(refTableFile) as file: + expected = file.read().rstrip() # Fix newlines (make them all the same) expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) @@ -834,7 +835,8 @@ def test_ospfv2_interfaces(): refTableFile = "{}/r{}/show_ip_ospf_interface.ref".format(thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file - expected = open(refTableFile).read().rstrip() + with open(refTableFile) as file: + expected = file.read().rstrip() # Fix newlines (make them all the same) expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) @@ -916,7 +918,8 @@ def test_isis_interfaces(): refTableFile = "{}/r{}/show_isis_interface_detail.ref".format(thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file - expected = open(refTableFile).read().rstrip() + with open(refTableFile) as file: + expected = file.read().rstrip() # Fix newlines (make them all the same) expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) @@ -979,7 +982,8 @@ def test_bgp_summary(): refTableFile = "{}/r{}/show_ip_bgp_summary.ref".format(thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file - expected_original = open(refTableFile).read().rstrip() + with open(refTableFile) as file: + expected_original = file.read().rstrip() for arguments in [ "", @@ -1152,7 +1156,8 @@ def test_bgp_ipv6_summary(): refTableFile = "{}/r{}/show_bgp_ipv6_summary.ref".format(thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file - expected = open(refTableFile).read().rstrip() + with open(refTableFile) as file: + expected = file.read().rstrip() # Fix newlines (make them all the same) expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) @@ -1244,7 +1249,8 @@ def test_nht(): for i in range(1, 2): nhtFile = "{}/r{}/ip_nht.ref".format(thisDir, i) - expected = open(nhtFile).read().rstrip() + with open(nhtFile) as file: + expected = file.read().rstrip() expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) actual = ( @@ -1266,7 +1272,8 @@ def test_nht(): print("show ip nht is ok\n") nhtFile = "{}/r{}/ipv6_nht.ref".format(thisDir, i) - expected = open(nhtFile).read().rstrip() + with open(nhtFile) as file: + expected = file.read().rstrip() expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) actual = ( @@ -1306,7 +1313,8 @@ def test_bgp_ipv4(): for refTableFile in glob.glob("{}/r{}/show_bgp_ipv4*.ref".format(thisDir, i)): if os.path.isfile(refTableFile): # Read expected result from file - expected = open(refTableFile).read().rstrip() + with open(refTableFile) as file: + expected = file.read().rstrip() # Fix newlines (make them all the same) expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) @@ -1377,7 +1385,8 @@ def test_bgp_ipv6(): for refTableFile in glob.glob("{}/r{}/show_bgp_ipv6*.ref".format(thisDir, i)): if os.path.isfile(refTableFile): # Read expected result from file - expected = open(refTableFile).read().rstrip() + with open(refTableFile) as file: + expected = file.read().rstrip() # Fix newlines (make them all the same) expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) @@ -1444,7 +1453,8 @@ def test_route_map(): for i in range(1, 2): refroutemap = "{}/r{}/show_route_map.ref".format(thisDir, i) if os.path.isfile(refroutemap): - expected = open(refroutemap).read().rstrip() + with open(refroutemap) as file: + expected = file.read().rstrip() expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) actual = ( @@ -1649,7 +1659,8 @@ def test_mpls_interfaces(): refTableFile = "{}/r{}/show_mpls_ldp_interface.ref".format(thisDir, i) if os.path.isfile(refTableFile): # Read expected result from file - expected = open(refTableFile).read().rstrip() + with open(refTableFile) as file: + expected = file.read().rstrip() # Fix newlines (make them all the same) expected = ("\n".join(expected.splitlines()) + "\n").splitlines(1) diff --git a/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py b/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py index 874ad09264..e2bcd004d4 100644 --- a/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py +++ b/tests/topotests/bgp_gr_notification/test_bgp_gr_notification.py @@ -195,14 +195,14 @@ def test_bgp_administrative_reset_gr(): step("Reset and delay the session establishement for R1") r1.vtysh_cmd( """ - configure terminal" + configure terminal router bgp neighbor 192.168.255.2 timers delayopen 60 """ ) r2.vtysh_cmd( """ - configure terminal" + configure terminal router bgp neighbor 192.168.255.1 timers delayopen 60 """ diff --git a/tests/topotests/bgp_rfapi_basic_sanity/r3/bgpd.conf b/tests/topotests/bgp_rfapi_basic_sanity/r3/bgpd.conf index 2210f24589..e1c533c1f3 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/r3/bgpd.conf +++ b/tests/topotests/bgp_rfapi_basic_sanity/r3/bgpd.conf @@ -4,6 +4,7 @@ hostname r3 password zebra log stdout notifications log commands +#debug bgp vnc verbose router bgp 5226 bgp router-id 3.3.3.3 bgp cluster-id 3.3.3.3 diff --git a/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py b/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py index 7201ac8111..aaa43d5a7e 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py +++ b/tests/topotests/bgp_rfapi_basic_sanity/scripts/cleanup_all.py @@ -91,10 +91,10 @@ luCommand( ) num = "0 exist" -luCommand("r1", 'vtysh -c "show bgp ipv4 vpn"', num, "pass", "VPN SAFI clear") -luCommand("r2", 'vtysh -c "show bgp ipv4 vpn"', num, "pass", "VPN SAFI clear") -luCommand("r3", 'vtysh -c "show bgp ipv4 vpn"', num, "pass", "VPN SAFI clear") -luCommand("r4", 'vtysh -c "show bgp ipv4 vpn"', num, "pass", "VPN SAFI clear") +luCommand("r1", 'vtysh -c "show bgp ipv4 vpn"', num, "wait", "VPN SAFI clear") +luCommand("r2", 'vtysh -c "show bgp ipv4 vpn"', num, "wait", "VPN SAFI clear") +luCommand("r3", 'vtysh -c "show bgp ipv4 vpn"', num, "wait", "VPN SAFI clear") +luCommand("r4", 'vtysh -c "show bgp ipv4 vpn"', num, "wait", "VPN SAFI clear") luCommand( "r1", diff --git a/tests/topotests/bgp_rfapi_basic_sanity_config2/r3/bgpd.conf b/tests/topotests/bgp_rfapi_basic_sanity_config2/r3/bgpd.conf index e74fc0b3de..04b10b4d22 100644 --- a/tests/topotests/bgp_rfapi_basic_sanity_config2/r3/bgpd.conf +++ b/tests/topotests/bgp_rfapi_basic_sanity_config2/r3/bgpd.conf @@ -4,6 +4,7 @@ hostname r3 password zebra log stdout notifications log commands +#debug bgp vnc verbose router bgp 5226 bgp router-id 3.3.3.3 bgp cluster-id 3.3.3.3 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 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 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 <jvoss@onvox.net> +# +# 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) diff --git a/tests/topotests/static_srv6_sids/test_static_srv6_sids.py b/tests/topotests/static_srv6_sids/test_static_srv6_sids.py index 1ea94c8c07..abf49df046 100755 --- a/tests/topotests/static_srv6_sids/test_static_srv6_sids.py +++ b/tests/topotests/static_srv6_sids/test_static_srv6_sids.py @@ -210,6 +210,36 @@ def test_srv6_static_sids_sid_modify(): check_srv6_static_sids(router, "expected_srv6_sids_sid_modify.json") +def test_srv6_static_sids_wrong_sid_block(): + """ + The purpose of this test is to verify how FRR behaves when the user + provides an invalid configuration. + Add a new static Sid with a mismatch in locator and sid block + to make sure no Sid is allocated by zebra (TBD: Strict verify once show cmd + commit is merged (#16836)) + """ + router = get_topogen().gears["r1"] + router.vtysh_cmd( + """ + configure terminal + segment-routing + srv6 + locators + locator MAIN1 + prefix fcbb:1234:1::/48 block-len 32 node-len 16 func-bits 16 + srv6 + static-sids + sid fcbb:bbbb:1:fe50::/64 locator MAIN1 behavior uA interface sr0 nexthop 2001::3 + """ + ) + + output = json.loads(router.vtysh_cmd("show ipv6 route static json")) + if "fcbb:bbbb:1:fe50::/64" in output: + assert ( + False + ), "Failed. Expected no entry for fcbb:bbbb:1:fe50::/64 since loc and node block dont match" + + def test_srv6_static_sids_sid_delete_all(): """ Remove all static SIDs and verify they get removed |
