From: Donald Sharp Date: Wed, 9 Apr 2025 15:20:49 +0000 (-0400) Subject: tests: Add ability to test ipv6 ra pref64 extension X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=refs%2Fpull%2F18626%2Fhead;p=mirror%2Ffrr.git 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 --- diff --git a/tests/topotests/zebra_pref64/r1/frr.conf b/tests/topotests/zebra_pref64/r1/frr.conf new file mode 100644 index 0000000000..b244791ac3 --- /dev/null +++ b/tests/topotests/zebra_pref64/r1/frr.conf @@ -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 + diff --git a/tests/topotests/zebra_pref64/r2/frr.conf b/tests/topotests/zebra_pref64/r2/frr.conf new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/topotests/zebra_pref64/rx_ipv6_ra_8781.py b/tests/topotests/zebra_pref64/rx_ipv6_ra_8781.py old mode 100644 new mode 100755 diff --git a/tests/topotests/zebra_pref64/test_zebra_prefix64.py b/tests/topotests/zebra_pref64/test_zebra_prefix64.py new file mode 100644 index 0000000000..c9ff776754 --- /dev/null +++ b/tests/topotests/zebra_pref64/test_zebra_prefix64.py @@ -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)