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; } ];
|
ipv6.addresses = [ { address = "fd00:1234:5678:${toString n}::1"; prefixLength = 64; } ];
|
||||||
})));
|
})));
|
||||||
};
|
};
|
||||||
services.dhcpd4 = {
|
services.kea = {
|
||||||
enable = true;
|
dhcp4 = {
|
||||||
interfaces = map (n: "eth${toString n}") vlanIfs;
|
enable = true;
|
||||||
extraConfig = flip concatMapStrings vlanIfs (n: ''
|
settings = {
|
||||||
subnet 192.168.${toString n}.0 netmask 255.255.255.0 {
|
interfaces-config = {
|
||||||
option routers 192.168.${toString n}.1;
|
interfaces = map (n: "eth${toString n}") vlanIfs;
|
||||||
range 192.168.${toString n}.3 192.168.${toString n}.254;
|
dhcp-socket-type = "raw";
|
||||||
}
|
service-sockets-require-all = true;
|
||||||
'')
|
service-sockets-max-retries = 5;
|
||||||
;
|
service-sockets-retry-wait-time = 2500;
|
||||||
machines = flip map vlanIfs (vlan:
|
};
|
||||||
{
|
subnet4 = map (n: {
|
||||||
hostName = "client${toString vlan}";
|
id = n;
|
||||||
ethernetAddress = qemu-common.qemuNicMac vlan 1;
|
subnet = "192.168.${toString n}.0/24";
|
||||||
ipAddress = "192.168.${toString vlan}.2";
|
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 = {
|
services.radvd = {
|
||||||
enable = true;
|
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 = {
|
testCases = {
|
||||||
@ -117,8 +132,9 @@ let
|
|||||||
client.wait_for_unit("network.target")
|
client.wait_for_unit("network.target")
|
||||||
router.wait_for_unit("network-online.target")
|
router.wait_for_unit("network-online.target")
|
||||||
|
|
||||||
with subtest("Make sure dhcpcd is not started"):
|
with subtest("Make sure DHCP server is not started"):
|
||||||
client.fail("systemctl status dhcpcd.service")
|
client.fail("systemctl status kea-dhcp4-server.service")
|
||||||
|
client.fail("systemctl status kea-dhcp6-server.service")
|
||||||
|
|
||||||
with subtest("Test vlan 1"):
|
with subtest("Test vlan 1"):
|
||||||
client.wait_until_succeeds("ping -c 1 192.168.1.1")
|
client.wait_until_succeeds("ping -c 1 192.168.1.1")
|
||||||
@ -1035,7 +1051,7 @@ let
|
|||||||
testScript = ''
|
testScript = ''
|
||||||
machine.succeed("udevadm settle")
|
machine.succeed("udevadm settle")
|
||||||
print(machine.succeed("ip link show dev enCustom"))
|
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;
|
kea = nixosTests.kea;
|
||||||
prefix-delegation = nixosTests.systemd-networkd-ipv6-prefix-delegation;
|
prefix-delegation = nixosTests.systemd-networkd-ipv6-prefix-delegation;
|
||||||
prometheus-exporter = nixosTests.prometheus-exporters.kea;
|
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; {
|
meta = with lib; {
|
||||||
|
Loading…
Reference in New Issue
Block a user