From 839058e95311ed6ee08f96a943c271dbf77320ed Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 24 Sep 2019 18:24:39 +0200 Subject: Python/ifconfig: T1557: refactor BridgeIf 'ageing_time' property to set_ageing_time() --- python/vyos/ifconfig.py | 22 +++------------------- src/conf_mode/interface-bridge.py | 2 +- 2 files changed, 4 insertions(+), 20 deletions(-) diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index e10e01e2f..4ffeaa729 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -740,30 +740,14 @@ class BridgeIf(Interface): def __init__(self, ifname): super().__init__(ifname, type='bridge') - @property - def ageing_time(self): - """ - Return configured bridge interface MAC address aging time in seconds. - Internal kernel representation is in centiseconds, thus its converted - in the end. Kernel default is 300 seconds. - - Example: - >>> from vyos.ifconfig import Interface - >>> BridgeIf('br0').aging_time - '300' - """ - return (self._read_sysfs('/sys/class/net/{}/bridge/ageing_time' - .format(self._ifname)) / 100) - - @ageing_time.setter - def ageing_time(self, time): + def set_ageing_time(self, time): """ Set bridge interface MAC address aging time in seconds. Internal kernel representation is in centiseconds. Kernel default is 300 seconds. Example: - >>> from vyos.ifconfig import Interface - >>> BridgeIf('br0').ageing_time = 2 + >>> from vyos.ifconfig import BridgeIf + >>> BridgeIf('br0').ageing_time(2) """ time = int(time) * 100 return self._write_sysfs('/sys/class/net/{}/bridge/ageing_time' diff --git a/src/conf_mode/interface-bridge.py b/src/conf_mode/interface-bridge.py index 5d97d49bc..3b18e24ab 100755 --- a/src/conf_mode/interface-bridge.py +++ b/src/conf_mode/interface-bridge.py @@ -187,7 +187,7 @@ def apply(bridge): # enable interface br.state = 'up' # set ageing time - br.ageing_time = bridge['aging'] + br.set_ageing_time(bridge['aging']) # set bridge forward delay br.set_forward_delay(bridge['forwarding_delay']) # set hello time -- cgit v1.2.3