# Path: hardware/detect_utils.py
# AUXV_FLAGS = ["AT_HWCAP", "AT_HWCAP2", "AT_PAGESZ",
#               "AT_FLAGS", "AT_PLATFORM"]
# AUXV_OPT_FLAGS = ["AT_BASE_PLATFORM"]
# def cmd(cmdline):
# def output_lines(cmdline):
# def parse_lldtool(hw_lst, interface_name, lines):
# def get_lld_status(hw_lst, interface_name):
# def parse_ethtool(hw_lst, interface_name, lines):
# def get_ethtool_status(hw_lst, interface_name):
# def which(program):
#     def is_exe(fpath):
# def size_in_gb(size):
# def clean_str(val):
# def clean_tuples(lst):
# def _get_uuid_x86_64():
# def _get_uuid_ppc64le(hw_lst):
# def get_uuid(hw_lst):
# def get_value(hw_lst, *vect):
# def get_cidr(netmask):
# def from_file(filename):
# def fix_bad_serial(hw_lst, system_uuid, mobo_id, nic_id):
# def get_cpus(hw_lst):
#     def _maybe_int(v):
#     def _get_governor(lcpu):
# def modprobe(module):
# def detect_auxv():
# def parse_ahci(words):
# def parse_dmesg():
# 
# Path: hardware/detect_utils.py
# def cmd(cmdline):
#     """Equivalent of commands.getstatusoutput"""
#     try:
#         return 0, subprocess.check_output(cmdline,
#                                           shell=True, universal_newlines=True)
#     except subprocess.CalledProcessError as excpt:
#         return excpt.returncode, excpt.output


import re
import sys
from hardware import detect_utils
from hardware.detect_utils import cmd
                port_infos['state'] = re_state.group(1)
            re_phy_state = re.search('State: (.*)', line)
            if re_phy_state is not None:
                port_infos['physical_state'] = re_phy_state.group(1)
            re_rate = re.search('Rate: (.*)', line)
            if re_rate is not None:
                port_infos['rate'] = re_rate.group(1)
            re_blid = re.search('Base lid: (.*)', line)
            if re_blid is not None:
                port_infos['base_lid'] = re_blid.group(1)
            re_lmc = re.search('LMC: (.*)', line)
            if re_lmc is not None:
                port_infos['lmc'] = re_lmc.group(1)
            re_smlid = re.search('SM lid: (.*)', line)
            if re_smlid is not None:
                port_infos['sm_lid'] = re_smlid.group(1)
            re_pguid = re.search('Port GUID: (.*)', line)
            if re_pguid is not None:
                port_infos['port_guid'] = re_pguid.group(1)
    return port_infos


def detect():
    """Detect Infiniband devices.

    To detect if an IB device is present, we search for a pci device.
    This pci device shall be from vendor Mellanox (15b3) from class 0280
    Class 280 stands for a Network Controller while ethernet device are 0200.
    """
    hw_lst = []

# Path: hardware/detect_utils.py
# AUXV_FLAGS = ["AT_HWCAP", "AT_HWCAP2", "AT_PAGESZ",
#               "AT_FLAGS", "AT_PLATFORM"]
# AUXV_OPT_FLAGS = ["AT_BASE_PLATFORM"]
# def cmd(cmdline):
# def output_lines(cmdline):
# def parse_lldtool(hw_lst, interface_name, lines):
# def get_lld_status(hw_lst, interface_name):
# def parse_ethtool(hw_lst, interface_name, lines):
# def get_ethtool_status(hw_lst, interface_name):
# def which(program):
#     def is_exe(fpath):
# def size_in_gb(size):
# def clean_str(val):
# def clean_tuples(lst):
# def _get_uuid_x86_64():
# def _get_uuid_ppc64le(hw_lst):
# def get_uuid(hw_lst):
# def get_value(hw_lst, *vect):
# def get_cidr(netmask):
# def from_file(filename):
# def fix_bad_serial(hw_lst, system_uuid, mobo_id, nic_id):
# def get_cpus(hw_lst):
#     def _maybe_int(v):
#     def _get_governor(lcpu):
# def modprobe(module):
# def detect_auxv():
# def parse_ahci(words):
# def parse_dmesg():
# 
# Path: hardware/detect_utils.py
# def cmd(cmdline):
#     """Equivalent of commands.getstatusoutput"""
#     try:
#         return 0, subprocess.check_output(cmdline,
#                                           shell=True, universal_newlines=True)
#     except subprocess.CalledProcessError as excpt:
#         return excpt.returncode, excpt.output


# Path: hardware/infiniband.py
import re
import sys
from hardware import detect_utils
from hardware.detect_utils import cmd

                port_infos['state'] = re_state.group(1)
            re_phy_state = re.search('State: (.*)', line)
            if re_phy_state is not None:
                port_infos['physical_state'] = re_phy_state.group(1)
            re_rate = re.search('Rate: (.*)', line)
            if re_rate is not None:
                port_infos['rate'] = re_rate.group(1)
            re_blid = re.search('Base lid: (.*)', line)
            if re_blid is not None:
                port_infos['base_lid'] = re_blid.group(1)
            re_lmc = re.search('LMC: (.*)', line)
            if re_lmc is not None:
                port_infos['lmc'] = re_lmc.group(1)
            re_smlid = re.search('SM lid: (.*)', line)
            if re_smlid is not None:
                port_infos['sm_lid'] = re_smlid.group(1)
            re_pguid = re.search('Port GUID: (.*)', line)
            if re_pguid is not None:
                port_infos['port_guid'] = re_pguid.group(1)
    return port_infos


def detect():
    """Detect Infiniband devices.

    To detect if an IB device is present, we search for a pci device.
    This pci device shall be from vendor Mellanox (15b3) from class 0280
    Class 280 stands for a Network Controller while ethernet device are 0200.
    """
    hw_lst = []

    status, _ = detect_utils.cmd(