Пример #1
0
def test_snmp_set_integer(sess_args):
    success = snmp_set(('nsCacheTimeout', '.1.3.6.1.2.1.2.2'), 65, **sess_args)
    assert success

    res = snmp_get(('nsCacheTimeout', '.1.3.6.1.2.1.2.2'), **sess_args)
    assert res.oid == 'nsCacheTimeout'
    assert res.oid_index == '1.3.6.1.2.1.2.2'
    assert res.value == '65'
    assert res.snmp_type == 'INTEGER'
Пример #2
0
def test_snmp_set_integer(sess_args, reset_values):
    success = snmp_set(("nsCacheTimeout", ".1.3.6.1.2.1.2.2"), 65, **sess_args)
    assert success

    res = snmp_get(("nsCacheTimeout", ".1.3.6.1.2.1.2.2"), **sess_args)
    assert res.oid == "nsCacheTimeout"
    assert res.oid_index == "1.3.6.1.2.1.2.2"
    assert res.value == "65"
    assert res.snmp_type == "INTEGER"
Пример #3
0
def test_snmp_set_integer_short_type(sess_args):
    success = snmp_set(
        ('nsCacheTimeout', '.1.3.6.1.2.1.2.2'), 65, 'i', **sess_args
    )
    assert success

    res = snmp_get(
        ('nsCacheTimeout', '.1.3.6.1.2.1.2.2'), **sess_args
    )
    assert res.oid == 'nsCacheTimeout'
    assert res.oid_index == '1.3.6.1.2.1.2.2'
    assert res.value == '65'
    assert res.snmp_type == 'INTEGER'
Пример #4
0
def test_snmp_set_string(sess_args):
    res = snmp_get(('sysLocation', '0'), **sess_args)
    assert res.oid == 'sysLocation'
    assert res.oid_index == '0'
    assert res.value != 'my newer location'
    assert res.snmp_type == 'OCTETSTR'

    success = snmp_set(('sysLocation', '0'), 'my newer location', **sess_args)
    assert success

    res = snmp_get(('sysLocation', '0'), **sess_args)
    assert res.oid == 'sysLocation'
    assert res.oid_index == '0'
    assert res.value == 'my newer location'
    assert res.snmp_type == 'OCTETSTR'
Пример #5
0
def test_snmp_set_string(sess_args, request, reset_values):
    res = snmp_get(("sysLocation", "0"), **sess_args)
    assert res.oid == "sysLocation"
    assert res.oid_index == "0"
    assert res.value != "my newer location"
    assert res.snmp_type == "OCTETSTR"

    success = snmp_set(("sysLocation", "0"), "my newer location", **sess_args)
    assert success

    res = snmp_get(("sysLocation", "0"), **sess_args)
    assert res.oid == "sysLocation"
    assert res.oid_index == "0"
    assert res.value == "my newer location"
    assert res.snmp_type == "OCTETSTR"
Пример #6
0
def test_snmp_set_string_short_type(sess_args):
    res = snmp_get(('sysLocation', '0'), **sess_args)
    assert res.oid == 'sysLocation'
    assert res.oid_index == '0'
    assert res.value != 'my newer location'
    assert res.snmp_type == 'OCTETSTR'

    success = snmp_set(
        ('sysLocation', '0'), 'my newer location', 's', **sess_args
    )
    assert success

    res = snmp_get(('sysLocation', '0'), **sess_args)
    assert res.oid == 'sysLocation'
    assert res.oid_index == '0'
    assert res.value == 'my newer location'
    assert res.snmp_type == 'OCTETSTR'
Пример #7
0
def test_snmp_set_unknown(sess_args):
    with pytest.raises(EasySNMPUnknownObjectIDError):
        snmp_set('nsCacheTimeoooout', 1234, **sess_args)
Пример #8
0
def test_snmp_set_unknown(sess_args):
    with pytest.raises(EasySNMPUnknownObjectIDError):
        snmp_set('nsCacheTimeoooout', 1234, **sess_args)