aboutsummaryrefslogtreecommitdiffstats
path: root/os_net_config/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'os_net_config/utils.py')
-rw-r--r--os_net_config/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/os_net_config/utils.py b/os_net_config/utils.py
index a2df823..cd7ee65 100644
--- a/os_net_config/utils.py
+++ b/os_net_config/utils.py
@@ -34,6 +34,15 @@ def get_file_data(filename):
return ""
+def interface_mac(name):
+ try:
+ with open('/sys/class/net/%s/address' % name, "r") as f:
+ return f.read().rstrip()
+ except IOError:
+ logger.error("Unable to read file: %s" % name)
+ raise
+
+
def diff(filename, data):
file_data = get_file_data(filename)
logger.debug("Diff file data:\n%s" % file_data)