diff options
author | rnhmjoj <rnhmjoj@inventati.org> | 2021-02-18 18:12:48 +0100 |
---|---|---|
committer | rnhmjoj <rnhmjoj@inventati.org> | 2021-02-19 09:26:14 +0100 |
commit | 7384c81e986d27aa08c451b21b6508c1ecf767a2 (patch) | |
tree | 34b7f30380b317ca6e33b50b743e25bef1afd47b /nixos/tests/networking.nix | |
parent | 8e59a682a5e937b4ad6f1246ca59196b8558446d (diff) | |
download | nixpkgs-7384c81e986d27aa08c451b21b6508c1ecf767a2.tar nixpkgs-7384c81e986d27aa08c451b21b6508c1ecf767a2.tar.gz nixpkgs-7384c81e986d27aa08c451b21b6508c1ecf767a2.tar.bz2 nixpkgs-7384c81e986d27aa08c451b21b6508c1ecf767a2.tar.lz nixpkgs-7384c81e986d27aa08c451b21b6508c1ecf767a2.tar.xz nixpkgs-7384c81e986d27aa08c451b21b6508c1ecf767a2.tar.zst nixpkgs-7384c81e986d27aa08c451b21b6508c1ecf767a2.zip |
nixos/tests/networking: test interface renaming
Diffstat (limited to 'nixos/tests/networking.nix')
-rw-r--r-- | nixos/tests/networking.nix | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/nixos/tests/networking.nix b/nixos/tests/networking.nix index 4fc5d48e0e1..62e9c2f62ad 100644 --- a/nixos/tests/networking.nix +++ b/nixos/tests/networking.nix @@ -672,6 +672,30 @@ let ), "The IPv6 routing table has not been properly cleaned:\n{}".format(ipv6Residue) ''; }; + rename = { + name = "RenameInterface"; + machine = { pkgs, ... }: { + virtualisation.vlans = [ 1 ]; + networking = { + useNetworkd = networkd; + useDHCP = false; + }; + } // + (if networkd + then { systemd.network.links."10-custom_name" = { + matchConfig.MACAddress = "52:54:00:12:01:01"; + linkConfig.Name = "custom_name"; + }; + } + else { services.udev.initrdRules = '' + SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="52:54:00:12:01:01", KERNEL=="eth*", NAME="custom_name" + ''; + }); + testScript = '' + machine.succeed("udevadm settle") + print(machine.succeed("ip link show dev custom_name")) + ''; + }; # even with disabled networkd, systemd.network.links should work # (as it's handled by udev, not networkd) link = { |