https://sourceforge.net/p/net-snmp/code/merge-requests/3/
I had quite a lot of fun on this project, and I'd like it to be merged upstream. I know it's 71 commits, and may be easier to just read the final 'snmp_api.c'. I'm also guessing all the source owners are volunteers, who are busy. Anyway, it's been a few weeks, and I'm not complaining, but I'd appreciate some comment on what you'd like to see improved to accept it before I forget everything. I did this to expose the asynchronous API of NetSNMP of old which I'm accustomed to, and (predictably) have been able to realize some significant improvements in monitoring delay, experimentally. Things I learned / issues to spur discussion; I used the new 'Capsule' API, which unfortunately makes it rely on Python 2.7 or later. In retrospect, it might have been better to make the Session and PDU objects "custom types," so that they can be accessed by Python users similarly to the C structures they approximate, rather than what I wound up doing for the callback function - making a dict that approximates the C structure. I dug out placeholders for a grepped-out list of API functions. No doubt some are internal and should be deleted, but it represents opportunities for future work to expose more of the C API to Python users. I prioritized what I needed, and did what I could in the week I had. I've used this library since the CMU-SNMP days, and I noticed the C API was updated in a way that reduced some functionality from old CMU->UCD->NET - I'm referring to the abstraction layer for SNMP transports. It used to be (or so I remember) there was a sockaddr_in on the PDU structure, so you could open a session with no peername, and then set the target address on a PDU-by-PDU basis (this is important, for example, in monitoring systems at scale to control the number of open sockets and allocated socket buffer). The new abstraction structure puts an opaque object there, and the only way to get the same functionality is to create a 'indexed sockaddr' object manually, guessing that's what the default (UDP) transport is going to require. A little hinky, but it works. But even if you have a reference to the non-default transport you're using, there isn't a transport API function to resolve a new opaque object (say from a hostname or IP address) on demand. I'd be happy to submit a C API extension for merging if there is consensus - I think there should be a way to resolve an opaque object onto a PDU from a {multi,single}-session pointer and peername. It should throw an error on transports that don't support multiple endpoints (e.g. TCP). The netsnmp-python setup.py sets its version to 1.0a1. I think this should simply be the netsnmp release version (and it should default to link statically off --basedir=.. if possible, as most users build eggs which should be as hermetic as possible). Any objection to changing one or both of those? We'd really like to get MIB modules loaded out of egg or wheel files as well, talking about hermetic eggs, rather than having the runtime try to find them in magic local directories. This allows us to build python binaries that are fully self contained, and all changes (including mib updates) follow our software release for same. To do this I think the C API will have to change, so that we can insert an abstraction layer where the Python package loader is used instead of system file open routines to read the MIB files. -- Network Tools & Automation Twitter, Inc.
------------------------------------------------------------------------------
_______________________________________________ Net-snmp-coders mailing list Net-snmp-coders@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/net-snmp-coders