diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-24 18:10:39 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-24 18:11:49 +0200 |
commit | d80398b6542b24042961ff6eae657c58c98d93c3 (patch) | |
tree | 66fb3964a744694391b99d0b7d46378ec5be8819 /python/vyos/ifconfig.py | |
parent | d77f68ef3198cff019e1e2d74dfe2290800a1ea6 (diff) | |
download | vyos-1x-d80398b6542b24042961ff6eae657c58c98d93c3.tar.gz vyos-1x-d80398b6542b24042961ff6eae657c58c98d93c3.zip |
Python/ifconfig: T1557: refactor 'mac' property to set_mac()
Diffstat (limited to 'python/vyos/ifconfig.py')
-rw-r--r-- | python/vyos/ifconfig.py | 22 |
1 files changed, 3 insertions, 19 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index a128c3d54..afc7bbbf8 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -173,29 +173,13 @@ class Interface: return self._write_sysfs('/sys/class/net/{}/mtu' .format(self._ifname), mtu) - @property - def mac(self): - """ - Get/set interface mac address - - Example: - >>> from vyos.ifconfig import Interface - >>> Interface('eth0').mac - '00:0c:29:11:aa:cc' - """ - return self._read_sysfs('/sys/class/net/{}/address' - .format(self._ifname)) - - @mac.setter - def mac(self, mac): + def set_mac(self, mac): """ - Get/set interface mac address + Set interface MAC (Media Access Contrl) address to given value. Example: >>> from vyos.ifconfig import Interface - >>> Interface('eth0').mac = '00:90:43:fe:fe:1b' - >>> Interface('eth0').mac - '00:90:43:fe:fe:1b' + >>> Interface('eth0').set_mac('00:50:ab:cd:ef:01') """ # on interface removal (ethernet) an empty string is passed - ignore it if not mac: |