diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-03-27 20:04:43 +0000 |
---|---|---|
committer | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-03-27 22:59:56 +0000 |
commit | 186ea12fecb93d7c8c1eb787e3ae405a9627ec4e (patch) | |
tree | f00e1bfcc10af22340a8a7135679e4a8823e6ed6 /python | |
parent | 583e9d907236a4a98fe40e97a378c1fb655f8a95 (diff) | |
download | vyos-1x-186ea12fecb93d7c8c1eb787e3ae405a9627ec4e.tar.gz vyos-1x-186ea12fecb93d7c8c1eb787e3ae405a9627ec4e.zip |
ifconfig: T2057: add get_alias function
Diffstat (limited to 'python')
-rw-r--r-- | python/vyos/ifconfig/interface.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index f2b43fd35..6c14c3db6 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -66,6 +66,9 @@ class Interface(DHCP): } _sysfs_get = { + 'alias': { + 'location': '/sys/class/net/{ifname}/ifalias', + }, 'mac': { 'location': '/sys/class/net/{ifname}/address', }, @@ -384,6 +387,16 @@ class Interface(DHCP): """ return self.set_interface('link_detect', link_filter) + def get_alias(self): + """ + Get interface alias name used by e.g. SNMP + + Example: + >>> Interface('eth0').get_alias() + 'interface description as set by user' + """ + return self.get_interface('alias') + def set_alias(self, ifalias=''): """ Set interface alias name used by e.g. SNMP |