twistedsnmp.datatypes
index
/home/mcfletch/pylive/twistedsnmp/datatypes.py

Hack around PySNMP lack of generic types
 
This was written against PySNMP 3.3.x, apparently 3.4.x has
some fixes to make this all cleaner, but I haven't had time
to revisit the question just yet.

 
Modules
       
pysnmp.proto.rfc1902
pysnmp.proto.v1
pysnmp.proto.v2c

 
Classes
       
SimpleConverter

 
class SimpleConverter
    Simple callable object that just does target(value.get())
 
  Methods defined here:
__call__(self, value)
__init__(self, target)

 
Functions
       
ipConvert(value)
Mapping that returns v2c.IpAddress(value.get())
nullMapping(value)
Mapping that just returns value unchanged
typeCoerce(value, implementation)
Coerce value to implementation-friendly version
 
value -- Python or PySNMP value to be represented as a value
        compatible with the implementation given
implementation -- v1 or v2c modules from PySNMP, they are
        simply used to choose between use of data-type mappings

 
Data
        v1Mapping = [(<type 'int'>, <class pysnmp.proto.rfc1902.Integer>), (<type 'str'>, <class pysnmp.proto.rfc1902.OctetString>), (<class pysnmp.proto.rfc1155.Choice>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1155.Counter>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1155.Gauge>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1155.Integer>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1155.IpAddress>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1905.EndOfMibView>, <function nullMapping>), (<class pysnmp.proto.rfc1155.Null>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1155.ObjectIdentifier>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1155.ObjectName>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1155.ObjectSyntax>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1155.OctetString>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1155.Opaque>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1155.Sequence>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1155.TimeTicks>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1157.VarBind>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.Counter64>, <twistedsnmp.datatypes.SimpleConverter instance>)]
v2Mapping = [(<type 'int'>, <class pysnmp.proto.rfc1155.Integer>), (<type 'str'>, <class pysnmp.proto.rfc1155.OctetString>), (<class pysnmp.proto.rfc1902.Choice>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.Counter32>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.Counter64>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.Gauge32>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.Integer>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.Integer32>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.IpAddress>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.Null>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.ObjectIdentifier>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.ObjectName>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.OctetString>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.Opaque>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.Sequence>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.TimeTicks>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1905.VarBind>, <twistedsnmp.datatypes.SimpleConverter instance>), (<class pysnmp.proto.rfc1902.Counter64>, <twistedsnmp.datatypes.SimpleConverter instance>)]