diff options
author | Donatas Abraitis <donatas@opensourcerouting.org> | 2023-01-20 10:12:47 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-20 10:12:47 +0100 |
commit | f5c8073dddce2a1821b0f0c04599e4f3281b4a28 (patch) | |
tree | 9f9aace9be92888594c82f02e21b34cb70a37484 /tests | |
parent | Merge pull request #12350 from kuldeepkash/pim6_fixes (diff) | |
parent | bgpd: Skip RD match if ACCEPT_OWN is not enabled (diff) | |
download | frr-f5c8073dddce2a1821b0f0c04599e4f3281b4a28.tar.xz frr-f5c8073dddce2a1821b0f0c04599e4f3281b4a28.zip |
Merge pull request #12669 from proelbtn/fix-accept-own-rd-check
bgpd: Skip RD match if ACCEPT_OWN excended community is not attached
Diffstat (limited to 'tests')
16 files changed, 165 insertions, 30 deletions
diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/c31/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c31/bgpd.conf new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c31/bgpd.conf diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/c31/staticd.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c31/staticd.conf new file mode 100644 index 000000000..0c88575ab --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c31/staticd.conf @@ -0,0 +1,4 @@ +! +ip route 0.0.0.0/0 192.168.3.254 +ipv6 route ::/0 2001:3::ffff +! diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/c31/zebra.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c31/zebra.conf new file mode 100644 index 000000000..3f75641ea --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c31/zebra.conf @@ -0,0 +1,6 @@ +hostname c31 +! +interface eth0 + ip address 192.168.3.1/24 + ipv6 address 2001:3::1/64 +! diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/c32/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c32/bgpd.conf new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c32/bgpd.conf diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/c32/staticd.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c32/staticd.conf new file mode 100644 index 000000000..0c88575ab --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c32/staticd.conf @@ -0,0 +1,4 @@ +! +ip route 0.0.0.0/0 192.168.3.254 +ipv6 route ::/0 2001:3::ffff +! diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/c32/zebra.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c32/zebra.conf new file mode 100644 index 000000000..c06a7d19f --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/c32/zebra.conf @@ -0,0 +1,6 @@ +hostname c32 +! +interface eth0 + ip address 192.168.3.1/24 + ipv6 address 2001:3::1/64 +! diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/bgpd.conf index 048702f91..22b901429 100644 --- a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/bgpd.conf @@ -11,16 +11,21 @@ router bgp 65001 bgp router-id 192.0.2.1 no bgp ebgp-requires-policy no bgp default ipv4-unicast - neighbor 2001:db8::2 remote-as 65002 - neighbor 2001:db8::2 timers 3 10 - neighbor 2001:db8::2 timers connect 1 - neighbor 2001:db8::2 capability extended-nexthop + neighbor 2001:db8:12::2 remote-as 65002 + neighbor 2001:db8:12::2 timers 3 10 + neighbor 2001:db8:12::2 timers connect 1 + neighbor 2001:db8:12::2 capability extended-nexthop + neighbor 2001:db8:13::3 remote-as 65001 + neighbor 2001:db8:13::3 timers 3 10 + neighbor 2001:db8:13::3 timers connect 1 + neighbor 2001:db8:13::3 capability extended-nexthop ! segment-routing srv6 locator default ! address-family ipv4 vpn - neighbor 2001:db8::2 activate + neighbor 2001:db8:12::2 activate + neighbor 2001:db8:13::3 activate exit-address-family ! ! diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/staticd.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/staticd.conf index 662856f47..49b64fd7a 100644 --- a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/staticd.conf +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/staticd.conf @@ -1,3 +1,4 @@ ! -ipv6 route 2001:db8:2:2::/64 2001:db8::2 +ipv6 route 2001:db8:2:2::/64 2001:db8:12::2 +ipv6 route 2001:db8:3:3::/64 2001:db8:13::3 ! diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/zebra.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/zebra.conf index 066748bec..79dbf9559 100644 --- a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r1/zebra.conf @@ -6,12 +6,15 @@ interface lo ipv6 address 2001:db8:1:1::1/128 ! interface eth0 - ipv6 address 2001:db8::1/64 + ipv6 address 2001:db8:12::1/64 ! -interface eth1 vrf vrf10 +interface eth1 + ipv6 address 2001:db8:13::1/64 +! +interface eth2 vrf vrf10 ip address 192.168.1.254/24 ! -interface eth2 vrf vrf20 +interface eth3 vrf vrf20 ip address 192.168.1.254/24 ! segment-routing diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/bgpd.conf index 33b9103aa..42b9d511d 100644 --- a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/bgpd.conf +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/bgpd.conf @@ -11,16 +11,16 @@ router bgp 65002 bgp router-id 192.0.2.2 no bgp ebgp-requires-policy no bgp default ipv4-unicast - neighbor 2001:db8::1 remote-as 65001 - neighbor 2001:db8::1 timers 3 10 - neighbor 2001:db8::1 timers connect 1 - neighbor 2001:db8::1 capability extended-nexthop + neighbor 2001:db8:12::1 remote-as 65001 + neighbor 2001:db8:12::1 timers 3 10 + neighbor 2001:db8:12::1 timers connect 1 + neighbor 2001:db8:12::1 capability extended-nexthop ! segment-routing srv6 locator default ! address-family ipv4 vpn - neighbor 2001:db8::1 activate + neighbor 2001:db8:12::1 activate exit-address-family ! ! diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/staticd.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/staticd.conf index a2f54b733..8d80c1ead 100644 --- a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/staticd.conf +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/staticd.conf @@ -1,3 +1,4 @@ ! -ipv6 route 2001:db8:1:1::/64 2001:db8::1 +ipv6 route 2001:db8:1:1::/64 2001:db8:12::1 +ipv6 route 2001:db8:3:3::/64 2001:db8:12::1 ! diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/zebra.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/zebra.conf index dc03389fc..09a65b989 100644 --- a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/zebra.conf +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r2/zebra.conf @@ -6,7 +6,7 @@ interface lo ipv6 address 2001:db8:2:2::1/128 ! interface eth0 - ipv6 address 2001:db8::2/64 + ipv6 address 2001:db8:12::2/64 ! interface eth1 vrf vrf10 ip address 192.168.2.254/24 diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r3/bgpd.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r3/bgpd.conf new file mode 100644 index 000000000..339b4eb08 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r3/bgpd.conf @@ -0,0 +1,52 @@ +frr defaults traditional +! +hostname r2 +password zebra +! +log stdout notifications +log monitor notifications +log commands +! +router bgp 65001 + bgp router-id 192.0.2.3 + no bgp ebgp-requires-policy + no bgp default ipv4-unicast + neighbor 2001:db8:13::1 remote-as 65001 + neighbor 2001:db8:13::1 timers 3 10 + neighbor 2001:db8:13::1 timers connect 1 + neighbor 2001:db8:13::1 capability extended-nexthop + ! + segment-routing srv6 + locator default + ! + address-family ipv4 vpn + neighbor 2001:db8:13::1 activate + exit-address-family + ! +! +router bgp 65001 vrf vrf10 + bgp router-id 192.0.2.3 + ! + address-family ipv4 unicast + redistribute connected + sid vpn export 1 + rd vpn export 65001:10 + rt vpn both 0:10 + import vpn + export vpn + exit-address-family + ! +! +router bgp 65001 vrf vrf20 + bgp router-id 192.0.2.2 + ! + address-family ipv4 unicast + redistribute connected + sid vpn export 2 + rd vpn export 65001:20 + rt vpn both 0:20 + import vpn + export vpn + exit-address-family + ! +! diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r3/staticd.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r3/staticd.conf new file mode 100644 index 000000000..9d672d51b --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r3/staticd.conf @@ -0,0 +1,6 @@ +! +ipv6 route 2001:db8:12::/64 2001:db8:13::1 +! +ipv6 route 2001:db8:1:1::/64 2001:db8:13::1 +ipv6 route 2001:db8:2:2::/64 2001:db8:13::1 +! diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/r3/zebra.conf b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r3/zebra.conf new file mode 100644 index 000000000..a20cb76a7 --- /dev/null +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/r3/zebra.conf @@ -0,0 +1,29 @@ +log file zebra.log +! +hostname r2 +! +interface lo + ipv6 address 2001:db8:3:3::1/128 +! +interface eth0 + ipv6 address 2001:db8:13::3/64 +! +interface eth1 vrf vrf10 + ip address 192.168.3.254/24 +! +interface eth2 vrf vrf20 + ip address 192.168.3.254/24 +! +segment-routing + srv6 + locators + locator default + prefix 2001:db8:3:3::/64 + ! + ! +! +ip forwarding +ipv6 forwarding +! +line vty +! diff --git a/tests/topotests/bgp_srv6l3vpn_over_ipv6/test_bgp_srv6l3vpn_over_ipv6.py b/tests/topotests/bgp_srv6l3vpn_over_ipv6/test_bgp_srv6l3vpn_over_ipv6.py index 6a75fb82f..0b8870cdc 100755 --- a/tests/topotests/bgp_srv6l3vpn_over_ipv6/test_bgp_srv6l3vpn_over_ipv6.py +++ b/tests/topotests/bgp_srv6l3vpn_over_ipv6/test_bgp_srv6l3vpn_over_ipv6.py @@ -44,17 +44,23 @@ pytestmark = [pytest.mark.bgpd] def build_topo(tgen): tgen.add_router("r1") tgen.add_router("r2") + tgen.add_router("r3") tgen.add_router("c11") tgen.add_router("c12") tgen.add_router("c21") tgen.add_router("c22") + tgen.add_router("c31") + tgen.add_router("c32") tgen.add_link(tgen.gears["r1"], tgen.gears["r2"], "eth0", "eth0") - tgen.add_link(tgen.gears["r1"], tgen.gears["c11"], "eth1", "eth0") - tgen.add_link(tgen.gears["r1"], tgen.gears["c12"], "eth2", "eth0") + tgen.add_link(tgen.gears["r1"], tgen.gears["r3"], "eth1", "eth0") + tgen.add_link(tgen.gears["r1"], tgen.gears["c11"], "eth2", "eth0") + tgen.add_link(tgen.gears["r1"], tgen.gears["c12"], "eth3", "eth0") tgen.add_link(tgen.gears["r2"], tgen.gears["c21"], "eth1", "eth0") tgen.add_link(tgen.gears["r2"], tgen.gears["c22"], "eth2", "eth0") + tgen.add_link(tgen.gears["r3"], tgen.gears["c31"], "eth1", "eth0") + tgen.add_link(tgen.gears["r3"], tgen.gears["c32"], "eth2", "eth0") def setup_module(mod): @@ -66,20 +72,23 @@ def setup_module(mod): tgen.start_topology() for rname, router in tgen.routers().items(): - router.load_config(TopoRouter.RD_ZEBRA, - os.path.join(CWD, '{}/zebra.conf'.format(rname))) - router.load_config(TopoRouter.RD_STATIC, - os.path.join(CWD, '{}/staticd.conf'.format(rname))) - router.load_config(TopoRouter.RD_BGP, - os.path.join(CWD, '{}/bgpd.conf'.format(rname))) + router.load_config( + TopoRouter.RD_ZEBRA, os.path.join(CWD, "{}/zebra.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_STATIC, os.path.join(CWD, "{}/staticd.conf".format(rname)) + ) + router.load_config( + TopoRouter.RD_BGP, os.path.join(CWD, "{}/bgpd.conf".format(rname)) + ) tgen.gears["r1"].run("sysctl net.vrf.strict_mode=1") tgen.gears["r1"].run("ip link add vrf10 type vrf table 10") tgen.gears["r1"].run("ip link set vrf10 up") tgen.gears["r1"].run("ip link add vrf20 type vrf table 20") tgen.gears["r1"].run("ip link set vrf20 up") - tgen.gears["r1"].run("ip link set eth1 master vrf10") - tgen.gears["r1"].run("ip link set eth2 master vrf20") + tgen.gears["r1"].run("ip link set eth2 master vrf10") + tgen.gears["r1"].run("ip link set eth3 master vrf20") tgen.gears["r2"].run("sysctl net.vrf.strict_mode=1") tgen.gears["r2"].run("ip link add vrf10 type vrf table 10") @@ -89,6 +98,14 @@ def setup_module(mod): tgen.gears["r2"].run("ip link set eth1 master vrf10") tgen.gears["r2"].run("ip link set eth2 master vrf20") + tgen.gears["r3"].run("sysctl net.vrf.strict_mode=1") + tgen.gears["r3"].run("ip link add vrf10 type vrf table 10") + tgen.gears["r3"].run("ip link set vrf10 up") + tgen.gears["r3"].run("ip link add vrf20 type vrf table 20") + tgen.gears["r3"].run("ip link set vrf20 up") + tgen.gears["r3"].run("ip link set eth1 master vrf10") + tgen.gears["r3"].run("ip link set eth2 master vrf20") + tgen.start_router() @@ -115,12 +132,13 @@ def check_ping4(name, dest_addr, expected): def test_ping(): tgen = get_topogen() - logger.info(tgen.gears["c11"].run("ip route show")) - # tests for ipv4-vpn + check_ping4("c11", "192.168.2.1", True) + check_ping4("c11", "192.168.3.1", True) check_ping4("c12", "192.168.2.1", True) - check_ping4("c21", "192.168.1.1", True) - check_ping4("c22", "192.168.1.1", True) + check_ping4("c12", "192.168.3.1", True) + check_ping4("c21", "192.168.3.1", True) + check_ping4("c22", "192.168.3.1", True) if __name__ == "__main__": |