SNMP Protocol for Twisted
This protocol exposes most of the functionality of the pysnmp
manager side operations, with the notable exceptions of traps,
and retrieval from large numbers of agents.
Parallel retrieval from large numbers of agents should be
doable simply by creating ports for each agent and calling
get on that port's protocol.
||Base class for SNMP datagram protocol|
requests -- dictionary holding request-key: df,timer
where request-keys are calculated by our getRequestKey
method, df is the defer for callbacks to the request,
and timer is the timeout timer for the request.
- Method resolution order:
Methods defined here:
- __init__(self, port=20000)
- Initialize the SNMPProtocol object
port -- port on which we are listening...
- datagramReceived(self, datagram, address)
- Process a newly received datagram
Converts the message to a pysnmp response
object, then dispatches it to the appropriate
callback based on the message ID as determined
by getRequestKey( response, address ).
Passes on the response object itself to the
callback, as the response object is needed for
table download and the like.
- decode(self, message)
- Decode a datagram message
- getRequestKey(self, request, target)
- Get the request key from a request/response
- handleTrap(self, request, address)
- Handle a trap message from an agent
- send(self, request, target)
- Send a request (string) to the network
Methods inherited from DatagramProtocol:
- Called due to error from write in connected mode.
Note this is a result of ICMP message generated by *previous*
Methods inherited from AbstractDatagramProtocol:
- Make sure startProtocol is called.
This will be called by makeConnection(), users should not call it.
- Make sure stopProtocol is called.
This will be called by the port, users should not call it.
- makeConnection(self, transport)
- Make a connection to a transport and a server.
This sets the 'transport' attribute of this DatagramProtocol, and calls the
- Called when a transport is connected to this protocol.
Will only be called once, even if multiple ports are connected.
- Called when the transport is disconnected.
Will only be called once, after all ports are disconnected.
Data and other attributes inherited from AbstractDatagramProtocol:
- noisy = True
- numPorts = 0
- transport = None
- port(portNumber=-1, protocolClass=<class twistedsnmp.snmpprotocol.SNMPProtocol>)
- Create a new listening TwistedSNMP port (with attached protocol)
portNumber -- a numeric port specifier, or a sequence of
numeric port specifiers to search
if not specified, defaults to range(25000,30000)
protocolClass -- the protocol class to create, will
be called with default arguments () to create the
XXX should that be an instance? this is a convenience
method, but seems silly to restrict it to protocols
that have the same initialiser. Oh well.
This is a convenience function which allows you to specify
a range of UDP ports which will be searched in order to
create a new TwistedSNMP protocol. Since the client-side
protocol's port number is of minimal interest it is often
handy to have this functionality available.
returns Twisted UDP port object, with the SNMPProtocol
instance available as port.protocol on that object
||reactor = <twisted.internet.selectreactor.SelectReactor instance>|