]> git.puffer.fish Git - mirror/frr.git/commitdiff
tests: Add ability to test ipv6 ra pref64 extension 11224/head 18626/head
authorDonald Sharp <sharpd@nvidia.com>
Wed, 9 Apr 2025 15:20:49 +0000 (11:20 -0400)
committerDavid Lamparter <equinox@opensourcerouting.org>
Tue, 15 Apr 2025 12:20:28 +0000 (14:20 +0200)
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>
tests/topotests/zebra_pref64/r1/frr.conf [new file with mode: 0644]
tests/topotests/zebra_pref64/r2/frr.conf [new file with mode: 0644]
tests/topotests/zebra_pref64/rx_ipv6_ra_8781.py [changed mode: 0644->0755]
tests/topotests/zebra_pref64/test_zebra_prefix64.py [new file with mode: 0644]

diff --git a/tests/topotests/zebra_pref64/r1/frr.conf b/tests/topotests/zebra_pref64/r1/frr.conf
new file mode 100644 (file)
index 0000000..b244791
--- /dev/null
@@ -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 (file)
index 0000000..e69de29
old mode 100644 (file)
new mode 100755 (executable)
diff --git a/tests/topotests/zebra_pref64/test_zebra_prefix64.py b/tests/topotests/zebra_pref64/test_zebra_prefix64.py
new file mode 100644 (file)
index 0000000..c9ff776
--- /dev/null
@@ -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)