summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-23 15:57:18 +0100
committerChristian Poessinger <christian@poessinger.com>2020-03-23 15:57:21 +0100
commita32d4d0bb0c2d324d4c6a20df263348171ec5254 (patch)
tree2f9c1d67928615d5354bf12bb324312e044b9770 /python
parent47cdcc9f7be06c81829dff4b99a4a5c7ab054082 (diff)
downloadvyos-1x-a32d4d0bb0c2d324d4c6a20df263348171ec5254.tar.gz
vyos-1x-a32d4d0bb0c2d324d4c6a20df263348171ec5254.zip
ifconfig: T2151: add possibility to query assigned MAC address
... this is required for delta checks
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/interface.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index 718fe93db..37fa43bde 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -93,6 +93,9 @@ class Interface(Control):
}
_sysfs_get = {
+ 'mac': {
+ 'location': '/sys/class/net/{ifname}/address',
+ },
'mtu': {
'location': '/sys/class/net/{ifname}/mtu',
},
@@ -287,6 +290,17 @@ class Interface(Control):
"""
return self.set_interface('mtu', mtu)
+ def get_mac(self):
+ """
+ Get current interface MAC (Media Access Contrl) address used.
+
+ Example:
+ >>> from vyos.ifconfig import Interface
+ >>> Interface('eth0').get_mac()
+ '00:50:ab:cd:ef:00'
+ """
+ self.get_interface('mac')
+
def set_mac(self, mac):
"""
Set interface MAC (Media Access Contrl) address to given value.