summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/bond.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/ifconfig/bond.py')
-rw-r--r--python/vyos/ifconfig/bond.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/bond.py b/python/vyos/ifconfig/bond.py
index 64407401b..67dcd2b69 100644
--- a/python/vyos/ifconfig/bond.py
+++ b/python/vyos/ifconfig/bond.py
@@ -52,6 +52,10 @@ class BondIf(Interface):
'validate': lambda v: assert_list(v, ['layer2', 'layer2+3', 'layer3+4', 'encap2+3', 'encap3+4']),
'location': '/sys/class/net/{ifname}/bonding/xmit_hash_policy',
},
+ 'bond_min_links': {
+ 'validate': assert_positive,
+ 'location': '/sys/class/net/{ifname}/bonding/min_links',
+ },
'bond_miimon': {
'validate': assert_positive,
'location': '/sys/class/net/{ifname}/bonding/miimon'
@@ -130,6 +134,29 @@ class BondIf(Interface):
"""
self.set_interface('bond_hash_policy', mode)
+ def set_min_links(self, number):
+ """
+ Specifies the minimum number of links that must be active before
+ asserting carrier. It is similar to the Cisco EtherChannel min-links
+ feature. This allows setting the minimum number of member ports that
+ must be up (link-up state) before marking the bond device as up
+ (carrier on). This is useful for situations where higher level services
+ such as clustering want to ensure a minimum number of low bandwidth
+ links are active before switchover. This option only affect 802.3ad
+ mode.
+
+ The default value is 0. This will cause carrier to be asserted (for
+ 802.3ad mode) whenever there is an active aggregator, regardless of the
+ number of available links in that aggregator. Note that, because an
+ aggregator cannot be active without at least one available link,
+ setting this option to 0 or to 1 has the exact same effect.
+
+ Example:
+ >>> from vyos.ifconfig import BondIf
+ >>> BondIf('bond0').set_min_links('0')
+ """
+ self.set_interface('bond_min_links', number)
+
def set_arp_interval(self, interval):
"""
Specifies the ARP link monitoring frequency in milliseconds.
@@ -347,6 +374,10 @@ class BondIf(Interface):
value = config.get('hash_policy')
if value: self.set_hash_policy(value)
+ # Minimum number of member interfaces
+ value = config.get('min_links')
+ if value: self.set_min_links(value)
+
# Some interface options can only be changed if the interface is
# administratively down
if self.get_admin_state() == 'down':