[Twisted-Python] SNMPProtocol, request for review...

Mike C. Fletcher mcfletch at rogers.com
Sun Nov 2 11:56:15 MST 2003


I've built an SNMP Protocol for Twisted (based on a pattern from Patrick 
K. O'Brien), but as I'm a rather new Twisted developer, I'm wondering if 
someone more "in the know" could take a look at the package and see if I 
got the "ideas" right.  That is, whether I'm going about the entire 
thing incorrectly/correctly, or whether I've missed anything that would 
be obvious to an experienced twisted developer.

The protocol provides for sending get, getnext and getbulk requests, but 
doesn't yet support trap or answering any query (i.e. in SNMP-eese it's 
a manager-only protocol at the moment, not an agent-side protocol).

I'm particularly interested in:

    * whether the timeouts are handled properly (we do a crude callLater
      and check for deferred.called for them), is there a more elegant
      Twisted mechanism for handling timed-out operations?
    * whether the message IDs are handled properly (we just store all
      "live" messages in a dictionary and delete them when they are
      timed out or responded to), is there some more elegant Twisted
      solution?
    * whether the entire approach is okay. I put most of the code and
      API on the protocol object, with a helper object for managing
      tabular downloads.  Is there a more "Twisted" way of doing this? 
      Should the get method on the protocol be implemented as a separate
      object driving the protocol as well?  What should be in the
      "protocol" level, (as opposed to higher-level "application" code)?

Package is here:
    http://members.rogers.com/mcfletch/programming/TwistedSNMP-0.1.tar.gz
It requires pysnmp-3.3.5, available here:
    http://download.sourceforge.net/pysnmp/

You'll need an SNMP agent against which to test (as well as some OIDs 
for that agent), as the ips in the scripts won't work without the proper 
community IDs (or from unrecognised manager IPs, for that matter).

Feedback appreciated,
Mike

_______________________________________
  Mike C. Fletcher
  Designer, VR Plumber, Coder
  http://members.rogers.com/mcfletch/







More information about the Twisted-Python mailing list