Esempio n. 1
0
def generate_test_config(session, config, test_run_file):
    """Enumerate hardware on machine and setup test config file"""

    doc = minidom.Document()

    kit_info_rec = {
        'version': '@KIT_VERSION@',
        'build': '@BUILD_NUMBER@',
        'product_version': '@PRODUCT_VERSION@'
    }

    root_node = doc.createElement('automated_certification_kit')
    utils.set_dict_attributes(root_node, kit_info_rec)
    doc.appendChild(root_node)

    global_config_node = doc.createElement('global_config')
    utils.set_dict_attributes(global_config_node, config)
    root_node.appendChild(global_config_node)

    # Create the XML node under which, each device we are testing
    # is located.

    devices_node = doc.createElement('devices')
    root_node.appendChild(devices_node)

    # Based on the mode of operation, generate the particular tests
    # that the user would like to run.
    ifs = network_interfaces_to_test(session, config)
    if config['mode'] == 'ALL' or config['mode'] == 'NET':
        for iface in ifs:
            print "iface: %s" % iface
            natg = NetworkAdapterTestGenerator(session, config, iface)
            natg.append_xml_config(doc, devices_node)

    # Take an interface to use for non-networking tests
    if not len(ifs):
        raise Exception(
            "Error: in order to run these tests, you need at least one network defined."
        )

    if config['mode'] == 'ALL' or config['mode'] == 'CPU':
        cputg = ProcessorTestGenerator(session, config)
        cputg.append_xml_config(doc, devices_node)

    if config['mode'] == 'ALL' or config['mode'] == 'LSTOR':
        for device in storage_interfaces_to_test(session):
            lstg = StorageTestGenerator(session, config, device)
            lstg.append_xml_config(doc, devices_node)

    if config['mode'] == 'ALL' or config['mode'] == 'OPS':
        optg = OperationsTestGenerator(session, config)
        optg.append_xml_config(doc, devices_node)

    fh = open(test_run_file, 'w')
    fh.write(doc.toxml())
    fh.close()
Esempio n. 2
0
def generate_test_config(session, config, test_run_file):
    """Enumerate hardware on machine and setup test config file"""

    doc = minidom.Document()

    kit_info_rec = {'version': '@KIT_VERSION@', 'build': '@BUILD_NUMBER@',
                    'product_version': '@PRODUCT_VERSION@'}

    root_node = doc.createElement('automated_certification_kit')
    utils.set_dict_attributes(root_node, kit_info_rec)
    doc.appendChild(root_node)

    global_config_node = doc.createElement('global_config')
    utils.set_dict_attributes(global_config_node, config)
    root_node.appendChild(global_config_node)

    # Create the XML node under which, each device we are testing
    # is located. 

    devices_node = doc.createElement('devices')
    root_node.appendChild(devices_node)

    # Based on the mode of operation, generate the particular tests
    # that the user would like to run.
    ifs = network_interfaces_to_test(session, config)
    if config['mode'] == 'ALL' or config['mode'] == 'NET':
        for iface in ifs:
            print "iface: %s" % iface
            natg = NetworkAdapterTestGenerator(session, config, iface)
            natg.append_xml_config(doc, devices_node)

    # Take an interface to use for non-networking tests
    if not len(ifs):
        raise Exception("Error: in order to run these tests, you need a least one network defined.")

    # Just pick any interface
    iface = ifs.pop()

    if config['mode'] == 'ALL' or config['mode'] == 'CPU':
        cputg = ProcessorTestGenerator(session, config, iface)
        cputg.append_xml_config(doc, devices_node)

    if config['mode'] == 'ALL' or config['mode'] == 'LSTOR':
        lstg = StorageTestGenerator(session, config, iface)
        lstg.append_xml_config(doc, devices_node)

    if config['mode'] == 'ALL' or config['mode'] == 'OPS':
        optg = OperationsTestGenerator(session, config, iface)
        optg.append_xml_config(doc, devices_node)
        
    fh = open(test_run_file, 'w')
    fh.write(doc.toxml())
    fh.close()
Esempio n. 3
0
def generate_test_config(session, config, test_run_file):
    """Enumerate hardware on machine and setup test config file"""

    doc = minidom.Document()

    kit_info_rec = {
        'version': '@KIT_VERSION@',
        'build': '@BUILD_NUMBER@',
        'product_version': '@PRODUCT_VERSION@'
    }

    root_node = doc.createElement('automated_certification_kit')
    utils.set_dict_attributes(root_node, kit_info_rec)
    doc.appendChild(root_node)

    global_config_node = doc.createElement('global_config')
    utils.set_dict_attributes(global_config_node, config)
    root_node.appendChild(global_config_node)

    # Create the XML node under which, each device we are testing
    # is located.

    devices_node = doc.createElement('devices')
    root_node.appendChild(devices_node)

    # Based on the mode of operation, generate the particular tests
    # that the user would like to run.
    ifs = network_interfaces_to_test(session, config)
    storage_devs = storage_interfaces_to_test(session)

    # Take an interface to use for non-networking tests
    if not len(ifs):
        raise Exception(
            "Error: in order to run these tests, you need at least one network defined."
        )

    xml_generators = list(XML_GENERATORS)

    # Support the loading of additional tests
    try:
        import ack_addons
        xml_generators.extend(ack_addons.XML_GENERATORS)
    except ImportError:
        utils.log.debug("No ack_addons module found.")

    for gen_cls in xml_generators:
        xml_generator = gen_cls(session, config, config['mode'], ifs,
                                storage_devs)
        xml_generator.append_xml_config(doc, devices_node)

    fh = open(test_run_file, 'w')
    fh.write(doc.toxml())
    fh.close()
Esempio n. 4
0
def generate_test_config(session, config, test_run_file):
    """Enumerate hardware on machine and setup test config file"""

    doc = minidom.Document()

    kit_info_rec = {'version': '@KIT_VERSION@', 'build': '@BUILD_NUMBER@',
                    'product_version': '@PRODUCT_VERSION@'}

    root_node = doc.createElement('automated_certification_kit')
    utils.set_dict_attributes(root_node, kit_info_rec)
    doc.appendChild(root_node)

    global_config_node = doc.createElement('global_config')
    utils.set_dict_attributes(global_config_node, config)
    root_node.appendChild(global_config_node)

    # Create the XML node under which, each device we are testing
    # is located.

    devices_node = doc.createElement('devices')
    root_node.appendChild(devices_node)

    # Based on the mode of operation, generate the particular tests
    # that the user would like to run.
    ifs = network_interfaces_to_test(session, config)
    storage_devs = storage_interfaces_to_test(session)

    # Take an interface to use for non-networking tests
    if not len(ifs):
        raise Exception(
            "Error: in order to run these tests, you need at least one network defined.")

    xml_generators = list(XML_GENERATORS)

    # Support the loading of additional tests
    try:
        import ack_addons
        xml_generators.extend(ack_addons.XML_GENERATORS)
    except ImportError:
        utils.log.debug("No ack_addons module found.")

    for gen_cls in xml_generators:
        xml_generator = gen_cls(session, config, config[
                                'mode'], ifs, storage_devs)
        xml_generator.append_xml_config(doc, devices_node)

    fh = open(test_run_file, 'w')
    fh.write(doc.toxml())
    fh.close()