def test_command_generator(aggregator):
    """
    Command generator's parameters should match init_config
    """
    check = SnmpCheck('snmp', common.MIBS_FOLDER, {}, {})
    cmdgen, _, _, _, _, _, _ = check._load_conf(common.SNMP_CONF)

    # Test command generator MIB source
    mib_folders = cmdgen.snmpEngine.msgAndPduDsp\
        .mibInstrumController.mibBuilder.getMibSources()
    full_path_mib_folders = map(lambda f: f.fullPath(), mib_folders)

    assert "/etc/mibs" in full_path_mib_folders
    assert not cmdgen.ignoreNonIncreasingOid

    # Test command generator `ignoreNonIncreasingOid` parameter
    check = SnmpCheck('snmp', common.IGNORE_NONINCREASING_OID, {}, {})
    cmdgen, _, _, _, _, _, _ = check._load_conf(common.SNMP_CONF)
    assert cmdgen.ignoreNonIncreasingOid
Example #2
0
def test_command_generator(aggregator):
    """
    Command generator's parameters should match init_config
    """
    check = SnmpCheck('snmp', common.MIBS_FOLDER, {}, {})
    snmp_engine, _, _, _, _, _, _, _ = check._load_conf(common.SNMP_CONF)

    # Test command generator MIB source
    mib_folders = snmp_engine.getMibBuilder().getMibSources()
    full_path_mib_folders = map(lambda f: f.fullPath(), mib_folders)
    assert check.ignore_nonincreasing_oid is False  # Default value

    check = SnmpCheck('snmp', common.IGNORE_NONINCREASING_OID, {}, {})
    assert check.ignore_nonincreasing_oid is True

    assert common.MIBS_FOLDER["mibs_folder"] in full_path_mib_folders