summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/bond.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-05-13 10:49:39 +0200
committerChristian Poessinger <christian@poessinger.com>2021-05-13 11:18:15 +0200
commit78d375a3a354b0cc93bdfc36fd828c691f9ccb56 (patch)
tree0b18ed56e88b493728631f2d630930947e27c615 /python/vyos/ifconfig/bond.py
parent1d2531075269ee627ff2a138f5bf65b1ed3933a5 (diff)
downloadvyos-1x-78d375a3a354b0cc93bdfc36fd828c691f9ccb56.tar.gz
vyos-1x-78d375a3a354b0cc93bdfc36fd828c691f9ccb56.zip
bonding: T3543: add support to configure lacp-rate (slow or fast)
Option specifying the rate in which we'll ask our link partner to transmit LACPDU packets in 802.3ad mode. set interfaces bonding bond0 lacp-rate <slow|fast> slow: Request partner to transmit LACPDUs every 30 seconds (default) fast: Request partner to transmit LACPDUs every 1 second (cherry picked from commit 8e392a3dbc16f7b80a979f7b4e9c11408d700e6f)
Diffstat (limited to 'python/vyos/ifconfig/bond.py')
-rw-r--r--python/vyos/ifconfig/bond.py34
1 files changed, 31 insertions, 3 deletions
diff --git a/python/vyos/ifconfig/bond.py b/python/vyos/ifconfig/bond.py
index 199c69dde..78ce27bba 100644
--- a/python/vyos/ifconfig/bond.py
+++ b/python/vyos/ifconfig/bond.py
@@ -53,6 +53,10 @@ class BondIf(Interface):
'validate': assert_positive,
'location': '/sys/class/net/{ifname}/bonding/min_links',
},
+ 'bond_lacp_rate': {
+ 'validate': lambda v: assert_list(v, ['slow', 'fast']),
+ 'location': '/sys/class/net/{ifname}/bonding/lacp_rate',
+ },
'bond_miimon': {
'validate': assert_positive,
'location': '/sys/class/net/{ifname}/bonding/miimon'
@@ -154,6 +158,26 @@ class BondIf(Interface):
"""
self.set_interface('bond_min_links', number)
+ def set_lacp_rate(self, slow_fast):
+ """
+ Option specifying the rate in which we'll ask our link partner
+ to transmit LACPDU packets in 802.3ad mode. Possible values
+ are:
+
+ slow or 0
+ Request partner to transmit LACPDUs every 30 seconds
+
+ fast or 1
+ Request partner to transmit LACPDUs every 1 second
+
+ The default is slow.
+
+ Example:
+ >>> from vyos.ifconfig import BondIf
+ >>> BondIf('bond0').set_lacp_rate('slow')
+ """
+ self.set_interface('bond_lacp_rate', slow_fast)
+
def set_arp_interval(self, interval):
"""
Specifies the ARP link monitoring frequency in milliseconds.
@@ -384,9 +408,13 @@ class BondIf(Interface):
if not dict_search(f'member.interface_remove.{interface}.disable', config):
Interface(interface).set_admin_state('up')
- # Bonding policy/mode
- value = config.get('mode')
- if value: self.set_mode(value)
+ # Bonding policy/mode - default value, always present
+ mode = config.get('mode')
+ self.set_mode(mode)
+
+ # LACPDU transmission rate - default value
+ if mode == '802.3ad':
+ self.set_lacp_rate(config.get('lacp_rate'))
# Add (enslave) interfaces to bond
value = dict_search('member.interface', config)