# Path: os_vif/internal/ip/api.py
# LOG = logging.getLogger(__name__)
# 
# Path: os_vif/tests/functional/base.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# DEFAULT_LOG_DIR = os.path.join(_get_test_log_path(), 'osvif-functional-logs')
#     COMPONENT_NAME = 'os_vif'
#     PRIVILEGED_GROUP = 'os_vif_privileged'
# def _get_test_log_path():
# def wait_until_true(predicate, timeout=15, sleep=1):
#     def __init__(cls, name, bases, dct):
#     def _catch_timeout(f):
#         def func(self, *args, **kwargs):
# def setup_logging(component_name):
# def sanitize_log_path(path):
#     def setUp(self):
#     def flags(self, **kw):
# class _CatchTimeoutMetaclass(abc.ABCMeta):
# class BaseFunctionalTestCase(base.BaseTestCase,
#                              metaclass=_CatchTimeoutMetaclass):
# 
# Path: os_vif/tests/functional/privsep.py



import os
import re
from oslo_concurrency import processutils
from oslo_utils import excutils
from os_vif.internal.ip.api import ip as ip_lib
from os_vif.tests.functional import base
from os_vif.tests.functional import privsep
        return match.group('state')

    def show_promisc(self, device):
        regex = re.compile(r".*(PROMISC)")
        match = regex.match(self.show_device(device)[0])
        return True if match else False

    def show_mac(self, device):
        exp = r".*link/ether (?P<mac>([0-9A-Fa-f]{2}[:]){5}[0-9A-Fa-f]{2})"
        regex = re.compile(exp)
        match = regex.match(self.show_device(device)[1])
        if match is None:
            return
        return match.group('mac')

    def show_mtu(self, device):
        regex = re.compile(r".*mtu (?P<mtu>\d+)")
        match = regex.match(self.show_device(device)[0])
        if match is None:
            return
        return int(match.group('mtu'))


@privsep.os_vif_pctxt.entrypoint
def _ip_cmd_set(*args, **kwargs):
    ip_lib.set(*args, **kwargs)


@privsep.os_vif_pctxt.entrypoint
def _ip_cmd_add(*args, **kwargs):

# Path: os_vif/internal/ip/api.py
# LOG = logging.getLogger(__name__)
# 
# Path: os_vif/tests/functional/base.py
# CONF = cfg.CONF
# LOG = logging.getLogger(__name__)
# DEFAULT_LOG_DIR = os.path.join(_get_test_log_path(), 'osvif-functional-logs')
#     COMPONENT_NAME = 'os_vif'
#     PRIVILEGED_GROUP = 'os_vif_privileged'
# def _get_test_log_path():
# def wait_until_true(predicate, timeout=15, sleep=1):
#     def __init__(cls, name, bases, dct):
#     def _catch_timeout(f):
#         def func(self, *args, **kwargs):
# def setup_logging(component_name):
# def sanitize_log_path(path):
#     def setUp(self):
#     def flags(self, **kw):
# class _CatchTimeoutMetaclass(abc.ABCMeta):
# class BaseFunctionalTestCase(base.BaseTestCase,
#                              metaclass=_CatchTimeoutMetaclass):
# 
# Path: os_vif/tests/functional/privsep.py



# Path: os_vif/tests/functional/internal/command/ip/test_impl_pyroute2.py
import os
import re
from oslo_concurrency import processutils
from oslo_utils import excutils
from os_vif.internal.ip.api import ip as ip_lib
from os_vif.tests.functional import base
from os_vif.tests.functional import privsep

        return match.group('state')

    def show_promisc(self, device):
        regex = re.compile(r".*(PROMISC)")
        match = regex.match(self.show_device(device)[0])
        return True if match else False

    def show_mac(self, device):
        exp = r".*link/ether (?P<mac>([0-9A-Fa-f]{2}[:]){5}[0-9A-Fa-f]{2})"
        regex = re.compile(exp)
        match = regex.match(self.show_device(device)[1])
        if match is None:
            return
        return match.group('mac')

    def show_mtu(self, device):
        regex = re.compile(r".*mtu (?P<mtu>\d+)")
        match = regex.match(self.show_device(device)[0])
        if match is None:
            return
        return int(match.group('mtu'))


@privsep.os_vif_pctxt.entrypoint
def _ip_cmd_set(*args, **kwargs):
    ip_lib.set(*args, **kwargs)


@privsep.os_vif_pctxt.entrypoint
def _ip_cmd_add(*args, **kwargs):

    ip_lib.add(*args, **kwargs)