nixos/test/networking: test bonding netdev creation

Previously the bonding driver would create an initial `bond0` interface
when it was loaded. If the network management integration used that
interface and did not recreate it, it was stuck to the default
`balance-rr` mode.

Deploying systemds modprobe.d configuration sets `max_bonds=0`, so we
don't run into that issue anymore.

Hence we now make sure that we can indeed create `bond0` with `802.3ad`
(LACP), which is a non default mode.
This commit is contained in:
Martin Weinelt 2022-02-22 17:29:41 +01:00
parent c2147ab6a8
commit b4ac004d09
No known key found for this signature in database
GPG key ID: 87C1E9888F856759

View file

@ -246,13 +246,13 @@ let
networking = { networking = {
useNetworkd = networkd; useNetworkd = networkd;
useDHCP = false; useDHCP = false;
bonds.bond = { bonds.bond0 = {
interfaces = [ "eth1" "eth2" ]; interfaces = [ "eth1" "eth2" ];
driverOptions.mode = "balance-rr"; driverOptions.mode = "802.3ad";
}; };
interfaces.eth1.ipv4.addresses = mkOverride 0 [ ]; interfaces.eth1.ipv4.addresses = mkOverride 0 [ ];
interfaces.eth2.ipv4.addresses = mkOverride 0 [ ]; interfaces.eth2.ipv4.addresses = mkOverride 0 [ ];
interfaces.bond.ipv4.addresses = mkOverride 0 interfaces.bond0.ipv4.addresses = mkOverride 0
[ { inherit address; prefixLength = 30; } ]; [ { inherit address; prefixLength = 30; } ];
}; };
}; };
@ -274,6 +274,10 @@ let
client2.wait_until_succeeds("ping -c 2 192.168.1.1") client2.wait_until_succeeds("ping -c 2 192.168.1.1")
client2.wait_until_succeeds("ping -c 2 192.168.1.2") client2.wait_until_succeeds("ping -c 2 192.168.1.2")
with subtest("Verify bonding mode"):
for client in client1, client2:
client.succeed('grep -q "Bonding Mode: IEEE 802.3ad Dynamic link aggregation" /proc/net/bonding/bond0')
''; '';
}; };
bridge = let bridge = let