summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-24 19:27:54 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-24 21:53:26 +0200
commitf95659216b0816f53bdf5cb8ccc02afff970dd53 (patch)
tree0ba646af17b6e41e2f7cdea08f4bd118b219abcc /python
parentbc9b28132ca7270f226968d0c1207adefe768049 (diff)
downloadvyos-1x-f95659216b0816f53bdf5cb8ccc02afff970dd53.tar.gz
vyos-1x-f95659216b0816f53bdf5cb8ccc02afff970dd53.zip
Python/ifconfig: T1557: refactor BondIf 'mode' property to set_mode()
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig.py24
1 files changed, 2 insertions, 22 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index 8b333b81d..8f81bc9f6 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -1254,25 +1254,7 @@ class BondIf(VLANIf):
return self._write_sysfs('/sys/class/net/{}/bonding/primary'
.format(self._ifname), interface)
- @property
- def mode(self):
- """
- Specifies one of the bonding policies. The default is balance-rr
- (round robin).
-
- Possible values are: balance-rr (0), active-backup (1), balance-xor (2),
- broadcast (3), 802.3ad (4), balance-tlb (5), balance-alb (6)
-
- Example:
- >>> from vyos.ifconfig import BondIf
- >>> BondIf('bond0').mode
- 'balance-rr'
- """
- return self._read_sysfs('/sys/class/net/{}/bonding/mode'
- .format(self._ifname)).split()[0]
-
- @mode.setter
- def mode(self, mode):
+ def set_mode(self, mode):
"""
Specifies one of the bonding policies. The default is balance-rr
(round robin).
@@ -1285,9 +1267,7 @@ class BondIf(VLANIf):
Example:
>>> from vyos.ifconfig import BondIf
- >>> BondIf('bond0').mode = '802.3ad'
- >>> BondIf('bond0').mode
- '802.3ad'
+ >>> BondIf('bond0').set_mode('802.3ad')
"""
if not mode in [
'balance-rr', 'active-backup', 'balance-xor', 'broadcast',