From 1e373c5ea5a8ac6a5a4f99376d6399b82df00efa Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 24 Sep 2019 18:15:01 +0200 Subject: Python/ifconfig: T1557: refactor BondIf 'primary' property to set_primary() --- python/vyos/ifconfig.py | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) (limited to 'python/vyos') diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index afc7bbbf8..f55c5fd5c 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -1516,28 +1516,8 @@ class BondIf(VLANIf): .format(self._ifname)) return list(map(str, slaves.split())) - @property - def primary(self): - """ - A string (eth0, eth2, etc) specifying which slave is the primary - device. The specified device will always be the active slave while it - is available. Only when the primary is off-line will alternate devices - be used. This is useful when one slave is preferred over another, e.g., - when one slave has higher throughput than another. - - The primary option is only valid for active-backup, balance-tlb and - balance-alb mode. - - Example: - >>> from vyos.ifconfig import BondIf - >>> BondIf('bond0').primary - 'eth1' - """ - return self._read_sysfs('/sys/class/net/{}/bonding/primary' - .format(self._ifname)) - @primary.setter - def primary(self, interface): + def set_primary(self, interface): """ A string (eth0, eth2, etc) specifying which slave is the primary device. The specified device will always be the active slave while it @@ -1550,9 +1530,7 @@ class BondIf(VLANIf): Example: >>> from vyos.ifconfig import BondIf - >>> BondIf('bond0').primary = 'eth2' - >>> BondIf('bond0').primary - 'eth2' + >>> BondIf('bond0').set_primary('eth2') """ if not interface: # reset primary interface -- cgit v1.2.3