charlestolley / python-snmp

A user-friendly SNMP library
MIT License
14 stars 3 forks source link

OID increase check #11

Open denisbondar opened 5 months ago

denisbondar commented 5 months ago

Greetings, @charlestolley!

The getNext and getBulk manager commands do not check for OID increases. Agents that give data out of order can (and most often do) cause a loop.

It is very desirable that such a check be performed by default and an exception thrown if it is detected that the last received OID is not larger than the previous one.

At the same time, there should be an option to forcibly disable this check if necessary, explicitly stating in the documentation that this may cause a loop.

charlestolley commented 5 months ago

This raises the question of the boundary between library and application. I have always viewed this as something that the calling application can check for, if they are concerned about a misbehaving agent. However, I think I would agree that a walk method, if and when we implement that, should include this type of check.

denisbondar commented 5 months ago

Yes, I agree with you. Minimal, yet clearly defined library responsibilities are excellent! Thanks!

denisbondar commented 5 months ago

If you think about it that way, you can probably even get by without high-level functions like walk, just by giving an example of writing such in the documentation. This will make the library more compact and cleaner.