]> git.puffer.fish Git - matthieu/frr.git/commitdiff
tests: Validating staticd v4-over-v6 nexthop
authorChristopher Dziomba <christopher.dziomba@telekom.de>
Mon, 14 Apr 2025 17:23:16 +0000 (19:23 +0200)
committerChristopher Dziomba <christopher.dziomba@telekom.de>
Mon, 14 Apr 2025 17:34:11 +0000 (19:34 +0200)
Introducing do_ipv6_nexthop to static_simple topotest. The test
configures IPv4 routes with IPv6 nexthop and validates that via
inet6 is visible in the Linux Kernel

Signed-off-by: Christopher Dziomba <christopher.dziomba@telekom.de>
tests/topotests/static_simple/test_static_simple.py

index afde58fbf71ee4ae32c191ecae8587148028cda3..615d1621f39c1dacc42af22e2654c8eed6027dd9 100644 (file)
@@ -111,6 +111,7 @@ def do_config_inner(
     count,
     add=True,
     do_ipv6=False,
+    do_ipv6_nexthop=False,
     do_sadr=False,
     via=None,
     vrf=None,
@@ -129,6 +130,8 @@ def do_config_inner(
         src_prefs = ["2001:db8:1111::/48", "2001:db8:2222::/48"]
     elif do_ipv6:
         super_prefs = ["2001::/48", "2002::/48"]
+    elif do_ipv6_nexthop:
+        super_prefs = ["11.0.0.0/8", "21.0.0.0/8"]
     else:
         super_prefs = ["10.0.0.0/8", "20.0.0.0/8"]
 
@@ -142,11 +145,19 @@ def do_config_inner(
         matchvia = f"dev {via}"
     else:
         if vrf:
-            via = "2102::2" if do_ipv6 else "102.0.0.2"
-            matchvia = f"via {via} dev r1-eth1"
+            via = "2102::2" if do_ipv6 or do_ipv6_nexthop else "102.0.0.2"
+            matchvia = (
+                f"via inet6 {via} dev r1-eth1"
+                if not do_ipv6 and do_ipv6_nexthop
+                else f"via {via} dev r1-eth1"
+            )
         else:
-            via = "2101::2" if do_ipv6 else "101.0.0.2"
-            matchvia = f"via {via} dev r1-eth0"
+            via = "2101::2" if do_ipv6 or do_ipv6_nexthop else "101.0.0.2"
+            matchvia = (
+                f"via inet6 {via} dev r1-eth0"
+                if not do_ipv6 and do_ipv6_nexthop
+                else f"via {via} dev r1-eth0"
+            )
 
     vrfdbg = " in vrf {}".format(vrf) if vrf else ""
     logger.debug("{} {} static {} routes{}".format(optype, count, iptype, vrfdbg))
@@ -201,6 +212,7 @@ def do_config_inner(
 
 def do_config(*args, **kwargs):
     do_config_inner(*args, do_ipv6=False, do_sadr=False, **kwargs)
+    do_config_inner(*args, do_ipv6=False, do_ipv6_nexthop=True, **kwargs)
     do_config_inner(*args, do_ipv6=True, do_sadr=False, **kwargs)
     do_config_inner(*args, do_ipv6=True, do_sadr=True, **kwargs)