diff options
author | Christian Poessinger <christian@poessinger.com> | 2019-09-24 18:40:07 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2019-09-24 21:53:25 +0200 |
commit | 12d0cdf69ba15dccb705e212ea605b692f825dbd (patch) | |
tree | e871010d64336f6494ef7f1deb372862b11b342c /python | |
parent | 8138766884bb7fe301dc21d2cb0bd3556d169d2e (diff) | |
download | vyos-1x-12d0cdf69ba15dccb705e212ea605b692f825dbd.tar.gz vyos-1x-12d0cdf69ba15dccb705e212ea605b692f825dbd.zip |
Python/ifconfig: T1557: refactor Interface 'ifalias' property to set_alias()
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/ifconfig.py | 29 |
1 files changed, 5 insertions, 24 deletions
diff --git a/python/vyos/ifconfig.py b/python/vyos/ifconfig.py index 749bc6a1a..86e2084d3 100644 --- a/python/vyos/ifconfig.py +++ b/python/vyos/ifconfig.py @@ -261,36 +261,17 @@ class Interface: else: raise ValueError("Value out of range") - @property - def ifalias(self): - """ - Get/set interface alias name - - Example: - - >>> from vyos.ifconfig import Interface - >>> Interface('eth0').ifalias - '' - """ - return self._read_sysfs('/sys/class/net/{}/ifalias' - .format(self._ifname)) - - @ifalias.setter - def ifalias(self, ifalias=None): + def set_alias(self, ifalias=None): """ - Get/set interface alias name + Set interface alias name used by e.g. SNMP Example: >>> from vyos.ifconfig import Interface - >>> Interface('eth0').ifalias = 'VyOS upstream interface' - >>> Interface('eth0').ifalias - 'VyOS upstream interface' + >>> Interface('eth0').set_alias('VyOS upstream interface') - to clear interface alias e.g. delete it use: + to clear alias e.g. delete it use: - >>> Interface('eth0').ifalias = '' - >>> Interface('eth0').ifalias - '' + >>> Interface('eth0').set_ifalias('') """ if not ifalias: # clear interface alias |