diff options
| author | Christian Poessinger <christian@poessinger.com> | 2019-09-24 18:15:01 +0200 | 
|---|---|---|
| committer | Christian Poessinger <christian@poessinger.com> | 2019-09-24 18:15:01 +0200 | 
| commit | 1e373c5ea5a8ac6a5a4f99376d6399b82df00efa (patch) | |
| tree | 0fc8e3d1247a4fdd150e1c3a0d310a2a0316a822 | |
| parent | d80398b6542b24042961ff6eae657c58c98d93c3 (diff) | |
| download | vyos-1x-1e373c5ea5a8ac6a5a4f99376d6399b82df00efa.tar.gz vyos-1x-1e373c5ea5a8ac6a5a4f99376d6399b82df00efa.zip | |
Python/ifconfig: T1557: refactor BondIf 'primary' property to set_primary()
| -rw-r--r-- | python/vyos/ifconfig.py | 26 | ||||
| -rwxr-xr-x | src/conf_mode/interface-bonding.py | 2 | 
2 files changed, 3 insertions, 25 deletions
| 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 diff --git a/src/conf_mode/interface-bonding.py b/src/conf_mode/interface-bonding.py index fddc73b0f..83cd2facc 100755 --- a/src/conf_mode/interface-bonding.py +++ b/src/conf_mode/interface-bonding.py @@ -397,7 +397,7 @@ def apply(bond):          # Primary device interface          if bond['primary']: -            b.primary = bond['primary'] +            b.set_primary(bond['primary'])          # Add (enslave) interfaces to bond          for intf in bond['member']: | 
