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'
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'
def test_snmp_set_unknown(sess_args): with pytest.raises(EasySNMPUnknownObjectIDError): snmp_set('nsCacheTimeoooout', 1234, **sess_args)