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 <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2025-04-09 11:20:49 -04:00 committed by David Lamparter
parent 5fd36a5818
commit fd9ff5e0e2
4 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,19 @@
log timestamp precision 6
log file frr.log
interface r1-eth0
ip address 1.1.1.1/24
ipv6 address 2001:1111::1/64
ipv6 nd nat64
no ipv6 nd suppress-ra
ipv6 nd ra-interval 3
exit
interface r1-eth1
ip address 2.2.2.1/24
ipv6 address 2002:2222::1/64
ipv6 nd nat64 64:ff9b::3/64 lifetime 15
no ipv6 nd suppress-ra
ipv6 nd ra-interval 3
exit

View file

0
tests/topotests/zebra_pref64/rx_ipv6_ra_8781.py Normal file → Executable file
View file

View file

@ -0,0 +1,57 @@
#!/usr/bin/env python
# -*- coding: utf-8 eval: (blacken-mode 1) -*-
# SPDX-License-Identifier: ISC
#
# Copyright (c) 2025 Nvidia Inc.
# Donald Sharp
#
"""
Test zebra ipv6 nd nat64 advertisement
Requires scapy 2.6.1 or greater
"""
import os
import pytest
import json
from lib.topogen import Topogen
from lib.topolog import logger
CWD = os.path.dirname(os.path.realpath(__file__))
pytestmark = [pytest.mark.mgmtd]
@pytest.fixture(scope="module")
def tgen(request):
"Setup/Teardown the environment and provide tgen argument to tests"
topodef = {"s1": ("r1", "r2"), "s2": ("r1", "r2")}
tgen = Topogen(topodef, request.module.__name__)
tgen.start_topology()
router_list = tgen.routers()
for rname, router in router_list.items():
router.load_frr_config("frr.conf")
tgen.start_router()
yield tgen
tgen.stop_topology()
def test_zebra_rapref64_sent(tgen):
if tgen.routers_have_failure():
pytest.skip(tgen.errors)
r2 = tgen.gears["r2"]
r2.cmd_raises("{}/rx_ipv6_ra_8781.py r2-eth0 64:ff9b::/96 16 10".format(CWD))
r2.cmd_raises("{}/rx_ipv6_ra_8781.py r2-eth1 64:ff9b::/64 16 10".format(CWD))
if __name__ == "__main__":
# To suppress tracebacks, either use the following pytest call or add "--tb=no" to cli
# retval = pytest.main(["-s", "--tb=no"])
retval = pytest.main(["-s"])
sys.exit(retval)