Exemplo n.º 1
0
def test_read_operating_system(input_filename):
    """Parses up to the OS section."""
    target_file = open(input_filename)
    test_dmi = parse_dmidecode.read_dmidecode(target_file)
    test_os = parse_operating_system.read_operating_system(target_file)
    target_output = open('output.yaml', 'w')
    yaml.dump(test_dmi, target_output)
    yaml.dump(test_os, target_output)
Exemplo n.º 2
0
def test_read_memory_stats(input_filename):
    """Parses up to the MEMORY section."""
    target_file = open(input_filename)
    test_dmi = parse_dmidecode.read_dmidecode(target_file)
    test_os = parse_operating_system.read_operating_system(target_file)
    test_cpu_stats = parse_cpu.read_cpu_stats(target_file)
    test_memory_stats = parse_memory.read_memory_stats(target_file)
    target_output = open('output.yaml', 'w')
    yaml.dump(test_dmi, target_output)
    yaml.dump(test_os, target_output)
    yaml.dump(test_cpu_stats, target_output)
    yaml.dump(test_memory_stats, target_output)
Exemplo n.º 3
0
def test_read_dm_multipath(input_filename):
    """Parses up to the DMI-MULTIPATH section."""
    target_file = open(input_filename)
    test_dmi = parse_dmidecode.read_dmidecode(target_file)
    test_os = parse_operating_system.read_operating_system(target_file)
    test_cpu_stats = parse_cpu.read_cpu_stats(target_file)
    test_memory_stats = parse_memory.read_memory_stats(target_file)
    test_storage_stats = parse_storage.read_storage_stats(target_file)
    test_dm_multipath = parse_dm_multipath.parse_dm_multipath(target_file)
    target_output = open('output.yaml', 'w')
    yaml.dump(test_dmi, target_output)
    yaml.dump(test_os, target_output)
    yaml.dump(test_cpu_stats, target_output)
    yaml.dump(test_memory_stats, target_output)
    yaml.dump(test_storage_stats, target_output)
    yaml.dump(test_dm_multipath, target_output)
Exemplo n.º 4
0
def read_entire_file(input_filename, output_filename):
    """Parses the entire report."""
    target_file = open(input_filename)
    test_dmi = parse_dmidecode.read_dmidecode(target_file)
    test_os = parse_operating_system.read_operating_system(target_file)
    test_cpu_stats = parse_cpu.read_cpu_stats(target_file)
    test_memory_stats = parse_memory.read_memory_stats(target_file)
    test_storage_stats = parse_storage.read_storage_stats(target_file)
    test_dm_multipath = parse_dm_multipath.parse_dm_multipath(target_file)
    test_lspci = parse_lspci.read_lspci(target_file)
    test_ethtool = parse_ethtool.read_ethtool(target_file)
    target_output = open(output_filename, 'w')
    yaml.dump(test_dmi, target_output)
    yaml.dump(test_os, target_output)
    yaml.dump(test_cpu_stats, target_output)
    yaml.dump(test_memory_stats, target_output)
    yaml.dump(test_storage_stats, target_output)
    yaml.dump(test_dm_multipath, target_output)
    yaml.dump(test_lspci, target_output)
    yaml.dump(test_ethtool, target_output)
Exemplo n.º 5
0
def test_read_ethtool(input_filename):
    """Parses up to the ETHTOOL section."""
    target_file = open(input_filename)
    test_dmi = parse_dmidecode.read_dmidecode(target_file)
    test_os = parse_operating_system.read_operating_system(target_file)
    test_cpu_stats = parse_cpu.read_cpu_stats(target_file)
    test_memory_stats = parse_memory.read_memory_stats(target_file)
    test_storage_stats = parse_storage.read_storage_stats(target_file)
    test_dm_multipath = parse_dm_multipath.parse_dm_multipath(target_file)
    test_lspci = parse_lspci.read_lspci(target_file)
    test_ethtool = parse_ethtool.read_ethtool(target_file)
    target_output = open('output.yaml', 'w')
    yaml.dump(test_dmi, target_output)
    yaml.dump(test_os, target_output)
    yaml.dump(test_cpu_stats, target_output)
    yaml.dump(test_memory_stats, target_output)
    yaml.dump(test_storage_stats, target_output)
    yaml.dump(test_dm_multipath, target_output)
    yaml.dump(test_lspci, target_output)
    yaml.dump(test_ethtool, target_output)
Exemplo n.º 6
0
def read_entire_file(input_filename, output_filename):
    """Parses the entire report."""
    target_file = open(input_filename)
    test_dmi = parse_dmidecode.read_dmidecode(target_file)
    test_os = parse_operating_system.read_operating_system(target_file)
    test_cpu_stats = parse_cpu.read_cpu_stats(target_file)
    test_memory_stats = parse_memory.read_memory_stats(target_file)
    test_storage_stats = parse_storage.read_storage_stats(target_file)
    test_dm_multipath = parse_dm_multipath.parse_dm_multipath(target_file)
    test_lspci = parse_lspci.read_lspci(target_file)
    test_ethtool = parse_ethtool.read_ethtool(target_file)
    target_output = open(output_filename, 'w')
    test_list = [
        test_dmi, test_os, test_cpu_stats, test_memory_stats,
        test_storage_stats, test_dm_multipath, test_lspci, test_ethtool
    ]
    for test in test_list:
        target_output.write("---\n")
        yaml.dump(test, Dumper=CustomDumper, stream=target_output)
    target_output.close()
Exemplo n.º 7
0
def test_dmidecode(input_filename):
    """Parses up to the DMIDECODE section."""
    test_dmi = parse_dmidecode.read_dmidecode(open(input_filename))
    yaml.dump(test_dmi, open('output.yaml', 'w'))