diff options
author | Louis Scalbert <louis.scalbert@6wind.com> | 2024-03-28 13:58:33 +0100 |
---|---|---|
committer | Louis Scalbert <louis.scalbert@6wind.com> | 2024-04-23 11:28:36 +0200 |
commit | 04c220bedb63334a65677a46ef84938cc812221f (patch) | |
tree | e7d90f0b5004bc273ff4c4e021aac6637a925ddb /tests | |
parent | bgpd: fix "used" json key on link-local nexthop (diff) | |
download | frr-04c220bedb63334a65677a46ef84938cc812221f.tar.xz frr-04c220bedb63334a65677a46ef84938cc812221f.zip |
tests: ipv6 global removal in bgp_nexthop_mp_ipv4_6
Test ipv6 global removal in bgp_nexthop_mp_ipv4_6
Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
Diffstat (limited to 'tests')
10 files changed, 542 insertions, 0 deletions
diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json new file mode 100755 index 000000000..f7c5c7c3b --- /dev/null +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json @@ -0,0 +1,90 @@ +{ + "routes": { + "fd00:100::/64": [ + { + "valid": true, + "bestpath": true, + "path": "", + "nexthops": [ + { + "ip": "::", + "afi": "ipv6", + "used": true + } + ] + } + ], + "fd00:700::/64": [ + { + "valid": true, + "multipath": true, + "path": "65000 65700", + "nexthops": [ + { + "ip": "fd00:0:2::3", + "afi": "ipv6", + "scope": "global" + }, + { + "afi": "ipv6", + "scope": "link-local", + "used": true + } + ] + }, + { + "valid": true, + "bestpath": true, + "path": "65000 65700", + "nexthops": [ + { + "ip": "fd00:0:1::2", + "afi": "ipv6", + "scope": "global" + }, + { + "afi": "ipv6", + "scope": "link-local", + "used": true + } + ] + } + ], + "fd00:800::/64": [ + { + "valid": true, + "multipath": true, + "path": "65000 65800", + "nexthops": [ + { + "ip": "fd00:0:2::3", + "afi": "ipv6", + "scope": "global" + }, + { + "afi": "ipv6", + "scope": "link-local", + "used": true + } + ] + }, + { + "valid": true, + "bestpath": true, + "path": "65000 65800", + "nexthops": [ + { + "ip": "fd00:0:1::2", + "afi": "ipv6", + "scope": "global" + }, + { + "afi": "ipv6", + "scope": "link-local", + "used": true + } + ] + } + ] + } +} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json new file mode 100644 index 000000000..21f36089b --- /dev/null +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json @@ -0,0 +1,48 @@ +{ + "routes": { + "fd00:100::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65100", + "nexthops": [ + { + "afi": "ipv6", + "scope": "link-local", + "used": true + } + ] + } + ], + "fd00:700::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65700", + "nexthops": [ + { + "ip": "fd00:0:9::7", + "scope": "global", + "afi": "ipv6", + "used": true + } + ] + } + ], + "fd00:800::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65800", + "nexthops": [ + { + "ip": "fd00:0:9::8", + "scope": "global", + "afi": "ipv6", + "used": true + } + ] + } + ] + } +} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json new file mode 100644 index 000000000..21f36089b --- /dev/null +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json @@ -0,0 +1,48 @@ +{ + "routes": { + "fd00:100::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65100", + "nexthops": [ + { + "afi": "ipv6", + "scope": "link-local", + "used": true + } + ] + } + ], + "fd00:700::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65700", + "nexthops": [ + { + "ip": "fd00:0:9::7", + "scope": "global", + "afi": "ipv6", + "used": true + } + ] + } + ], + "fd00:800::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65800", + "nexthops": [ + { + "ip": "fd00:0:9::8", + "scope": "global", + "afi": "ipv6", + "used": true + } + ] + } + ] + } +} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json new file mode 100755 index 000000000..7d0786c0e --- /dev/null +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json @@ -0,0 +1,49 @@ +{ + "routes": { + "fd00:100::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65100", + "nexthops": [ + { + "ip": "2001:db8::2", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ], + "fd00:700::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65700", + "nexthops": [ + { + "ip": "fd00:0:9::7", + "scope": "global", + "afi": "ipv6", + "used": true + } + ] + } + ], + "fd00:800::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65800", + "nexthops": [ + { + "ip": "fd00:0:9::8", + "scope": "global", + "afi": "ipv6", + "used": true + } + ] + } + ] + } +} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step2.json new file mode 100755 index 000000000..7d0786c0e --- /dev/null +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/r5/bgp_ipv6_step2.json @@ -0,0 +1,49 @@ +{ + "routes": { + "fd00:100::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65100", + "nexthops": [ + { + "ip": "2001:db8::2", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ], + "fd00:700::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65700", + "nexthops": [ + { + "ip": "fd00:0:9::7", + "scope": "global", + "afi": "ipv6", + "used": true + } + ] + } + ], + "fd00:800::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65800", + "nexthops": [ + { + "ip": "fd00:0:9::8", + "scope": "global", + "afi": "ipv6", + "used": true + } + ] + } + ] + } +} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json new file mode 100644 index 000000000..55912dd74 --- /dev/null +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json @@ -0,0 +1,48 @@ +{ + "routes": { + "fd00:100::/64": [ + { + "valid": true, + "bestpath": true, + "nexthops": [ + { + "ip": "2001:db8::2", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ], + "fd00:700::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65700", + "nexthops": [ + { + "ip": "fd00:0:9::7", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ], + "fd00:800::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65800", + "nexthops": [ + { + "ip": "fd00:0:9::8", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ] + } +} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json new file mode 100644 index 000000000..8fe5f7c1d --- /dev/null +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json @@ -0,0 +1,48 @@ +{ + "routes": { + "fd00:100::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65000 65100", + "nexthops": [ + { + "ip": "fd00:0:9::6", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ], + "fd00:700::/64": [ + { + "valid": true, + "bestpath": true, + "path": "", + "nexthops": [ + { + "ip": "::", + "afi": "ipv6", + "used": true + } + ] + } + ], + "fd00:800::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65800", + "nexthops": [ + { + "ip": "fd00:0:9::8", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ] + } +} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step2.json new file mode 100644 index 000000000..20f494032 --- /dev/null +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/r8/bgp_ipv6_step2.json @@ -0,0 +1,48 @@ +{ + "routes": { + "fd00:100::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65000 65100", + "nexthops": [ + { + "ip": "fd00:0:9::6", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ], + "fd00:700::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65700", + "nexthops": [ + { + "ip": "fd00:0:9::7", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ], + "fd00:800::/64": [ + { + "valid": true, + "bestpath": true, + "path": "", + "nexthops": [ + { + "ip": "::", + "afi": "ipv6", + "used": true + } + ] + } + ] + } +} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json new file mode 100644 index 000000000..4ab0e1c2a --- /dev/null +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json @@ -0,0 +1,62 @@ +{ + "routes": { + "fd00:100::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65100", + "nexthops": [ + { + "ip": "2001:db8::2", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + }, + { + "valid": true, + "multipath": true, + "path": "65100", + "nexthops": [ + { + "ip": "2001:db8::3", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ], + "fd00:700::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65700", + "nexthops": [ + { + "ip": "fd00:0:9::7", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ], + "fd00:800::/64": [ + { + "valid": true, + "bestpath": true, + "path": "65800", + "nexthops": [ + { + "ip": "fd00:0:9::8", + "afi": "ipv6", + "scope": "global", + "used": true + } + ] + } + ] + } +} diff --git a/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py b/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py index a58debd3e..0058f213d 100644 --- a/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py +++ b/tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py @@ -226,6 +226,58 @@ def test_bgp_ping_ok_step1(): check_ping("h1", "fd00:800::1", True, 5, 1) +def test_bgp_ipv6_nexthop_step2(): + """ + Remove IPv6 global on r1 and r7 + Assert that BGP has correct ipv6 nexthops. + """ + + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + tgen.gears["r1"].vtysh_cmd( + """ +configure +interface eth-r2 + no ipv6 address fd00:0:1::1/64 +! +interface eth-r3 + no ipv6 address fd00:0:2::1/64 +""" + ) + + for rname, router in tgen.routers().items(): + if "h" in rname: + # hosts + continue + if "rs1" in rname: + continue + ref_file = "{}/{}/bgp_ipv6_step2.json".format(CWD, rname) + expected = json.loads(open(ref_file).read()) + test_func = partial( + topotest.router_json_cmp, + router, + "show bgp ipv6 unicast json", + expected, + ) + _, res = topotest.run_and_expect(test_func, None, count=30, wait=1) + assertmsg = "{}: BGP IPv6 Nexthop failure".format(rname) + assert res is None, assertmsg + + +def test_bgp_ping_ok_step2(): + "Check that h1 pings h2 and h3" + tgen = get_topogen() + if tgen.routers_have_failure(): + pytest.skip(tgen.errors) + + check_ping("h1", "192.168.7.1", True, 5, 1) + check_ping("h1", "fd00:700::1", True, 5, 1) + check_ping("h1", "192.168.8.1", True, 5, 1) + check_ping("h1", "fd00:800::1", True, 5, 1) + + if __name__ == "__main__": args = ["-s"] + sys.argv[1:] sys.exit(pytest.main(args)) |