diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-03-28 07:19:49 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-28 07:19:49 +0100 |
commit | 981b5ad0fd680bad27ef6754502e58429ca0d4b0 (patch) | |
tree | e12bde65c4b3f3422996c4df2f390901d2a1744b | |
parent | 8247524dc18e2b8a97227e6c439051666f85d9a0 (diff) | |
parent | 186ea12fecb93d7c8c1eb787e3ae405a9627ec4e (diff) | |
download | vyos-1x-981b5ad0fd680bad27ef6754502e58429ca0d4b0.tar.gz vyos-1x-981b5ad0fd680bad27ef6754502e58429ca0d4b0.zip |
Merge pull request #276 from thomas-mangin/T2057-alias
ifconfig: T2057: add get_alias function
-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 8e37d6abd..e9c026c5f 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -65,6 +65,9 @@ class Interface(DHCP): } _sysfs_get = { + 'alias': { + 'location': '/sys/class/net/{ifname}/ifalias', + }, 'mac': { 'location': '/sys/class/net/{ifname}/address', }, @@ -383,6 +386,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 |