Skip to content

Commit edff298

Browse files
committed
tests: Add ability to test ipv6 ra pref64 extension
This is the test to ensure that the ipv6 ra pref64 extension is working properly.. This is a very simple test. Enables the feature on r1 to send out the ra's once every 3 seconds with the feature turned on. Then on r2 ensure that we see the ra with the appropriate values. Signed-off-by: Donald Sharp <[email protected]>
1 parent 318b0ae commit edff298

File tree

4 files changed

+76
-0
lines changed

4 files changed

+76
-0
lines changed

Diff for: tests/topotests/zebra_pref64/r1/frr.conf

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
log timestamp precision 6
2+
log file frr.log
3+
4+
interface r1-eth0
5+
ip address 1.1.1.1/24
6+
ipv6 address 2001:1111::1/64
7+
ipv6 nd nat64
8+
no ipv6 nd suppress-ra
9+
ipv6 nd ra-interval 3
10+
exit
11+
12+
interface r1-eth1
13+
ip address 2.2.2.1/24
14+
ipv6 address 2002:2222::1/64
15+
ipv6 nd nat64 64:ff9b::3/64 lifetime 15
16+
no ipv6 nd suppress-ra
17+
ipv6 nd ra-interval 3
18+
exit
19+

Diff for: tests/topotests/zebra_pref64/r2/frr.conf

Whitespace-only changes.

Diff for: tests/topotests/zebra_pref64/rx_ipv6_ra_8781.py

100644100755
File mode changed.

Diff for: tests/topotests/zebra_pref64/test_zebra_prefix64.py

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/usr/bin/env python
2+
# -*- coding: utf-8 eval: (blacken-mode 1) -*-
3+
# SPDX-License-Identifier: ISC
4+
#
5+
# Copyright (c) 2025 Nvidia Inc.
6+
# Donald Sharp
7+
#
8+
"""
9+
Test zebra ipv6 nd nat64 advertisement
10+
11+
Requires scapy 2.6.1 or greater
12+
"""
13+
14+
import os
15+
import pytest
16+
import json
17+
from lib.topogen import Topogen
18+
from lib.topolog import logger
19+
20+
CWD = os.path.dirname(os.path.realpath(__file__))
21+
22+
pytestmark = [pytest.mark.mgmtd]
23+
24+
25+
@pytest.fixture(scope="module")
26+
def tgen(request):
27+
"Setup/Teardown the environment and provide tgen argument to tests"
28+
29+
topodef = {"s1": ("r1", "r2"), "s2": ("r1", "r2")}
30+
31+
tgen = Topogen(topodef, request.module.__name__)
32+
tgen.start_topology()
33+
34+
router_list = tgen.routers()
35+
for rname, router in router_list.items():
36+
router.load_frr_config("frr.conf")
37+
38+
tgen.start_router()
39+
yield tgen
40+
tgen.stop_topology()
41+
42+
43+
def test_zebra_rapref64_sent(tgen):
44+
if tgen.routers_have_failure():
45+
pytest.skip(tgen.errors)
46+
47+
r2 = tgen.gears["r2"]
48+
49+
r2.cmd_raises("{}/rx_ipv6_ra_8781.py r2-eth0 64:ff9b::/96 16 10".format(CWD))
50+
r2.cmd_raises("{}/rx_ipv6_ra_8781.py r2-eth1 64:ff9b::/64 16 10".format(CWD))
51+
52+
53+
if __name__ == "__main__":
54+
# To suppress tracebacks, either use the following pytest call or add "--tb=no" to cli
55+
# retval = pytest.main(["-s", "--tb=no"])
56+
retval = pytest.main(["-s"])
57+
sys.exit(retval)

0 commit comments

Comments
 (0)