summaryrefslogtreecommitdiff
path: root/pysnmp/smi
diff options
context:
space:
mode:
authorIlya Etingof <etingof@gmail.com>2019-02-10 16:38:35 +0100
committerGitHub <noreply@github.com>2019-02-10 16:38:35 +0100
commit588b9b902d191d8010cb6b247fcb07887d59542c (patch)
tree419b01d2598e91331db784ac3a6675324aba8c24 /pysnmp/smi
parent9664858b145140a4fbb2a22b633c1ab41c2555bd (diff)
downloadpysnmp-git-588b9b902d191d8010cb6b247fcb07887d59542c.tar.gz
Uppercase global constants (#238)
This is a massive patch essentially upper-casing global/class attributes that mean to be constants. Some previously exposed constants have been preserved for compatibility reasons (notably, in `hlapi`), though the rest might break user code relying on pysnmp 4.
Diffstat (limited to 'pysnmp/smi')
-rw-r--r--pysnmp/smi/builder.py51
-rw-r--r--pysnmp/smi/compiler.py16
-rw-r--r--pysnmp/smi/instrum.py14
-rw-r--r--pysnmp/smi/mibs/SNMPv2-SMI.py92
-rw-r--r--pysnmp/smi/mibs/SNMPv2-TC.py2
-rw-r--r--pysnmp/smi/rfc1902.py112
-rw-r--r--pysnmp/smi/view.py6
7 files changed, 148 insertions, 145 deletions
diff --git a/pysnmp/smi/builder.py b/pysnmp/smi/builder.py
index 01273491..dedf95a2 100644
--- a/pysnmp/smi/builder.py
+++ b/pysnmp/smi/builder.py
@@ -14,8 +14,10 @@ import traceback
try:
from errno import ENOENT
+
except ImportError:
ENOENT = -1
+
from pysnmp import __version__ as pysnmp_version
from pysnmp.smi import error
from pysnmp import debug
@@ -38,7 +40,7 @@ class __AbstractMibSource(object):
if typ not in self.__sfx:
self.__sfx[typ] = []
self.__sfx[typ].append((sfx, len(sfx), mode))
- debug.logger & debug.flagBld and debug.logger('trying %s' % self)
+ debug.logger & debug.FLAG_BLD and debug.logger('trying %s' % self)
def __repr__(self):
return '%s(%r)' % (self.__class__.__name__, self._srcName)
@@ -82,7 +84,7 @@ class __AbstractMibSource(object):
except IOError as exc:
if ENOENT == -1 or exc.errno == ENOENT:
- debug.logger & debug.flagBld and debug.logger(
+ debug.logger & debug.FLAG_BLD and debug.logger(
'file %s access error: %s' % (f + pycSfx, exc)
)
@@ -94,13 +96,13 @@ class __AbstractMibSource(object):
pycData = pycData[4:]
pycTime = struct.unpack('<L', pycData[:4])[0]
pycData = pycData[4:]
- debug.logger & debug.flagBld and debug.logger(
+ debug.logger & debug.FLAG_BLD and debug.logger(
'file %s mtime %d' % (pycPath, pycTime)
)
break
else:
- debug.logger & debug.flagBld and debug.logger('bad magic in %s' % pycPath)
+ debug.logger & debug.FLAG_BLD and debug.logger('bad magic in %s' % pycPath)
for pySfx, pySfxLen, pyMode in self.__sfx[imp.PY_SOURCE]:
try:
@@ -108,7 +110,7 @@ class __AbstractMibSource(object):
except IOError as exc:
if ENOENT == -1 or exc.errno == ENOENT:
- debug.logger & debug.flagBld and debug.logger(
+ debug.logger & debug.FLAG_BLD and debug.logger(
'file %s access error: %s' % (f + pySfx, exc)
)
@@ -116,7 +118,7 @@ class __AbstractMibSource(object):
raise error.MibLoadError('MIB file %s access error: %s' % (f + pySfx, exc))
else:
- debug.logger & debug.flagBld and debug.logger('file %s mtime %d' % (f + pySfx, pyTime))
+ debug.logger & debug.FLAG_BLD and debug.logger('file %s mtime %d' % (f + pySfx, pyTime))
break
if pycTime != -1 and pycTime >= pyTime:
@@ -212,7 +214,7 @@ class DirMibSource(__AbstractMibSource):
try:
return self._uniqNames(os.listdir(self._srcName))
except OSError as exc:
- debug.logger & debug.flagBld and debug.logger(
+ debug.logger & debug.FLAG_BLD and debug.logger(
'listdir() failed for %s: %s' % (self._srcName, exc))
return ()
@@ -243,10 +245,11 @@ class DirMibSource(__AbstractMibSource):
class MibBuilder(object):
- defaultCoreMibs = os.pathsep.join(
+ DEFAULT_CORE_MIBS = os.pathsep.join(
('pysnmp.smi.mibs.instances', 'pysnmp.smi.mibs')
)
- defaultMiscMibs = 'pysnmp_mibs'
+
+ DEFAULT_MISC_MIBS = 'pysnmp_mibs'
moduleID = 'PYSNMP_MODULE_ID'
@@ -262,10 +265,10 @@ class MibBuilder(object):
if ev in os.environ:
for m in os.environ[ev].split(os.pathsep):
sources.append(ZipMibSource(m))
- if not sources and self.defaultMiscMibs:
- for m in self.defaultMiscMibs.split(os.pathsep):
+ if not sources and self.DEFAULT_MISC_MIBS:
+ for m in self.DEFAULT_MISC_MIBS.split(os.pathsep):
sources.append(ZipMibSource(m))
- for m in self.defaultCoreMibs.split(os.pathsep):
+ for m in self.DEFAULT_CORE_MIBS.split(os.pathsep):
sources.insert(0, ZipMibSource(m))
self.mibSymbols = {}
self.__mibSources = []
@@ -288,11 +291,11 @@ class MibBuilder(object):
def addMibSources(self, *mibSources):
self.__mibSources.extend([s.init() for s in mibSources])
- debug.logger & debug.flagBld and debug.logger('addMibSources: new MIB sources %s' % (self.__mibSources,))
+ debug.logger & debug.FLAG_BLD and debug.logger('addMibSources: new MIB sources %s' % (self.__mibSources,))
def setMibSources(self, *mibSources):
self.__mibSources = [s.init() for s in mibSources]
- debug.logger & debug.flagBld and debug.logger('setMibSources: new MIB sources %s' % (self.__mibSources,))
+ debug.logger & debug.FLAG_BLD and debug.logger('setMibSources: new MIB sources %s' % (self.__mibSources,))
def getMibSources(self):
return tuple(self.__mibSources)
@@ -300,25 +303,25 @@ class MibBuilder(object):
def loadModule(self, modName, **userCtx):
"""Load and execute MIB modules as Python code"""
for mibSource in self.__mibSources:
- debug.logger & debug.flagBld and debug.logger('loadModule: trying %s at %s' % (modName, mibSource))
+ debug.logger & debug.FLAG_BLD and debug.logger('loadModule: trying %s at %s' % (modName, mibSource))
try:
codeObj, sfx = mibSource.read(modName)
except IOError as exc:
- debug.logger & debug.flagBld and debug.logger(
+ debug.logger & debug.FLAG_BLD and debug.logger(
'loadModule: read %s from %s failed: %s' % (modName, mibSource, exc))
continue
modPath = mibSource.fullPath(modName, sfx)
if modPath in self.__modPathsSeen:
- debug.logger & debug.flagBld and debug.logger('loadModule: seen %s' % modPath)
+ debug.logger & debug.FLAG_BLD and debug.logger('loadModule: seen %s' % modPath)
break
else:
self.__modPathsSeen.add(modPath)
- debug.logger & debug.flagBld and debug.logger('loadModule: evaluating %s' % modPath)
+ debug.logger & debug.FLAG_BLD and debug.logger('loadModule: evaluating %s' % modPath)
g = {'mibBuilder': self, 'userCtx': userCtx}
@@ -333,7 +336,7 @@ class MibBuilder(object):
self.__modSeen[modName] = modPath
- debug.logger & debug.flagBld and debug.logger('loadModule: loaded %s' % modPath)
+ debug.logger & debug.FLAG_BLD and debug.logger('loadModule: loaded %s' % modPath)
break
@@ -366,7 +369,7 @@ class MibBuilder(object):
except error.MibNotFoundError:
if self.__mibCompiler:
- debug.logger & debug.flagBld and debug.logger('loadModules: calling MIB compiler for %s' % modName)
+ debug.logger & debug.FLAG_BLD and debug.logger('loadModules: calling MIB compiler for %s' % modName)
status = self.__mibCompiler.compile(modName, genTexts=self.loadTexts)
errs = '; '.join([hasattr(x, 'error') and str(x.error) or x for x in status.values() if
x in ('failed', 'missing')])
@@ -390,7 +393,7 @@ class MibBuilder(object):
self.__modPathsSeen.remove(self.__modSeen[modName])
del self.__modSeen[modName]
- debug.logger & debug.flagBld and debug.logger('unloadModules: %s' % modName)
+ debug.logger & debug.FLAG_BLD and debug.logger('unloadModules: %s' % modName)
return self
@@ -420,7 +423,7 @@ class MibBuilder(object):
mibSymbols = self.mibSymbols[modName]
for symObj in anonymousSyms:
- debug.logger & debug.flagBld and debug.logger(
+ debug.logger & debug.FLAG_BLD and debug.logger(
'exportSymbols: anonymous symbol %s::__pysnmp_%ld' % (modName, self._autoName))
mibSymbols['__pysnmp_%ld' % self._autoName] = symObj
self._autoName += 1
@@ -440,7 +443,7 @@ class MibBuilder(object):
mibSymbols[symName] = symObj
- debug.logger & debug.flagBld and debug.logger('exportSymbols: symbol %s::%s' % (modName, symName))
+ debug.logger & debug.FLAG_BLD and debug.logger('exportSymbols: symbol %s::%s' % (modName, symName))
self.lastBuildId += 1
@@ -457,7 +460,7 @@ class MibBuilder(object):
)
del mibSymbols[symName]
- debug.logger & debug.flagBld and debug.logger('unexportSymbols: symbol %s::%s' % (modName, symName))
+ debug.logger & debug.FLAG_BLD and debug.logger('unexportSymbols: symbol %s::%s' % (modName, symName))
if not self.mibSymbols[modName]:
del self.mibSymbols[modName]
diff --git a/pysnmp/smi/compiler.py b/pysnmp/smi/compiler.py
index 08e38811..231685f8 100644
--- a/pysnmp/smi/compiler.py
+++ b/pysnmp/smi/compiler.py
@@ -7,15 +7,15 @@
import os
import sys
-defaultSources = ['file:///usr/share/snmp/mibs', 'file:///usr/share/mibs']
+DEFAULT_SOURCES = ['file:///usr/share/snmp/mibs', 'file:///usr/share/mibs']
if sys.platform[:3] == 'win':
- defaultDest = os.path.join(os.path.expanduser("~"),
+ DEFAULT_DEST = os.path.join(os.path.expanduser("~"),
'PySNMP Configuration', 'mibs')
else:
- defaultDest = os.path.join(os.path.expanduser("~"), '.pysnmp', 'mibs')
+ DEFAULT_DEST = os.path.join(os.path.expanduser("~"), '.pysnmp', 'mibs')
-defaultBorrowers = []
+DEFAULT_BORROWERS = []
try:
from pysmi.reader.url import getReadersFromUrls
@@ -50,16 +50,16 @@ else:
compiler = MibCompiler(parserFactory(**smiV1Relaxed)(),
PySnmpCodeGen(),
- PyFileWriter(kwargs.get('destination') or defaultDest))
+ PyFileWriter(kwargs.get('destination') or DEFAULT_DEST))
- compiler.addSources(*getReadersFromUrls(*kwargs.get('sources') or defaultSources))
+ compiler.addSources(*getReadersFromUrls(*kwargs.get('sources') or DEFAULT_SOURCES))
compiler.addSearchers(StubSearcher(*baseMibs))
compiler.addSearchers(*[PyPackageSearcher(x.fullPath()) for x in mibBuilder.getMibSources()])
compiler.addBorrowers(*[PyFileBorrower(x, genTexts=mibBuilder.loadTexts) for x in
- getReadersFromUrls(*kwargs.get('borrowers') or defaultBorrowers,
+ getReadersFromUrls(*kwargs.get('borrowers') or DEFAULT_BORROWERS,
lowcaseMatching=False)])
mibBuilder.setMibCompiler(
- compiler, kwargs.get('destination') or defaultDest
+ compiler, kwargs.get('destination') or DEFAULT_DEST
)
diff --git a/pysnmp/smi/instrum.py b/pysnmp/smi/instrum.py
index f6940957..05c5c30b 100644
--- a/pysnmp/smi/instrum.py
+++ b/pysnmp/smi/instrum.py
@@ -200,7 +200,7 @@ class MibInstrumController(AbstractMibInstrumController):
self.lastBuildId = self.mibBuilder.lastBuildId
- debug.logger & debug.flagIns and debug.logger('__indexMib: rebuilt')
+ debug.logger & debug.FLAG_INS and debug.logger('__indexMib: rebuilt')
def flipFlopFsm(self, fsmTable, *varBinds, **context):
"""Read, modify, create or remove Managed Objects Instances.
@@ -275,19 +275,19 @@ class MibInstrumController(AbstractMibInstrumController):
count[0] += 1
- debug.logger & debug.flagIns and debug.logger(
+ debug.logger & debug.FLAG_INS and debug.logger(
'_cbFun: var-bind %d, processed %d, expected %d' % (
idx, count[0], len(varBinds)))
if count[0] < len(varBinds):
return
- debug.logger & debug.flagIns and debug.logger(
+ debug.logger & debug.FLAG_INS and debug.logger(
'_cbFun: finished, output var-binds %r' % (_varBinds,))
self.flipFlopFsm(fsmTable, *varBinds, **dict(context, cbFun=cbFun))
- debug.logger & debug.flagIns and debug.logger('flipFlopFsm: input var-binds %r' % (varBinds,))
+ debug.logger & debug.FLAG_INS and debug.logger('flipFlopFsm: input var-binds %r' % (varBinds,))
mibTree, = self.mibBuilder.importSymbols('SNMPv2-SMI', 'iso')
@@ -306,7 +306,7 @@ class MibInstrumController(AbstractMibInstrumController):
self.__indexMib()
- debug.logger & debug.flagIns and debug.logger(
+ debug.logger & debug.FLAG_INS and debug.logger(
'flipFlopFsm: current state %s, status %s' % (state, status))
try:
@@ -319,7 +319,7 @@ class MibInstrumController(AbstractMibInstrumController):
except KeyError:
raise error.SmiError('Unresolved FSM state %s, %s' % (state, status))
- debug.logger & debug.flagIns and debug.logger(
+ debug.logger & debug.FLAG_INS and debug.logger(
'flipFlopFsm: state %s status %s -> transitioned into state %s' % (state, status, newState))
state = newState
@@ -352,7 +352,7 @@ class MibInstrumController(AbstractMibInstrumController):
instances=instances, errors=errors,
varBinds=_varBinds, nextName=None))
- debug.logger & debug.flagIns and debug.logger(
+ debug.logger & debug.FLAG_INS and debug.logger(
'flipFlopFsm: func %s initiated for %r' % (actionFun, varBind))
@staticmethod
diff --git a/pysnmp/smi/mibs/SNMPv2-SMI.py b/pysnmp/smi/mibs/SNMPv2-SMI.py
index 03a085a1..68b2922a 100644
--- a/pysnmp/smi/mibs/SNMPv2-SMI.py
+++ b/pysnmp/smi/mibs/SNMPv2-SMI.py
@@ -512,7 +512,7 @@ class ManagedMibObject(ObjectType):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: readTest(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -533,7 +533,7 @@ class ManagedMibObject(ObjectType):
val = exval.noSuchInstance
except error.SmiError as exc:
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: exception %r' % (self, exc)))
if not node:
@@ -583,7 +583,7 @@ class ManagedMibObject(ObjectType):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: readGet(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -604,7 +604,7 @@ class ManagedMibObject(ObjectType):
val = exval.noSuchInstance
except error.SmiError as exc:
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: exception %r' % (self, exc)))
if not node:
@@ -647,7 +647,7 @@ class ManagedMibObject(ObjectType):
val = exval.noSuchInstance
except error.SmiError as exc:
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: exception %r' % (self, exc)))
if not node:
@@ -714,7 +714,7 @@ class ManagedMibObject(ObjectType):
In case of an error, the `error` key in the `context` dict will contain
an exception object.
"""
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: readTestNext(%s, %r)' % (self, name, val)))
self._readNext('readTestNext', varBind, **context)
@@ -759,7 +759,7 @@ class ManagedMibObject(ObjectType):
In case of an error, the `error` key in the `context` dict will contain
an exception object.
"""
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: readGetNext(%s, %r)' % (self, name, val)))
self._readNext('readGetNext', varBind, **context)
@@ -812,7 +812,7 @@ class ManagedMibObject(ObjectType):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeTest(%s, %r)' % (self, name, val)))
try:
@@ -866,7 +866,7 @@ class ManagedMibObject(ObjectType):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeCommit(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -930,7 +930,7 @@ class ManagedMibObject(ObjectType):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeCleanup(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -996,7 +996,7 @@ class ManagedMibObject(ObjectType):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeUndo(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -1151,7 +1151,7 @@ class MibScalar(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: readGet(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -1221,7 +1221,7 @@ class MibScalar(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: readGetNext(%s, %r)' % (self, name, val)))
acFun = context.get('acFun')
@@ -1290,7 +1290,7 @@ class MibScalar(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeTest(%s, %r)' % (self, name, val)))
acFun = context.get('acFun')
@@ -1352,7 +1352,7 @@ class MibScalar(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: createTest(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -1365,7 +1365,7 @@ class MibScalar(ManagedMibObject):
acFun = context.get('acFun')
if acFun:
if self.maxAccess != 'readcreate' or acFun('write', varBind, **context):
- debug.logger & debug.flagACL and debug.logger(
+ debug.logger & debug.FLAG_ACL and debug.logger(
'createTest: %s=%r %s at %s' % (name, val, self.maxAccess, self.name))
exc = error.NoCreationError(name=name, idx=context.get('idx'))
cbFun(varBind, **dict(context, error=exc))
@@ -1429,7 +1429,7 @@ class MibScalar(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeCommit(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -1488,7 +1488,7 @@ class MibScalar(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: createCleanup(%s, %r)' % (self, name, val)))
instances = context['instances'].setdefault(self.name, {self.ST_CREATE: {}, self.ST_DESTROY: {}})
@@ -1542,7 +1542,7 @@ class MibScalar(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: createUndo(%s, %r)' % (self, name, val)))
instances = context['instances'].setdefault(self.name, {self.ST_CREATE: {}, self.ST_DESTROY: {}})
@@ -1587,7 +1587,7 @@ class MibScalarInstance(ManagedMibObject):
#
def getValue(self, name, **context):
- debug.logger & debug.flagIns and debug.logger('getValue: returning %r for %s' % (self.syntax, self.name))
+ debug.logger & debug.FLAG_INS and debug.logger('getValue: returning %r for %s' % (self.syntax, self.name))
return self.syntax.clone()
def setValue(self, value, name, **context):
@@ -1601,7 +1601,7 @@ class MibScalarInstance(ManagedMibObject):
return self.syntax.clone(value)
except PyAsn1Error as exc:
- debug.logger & debug.flagIns and debug.logger('setValue: %s=%r failed with traceback %s' % (
+ debug.logger & debug.FLAG_INS and debug.logger('setValue: %s=%r failed with traceback %s' % (
self.name, value, traceback.format_exception(*sys.exc_info())))
if isinstance(exc, error.TableRowManagement):
raise exc
@@ -1678,7 +1678,7 @@ class MibScalarInstance(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: readTest(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -1729,7 +1729,7 @@ class MibScalarInstance(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: readGet(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -1788,7 +1788,7 @@ class MibScalarInstance(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: readTestNext(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -1846,7 +1846,7 @@ class MibScalarInstance(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: readGetNext(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -1911,7 +1911,7 @@ class MibScalarInstance(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeTest(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -1985,7 +1985,7 @@ class MibScalarInstance(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeCommit(%s, %r)' % (self, name, val)))
instances = context['instances'].setdefault(self.name, {self.ST_CREATE: {}, self.ST_DESTROY: {}})
@@ -2037,7 +2037,7 @@ class MibScalarInstance(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeCleanup(%s, %r)' % (self, name, val)))
instances = context['instances'].setdefault(self.name, {self.ST_CREATE: {}, self.ST_DESTROY: {}})
@@ -2092,7 +2092,7 @@ class MibScalarInstance(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeUndo(%s, %r)' % (self, name, val)))
instances = context['instances'].setdefault(self.name, {self.ST_CREATE: {}, self.ST_DESTROY: {}})
@@ -2197,7 +2197,7 @@ class MibTableColumn(MibScalar, ObjectType):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: destroyTest(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -2213,7 +2213,7 @@ class MibTableColumn(MibScalar, ObjectType):
acFun = context.get('acFun')
if acFun:
if self.maxAccess != 'readcreate' or acFun('write', varBind, **context):
- debug.logger & debug.flagACL and debug.logger(
+ debug.logger & debug.FLAG_ACL and debug.logger(
'destroyTest: %s=%r %s at %s' % (name, val, self.maxAccess, self.name))
exc = error.NotWritableError(name=name, idx=context.get('idx'))
cbFun(varBind, **dict(context, error=exc))
@@ -2226,7 +2226,7 @@ class MibTableColumn(MibScalar, ObjectType):
pass
else:
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: terminated columnar instance %s creation' % (self, name)))
cbFun(varBind, **context)
@@ -2276,7 +2276,7 @@ class MibTableColumn(MibScalar, ObjectType):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: destroyCommit(%s, %r)' % (self, name, val)))
instances = context['instances'].setdefault(self.name, {self.ST_CREATE: {}, self.ST_DESTROY: {}})
@@ -2335,7 +2335,7 @@ class MibTableColumn(MibScalar, ObjectType):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: destroyCleanup(%s, %r)' % (self, name, val)))
self.branchVersionId += 1
@@ -2391,7 +2391,7 @@ class MibTableColumn(MibScalar, ObjectType):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: destroyUndo(%s, %r)' % (self, name, val)))
instances = context['instances'].setdefault(self.name, {self.ST_CREATE: {}, self.ST_DESTROY: {}})
@@ -2657,7 +2657,7 @@ class MibTableRow(ManagedMibObject):
mibObj, = mibBuilder.importSymbols(modName, mibSym)
mibObj.receiveManagementEvent(action, (baseIndices, val), **dict(context, cbFun=_cbFun))
- debug.logger & debug.flagIns and debug.logger('announceManagementEvent %s to %s' % (action, mibObj))
+ debug.logger & debug.FLAG_INS and debug.logger('announceManagementEvent %s to %s' % (action, mibObj))
def receiveManagementEvent(self, action, varBind, **context):
"""Apply mass operation on extending table's row.
@@ -2712,7 +2712,7 @@ class MibTableRow(ManagedMibObject):
parentIndices.append(syntax)
if instId:
- debug.logger & debug.flagIns and debug.logger(
+ debug.logger & debug.FLAG_INS and debug.logger(
'receiveManagementEvent %s for suffix %s' % (action, instId))
self._manageColumns(action, (self.name + (0,) + instId, val), **context)
@@ -2789,7 +2789,7 @@ class MibTableRow(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: _manageColumns(%s, %s, %r)' % (self, action, name, val)))
cbFun = context['cbFun']
@@ -2841,7 +2841,7 @@ class MibTableRow(ManagedMibObject):
actionFun((colInstanceName, colInstanceValue),
**dict(context, acFun=acFun, cbFun=_cbFun))
- debug.logger & debug.flagIns and debug.logger(
+ debug.logger & debug.FLAG_INS and debug.logger(
'_manageColumns: action %s name %s instance %s %svalue %r' % (
action, name, instId, name in indexVals and "index " or "", indexVals.get(name, val)))
@@ -2876,7 +2876,7 @@ class MibTableRow(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: _checkColumns(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -2912,7 +2912,7 @@ class MibTableRow(ManagedMibObject):
colObj.readGet((instName, None), **dict(context, cbFun=_cbFun))
- debug.logger & debug.flagIns and debug.logger(
+ debug.logger & debug.FLAG_INS and debug.logger(
'%s: _checkColumns: checking instance %s' % (self, instName))
def writeTest(self, varBind, **context):
@@ -2963,7 +2963,7 @@ class MibTableRow(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeTest(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -3045,7 +3045,7 @@ class MibTableRow(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeCommit(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -3131,7 +3131,7 @@ class MibTableRow(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeCleanup(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -3204,7 +3204,7 @@ class MibTableRow(ManagedMibObject):
"""
name, val = varBind
- (debug.logger & debug.flagIns and
+ (debug.logger & debug.FLAG_INS and
debug.logger('%s: writeUndo(%s, %r)' % (self, name, val)))
cbFun = context['cbFun']
@@ -3253,7 +3253,7 @@ class MibTableRow(ManagedMibObject):
try:
syntax, instId = self.oidToValue(mibObj.syntax, instId, impliedFlag, indices)
except PyAsn1Error as exc:
- debug.logger & debug.flagIns and debug.logger(
+ debug.logger & debug.FLAG_INS and debug.logger(
'error resolving table indices at %s, %s: %s' % (self.__class__.__name__, instId, exc))
indices = [instId]
instId = ()
diff --git a/pysnmp/smi/mibs/SNMPv2-TC.py b/pysnmp/smi/mibs/SNMPv2-TC.py
index 1367e936..f234a2f3 100644
--- a/pysnmp/smi/mibs/SNMPv2-TC.py
+++ b/pysnmp/smi/mibs/SNMPv2-TC.py
@@ -501,7 +501,7 @@ class RowStatus(TextualConvention, Integer):
newState = self.clone(newState)
- debug.logger & debug.flagIns and debug.logger(
+ debug.logger & debug.FLAG_INS and debug.logger(
'RowStatus state change from %r to %r produced new state %r, error indication %r' % (
self, value, newState, excValue))
diff --git a/pysnmp/smi/rfc1902.py b/pysnmp/smi/rfc1902.py
index 506434e9..35c9f628 100644
--- a/pysnmp/smi/rfc1902.py
+++ b/pysnmp/smi/rfc1902.py
@@ -79,14 +79,14 @@ class ObjectIdentity(object):
ObjectIdentity('IP-MIB', 'ipAdEntAddr', '127.0.0.1', 123)
"""
- stDirty, stClean = 1, 2
+ ST_DIRTY, ST_CLEAN = 1, 2
def __init__(self, *args, **kwargs):
self.__args = args
self.__kwargs = kwargs
self.__mibSourcesToAdd = self.__modNamesToLoad = None
self.__asn1SourcesToAdd = self.__asn1SourcesOptions = None
- self.__state = self.stDirty
+ self.__state = self.ST_DIRTY
self.__indices = self.__oid = self.__label = ()
self.__modName = self.__symName = ''
self.__mibNode = None
@@ -117,7 +117,7 @@ class ObjectIdentity(object):
>>>
"""
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__modName, self.__symName, self.__indices
else:
raise SmiError('%s object not fully initialized' % self.__class__.__name__)
@@ -144,7 +144,7 @@ class ObjectIdentity(object):
>>>
"""
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__oid
else:
raise SmiError('%s object not fully initialized' % self.__class__.__name__)
@@ -180,19 +180,19 @@ class ObjectIdentity(object):
>>>
"""
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__label
else:
raise SmiError('%s object not fully initialized' % self.__class__.__name__)
def getMibNode(self):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__mibNode
else:
raise SmiError('%s object not fully initialized' % self.__class__.__name__)
def isFullyResolved(self):
- return self.__state & self.stClean
+ return self.__state & self.ST_CLEAN
#
# A gateway to MIBs manipulation routines
@@ -346,7 +346,7 @@ class ObjectIdentity(object):
"""
if self.__mibSourcesToAdd is not None:
- debug.logger & debug.flagMIB and debug.logger('adding MIB sources %s' % ', '.join(self.__mibSourcesToAdd))
+ debug.logger & debug.FLAG_MIB and debug.logger('adding MIB sources %s' % ', '.join(self.__mibSourcesToAdd))
mibViewController.mibBuilder.addMibSources(
*[ZipMibSource(x) for x in self.__mibSourcesToAdd]
)
@@ -356,7 +356,7 @@ class ObjectIdentity(object):
addMibCompiler(mibViewController.mibBuilder,
ifAvailable=True, ifNotAdded=True)
else:
- debug.logger & debug.flagMIB and debug.logger(
+ debug.logger & debug.FLAG_MIB and debug.logger(
'adding MIB compiler with source paths %s' % ', '.join(self.__asn1SourcesToAdd))
addMibCompiler(
mibViewController.mibBuilder,
@@ -370,11 +370,11 @@ class ObjectIdentity(object):
self.__asn1SourcesToAdd = self.__asn1SourcesOptions = None
if self.__modNamesToLoad is not None:
- debug.logger & debug.flagMIB and debug.logger('loading MIB modules %s' % ', '.join(self.__modNamesToLoad))
+ debug.logger & debug.FLAG_MIB and debug.logger('loading MIB modules %s' % ', '.join(self.__modNamesToLoad))
mibViewController.mibBuilder.loadModules(*self.__modNamesToLoad)
self.__modNamesToLoad = None
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self
MibScalar, MibTableColumn = mibViewController.mibBuilder.importSymbols('SNMPv2-SMI', 'MibScalar',
@@ -386,7 +386,7 @@ class ObjectIdentity(object):
self.__args[0].resolveWithMib(mibViewController)
if len(self.__args) == 1: # OID or label or MIB module
- debug.logger & debug.flagMIB and debug.logger('resolving %s as OID or label' % self.__args)
+ debug.logger & debug.FLAG_MIB and debug.logger('resolving %s as OID or label' % self.__args)
try:
# pyasn1 ObjectIdentifier or sequence of ints or string OID
self.__oid = rfc1902.ObjectName(self.__args[0]) # OID
@@ -421,7 +421,7 @@ class ObjectIdentity(object):
self.__oid
)
- debug.logger & debug.flagMIB and debug.logger(
+ debug.logger & debug.FLAG_MIB and debug.logger(
'resolved %r into prefix %r and suffix %r' % (self.__args, prefix, suffix))
modName, symName, _ = mibViewController.getNodeLocation(prefix)
@@ -437,7 +437,7 @@ class ObjectIdentity(object):
self.__mibNode = mibNode
- debug.logger & debug.flagMIB and debug.logger('resolved prefix %r into MIB node %r' % (prefix, mibNode))
+ debug.logger & debug.FLAG_MIB and debug.logger('resolved prefix %r into MIB node %r' % (prefix, mibNode))
if isinstance(mibNode, MibTableColumn): # table column
if suffix:
@@ -454,9 +454,9 @@ class ObjectIdentity(object):
else:
if suffix:
self.__indices = (rfc1902.ObjectName(suffix),)
- self.__state |= self.stClean
+ self.__state |= self.ST_CLEAN
- debug.logger & debug.flagMIB and debug.logger('resolved indices are %r' % (self.__indices,))
+ debug.logger & debug.FLAG_MIB and debug.logger('resolved indices are %r' % (self.__indices,))
return self
elif len(self.__args) > 1: # MIB, symbol[, index, index ...]
@@ -490,7 +490,7 @@ class ObjectIdentity(object):
)
self.__label = label
- debug.logger & debug.flagMIB and debug.logger(
+ debug.logger & debug.FLAG_MIB and debug.logger(
'resolved %r into prefix %r and suffix %r' % (self.__args, prefix, suffix))
if isinstance(mibNode, MibTableColumn): # table
@@ -515,16 +515,16 @@ class ObjectIdentity(object):
)
self.__oid += instId
self.__indices = (instId,)
- self.__state |= self.stClean
+ self.__state |= self.ST_CLEAN
- debug.logger & debug.flagMIB and debug.logger('resolved indices are %r' % (self.__indices,))
+ debug.logger & debug.FLAG_MIB and debug.logger('resolved indices are %r' % (self.__indices,))
return self
else:
raise SmiError('Non-OID, label or MIB symbol')
def prettyPrint(self):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
s = rfc1902.OctetString()
return '%s::%s%s%s' % (
self.__modName, self.__symName,
@@ -540,91 +540,91 @@ class ObjectIdentity(object):
# Redirect some attrs access to the OID object to behave alike
def __str__(self):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return str(self.__oid)
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __eq__(self, other):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__oid == other
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __ne__(self, other):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__oid != other
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __lt__(self, other):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__oid < other
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __le__(self, other):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__oid <= other
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __gt__(self, other):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__oid > other
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __ge__(self, other):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__oid > other
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __nonzero__(self):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__oid != 0
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __bool__(self):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return bool(self.__oid)
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __getitem__(self, i):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__oid[i]
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __len__(self):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return len(self.__oid)
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __add__(self, other):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__oid + other
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __radd__(self, other):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return other + self.__oid
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __hash__(self):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return hash(self.__oid)
else:
raise SmiError('%s object not properly initialized' % self.__class__.__name__)
def __getattr__(self, attr):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
if attr in ('asTuple', 'clone', 'subtype', 'isPrefixOf',
'isSameTypeWith', 'isSuperTypeOf', 'getTagSet',
'getEffectiveTagSet', 'getTagMap', 'tagSet', 'index'):
@@ -693,16 +693,16 @@ class ObjectType(object):
ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0), 'Linux i386')
"""
- stDirty, stClean = 1, 2
+ ST_DIRTY, ST_CLEAM = 1, 2
def __init__(self, objectIdentity, objectSyntax=rfc1905.unSpecified):
if not isinstance(objectIdentity, ObjectIdentity):
raise SmiError('initializer should be ObjectIdentity instance, not %r' % (objectIdentity,))
self.__args = [objectIdentity, objectSyntax]
- self.__state = self.stDirty
+ self.__state = self.ST_DIRTY
def __getitem__(self, i):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAM:
return self.__args[i]
else:
raise SmiError('%s object not fully initialized' % self.__class__.__name__)
@@ -714,7 +714,7 @@ class ObjectType(object):
return '%s(%s)' % (self.__class__.__name__, ', '.join([repr(x) for x in self.__args]))
def isFullyResolved(self):
- return self.__state & self.stClean
+ return self.__state & self.ST_CLEAM
def addAsn1MibSource(self, *asn1Sources, **kwargs):
"""Adds path to a repository to search ASN.1 MIB files.
@@ -841,7 +841,7 @@ class ObjectType(object):
>>>
"""
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAM:
return self
self.__args[0].resolveWithMib(mibViewController)
@@ -853,14 +853,14 @@ class ObjectType(object):
(MibScalar, MibTableColumn)):
if not isinstance(self.__args[1], AbstractSimpleAsn1Item):
raise SmiError('MIB object %r is not OBJECT-TYPE (MIB not loaded?)' % (self.__args[0],))
- self.__state |= self.stClean
+ self.__state |= self.ST_CLEAM
return self
if isinstance(self.__args[1], (rfc1905.UnSpecified,
rfc1905.NoSuchObject,
rfc1905.NoSuchInstance,
rfc1905.EndOfMibView)):
- self.__state |= self.stClean
+ self.__state |= self.ST_CLEAM
return self
try:
@@ -873,14 +873,14 @@ class ObjectType(object):
if rfc1902.ObjectIdentifier().isSuperTypeOf(self.__args[1], matchConstraints=False):
self.__args[1] = ObjectIdentity(self.__args[1]).resolveWithMib(mibViewController)
- self.__state |= self.stClean
+ self.__state |= self.ST_CLEAM
- debug.logger & debug.flagMIB and debug.logger('resolved %r syntax is %r' % (self.__args[0], self.__args[1]))
+ debug.logger & debug.FLAG_MIB and debug.logger('resolved %r syntax is %r' % (self.__args[0], self.__args[1]))
return self
def prettyPrint(self):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAM:
return '%s = %s' % (self.__args[0].prettyPrint(),
self.__args[1].prettyPrint())
else:
@@ -951,7 +951,7 @@ class NotificationType(object):
NotificationType(ObjectIdentity('1.3.6.1.6.3.1.1.5.3'), ObjectName('3.5'), {})
"""
- stDirty, stClean = 1, 2
+ ST_DIRTY, ST_CLEAN = 1, 2
def __init__(self, objectIdentity, instanceIndex=(), objects={}):
if not isinstance(objectIdentity, ObjectIdentity):
@@ -961,10 +961,10 @@ class NotificationType(object):
self.__objects = objects
self.__varBinds = []
self.__additionalVarBinds = []
- self.__state = self.stDirty
+ self.__state = self.ST_DIRTY
def __getitem__(self, i):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self.__varBinds[i]
else:
raise SmiError('%s object not fully initialized' % self.__class__.__name__)
@@ -1000,8 +1000,8 @@ class NotificationType(object):
>>>
"""
- debug.logger & debug.flagMIB and debug.logger('additional var-binds: %r' % (varBinds,))
- if self.__state & self.stClean:
+ debug.logger & debug.FLAG_MIB and debug.logger('additional var-binds: %r' % (varBinds,))
+ if self.__state & self.ST_CLEAN:
raise SmiError('%s object is already sealed' % self.__class__.__name__)
else:
self.__additionalVarBinds.extend(varBinds)
@@ -1097,7 +1097,7 @@ class NotificationType(object):
return self
def isFullyResolved(self):
- return self.__state & self.stClean
+ return self.__state & self.ST_CLEAN
def resolveWithMib(self, mibViewController):
"""Perform MIB variable ID conversion and notification objects expansion.
@@ -1137,7 +1137,7 @@ class NotificationType(object):
>>>
"""
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return self
self.__objectIdentity.resolveWithMib(mibViewController)
@@ -1164,7 +1164,7 @@ class NotificationType(object):
)
varBindsLocation[objectIdentity] = len(self.__varBinds) - 1
else:
- debug.logger & debug.flagMIB and debug.logger(
+ debug.logger & debug.FLAG_MIB and debug.logger(
'WARNING: MIB object %r is not NOTIFICATION-TYPE (MIB not loaded?)' % (self.__objectIdentity,))
for varBinds in self.__additionalVarBinds:
@@ -1178,14 +1178,14 @@ class NotificationType(object):
self.__additionalVarBinds = []
- self.__state |= self.stClean
+ self.__state |= self.ST_CLEAN
- debug.logger & debug.flagMIB and debug.logger('resolved %r into %r' % (self.__objectIdentity, self.__varBinds))
+ debug.logger & debug.FLAG_MIB and debug.logger('resolved %r into %r' % (self.__objectIdentity, self.__varBinds))
return self
def prettyPrint(self):
- if self.__state & self.stClean:
+ if self.__state & self.ST_CLEAN:
return ' '.join(['%s = %s' % (x[0].prettyPrint(), x[1].prettyPrint()) for x in self.__varBinds])
else:
raise SmiError('%s object not fully initialized' % self.__class__.__name__)
diff --git a/pysnmp/smi/view.py b/pysnmp/smi/view.py
index 223e22d8..46e74d8a 100644
--- a/pysnmp/smi/view.py
+++ b/pysnmp/smi/view.py
@@ -33,7 +33,7 @@ class MibViewController(object):
if self.lastBuildId == self.mibBuilder.lastBuildId:
return
- debug.logger & debug.flagMIB and debug.logger('indexMib: re-indexing MIB view')
+ debug.logger & debug.FLAG_MIB and debug.logger('indexMib: re-indexing MIB view')
MibScalarInstance, = self.mibBuilder.importSymbols(
'SNMPv2-SMI', 'MibScalarInstance'
@@ -210,7 +210,7 @@ class MibViewController(object):
str='Can\'t resolve node name %s::%s at %s' %
(modName, nodeName, self)
)
- debug.logger & debug.flagMIB and debug.logger(
+ debug.logger & debug.FLAG_MIB and debug.logger(
'getNodeNameByOid: resolved %s:%s -> %s.%s' % (modName, nodeName, label, suffix))
return oid, label, suffix
@@ -226,7 +226,7 @@ class MibViewController(object):
raise error.NoSuchObjectError(
str='No such symbol %s::%s at %s' % (modName, nodeName, self)
)
- debug.logger & debug.flagMIB and debug.logger(
+ debug.logger & debug.FLAG_MIB and debug.logger(
'getNodeNameByDesc: resolved %s:%s -> %s' % (modName, nodeName, oid))
return self.getNodeNameByOid(oid, modName)