[Python-modules-team] Bug#420964: python-twisted-snmp: patches
from/for Zenoss
Bernd Zeimetz
bernd at bzed.de
Wed Apr 25 14:48:44 UTC 2007
Package: python-pysnmp-se
Version: 3.5.2-2
Severity: wishlist
Tags: patch
Hey Stefano,
as discussed some weeks ago, here are the patches from/for Zenoss.
Please review and test them. AFAIK they only introduce BigCounter and
BigCounter2 support - see
http://lists.zenoss.org/pipermail/zenoss-users/2006/001192.html
Thanks,
Bernd
--
Bernd Zeimetz
<bernd at bzed.de> <http://bzed.de/>
-------------- next part --------------
--- pysnmp/proto/rfc1155.py.orig 2004-01-12 03:52:53.000000000 -0500
+++ pysnmp/proto/rfc1155.py 2006-06-20 09:12:58.000000000 -0400
@@ -40,6 +40,12 @@
"""
pass
+class Unsigned(univ.Integer):
+
+ def _berDecode(self, input):
+ # always unsigned
+ return univ.Integer._berDecode(self, '\0' + input)
+
# ApplicationSyntax
class IpAddress(univ.OctetString):
@@ -84,7 +90,7 @@
return '%d.%d.%d.%d' % (ord(value[0]), ord(value[1]), \
ord(value[2]), ord(value[3]))
-class Counter(univ.Integer):
+class Counter(Unsigned):
"""SNMP Counter object
"""
# Implicit tagging
@@ -94,7 +100,7 @@
# Subtyping -- value range constraint
valueRangeConstraint = (0, 4294967295L)
-class Gauge(univ.Integer):
+class Gauge(Unsigned):
"""SNMP Gauge object
"""
# Implicit tagging
@@ -104,7 +110,7 @@
# Subtyping -- value range constraint
valueRangeConstraint = (0, 4294967295L)
-class TimeTicks(univ.Integer):
+class TimeTicks(Unsigned):
"""SNMP TIMETICKS object
"""
# Implicit tagging
-------------- next part --------------
--- pysnmp/proto/rfc1155.py 2006-08-02 12:28:57.000000000 -0400
+++ pysnmp/proto/rfc1155.py 2006-08-04 15:41:26.000000000 -0400
@@ -90,6 +90,11 @@
return '%d.%d.%d.%d' % (ord(value[0]), ord(value[1]), \
ord(value[2]), ord(value[3]))
+class Bug(IpAddress):
+ sizeConstraint = (4, 8)
+ def _oconv(self, value):
+ return IpAddress._oconv(self, value[:-4])
+
class Counter(Unsigned):
"""SNMP Counter object
"""
@@ -146,8 +151,8 @@
class NetworkAddress(Choice):
"""SMI NetworkAddress
"""
- choiceNames = [ 'internet' ]
- choiceComponents = [ IpAddress ]
+ choiceNames = [ 'internet', 'bug' ]
+ choiceComponents = [ IpAddress, Bug ]
# Initialize to Internet address
initialComponent = choiceComponents[0]
@@ -168,7 +173,7 @@
"""Constructed objects
"""
choiceNames = [ 'address', 'counter', 'gauge', 'ticks', 'arbitrary' ]
- choiceComponents = [ NetworkAddress, Counter, Gauge, TimeTicks, Opaque ]
+ choiceComponents = [ NetworkAddress, Counter, Gauge, TimeTicks, Opaque]
class ObjectSyntax(Choice):
"""Syntax of objects in MIB
-------------- next part --------------
--- pysnmp/proto/rfc1155.py 2006-08-08 09:39:11.000000000 -0400
+++ pysnmp/proto/rfc1155.py 2006-08-08 11:45:22.000000000 -0400
@@ -105,6 +105,13 @@
# Subtyping -- value range constraint
valueRangeConstraint = (0, 4294967295L)
+class BigCounter(Unsigned):
+ """SNMP Counter object
+ """
+ # Implicit tagging
+ tagClass = tagClasses['APPLICATION']
+ tagId = 0x01
+
class Gauge(Unsigned):
"""SNMP Gauge object
"""
@@ -172,8 +179,8 @@
class ApplicationSyntax(Choice):
"""Constructed objects
"""
- choiceNames = [ 'address', 'counter', 'gauge', 'ticks', 'arbitrary' ]
- choiceComponents = [ NetworkAddress, Counter, Gauge, TimeTicks, Opaque]
+ choiceNames = [ 'address', 'counter', 'gauge', 'ticks', 'arbitrary', 'bug' ]
+ choiceComponents = [ NetworkAddress, Counter, Gauge, TimeTicks, Opaque, BigCounter]
class ObjectSyntax(Choice):
"""Syntax of objects in MIB
-------------- next part --------------
--- pysnmp/proto/rfc1155.py 2006-08-08 09:39:11.000000000 -0400
+++ pysnmp/proto/rfc1155.py 2006-08-08 11:45:22.000000000 -0400
@@ -112,6 +112,15 @@
tagClass = tagClasses['APPLICATION']
tagId = 0x01
+class BigCounter2(Counter):
+ """SMI Counter64 object
+ """
+ # Implicit tagging
+ tagId = 0x06
+
+ # Subtyping -- value range constraint
+ valueRangeConstraint = (0, 18446744073709551615L)
+
class Gauge(Unsigned):
"""SNMP Gauge object
"""
@@ -179,8 +188,8 @@
class ApplicationSyntax(Choice):
"""Constructed objects
"""
- choiceNames = [ 'address', 'counter', 'gauge', 'ticks', 'arbitrary', 'bug' ]
- choiceComponents = [ NetworkAddress, Counter, Gauge, TimeTicks, Opaque, BigCounter]
+ choiceNames = [ 'address', 'counter', 'gauge', 'ticks', 'arbitrary', 'bug', 'bug2' ]
+ choiceComponents = [ NetworkAddress, Counter, Gauge, TimeTicks, Opaque, BigCounter, BigCounter2]
class ObjectSyntax(Choice):
"""Syntax of objects in MIB
More information about the Python-modules-team
mailing list