summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/bond.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-25 09:57:21 +0100
committerGitHub <noreply@github.com>2020-03-25 09:57:21 +0100
commit6e7739e0b69e1d3371ebe36218604cbb1aca18b1 (patch)
treec745b79a378c75e928931073bfddbf8cc76ca730 /python/vyos/ifconfig/bond.py
parent7c4d21639d9594ba4a0d96a5d6d90f25189c2817 (diff)
parentbbea850ea5f8ff0402cd276ab63963ece7e0c763 (diff)
downloadvyos-1x-6e7739e0b69e1d3371ebe36218604cbb1aca18b1.tar.gz
vyos-1x-6e7739e0b69e1d3371ebe36218604cbb1aca18b1.zip
Merge pull request #265 from thomas-mangin/2057-dhcp-vlan
ifconfig: T2057: break down DHCP, add register, STP and VLAN as adapters
Diffstat (limited to 'python/vyos/ifconfig/bond.py')
-rw-r--r--python/vyos/ifconfig/bond.py27
1 files changed, 19 insertions, 8 deletions
diff --git a/python/vyos/ifconfig/bond.py b/python/vyos/ifconfig/bond.py
index c9dac891f..3c26b9b95 100644
--- a/python/vyos/ifconfig/bond.py
+++ b/python/vyos/ifconfig/bond.py
@@ -16,12 +16,14 @@
import os
from vyos.ifconfig.interface import Interface
-from vyos.ifconfig.vlan import VLANIf
+from vyos.ifconfig.vlan import VLAN
from vyos.validate import *
-class BondIf(VLANIf):
+@Interface.register
+@VLAN.enable
+class BondIf(Interface):
"""
The Linux bonding driver provides a method for aggregating multiple network
interfaces into a single logical "bonded" interface. The behavior of the
@@ -30,7 +32,20 @@ class BondIf(VLANIf):
monitoring may be performed.
"""
- _sysfs_set = {**VLANIf._sysfs_set, **{
+ default = {
+ 'type': 'bond',
+ }
+ definition = {
+ **Interface.definition,
+ ** {
+ 'section': 'bonding',
+ 'prefixes': ['bond', ],
+ 'broadcast': True,
+ 'bridgeable': True,
+ },
+ }
+
+ _sysfs_set = {**Interface._sysfs_set, **{
'bond_hash_policy': {
'validate': lambda v: assert_list(v, ['layer2', 'layer2+3', 'layer3+4', 'encap2+3', 'encap3+4']),
'location': '/sys/class/net/{ifname}/bonding/xmit_hash_policy',
@@ -63,16 +78,12 @@ class BondIf(VLANIf):
},
}}
- _sysfs_get = {**VLANIf._sysfs_get, **{
+ _sysfs_get = {**Interface._sysfs_get, **{
'bond_arp_ip_target': {
'location': '/sys/class/net/{ifname}/bonding/arp_ip_target',
}
}}
- default = {
- 'type': 'bond',
- }
-
def remove(self):
"""
Remove interface from operating system. Removing the interface