# 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/tests/utils.py
# def sample(name, mode='r'):
#     return open(os.path.join(_BASEDIR, 'samples', name), mode).read()


import unittest
from hardware import detect_utils
from hardware.tests.utils import sample
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.




class TestParsing(unittest.TestCase):

    def test_parse_lldp_tin(self):
        return self.assertEqual(
            detect_utils.parse_lldtool([], "eth0", LLDPTOOL_TIN.split('\n')),
            LLDPTOOL_TIN_RESULTS)

    def test_parse_lldp_tin2(self):
        return self.assertEqual(
            detect_utils.parse_lldtool([], "eth0", LLDPTOOL_TIN2.split('\n')),
            LLDPTOOL_TIN2_RESULTS)


##############################################################################
# Output from real commands and expected results below
##############################################################################

LLDPTOOL_TIN = sample('lldptool_tin')


# 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/tests/utils.py
# def sample(name, mode='r'):
#     return open(os.path.join(_BASEDIR, 'samples', name), mode).read()


# Path: hardware/tests/test_lldp.py
import unittest
from hardware import detect_utils
from hardware.tests.utils import sample

#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.




class TestParsing(unittest.TestCase):

    def test_parse_lldp_tin(self):
        return self.assertEqual(
            detect_utils.parse_lldtool([], "eth0", LLDPTOOL_TIN.split('\n')),
            LLDPTOOL_TIN_RESULTS)

    def test_parse_lldp_tin2(self):
        return self.assertEqual(
            detect_utils.parse_lldtool([], "eth0", LLDPTOOL_TIN2.split('\n')),
            LLDPTOOL_TIN2_RESULTS)


##############################################################################
# Output from real commands and expected results below
##############################################################################

LLDPTOOL_TIN = sample('lldptool_tin')


LLDPTOOL_TIN2 = sample('lldptool_tin2')