mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
ifupdown2 2.0.0-1
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
This commit is contained in:
@@ -15,6 +15,7 @@ import signal
|
||||
import logging
|
||||
import subprocess
|
||||
|
||||
from string import maketrans
|
||||
from functools import partial
|
||||
from ipaddr import IPNetwork, IPAddress
|
||||
|
||||
@@ -103,6 +104,7 @@ class utils():
|
||||
systemctl_cmd = '/bin/systemctl'
|
||||
dpkg_cmd = '/usr/bin/dpkg'
|
||||
|
||||
logger.info("utils init command paths")
|
||||
for cmd in ['bridge',
|
||||
'ip',
|
||||
'brctl',
|
||||
@@ -130,6 +132,17 @@ class utils():
|
||||
else:
|
||||
logger.debug('warning: path %s not found: %s won\'t be usable' % (path + cmd, cmd))
|
||||
|
||||
mac_translate_tab = maketrans(":.-,", " ")
|
||||
|
||||
@classmethod
|
||||
def mac_str_to_int(cls, hw_address):
|
||||
mac = 0
|
||||
if hw_address:
|
||||
for i in hw_address.translate(cls.mac_translate_tab).split():
|
||||
mac = mac << 8
|
||||
mac += int(i, 16)
|
||||
return mac
|
||||
|
||||
@staticmethod
|
||||
def get_onff_from_onezero(value):
|
||||
if value in utils._onoff_onezero:
|
||||
|
Reference in New Issue
Block a user