Merge pull request #247109 from helsinki-systems/fix/networking-test
nixos/tests/networking: dhcpd -> kea
This commit is contained in:
commit
3d36620b0e
@ -29,23 +29,49 @@ let
|
||||
ipv6.addresses = [ { address = "fd00:1234:5678:${toString n}::1"; prefixLength = 64; } ];
|
||||
})));
|
||||
};
|
||||
services.dhcpd4 = {
|
||||
enable = true;
|
||||
interfaces = map (n: "eth${toString n}") vlanIfs;
|
||||
extraConfig = flip concatMapStrings vlanIfs (n: ''
|
||||
subnet 192.168.${toString n}.0 netmask 255.255.255.0 {
|
||||
option routers 192.168.${toString n}.1;
|
||||
range 192.168.${toString n}.3 192.168.${toString n}.254;
|
||||
}
|
||||
'')
|
||||
;
|
||||
machines = flip map vlanIfs (vlan:
|
||||
{
|
||||
hostName = "client${toString vlan}";
|
||||
ethernetAddress = qemu-common.qemuNicMac vlan 1;
|
||||
ipAddress = "192.168.${toString vlan}.2";
|
||||
}
|
||||
);
|
||||
services.kea = {
|
||||
dhcp4 = {
|
||||
enable = true;
|
||||
settings = {
|
||||
interfaces-config = {
|
||||
interfaces = map (n: "eth${toString n}") vlanIfs;
|
||||
dhcp-socket-type = "raw";
|
||||
service-sockets-require-all = true;
|
||||
service-sockets-max-retries = 5;
|
||||
service-sockets-retry-wait-time = 2500;
|
||||
};
|
||||
subnet4 = map (n: {
|
||||
id = n;
|
||||
subnet = "192.168.${toString n}.0/24";
|
||||
pools = [{ pool = "192.168.${toString n}.3 - 192.168.${toString n}.254"; }];
|
||||
option-data = [{ name = "routers"; data = "192.168.${toString n}.1"; }];
|
||||
|
||||
reservations = [{
|
||||
hw-address = qemu-common.qemuNicMac n 1;
|
||||
hostname = "client${toString n}";
|
||||
ip-address = "192.168.${toString n}.2";
|
||||
}];
|
||||
}) vlanIfs;
|
||||
};
|
||||
};
|
||||
dhcp6 = {
|
||||
enable = true;
|
||||
settings = {
|
||||
interfaces-config = {
|
||||
interfaces = map (n: "eth${toString n}") vlanIfs;
|
||||
service-sockets-require-all = true;
|
||||
service-sockets-max-retries = 5;
|
||||
service-sockets-retry-wait-time = 2500;
|
||||
};
|
||||
|
||||
subnet6 = map (n: {
|
||||
id = n;
|
||||
subnet = "fd00:1234:5678:${toString n}::/64";
|
||||
interface = "eth${toString n}";
|
||||
pools = [{ pool = "fd00:1234:5678:${toString n}::2-fd00:1234:5678:${toString n}::2"; }];
|
||||
}) vlanIfs;
|
||||
};
|
||||
};
|
||||
};
|
||||
services.radvd = {
|
||||
enable = true;
|
||||
@ -61,17 +87,6 @@ let
|
||||
};
|
||||
'');
|
||||
};
|
||||
services.dhcpd6 = {
|
||||
enable = true;
|
||||
interfaces = map (n: "eth${toString n}") vlanIfs;
|
||||
extraConfig = ''
|
||||
authoritative;
|
||||
'' + flip concatMapStrings vlanIfs (n: ''
|
||||
subnet6 fd00:1234:5678:${toString n}::/64 {
|
||||
range6 fd00:1234:5678:${toString n}::2 fd00:1234:5678:${toString n}::2;
|
||||
}
|
||||
'');
|
||||
};
|
||||
};
|
||||
|
||||
testCases = {
|
||||
@ -117,8 +132,9 @@ let
|
||||
client.wait_for_unit("network.target")
|
||||
router.wait_for_unit("network-online.target")
|
||||
|
||||
with subtest("Make sure dhcpcd is not started"):
|
||||
client.fail("systemctl status dhcpcd.service")
|
||||
with subtest("Make sure DHCP server is not started"):
|
||||
client.fail("systemctl status kea-dhcp4-server.service")
|
||||
client.fail("systemctl status kea-dhcp6-server.service")
|
||||
|
||||
with subtest("Test vlan 1"):
|
||||
client.wait_until_succeeds("ping -c 1 192.168.1.1")
|
||||
@ -1035,7 +1051,7 @@ let
|
||||
testScript = ''
|
||||
machine.succeed("udevadm settle")
|
||||
print(machine.succeed("ip link show dev enCustom"))
|
||||
machine.wait_until_succeeds("ip link show dev enCustom | grep -q '52:54:00:12:0b:01")
|
||||
machine.wait_until_succeeds("ip link show dev enCustom | grep -q 52:54:00:12:0b:01")
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
@ -80,6 +80,8 @@ stdenv.mkDerivation rec {
|
||||
kea = nixosTests.kea;
|
||||
prefix-delegation = nixosTests.systemd-networkd-ipv6-prefix-delegation;
|
||||
prometheus-exporter = nixosTests.prometheus-exporters.kea;
|
||||
networking-scripted = lib.recurseIntoAttrs { inherit (nixosTests.networking.scripted) dhcpDefault dhcpSimple dhcpOneIf; };
|
||||
networking-networkd = lib.recurseIntoAttrs { inherit (nixosTests.networking.networkd) dhcpDefault dhcpSimple dhcpOneIf; };
|
||||
};
|
||||
|
||||
meta = with lib; {
|
||||
|
Loading…
Reference in New Issue
Block a user