1 import ./make-test-python.nix ({ lib, ... }: {
2 name = "systemd-initrd-vlan";
3 meta.maintainers = [ lib.maintainers.majiir ];
5 # Tests VLAN interface configuration in systemd-initrd.
7 # Two nodes are configured for a tagged VLAN. (Note that they also still have
8 # their ordinary eth0 and eth1 interfaces, which are not VLAN-tagged.)
10 # The 'server' node waits forever in initrd (stage 1) with networking
11 # enabled. The 'client' node pings it to test network connectivity.
20 interfaces."eth1.10" = {
22 address = "192.168.10.${id}";
29 # Node that will use initrd networking.
30 server = network "1" // {
31 boot.initrd.systemd.enable = true;
32 boot.initrd.network.enable = true;
33 boot.initrd.systemd.services.boot-blocker = {
34 before = [ "initrd.target" ];
35 wantedBy = [ "initrd.target" ];
36 script = "sleep infinity";
37 serviceConfig.Type = "oneshot";
41 # Node that will ping the server.
47 client.wait_for_unit("network.target")
49 # Wait for the regular (untagged) interface to be up.
50 def server_is_up(_) -> bool:
51 status, _ = client.execute("ping -n -c 1 server >&2")
53 with client.nested("waiting for server to come up"):
56 # Try to ping the (tagged) VLAN interface.
57 client.succeed("ping -n -w 10 -c 1 192.168.10.1 >&2")