summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2019-09-24 18:04:17 +0200
committerChristian Poessinger <christian@poessinger.com>2019-09-24 18:10:48 +0200
commitd77f68ef3198cff019e1e2d74dfe2290800a1ea6 (patch)
treeda3be3377968d9f4c242c0dfb5aa2421ecf7fbc8 /python
parent6b828200e698dbff5a3ee61a0c6c9906b0a8493f (diff)
downloadvyos-1x-d77f68ef3198cff019e1e2d74dfe2290800a1ea6.tar.gz
vyos-1x-d77f68ef3198cff019e1e2d74dfe2290800a1ea6.zip
Python/ifconfig: T1557: refactor 'mtu' property to get_mtu()/set_mtu()
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig.py12
1 files changed, 5 insertions, 7 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py
index 8d4923957..a128c3d54 100644
--- a/python/vyos/ifconfig.py
+++ b/python/vyos/ifconfig.py
@@ -145,28 +145,26 @@ class Interface:
cmd = 'ip link del dev {}'.format(self._ifname)
self._cmd(cmd)
- @property
- def mtu(self):
+ def get_mtu(self):
"""
Get/set interface mtu in bytes.
Example:
>>> from vyos.ifconfig import Interface
- >>> Interface('eth0').mtu
+ >>> Interface('eth0').get_mtu()
'1500'
"""
return self._read_sysfs('/sys/class/net/{}/mtu'
.format(self._ifname))
- @mtu.setter
- def mtu(self, mtu):
+ def set_mtu(self, mtu):
"""
Get/set interface mtu in bytes.
Example:
>>> from vyos.ifconfig import Interface
- >>> Interface('eth0').mtu = 1400
- >>> Interface('eth0').mtu
+ >>> Interface('eth0').set_mtu(1400)
+ >>> Interface('eth0').get_mtu()
'1400'
"""
if mtu < 68 or mtu > 9000: