summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-24 19:09:26 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-24 21:53:26 +0200
commit19cae8e57885034002b3773b289d9f9086937ddc (patch)
tree8996d69781cf0ebc74deb0c4800b87b4d2cb6c48 /python
parent42df77762c8bc436a53350b44355c23e70f7d215 (diff)
downloadvyos-1x-19cae8e57885034002b3773b289d9f9086937ddc.tar.gz
vyos-1x-19cae8e57885034002b3773b289d9f9086937ddc.zip
Python/ifconfig: T1557: refactor BondIf 'xmit_hash_policy' property to set_hash_policy()
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig.py25
1 files changed, 2 insertions, 23 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index a155ce572..2c627f0b0 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -1097,27 +1097,8 @@ class BondIf(VLANIf):
i = Interface(slave['ifname'])
i.set_state(slave['state'])
- @property
- def xmit_hash_policy(self):
- """
- Selects the transmit hash policy to use for slave selection in
- balance-xor, 802.3ad, and tlb modes. Possible values are: layer2,
- layer2+3, layer3+4, encap2+3, encap3+4.
-
- The default value is layer2
-
- Example:
- >>> from vyos.ifconfig import BondIf
- >>> BondIf('bond0').xmit_hash_policy
- 'layer3+4'
- """
- # Linux Kernel appends has policy value to string, e.g. 'layer3+4 1',
- # so remove the later part and only return the mode as string.
- return self._read_sysfs('/sys/class/net/{}/bonding/xmit_hash_policy'
- .format(self._ifname)).split()[0]
- @xmit_hash_policy.setter
- def xmit_hash_policy(self, mode):
+ def set_hash_policy(self, mode):
"""
Selects the transmit hash policy to use for slave selection in
balance-xor, 802.3ad, and tlb modes. Possible values are: layer2,
@@ -1127,9 +1108,7 @@ class BondIf(VLANIf):
Example:
>>> from vyos.ifconfig import BondIf
- >>> BondIf('bond0').xmit_hash_policy = 'layer2+3'
- >>> BondIf('bond0').proxy_arp
- '1'
+ >>> BondIf('bond0').set_hash_policy('layer2+3')
"""
if not mode in ['layer2', 'layer2+3', 'layer3+4', 'encap2+3', 'encap3+4']:
raise ValueError("Value out of range")