summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-24 18:24:39 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-24 18:24:39 +0200
commit839058e95311ed6ee08f96a943c271dbf77320ed (patch)
treed6ce69df8f5a15ff99025991b2aec18fe360dcc0
parente41213fd082603a7c70e518e52582b7600af8589 (diff)
downloadvyos-1x-839058e95311ed6ee08f96a943c271dbf77320ed.tar.gz
vyos-1x-839058e95311ed6ee08f96a943c271dbf77320ed.zip
Python/ifconfig: T1557: refactor BridgeIf 'ageing_time' property to set_ageing_time()
-rw-r--r--python/vyos/ifconfig.py22
-rwxr-xr-xsrc/conf_mode/interface-bridge.py2
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