Exemplo n.º 1
0
def test_snmp_get_next(sess_args):
    res = snmp_get_next('nsCacheEntry', **sess_args)

    assert res.oid == 'nsCacheTimeout'
    assert res.oid_index == '1.3.6.1.2.1.2.2'
    assert int(res.value) >= 0
    assert res.snmp_type == 'INTEGER'
Exemplo n.º 2
0
def test_snmp_get_next_numeric(sess_args):
    res = snmp_get_next(('.1.3.6.1.2.1.1.1', '0'), **sess_args)

    assert res.oid == 'sysObjectID'
    assert res.oid_index == '0'
    assert res.value == '.1.3.6.1.4.1.8072.3.2.10'
    assert res.snmp_type == 'OBJECTID'
Exemplo n.º 3
0
def test_snmp_get_next_numeric(sess_args):
    res = snmp_get_next(('.1.3.6.1.2.1.1.1', '0'), **sess_args)

    assert res.oid == 'sysObjectID'
    assert res.oid_index == '0'
    assert res.value == '.1.3.6.1.4.1.8072.3.2.10'
    assert res.snmp_type == 'OBJECTID'
Exemplo n.º 4
0
def test_snmp_get_next(sess_args):
    res = snmp_get_next('nsCacheEntry', **sess_args)

    assert res.oid == 'nsCacheTimeout'
    assert res.oid_index == '1.3.6.1.2.1.2.2'
    assert int(res.value) >= 0
    assert res.snmp_type == 'INTEGER'
Exemplo n.º 5
0
def test_snmp_get_next(sess_args):
    res = snmp_get_next("nsCacheEntry", **sess_args)

    assert res.oid == "nsCacheTimeout"
    assert res.oid_index == "1.3.6.1.2.1.2.2"
    assert int(res.value) >= 0
    assert res.snmp_type == "INTEGER"
Exemplo n.º 6
0
def test_snmp_get_next_numeric(sess_args):
    res = snmp_get_next((".1.3.6.1.2.1.1.1", "0"), **sess_args)

    assert res.oid == "sysObjectID"
    assert res.oid_index == "0"
    # .10 == Linux, .16 == macosx, .13 == win32, .255 == UNKNOWN
    assert res.value.rsplit(".", 1)[0] == ".1.3.6.1.4.1.8072.3.2"
    assert res.snmp_type == "OBJECTID"
Exemplo n.º 7
0
def test_snmp_get_next_end_of_mib_view(sess_args):
    if sess_args['version'] == 1:
        with pytest.raises(EasySNMPNoSuchNameError):
            snmp_get_next(['iso.9', 'sysDescr', 'iso.9'], **sess_args)
    else:
        res = snmp_get_next(['iso.9', 'sysDescr', 'iso.9'], **sess_args)

        assert res[0]
        assert res[0].value == 'ENDOFMIBVIEW'
        assert res[0].oid == 'iso.9'
        assert res[0].snmp_type == 'ENDOFMIBVIEW'

        assert res[1]
        assert platform.version() in res[1].value
        assert res[1].oid == 'sysDescr'
        assert res[1].oid_index == '0'
        assert res[1].snmp_type == 'OCTETSTR'

        assert res[2]
        assert res[2].value == 'ENDOFMIBVIEW'
        assert res[2].oid == 'iso.9'
        assert res[2].snmp_type == 'ENDOFMIBVIEW'
Exemplo n.º 8
0
def test_snmp_get_next_end_of_mib_view(sess_args):
    if sess_args['version'] == 1:
        with pytest.raises(EasySNMPNoSuchNameError):
            snmp_get_next(['iso.9', 'sysDescr', 'iso.9'], **sess_args)
    else:
        res = snmp_get_next(['iso.9', 'sysDescr', 'iso.9'], **sess_args)

        assert res[0]
        assert res[0].value == 'ENDOFMIBVIEW'
        assert res[0].oid == 'iso.9'
        assert res[0].snmp_type == 'ENDOFMIBVIEW'

        assert res[1]
        assert platform.version() in res[1].value
        assert res[1].oid == 'sysDescr'
        assert res[1].oid_index == '0'
        assert res[1].snmp_type == 'OCTETSTR'

        assert res[2]
        assert res[2].value == 'ENDOFMIBVIEW'
        assert res[2].oid == 'iso.9'
        assert res[2].snmp_type == 'ENDOFMIBVIEW'
Exemplo n.º 9
0
def test_snmp_get_next_end_of_mib_view(sess_args):
    if sess_args["version"] == 1:
        with pytest.raises(EasySNMPNoSuchNameError):
            snmp_get_next(["iso.9", "sysDescr", "iso.9"], **sess_args)
    else:
        res = snmp_get_next(["iso.9", "sysDescr", "iso.9"], **sess_args)

        assert res[0]
        assert res[0].value == "ENDOFMIBVIEW"
        assert res[0].oid == "iso.9"
        assert res[0].snmp_type == "ENDOFMIBVIEW"

        assert res[1]
        assert platform.version() in res[1].value
        assert res[1].oid == "sysDescr"
        assert res[1].oid_index == "0"
        assert res[1].snmp_type == "OCTETSTR"

        assert res[2]
        assert res[2].value == "ENDOFMIBVIEW"
        assert res[2].oid == "iso.9"
        assert res[2].snmp_type == "ENDOFMIBVIEW"
Exemplo n.º 10
0
def test_snmp_get_next_unknown(sess_args):
    with pytest.raises(EasySNMPUnknownObjectIDError):
        snmp_get_next('sysDescripto.0', **sess_args)
Exemplo n.º 11
0
def test_snmp_get_next_unknown(sess_args):
    with pytest.raises(EasySNMPUnknownObjectIDError):
        snmp_get_next('sysDescripto.0', **sess_args)