diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-24 19:15:36 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-24 21:53:26 +0200 |
commit | 7d747a6ad08d0ea726333bfa9917c7f05439f33b (patch) | |
tree | 068e7f03ace09e013513cdad701d6d898cf9f04f | |
parent | 8befa5b2aad043dca5d2ba293a7c762f55537c7e (diff) | |
download | vyos-1x-7d747a6ad08d0ea726333bfa9917c7f05439f33b.tar.gz vyos-1x-7d747a6ad08d0ea726333bfa9917c7f05439f33b.zip |
Python/ifconfig: T1557: refactor BondIf 'arp_ip_target' property to set_arp_ip_target()/get_arp_ip_target()
-rw-r--r-- | python/vyos/ifconfig.py | 12 | ||||
-rwxr-xr-x | src/conf_mode/interface-bonding.py | 6 |
2 files changed, 8 insertions, 10 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index e3404d3e1..324f341da 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -1133,8 +1133,7 @@ class BondIf(VLANIf): return self._write_sysfs('/sys/class/net/{}/bonding/arp_interval' .format(self._ifname), time) - @property - def arp_ip_target(self): + def get_arp_ip_target(self): """ Specifies the IP addresses to use as ARP monitoring peers when arp_interval is > 0. These are the targets of the ARP request sent to @@ -1147,14 +1146,13 @@ class BondIf(VLANIf): Example: >>> from vyos.ifconfig import BondIf - >>> BondIf('bond0').arp_ip_target + >>> BondIf('bond0').get_arp_ip_target() '192.0.2.1' """ return self._read_sysfs('/sys/class/net/{}/bonding/arp_ip_target' .format(self._ifname)) - @arp_ip_target.setter - def arp_ip_target(self, target): + def set_arp_ip_target(self, target): """ Specifies the IP addresses to use as ARP monitoring peers when arp_interval is > 0. These are the targets of the ARP request sent to @@ -1167,8 +1165,8 @@ class BondIf(VLANIf): Example: >>> from vyos.ifconfig import BondIf - >>> BondIf('bond0').arp_ip_target = '192.0.2.1' - >>> BondIf('bond0').arp_ip_target + >>> BondIf('bond0').set_arp_ip_target('192.0.2.1') + >>> BondIf('bond0').get_arp_ip_target() '192.0.2.1' """ return self._write_sysfs('/sys/class/net/{}/bonding/arp_ip_target' diff --git a/src/conf_mode/interface-bonding.py b/src/conf_mode/interface-bonding.py index d1617cb1c..01df0e3d2 100755 --- a/src/conf_mode/interface-bonding.py +++ b/src/conf_mode/interface-bonding.py @@ -360,13 +360,13 @@ def apply(bond): # from the kernel side this looks valid to me. We won't run into an error # when a user added manual adresses which would result in having more # then 16 adresses in total. - arp_tgt_addr = list(map(str, b.arp_ip_target.split())) + arp_tgt_addr = list(map(str, b.get_arp_ip_target().split())) for addr in arp_tgt_addr: - b.arp_ip_target = '-' + addr + b.set_arp_ip_target('-' + addr) # Add configured ARP target addresses for addr in bond['arp_mon_tgt']: - b.arp_ip_target = '+' + addr + b.set_arp_ip_target('+' + addr) # update interface description used e.g. within SNMP b.set_alias(bond['description']) |