diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-24 18:56:05 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-24 21:53:25 +0200 |
commit | 09f4553ffdbf3c35696f08118d75793db33cb59b (patch) | |
tree | 8944db754488689314f5cec66cde65aba4de1642 | |
parent | 48e5ad611bc63575eb1150024939d04eb62cf400 (diff) | |
download | vyos-1x-09f4553ffdbf3c35696f08118d75793db33cb59b.tar.gz vyos-1x-09f4553ffdbf3c35696f08118d75793db33cb59b.zip |
Python/ifconfig: T1557: refactor Interface 'arp_cache_tmo' property to set_set_arp_cache_tmo()
-rw-r--r-- | python/vyos/ifconfig.py | 18 | ||||
-rwxr-xr-x | src/conf_mode/interface-bonding.py | 2 | ||||
-rwxr-xr-x | src/conf_mode/interface-bridge.py | 2 | ||||
-rwxr-xr-x | src/conf_mode/interface-ethernet.py | 2 | ||||
-rwxr-xr-x | src/conf_mode/interface-vxlan.py | 2 |
5 files changed, 6 insertions, 20 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index d32b54199..5fa9f4f2b 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -208,29 +208,15 @@ class Interface: cmd = 'ip link set dev {} address {}'.format(self._ifname, mac) self._cmd(cmd) - @property - def arp_cache_tmo(self): - """ - Get configured ARP cache timeout value from interface in seconds. - Internal Kernel representation is in milliseconds. - - Example: - >>> from vyos.ifconfig import Interface - >>> Interface('eth0').arp_cache_tmo - '30' - """ - return (self._read_sysfs('/proc/sys/net/ipv4/neigh/{0}/base_reachable_time_ms' - .format(self._ifname)) / 1000) - @arp_cache_tmo.setter - def arp_cache_tmo(self, tmo): + def set_arp_cache_tmo(self, tmo): """ Set ARP cache timeout value in seconds. Internal Kernel representation is in milliseconds. Example: >>> from vyos.ifconfig import Interface - >>> Interface('eth0').arp_cache_tmo = '40' + >>> Interface('eth0').set_arp_cache_tmo(40) """ return self._write_sysfs('/proc/sys/net/ipv4/neigh/{0}/base_reachable_time_ms' .format(self._ifname), (int(tmo) * 1000)) diff --git a/src/conf_mode/interface-bonding.py b/src/conf_mode/interface-bonding.py index 0b6ac14a6..0fd19ce1e 100755 --- a/src/conf_mode/interface-bonding.py +++ b/src/conf_mode/interface-bonding.py @@ -380,7 +380,7 @@ def apply(bond): # Bonding transmit hash policy b.xmit_hash_policy = bond['hash_policy'] # configure ARP cache timeout in milliseconds - b.arp_cache_tmp = bond['ip_arp_cache_tmo'] + b.set_arp_cache_tmo(bond['ip_arp_cache_tmo']) # Enable proxy-arp on this interface b.set_proxy_arp(bond['ip_proxy_arp']) # Enable private VLAN proxy ARP on this interface diff --git a/src/conf_mode/interface-bridge.py b/src/conf_mode/interface-bridge.py index cadd44feb..cb053773a 100755 --- a/src/conf_mode/interface-bridge.py +++ b/src/conf_mode/interface-bridge.py @@ -236,7 +236,7 @@ def apply(bridge): i = Interface(member['name']) # configure ARP cache timeout - i.arp_cache_tmo = bridge['arp_cache_tmo'] + i.set_arp_cache_tmo(bridge['arp_cache_tmo']) # ignore link state changes i.set_link_detect(bridge['disable_link_detect']) diff --git a/src/conf_mode/interface-ethernet.py b/src/conf_mode/interface-ethernet.py index 02a45408f..cc9f44753 100755 --- a/src/conf_mode/interface-ethernet.py +++ b/src/conf_mode/interface-ethernet.py @@ -282,7 +282,7 @@ def apply(eth): # disable ethernet flow control (pause frames) e.set_flow_control(eth['flow_control']) # configure ARP cache timeout in milliseconds - e.arp_cache_tmo = eth['ip_arp_cache_tmo'] + e.set_arp_cache_tmo(eth['ip_arp_cache_tmo']) # Enable proxy-arp on this interface e.set_proxy_arp(eth['ip_proxy_arp']) # Enable private VLAN proxy ARP on this interface diff --git a/src/conf_mode/interface-vxlan.py b/src/conf_mode/interface-vxlan.py index b7aa55b61..c0c85e64c 100755 --- a/src/conf_mode/interface-vxlan.py +++ b/src/conf_mode/interface-vxlan.py @@ -168,7 +168,7 @@ def apply(vxlan): v.set_mtu(vxlan['mtu']) # configure ARP cache timeout in milliseconds - v.arp_cache_tmp = vxlan['ip_arp_cache_tmo'] + v.set_arp_cache_tmo(vxlan['ip_arp_cache_tmo']) # Enable proxy-arp on this interface v.set_proxy_arp(vxlan['ip_proxy_arp']) |