python3Packages.xknx: 1.1.0 -> 1.2.0
[NixPkgs.git] / nixos / tests / kea.nix
blobb1d5894cc7cd2af1f8839e5ff8888dfea34f517e
1 import ./make-test-python.nix ({ pkgs, lib, ...}: {
2   meta.maintainers = with lib.maintainers; [ hexa ];
4   name = "kea";
6   nodes = {
7     router = { config, pkgs, ... }: {
8       virtualisation.vlans = [ 1 ];
10       networking = {
11         useNetworkd = true;
12         useDHCP = false;
13         firewall.allowedUDPPorts = [ 67 ];
14       };
16       systemd.network = {
17         networks = {
18           "01-eth1" = {
19             name = "eth1";
20             networkConfig = {
21               Address = "10.0.0.1/30";
22             };
23           };
24         };
25       };
27       services.kea.dhcp4 = {
28         enable = true;
29         settings = {
30           valid-lifetime = 3600;
31           renew-timer = 900;
32           rebind-timer = 1800;
34           lease-database = {
35             type = "memfile";
36             persist = true;
37             name = "/var/lib/kea/dhcp4.leases";
38           };
40           interfaces-config = {
41             dhcp-socket-type = "raw";
42             interfaces = [
43               "eth1"
44             ];
45           };
47           subnet4 = [ {
48             subnet = "10.0.0.0/30";
49             pools = [ {
50               pool = "10.0.0.2 - 10.0.0.2";
51             } ];
52           } ];
53         };
54       };
55     };
57     client = { config, pkgs, ... }: {
58       virtualisation.vlans = [ 1 ];
59       systemd.services.systemd-networkd.environment.SYSTEMD_LOG_LEVEL = "debug";
60       networking = {
61         useNetworkd = true;
62         useDHCP = false;
63         firewall.enable = false;
64         interfaces.eth1.useDHCP = true;
65       };
66     };
67   };
68   testScript = { ... }: ''
69     start_all()
70     router.wait_for_unit("kea-dhcp4-server.service")
71     client.wait_for_unit("systemd-networkd-wait-online.service")
72     client.wait_until_succeeds("ping -c 5 10.0.0.1")
73     router.wait_until_succeeds("ping -c 5 10.0.0.2")
74   '';