# 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():


import os
import re
import subprocess
import sys
from hardware import detect_utils
    return False


def restart_bmc():
    """Restart a BMC card."""
    sys.stderr.write('Info: Restarting IPMI BMC\n')
    detect_utils.cmd('ipmitool bmc reset cold')


def setup_network(channel, ipv4, netmask, gateway, vlan_id=-1):
    """Define the network of an IPMI interface."""
    sys.stderr.write('Info: ipmi_setup_network: Setting network ip="%s", '
                     'netmask="%s", gateway="%s", vland_id="%d" on '
                     'channel %s\n' %
                     (ipv4,
                      netmask,
                      gateway,
                      vlan_id,
                      channel))
    # NOTE (leseb): assuming you're missing an argument
    # and this already happened
    # ipmitool always returns 0 and prompt the valid values...
    detect_utils.cmd('ipmitool lan set %s ipsrc static' % channel)
    detect_utils.cmd('ipmitool lan set %s ipaddr %s' % (channel, ipv4))
    detect_utils.cmd('ipmitool lan set %s netmask %s' % (channel, netmask))
    detect_utils.cmd(
        'ipmitool lan set %s defgw ipaddr %s' % (channel, gateway))
    detect_utils.cmd('ipmitool lan set %s arp respond on' % channel)

    if vlan_id >= 0:

# 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/ipmi.py
import os
import re
import subprocess
import sys
from hardware import detect_utils

    return False


def restart_bmc():
    """Restart a BMC card."""
    sys.stderr.write('Info: Restarting IPMI BMC\n')
    detect_utils.cmd('ipmitool bmc reset cold')


def setup_network(channel, ipv4, netmask, gateway, vlan_id=-1):
    """Define the network of an IPMI interface."""
    sys.stderr.write('Info: ipmi_setup_network: Setting network ip="%s", '
                     'netmask="%s", gateway="%s", vland_id="%d" on '
                     'channel %s\n' %
                     (ipv4,
                      netmask,
                      gateway,
                      vlan_id,
                      channel))
    # NOTE (leseb): assuming you're missing an argument
    # and this already happened
    # ipmitool always returns 0 and prompt the valid values...
    detect_utils.cmd('ipmitool lan set %s ipsrc static' % channel)
    detect_utils.cmd('ipmitool lan set %s ipaddr %s' % (channel, ipv4))
    detect_utils.cmd('ipmitool lan set %s netmask %s' % (channel, netmask))
    detect_utils.cmd(
        'ipmitool lan set %s defgw ipaddr %s' % (channel, gateway))
    detect_utils.cmd('ipmitool lan set %s arp respond on' % channel)

    if vlan_id >= 0:

        detect_utils.cmd('ipmitool lan set %s vlan id %d' % (channel, vlan_id))