···
-
{ system ? builtins.currentSystem,
-
pkgs ? import ../.. { inherit system config; }
-
with import ../lib/testing-python.nix { inherit system pkgs; };
···
description = "Mock webserver";
wants = [ "network-online.target" ];
wantedBy = [ "multi-user.target" ];
-
serviceConfig.Restart = "always";
···
# This test simulates the setup described in [1] with two IPv6 and
# IPv4-only devices on different subnets communicating through a border
# relay running Jool in SIIT mode.
···
meta.maintainers = with lib.maintainers; [ rnhmjoj ];
-
nodes.relay = { ... }: {
-
imports = [ ../modules/profiles/minimal.nix ];
virtualisation.vlans = [ 1 2 ];
···
eth2.ipv4.addresses = [ { address = "192.0.2.1"; prefixLength = 24; } ];
-
siit.config.global.pool6 = "fd::/96";
-
nodes.alice = { ... }: {
-
../modules/profiles/minimal.nix
-
(webserver 6 "Hello, Bob!")
virtualisation.vlans = [ 1 ];
networking.interfaces.eth1.ipv6 = {
···
-
../modules/profiles/minimal.nix
-
(webserver 4 "Hello, Alice!")
virtualisation.vlans = [ 2 ];
networking.interfaces.eth1.ipv4 = {
···
-
relay.wait_for_unit("jool-siit.service")
alice.wait_for_unit("network-addresses-eth1.service")
bob.wait_for_unit("network-addresses-eth1.service")
with subtest("Alice and Bob can't ping each other"):
-
relay.systemctl("stop jool-siit.service")
alice.fail("ping -c1 fd::192.0.2.16")
bob.fail("ping -c1 198.51.100.8")
with subtest("Alice and Bob can ping using the relay"):
-
relay.systemctl("start jool-siit.service")
alice.wait_until_succeeds("ping -c1 fd::192.0.2.16")
bob.wait_until_succeeds("ping -c1 198.51.100.8")
···
# This test simulates the setup described in [1] with two IPv6-only nodes
# (a client and a homeserver) on the LAN subnet and an IPv4 node on the WAN.
# The router runs Jool in stateful NAT64 mode, masquarading the LAN and
···
meta.maintainers = with lib.maintainers; [ rnhmjoj ];
-
nodes.router = { ... }: {
-
imports = [ ../modules/profiles/minimal.nix ];
virtualisation.vlans = [ 1 2 ];
···
eth2.ipv4.addresses = [ { address = "203.0.113.1"; prefixLength = 24; } ];
-
{ # forward HTTP 203.0.113.1 (router) → 2001:db8::9 (homeserver)
-
"ipv4 address" = "203.0.113.1#80";
-
"ipv6 address" = "2001:db8::9#80";
-
# Ports for dynamic translation
-
{ protocol = "TCP"; prefix = "203.0.113.1/32"; "port range" = "40001-65535"; }
-
{ protocol = "UDP"; prefix = "203.0.113.1/32"; "port range" = "40001-65535"; }
-
{ protocol = "ICMP"; prefix = "203.0.113.1/32"; "port range" = "40001-65535"; }
-
# Ports for static BIB entries
-
{ protocol = "TCP"; prefix = "203.0.113.1/32"; "port range" = "80"; }
-
nodes.client = { ... }: {
-
imports = [ ../modules/profiles/minimal.nix ipv6Only ];
virtualisation.vlans = [ 1 ];
networking.interfaces.eth1.ipv6 = {
···
-
nodes.homeserver = { ... }: {
-
../modules/profiles/minimal.nix
-
(webserver 6 "Hello from IPv6!")
virtualisation.vlans = [ 1 ];
networking.interfaces.eth1.ipv6 = {
···
-
nodes.server = { ... }: {
-
../modules/profiles/minimal.nix
-
(webserver 4 "Hello from IPv4!")
virtualisation.vlans = [ 2 ];
networking.interfaces.eth1.ipv4.addresses =
···
node.wait_for_unit("network-addresses-eth1.service")
with subtest("Client can ping the WAN server"):
-
router.wait_for_unit("jool-nat64.service")
client.succeed("ping -c1 64:ff9b::203.0.113.16")
with subtest("Client can connect to the WAN webserver"):