From 36f36e01b28c73d51a95f77123bf2b6709507d16 Mon Sep 17 00:00:00 2001 From: Matt Mulsow Date: Wed, 6 Jul 2016 18:36:33 -0500 Subject: [PATCH] Added support for setting bond-lacp-rate and bond-xmit_hash_policy With this change you can optionally specify bond_lacp_rate and/or bond-xmit_hash_policy. If not specified, they will be added with default values. This change also makes bond_miimon optional, with a default of 0. Change-Id: I6dffb693c49197398e795006afc120b9b0ba7073 Signed-off-by: Matt Mulsow --- glean/cmd.py | 18 +++++++++++++++--- .../fixtures/test/liberty.debian.network.out | 6 ++++++ .../fixtures/test/liberty.ubuntu.network.out | 4 ++++ 3 files changed, 25 insertions(+), 3 deletions(-) diff --git a/glean/cmd.py b/glean/cmd.py index fe5f541..5bebf50 100644 --- a/glean/cmd.py +++ b/glean/cmd.py @@ -385,7 +385,11 @@ def write_debian_interfaces(interfaces, sys_interfaces): interface['mac_address']) result += " bond-mode {0}\n".format(interface['bond_mode']) result += " bond-miimon {0}\n".format( - interface['bond_miimon']) + interface.get('bond_miimon', 0)) + result += " bond-lacp-rate {0}\n".format( + interface.get('bond_lacp_rate', 'slow')) + result += " bond-xmit_hash_policy {0}\n".format( + interface.get('bond_xmit_hash_policy', 'layer2')) slave_devices = [sys_interfaces[mac] for mac in interface['raw_macs']] slaves = ' '.join(slave_devices) @@ -405,7 +409,11 @@ def write_debian_interfaces(interfaces, sys_interfaces): interface['mac_address']) result += " bond-mode {0}\n".format(interface['bond_mode']) result += " bond-miimon {0}\n".format( - interface['bond_miimon']) + interface.get('bond_miimon', 0)) + result += " bond-lacp-rate {0}\n".format( + interface.get('bond_lacp_rate', 'slow')) + result += " bond-xmit_hash_policy {0}\n".format( + interface.get('bond_xmit_hash_policy', 'layer2')) slave_devices = [sys_interfaces[mac] for mac in interface['raw_macs']] slaves = ' '.join(slave_devices) @@ -436,7 +444,11 @@ def write_debian_interfaces(interfaces, sys_interfaces): interface['mac_address']) result += " bond-mode {0}\n".format(interface['bond_mode']) result += " bond-miimon {0}\n".format( - interface['bond_miimon']) + interface.get('bond_miimon', 0)) + result += " bond-lacp-rate {0}\n".format( + interface.get('bond_lacp_rate', 'slow')) + result += " bond-xmit_hash_policy {0}\n".format( + interface.get('bond_xmit_hash_policy', 'layer2')) slave_devices = [sys_interfaces[mac] for mac in interface['raw_macs']] slaves = ' '.join(slave_devices) diff --git a/glean/tests/fixtures/test/liberty.debian.network.out b/glean/tests/fixtures/test/liberty.debian.network.out index 6dd0806..20ee98b 100644 --- a/glean/tests/fixtures/test/liberty.debian.network.out +++ b/glean/tests/fixtures/test/liberty.debian.network.out @@ -44,6 +44,8 @@ iface bond0 inet dhcp hwaddress bc:76:4e:05:7b:13 bond-mode 802.3ad bond-miimon 100 + bond-lacp-rate slow + bond-xmit_hash_policy layer3+4 bond-slaves eth5 eth6 ### Write /etc/network/interfaces.d/eth7.cfg auto eth7 @@ -59,6 +61,8 @@ iface bond1 inet manual hwaddress bc:76:4e:05:7b:15 bond-mode 802.3ad bond-miimon 100 + bond-lacp-rate slow + bond-xmit_hash_policy layer3+4 bond-slaves eth7 eth8 ### Write /etc/network/interfaces.d/bond1.27.cfg auto bond1.27 @@ -71,6 +75,8 @@ iface bond2 inet static hwaddress bc:76:4e:05:7b:17 bond-mode 802.3ad bond-miimon 100 + bond-lacp-rate slow + bond-xmit_hash_policy layer3+4 bond-slaves eth9 eth10 address 192.0.2.2 netmask 255.255.255.0 diff --git a/glean/tests/fixtures/test/liberty.ubuntu.network.out b/glean/tests/fixtures/test/liberty.ubuntu.network.out index 68fbf51..08c9e2e 100644 --- a/glean/tests/fixtures/test/liberty.ubuntu.network.out +++ b/glean/tests/fixtures/test/liberty.ubuntu.network.out @@ -44,6 +44,8 @@ iface bond0 inet dhcp hwaddress bc:76:4e:05:7b:13 bond-mode 802.3ad bond-miimon 100 + bond-lacp-rate slow + bond-xmit_hash_policy layer3+4 bond-slaves eth5 eth6 ### Write /etc/network/interfaces.d/eth7.cfg auto eth7 @@ -59,6 +61,8 @@ iface bond1 inet manual hwaddress bc:76:4e:05:7b:15 bond-mode 802.3ad bond-miimon 100 + bond-lacp-rate slow + bond-xmit_hash_policy layer3+4 bond-slaves eth7 eth8 ### Write /etc/network/interfaces.d/bond1.27.cfg auto bond1.27