summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig
diff options
context:
space:
mode:
Diffstat (limited to 'python/vyos/ifconfig')
-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.