Page MenuHomeFreeBSD

testing: add ability to specify multi-vnet topologies in the pytest framework.
ClosedPublic

Authored by melifaro on Jul 4 2022, 12:52 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Oct 13, 1:32 PM
Unknown Object (File)
Oct 4 2024, 11:02 AM
Unknown Object (File)
Oct 1 2024, 10:11 PM
Unknown Object (File)
Sep 30 2024, 5:08 AM
Unknown Object (File)
Sep 27 2024, 11:46 AM
Unknown Object (File)
Sep 24 2024, 9:01 AM
Unknown Object (File)
Sep 23 2024, 12:17 AM
Unknown Object (File)
Sep 4 2024, 9:20 PM

Details

Summary

Add ability to specify multi-vnet topologies for the testing framework.

Notable amount of tests related to the packet IO require two VNET jails for proper testing and avoiding side effects for the host system. Additionally, it is often required to run actions in the jails some-sequentially - waiting for the listener initialisation can be an example.

This change extends pytest vnet framework to allow defining multi-vnet multi-epair topologies in declarative style, without any need to bother about jail or repair names. All jail creation/teardown, interface creation/teardown and address assignments are handled automatically.

Example:

  TOPOLOGY = {
      "vnet1": {"ifaces": ["if1", "if2", "if3"]},
      "vnet2": {"ifaces": ["if1", "if2", "if3"]},
      "if1": {"prefixes6": [("2001:db8:a::1/64", "2001:db8:a::2/64")]},
      "if2": {"prefixes6": [("2001:db8:b::1/64", "2001:db8:b::2/64")]},
      "if3": {"prefixes6": [("2001:db8:c::1/64", "2001:db8:c::2/64")]},
  }
 def vnet2_handler(self, vnet, obj_map, pipe):
   ss = VerboseSocketServer("::", self.DEFAULT_PORT)
   pipe.send("READY")

def test_output6_base(self):
  self.wait_object(second_vnet.pipe)

The definitions above will create 2 vnets ("jail_test_output6_base", "jail_test_output6_base_2"), 3 epairs, attached to both first and second jails, set up the IP addresses for each repair, spawn another process for vnet2_handler and pass control to vnet2_handler and test_output6_base. Both processes can pass objects between each other using pre-created pipes.

Add ip6_output() tests

Using the framework above, add tests for ip6_output() combined with the unicast/multicast options, altering packet behaviour.

Test Plan

13:34 [0] m@devel2 s kyua test -k /usr/tests/sys/netinet6/Kyuafile test_ip6_output.py
test_ip6_output.py:TestIP6Output::test_output6_base -> passed [0.396s]
test_ip6_output.py:TestIP6Output::test_output6_nhop -> passed [0.401s]
test_ip6_output.py:TestIP6Output::test_output6_pktinfo[empty] -> passed [0.402s]
test_ip6_output.py:TestIP6Output::test_output6_pktinfo[ifsame] -> passed [0.403s]
test_ip6_output.py:TestIP6Output::test_output6_pktinfo[ipandif] -> passed [0.413s]
test_ip6_output.py:TestIP6Output::test_output6_pktinfo[iponly1] -> passed [0.406s]
test_ip6_output.py:TestIP6Output::test_output6_pktinfo[nolocalip] -> passed [0.404s]
test_ip6_output.py:TestIP6OutputLL::test_output6_linklocal -> passed [0.424s]
test_ip6_output.py:TestIP6OutputMulticast::test_output6_multicast[ff02] -> passed [0.410s]
test_ip6_output.py:TestIP6OutputMulticast::test_output6_multicast[ff05] -> passed [0.422s]
test_ip6_output.py:TestIP6OutputMulticast::test_output6_multicast[ff08] -> passed [0.408s]
test_ip6_output.py:TestIP6OutputMulticast::test_output6_multicast[ff0e] -> passed [0.409s]
test_ip6_output.py:TestIP6OutputNhopLL::test_output6_nhop_linklocal -> skipped: Currently fails [0.204s]

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

melifaro edited the test plan for this revision. (Show Details)
melifaro added reviewers: tests, kp, ngie, network.
melifaro retitled this revision from testing: add ip6_output() tests to testing: add ability to specify multi-vnet topologies in the pytest framework..
This revision was not accepted when it landed; it landed in state Needs Review.Jul 7 2022, 10:11 AM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.