Skip to content

Commit

Permalink
tests: ipv6 global removal in bgp_nexthop_mp_ipv4_6
Browse files Browse the repository at this point in the history
Test ipv6 global removal in bgp_nexthop_mp_ipv4_6

Signed-off-by: Louis Scalbert <louis.scalbert@6wind.com>
  • Loading branch information
louis-6wind committed Mar 28, 2024
1 parent 0d5519a commit d1545c7
Show file tree
Hide file tree
Showing 9 changed files with 326 additions and 0 deletions.
54 changes: 54 additions & 0 deletions tests/topotests/bgp_nexthop_mp_ipv4_6/r1/bgp_ipv6_step2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"routes": {
"fd00:500::/64": [
{
"valid": true,
"bestpath": true,
"path": "",
"nexthops": [
{
"ip": "::",
"afi": "ipv6",
"used": true
}
]
}
],
"fd00:600::/64": [
{
"valid": true,
"multipath": true,
"path": "65000 65600",
"nexthops": [
{
"ip": "fd00:0:2::3",
"afi": "ipv6",
"scope": "global"
},
{
"afi": "ipv6",
"scope": "link-local",
"used": true
}
]
},
{
"valid": true,
"bestpath": true,
"path": "65000 65600",
"nexthops": [
{
"ip": "fd00:0:1::2",
"afi": "ipv6",
"scope": "global"
},
{
"afi": "ipv6",
"scope": "link-local",
"used": true
}
]
}
]
}
}
33 changes: 33 additions & 0 deletions tests/topotests/bgp_nexthop_mp_ipv4_6/r2/bgp_ipv6_step2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"routes": {
"fd00:500::/64": [
{
"valid": true,
"bestpath": true,
"path": "65500",
"nexthops": [
{
"afi": "ipv6",
"scope": "link-local",
"used": true
}
]
}
],
"fd00:600::/64": [
{
"valid": true,
"bestpath": true,
"path": "65600",
"nexthops": [
{
"ip": "fd00:1000::6",
"scope": "global",
"afi": "ipv6",
"used": true
}
]
}
]
}
}
33 changes: 33 additions & 0 deletions tests/topotests/bgp_nexthop_mp_ipv4_6/r3/bgp_ipv6_step2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"routes": {
"fd00:500::/64": [
{
"valid": true,
"bestpath": true,
"path": "65500",
"nexthops": [
{
"afi": "ipv6",
"scope": "link-local",
"used": true
}
]
}
],
"fd00:600::/64": [
{
"valid": true,
"bestpath": true,
"path": "65600",
"nexthops": [
{
"ip": "fd00:1000::6",
"scope": "global",
"afi": "ipv6",
"used": true
}
]
}
]
}
}
34 changes: 34 additions & 0 deletions tests/topotests/bgp_nexthop_mp_ipv4_6/r4/bgp_ipv6_step2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"routes": {
"fd00:500::/64": [
{
"valid": true,
"bestpath": true,
"path": "65500",
"nexthops": [
{
"ip": "fd00:1000::2",
"afi": "ipv6",
"scope": "global",
"used": true
}
]
}
],
"fd00:600::/64": [
{
"valid": true,
"bestpath": true,
"path": "65600",
"nexthops": [
{
"ip": "fd00:1000::6",
"scope": "global",
"afi": "ipv6",
"used": true
}
]
}
]
}
}
32 changes: 32 additions & 0 deletions tests/topotests/bgp_nexthop_mp_ipv4_6/r6/bgp_ipv6_step2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"routes": {
"fd00:500::/64": [
{
"valid": true,
"bestpath": true,
"nexthops": [
{
"ip": "fd00:1000::2",
"afi": "ipv6",
"scope": "global",
"used": true
}
]
}
],
"fd00:600::/64": [
{
"valid": true,
"bestpath": true,
"path": "65600",
"nexthops": [
{
"afi": "ipv6",
"scope": "link-local",
"used": true
}
]
}
]
}
}
37 changes: 37 additions & 0 deletions tests/topotests/bgp_nexthop_mp_ipv4_6/r7/bgp_ipv6_step2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"routes": {
"fd00:500::/64": [
{
"valid": true,
"bestpath": true,
"path": "65000 65500",
"nexthops": [
{
"ip": "fd00:0:9::6",
"afi": "ipv6",
"scope": "global"
},
{
"afi": "ipv6",
"scope": "link-local",
"used": true
}
]
}
],
"fd00:600::/64": [
{
"valid": true,
"bestpath": true,
"path": "",
"nexthops": [
{
"ip": "::",
"afi": "ipv6",
"used": true
}
]
}
]
}
}
47 changes: 47 additions & 0 deletions tests/topotests/bgp_nexthop_mp_ipv4_6/rr1/bgp_ipv6_step2.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"routes": {
"fd00:500::/64": [
{
"valid": true,
"bestpath": true,
"path": "65500",
"nexthops": [
{
"ip": "fd00:1000::2",
"afi": "ipv6",
"scope": "global",
"used": true
}
]
},
{
"valid": true,
"multipath": true,
"path": "65500",
"nexthops": [
{
"ip": "fd00:1000::3",
"afi": "ipv6",
"scope": "global",
"used": true
}
]
}
],
"fd00:600::/64": [
{
"valid": true,
"bestpath": true,
"path": "65600",
"nexthops": [
{
"ip": "fd00:1000::6",
"afi": "ipv6",
"scope": "global",
"used": true
}
]
}
]
}
}
55 changes: 55 additions & 0 deletions tests/topotests/bgp_nexthop_mp_ipv4_6/test_nexthop_mp_ipv4_6.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,61 @@ def test_bgp_ping_ok_step1():
check_ping("h1", "fd00:600::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
"""
)
tgen.gears["r7"].vtysh_cmd(
"""
configure
interface eth-r6
no ipv6 address fd00:0:9::7/64
"""
)

for rname, router in tgen.routers().items():
if "h" in rname:
# hosts
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"
tgen = get_topogen()
if tgen.routers_have_failure():
pytest.skip(tgen.errors)

check_ping("h1", "192.168.6.1", True, 5, 1)
check_ping("h1", "fd00:600::1", True, 5, 1)


if __name__ == "__main__":
args = ["-s"] + sys.argv[1:]
sys.exit(pytest.main(args))

0 comments on commit d1545c7

Please sign in to comment.