at 25.11-pre 2.5 kB view raw
1import ./make-test-python.nix ( 2 { pkgs, lib, ... }: 3 { 4 name = "connman"; 5 meta = with lib.maintainers; { 6 maintainers = [ rnhmjoj ]; 7 }; 8 9 # Router running radvd on VLAN 1 10 nodes.router = 11 { ... }: 12 { 13 imports = [ ../modules/profiles/minimal.nix ]; 14 15 virtualisation.vlans = [ 1 ]; 16 17 boot.kernel.sysctl."net.ipv6.conf.all.forwarding" = true; 18 19 networking = { 20 useDHCP = false; 21 interfaces.eth1.ipv6.addresses = [ 22 { 23 address = "fd12::1"; 24 prefixLength = 64; 25 } 26 ]; 27 }; 28 29 services.radvd = { 30 enable = true; 31 config = '' 32 interface eth1 { 33 AdvSendAdvert on; 34 AdvManagedFlag on; 35 AdvOtherConfigFlag on; 36 prefix fd12::/64 { 37 AdvAutonomous off; 38 }; 39 }; 40 ''; 41 }; 42 }; 43 44 # Client running connman, connected to VLAN 1 45 nodes.client = 46 { ... }: 47 { 48 virtualisation.vlans = [ 1 ]; 49 50 # add a virtual wlan interface 51 boot.kernelModules = [ "mac80211_hwsim" ]; 52 boot.extraModprobeConfig = '' 53 options mac80211_hwsim radios=1 54 ''; 55 56 # Note: the overrides are needed because the wifi is 57 # disabled with mkVMOverride in qemu-vm.nix. 58 services.connman.enable = lib.mkOverride 0 true; 59 services.connman.networkInterfaceBlacklist = [ "eth0" ]; 60 networking.wireless.enable = lib.mkOverride 0 true; 61 networking.wireless.interfaces = [ "wlan0" ]; 62 }; 63 64 testScript = '' 65 start_all() 66 67 with subtest("Router is ready"): 68 router.wait_for_unit("radvd.service") 69 70 with subtest("Daemons are running"): 71 client.wait_for_unit("wpa_supplicant-wlan0.service") 72 client.wait_for_unit("connman.service") 73 client.wait_until_succeeds("connmanctl state | grep -q ready") 74 75 with subtest("Wired interface is configured"): 76 client.wait_until_succeeds("ip -6 route | grep -q fd12::/64") 77 client.wait_until_succeeds("ping -c 1 fd12::1") 78 79 with subtest("Can set up a wireless access point"): 80 client.succeed("connmanctl enable wifi") 81 client.wait_until_succeeds("connmanctl tether wifi on nixos-test reproducibility | grep -q 'Enabled'") 82 client.wait_until_succeeds("iw wlan0 info | grep -q nixos-test") 83 ''; 84 } 85)