Compare commits
1 Commits
master
...
require-py
Author | SHA1 | Date |
---|---|---|
Ilya Etingof | a844008ab6 |
|
@ -27,7 +27,7 @@ Features
|
|||
* [PySMI](http://snmplabs.com/pysmi/) integration for dynamic MIB compilation
|
||||
* Built-in instrumentation exposing protocol engine operations
|
||||
* Python eggs and py2exe friendly
|
||||
* 100% Python, works with Python 2.4 though 3.7
|
||||
* 100% Python, works with Python 2.6 though 3.7
|
||||
* MT-safe (if SnmpEngine is thread-local)
|
||||
|
||||
Features, specific to SNMPv3 model include:
|
||||
|
|
|
@ -17,7 +17,7 @@ multilingual capabilities, remote configuration and other features.
|
|||
PySNMP implementation closely follows intricate system details and features
|
||||
bringing most possible power and flexibility to its users.
|
||||
|
||||
Current PySNMP stable version is 4.4. It runs with Python 2.4 through 3.7
|
||||
Current PySNMP stable version is 4.4. It runs with Python 2.6 through 3.7
|
||||
and is recommended for new applications as well as for migration from
|
||||
older, now obsolete, PySNMP releases. All site documentation and
|
||||
examples are written for the 4.4 and later versions in mind.
|
||||
|
|
|
@ -92,7 +92,7 @@ You could greater speed up the development of particular feature by
|
|||
sponsoring it. Please get back to us to discuss details.
|
||||
|
||||
Contributions to the PySNMP source code is greatly appreciated as well.
|
||||
We require contributed code to run with Python 2.4 through the latest
|
||||
We require contributed code to run with Python 2.6 through the latest
|
||||
Python version (which is 3.7 at the time of this writing). Contributed
|
||||
code will be redistributed under the terms of the same
|
||||
`license <http://snmplabs.com/pysnmp/>`_ as PySNMP is.
|
||||
|
|
|
@ -58,6 +58,6 @@ snmpDispatcher = SnmpDispatcher()
|
|||
# Submit a bunch of initial GET requests
|
||||
for authData, transportTarget, varBinds in targets:
|
||||
getCmd(snmpDispatcher, authData, transportTarget, *varBinds,
|
||||
**dict(cbFun=cbFun, lookupMib=True))
|
||||
cbFun=cbFun, lookupMib=True)
|
||||
|
||||
snmpDispatcher.transportDispatcher.runDispatcher()
|
||||
|
|
|
@ -58,6 +58,6 @@ snmpDispatcher = SnmpDispatcher()
|
|||
# Submit a bunch of initial GETNEXT requests
|
||||
for authData, transportTarget, varBinds in targets:
|
||||
nextCmd(snmpDispatcher, authData, transportTarget, *varBinds,
|
||||
**dict(cbFun=cbFun, lookupMib=True))
|
||||
cbFun=cbFun, lookupMib=True)
|
||||
|
||||
snmpDispatcher.transportDispatcher.runDispatcher()
|
||||
|
|
|
@ -39,6 +39,6 @@ bulkCmd(snmpDispatcher,
|
|||
UdpTransportTarget(('demo.snmplabs.com', 161)),
|
||||
0, 25,
|
||||
('1.3.6.1.4.1', None),
|
||||
**dict(cbFun=cbFun))
|
||||
cbFun=cbFun)
|
||||
|
||||
snmpDispatcher.transportDispatcher.runDispatcher()
|
||||
|
|
|
@ -75,6 +75,6 @@ snmpEngine = SnmpEngine()
|
|||
# Submit GET requests
|
||||
for authData, transportTarget, varNames in targets:
|
||||
getCmd(snmpEngine, authData, transportTarget, ContextData(), *varNames,
|
||||
**dict(cbFun=cbFun, cbCtx=(authData, transportTarget)))
|
||||
cbFun=cbFun, cbCtx=(authData, transportTarget))
|
||||
|
||||
snmpEngine.transportDispatcher.runDispatcher()
|
||||
|
|
|
@ -68,6 +68,6 @@ snmpEngine = SnmpEngine()
|
|||
# Submit initial GETNEXT requests and wait for responses
|
||||
for authData, transportTarget, varBinds in targets:
|
||||
nextCmd(snmpEngine, authData, transportTarget, ContextData(),
|
||||
*varBinds, **dict(cbFun=cbFun, cbCtx=(authData, transportTarget)))
|
||||
*varBinds, cbFun=cbFun, cbCtx=(authData, transportTarget))
|
||||
|
||||
snmpEngine.transportDispatcher.runDispatcher()
|
||||
|
|
|
@ -87,9 +87,9 @@ snmpEngineB = SnmpEngine()
|
|||
snmpEngineB.registerTransportDispatcher(transportDispatcher, 'B')
|
||||
|
||||
for authData, transportTarget, varBinds in targets:
|
||||
snmpEngine = transportTarget.getTransportInfo()[1][1] % 3 and \
|
||||
snmpEngineA or snmpEngineB
|
||||
snmpEngine = (transportTarget.getTransportInfo()[1][1] % 3 and
|
||||
snmpEngineA or snmpEngineB)
|
||||
getCmd(snmpEngine, authData, transportTarget, ContextData(), *varBinds,
|
||||
**dict(cbFun=cbFun, cbCtx=(snmpEngine, authData, transportTarget)))
|
||||
cbFun=cbFun, cbCtx=(snmpEngine, authData, transportTarget))
|
||||
|
||||
transportDispatcher.runDispatcher()
|
||||
|
|
|
@ -84,7 +84,7 @@ def addV1System(snmpEngine, communityIndex, communityName,
|
|||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpCommunityEntry.name + (8,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpCommunityEntry.name + (1,) + tblIdx, communityIndex),
|
||||
|
@ -95,7 +95,7 @@ def addV1System(snmpEngine, communityIndex, communityName,
|
|||
(snmpCommunityEntry.name + (6,) + tblIdx, transportTag),
|
||||
(snmpCommunityEntry.name + (7,) + tblIdx, 'nonVolatile'),
|
||||
(snmpCommunityEntry.name + (8,) + tblIdx, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -104,7 +104,7 @@ def delV1System(snmpEngine, communityIndex):
|
|||
snmpEngineID) = __cookV1SystemInfo(snmpEngine, communityIndex)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpCommunityEntry.name + (8,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -147,7 +147,7 @@ def addV3User(snmpEngine, userName,
|
|||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(usmUserEntry.name + (13,) + tblIdx1, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(usmUserEntry.name + (2,) + tblIdx1, userName),
|
||||
|
@ -156,7 +156,7 @@ def addV3User(snmpEngine, userName,
|
|||
(usmUserEntry.name + (5,) + tblIdx1, authProtocol),
|
||||
(usmUserEntry.name + (8,) + tblIdx1, privProtocol),
|
||||
(usmUserEntry.name + (13,) + tblIdx1, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
# Localize keys
|
||||
|
@ -186,21 +186,21 @@ def addV3User(snmpEngine, userName,
|
|||
(pysnmpUsmKeyEntry.name + (2,) + tblIdx1, localPrivKey),
|
||||
(pysnmpUsmKeyEntry.name + (3,) + tblIdx1, hashedAuthPassphrase),
|
||||
(pysnmpUsmKeyEntry.name + (4,) + tblIdx1, hashedPrivPassphrase),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
# Commit passphrases
|
||||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(pysnmpUsmSecretEntry.name + (4,) + tblIdx2, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(pysnmpUsmSecretEntry.name + (1,) + tblIdx2, userName),
|
||||
(pysnmpUsmSecretEntry.name + (2,) + tblIdx2, authKey),
|
||||
(pysnmpUsmSecretEntry.name + (3,) + tblIdx2, privKey),
|
||||
(pysnmpUsmSecretEntry.name + (4,) + tblIdx2, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -211,11 +211,11 @@ def delV3User(snmpEngine,
|
|||
tblIdx2) = __cookV3UserInfo(snmpEngine, userName, securityEngineId)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(usmUserEntry.name + (13,) + tblIdx1, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(pysnmpUsmSecretEntry.name + (4,) + tblIdx2, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
# Drop all derived rows
|
||||
|
@ -226,7 +226,7 @@ def delV3User(snmpEngine,
|
|||
)
|
||||
while varBinds:
|
||||
varBinds = snmpEngine.msgAndPduDsp.mibInstrumController.readNextVars(
|
||||
*varBinds, **dict(snmpEngine=snmpEngine)
|
||||
*varBinds, snmpEngine=snmpEngine
|
||||
)
|
||||
if varBinds[0][1].isSameTypeWith(rfc1905.endOfMibView):
|
||||
break
|
||||
|
@ -260,7 +260,7 @@ def addTargetParams(snmpEngine, name, securityName, securityLevel, mpModel=3):
|
|||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpTargetParamsEntry.name + (7,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpTargetParamsEntry.name + (1,) + tblIdx, name),
|
||||
|
@ -269,7 +269,7 @@ def addTargetParams(snmpEngine, name, securityName, securityLevel, mpModel=3):
|
|||
(snmpTargetParamsEntry.name + (4,) + tblIdx, securityName),
|
||||
(snmpTargetParamsEntry.name + (5,) + tblIdx, securityLevel),
|
||||
(snmpTargetParamsEntry.name + (7,) + tblIdx, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -277,7 +277,7 @@ def delTargetParams(snmpEngine, name):
|
|||
snmpTargetParamsEntry, tblIdx = __cookTargetParamsInfo(snmpEngine, name)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpTargetParamsEntry.name + (7,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -313,7 +313,7 @@ def addTargetAddr(snmpEngine, addrName, transportDomain, transportAddress,
|
|||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpTargetAddrEntry.name + (9,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpTargetAddrEntry.name + (1,) + tblIdx, addrName),
|
||||
|
@ -325,7 +325,7 @@ def addTargetAddr(snmpEngine, addrName, transportDomain, transportAddress,
|
|||
(snmpTargetAddrEntry.name + (7,) + tblIdx, params),
|
||||
(snmpSourceAddrEntry.name + (1,) + tblIdx, sourceAddress),
|
||||
(snmpTargetAddrEntry.name + (9,) + tblIdx, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -334,7 +334,7 @@ def delTargetAddr(snmpEngine, addrName):
|
|||
tblIdx) = __cookTargetAddrInfo(snmpEngine, addrName)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpTargetAddrEntry.name + (9,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -412,7 +412,7 @@ def addContext(snmpEngine, contextName):
|
|||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(vacmContextEntry.name + (1,) + tblIdx, contextName),
|
||||
(vacmContextEntry.name + (2,) + tblIdx, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -439,14 +439,14 @@ def addVacmGroup(snmpEngine, groupName, securityModel, securityName):
|
|||
tblIdx) = __cookVacmGroupInfo(snmpEngine, securityModel, securityName)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(vacmSecurityToGroupEntry.name + (5,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(vacmSecurityToGroupEntry.name + (1,) + tblIdx, securityModel),
|
||||
(vacmSecurityToGroupEntry.name + (2,) + tblIdx, securityName),
|
||||
(vacmSecurityToGroupEntry.name + (3,) + tblIdx, groupName),
|
||||
(vacmSecurityToGroupEntry.name + (5,) + tblIdx, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -456,7 +456,7 @@ def delVacmGroup(snmpEngine, securityModel, securityName):
|
|||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(vacmSecurityToGroupEntry.name + (5,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -480,7 +480,7 @@ def addVacmAccess(snmpEngine, groupName, contextName, securityModel,
|
|||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(vacmAccessEntry.name + (9,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(vacmAccessEntry.name + (1,) + tblIdx, contextName),
|
||||
|
@ -491,7 +491,7 @@ def addVacmAccess(snmpEngine, groupName, contextName, securityModel,
|
|||
(vacmAccessEntry.name + (6,) + tblIdx, writeView),
|
||||
(vacmAccessEntry.name + (7,) + tblIdx, notifyView),
|
||||
(vacmAccessEntry.name + (9,) + tblIdx, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -505,7 +505,7 @@ def delVacmAccess(snmpEngine, groupName, contextName, securityModel,
|
|||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(vacmAccessEntry.name + (9,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -524,7 +524,7 @@ def addVacmView(snmpEngine, viewName, viewType, subTree, mask):
|
|||
subTree)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(vacmViewTreeFamilyEntry.name + (6,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(vacmViewTreeFamilyEntry.name + (1,) + tblIdx, viewName),
|
||||
|
@ -532,7 +532,7 @@ def addVacmView(snmpEngine, viewName, viewType, subTree, mask):
|
|||
(vacmViewTreeFamilyEntry.name + (3,) + tblIdx, mask),
|
||||
(vacmViewTreeFamilyEntry.name + (4,) + tblIdx, viewType),
|
||||
(vacmViewTreeFamilyEntry.name + (6,) + tblIdx, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -541,7 +541,7 @@ def delVacmView(snmpEngine, viewName, subTree):
|
|||
subTree)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(vacmViewTreeFamilyEntry.name + (6,) + tblIdx, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -633,23 +633,23 @@ def addNotificationTarget(snmpEngine, notificationName, paramsName,
|
|||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpNotifyEntry.name + (5,) + tblIdx1, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpNotifyEntry.name + (2,) + tblIdx1, transportTag),
|
||||
(snmpNotifyEntry.name + (3,) + tblIdx1, notifyType),
|
||||
(snmpNotifyEntry.name + (5,) + tblIdx1, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpNotifyFilterProfileEntry.name + (3,) + tblIdx2, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpNotifyFilterProfileEntry.name + (1,) + tblIdx2, profileName),
|
||||
(snmpNotifyFilterProfileEntry.name + (3,) + tblIdx2, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
if not snmpNotifyFilterEntry:
|
||||
|
@ -657,14 +657,14 @@ def addNotificationTarget(snmpEngine, notificationName, paramsName,
|
|||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpNotifyFilterEntry.name + (5,) + tblIdx3, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpNotifyFilterEntry.name + (1,) + tblIdx3, filterSubtree),
|
||||
(snmpNotifyFilterEntry.name + (2,) + tblIdx3, filterMask),
|
||||
(snmpNotifyFilterEntry.name + (3,) + tblIdx3, filterType),
|
||||
(snmpNotifyFilterEntry.name + (5,) + tblIdx3, 'createAndGo'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
@ -677,12 +677,12 @@ def delNotificationTarget(snmpEngine, notificationName, paramsName,
|
|||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpNotifyEntry.name + (5,) + tblIdx1, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpNotifyFilterProfileEntry.name + (3,) + tblIdx2, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
if not snmpNotifyFilterEntry:
|
||||
|
@ -690,7 +690,7 @@ def delNotificationTarget(snmpEngine, notificationName, paramsName,
|
|||
|
||||
snmpEngine.msgAndPduDsp.mibInstrumController.writeVars(
|
||||
(snmpNotifyFilterEntry.name + (5,) + tblIdx3, 'destroy'),
|
||||
**dict(snmpEngine=snmpEngine)
|
||||
snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -11,11 +11,5 @@ from pysnmp.hlapi.v1arch.asyncore.transport import *
|
|||
from pysnmp.hlapi.v1arch.asyncore.cmdgen import *
|
||||
from pysnmp.hlapi.v1arch.asyncore.ntforg import *
|
||||
from pysnmp.hlapi.v1arch.asyncore.dispatch import *
|
||||
|
||||
try:
|
||||
from pysnmp.hlapi.v1arch.asyncore.sync.cmdgen import *
|
||||
from pysnmp.hlapi.v1arch.asyncore.sync.ntforg import *
|
||||
|
||||
except SyntaxError:
|
||||
from pysnmp.hlapi.v1arch.asyncore.sync.compat.cmdgen import *
|
||||
from pysnmp.hlapi.v1arch.asyncore.sync.compat.ntforg import *
|
||||
from pysnmp.hlapi.v1arch.asyncore.sync.cmdgen import *
|
||||
from pysnmp.hlapi.v1arch.asyncore.sync.ntforg import *
|
||||
|
|
|
@ -10,10 +10,5 @@ from pysnmp.hlapi.v3arch.auth import *
|
|||
from pysnmp.hlapi.v3arch.context import *
|
||||
from pysnmp.hlapi.v3arch.asyncore.transport import *
|
||||
from pysnmp.entity.engine import *
|
||||
|
||||
try:
|
||||
from pysnmp.hlapi.v3arch.asyncore.sync.cmdgen import *
|
||||
from pysnmp.hlapi.v3arch.asyncore.sync.ntforg import *
|
||||
except SyntaxError:
|
||||
from pysnmp.hlapi.v3arch.asyncore.sync.compat.cmdgen import *
|
||||
from pysnmp.hlapi.v3arch.asyncore.sync.compat.ntforg import *
|
||||
from pysnmp.hlapi.v3arch.asyncore.sync.cmdgen import *
|
||||
from pysnmp.hlapi.v3arch.asyncore.sync.ntforg import *
|
||||
|
|
|
@ -107,8 +107,8 @@ def getCmd(snmpEngine, authData, transportTarget, contextData,
|
|||
if varBinds:
|
||||
cmdgen.getCmd(snmpEngine, authData, transportTarget,
|
||||
contextData, *varBinds,
|
||||
**dict(cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True)))
|
||||
cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True))
|
||||
|
||||
snmpEngine.transportDispatcher.runDispatcher()
|
||||
|
||||
|
@ -213,8 +213,8 @@ def setCmd(snmpEngine, authData, transportTarget, contextData,
|
|||
if varBinds:
|
||||
cmdgen.setCmd(snmpEngine, authData, transportTarget,
|
||||
contextData, *varBinds,
|
||||
**dict(cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True)))
|
||||
cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True))
|
||||
|
||||
snmpEngine.transportDispatcher.runDispatcher()
|
||||
|
||||
|
@ -356,8 +356,8 @@ def nextCmd(snmpEngine, authData, transportTarget, contextData,
|
|||
if varBinds:
|
||||
cmdgen.nextCmd(snmpEngine, authData, transportTarget, contextData,
|
||||
*[(x[0], Null('')) for x in varBinds],
|
||||
**dict(cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True)))
|
||||
cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True))
|
||||
|
||||
snmpEngine.transportDispatcher.runDispatcher()
|
||||
|
||||
|
@ -561,8 +561,8 @@ def bulkCmd(snmpEngine, authData, transportTarget, contextData,
|
|||
cmdgen.bulkCmd(snmpEngine, authData, transportTarget, contextData,
|
||||
nonRepeaters, maxRepetitions,
|
||||
*[(x[0], Null('')) for x in varBinds],
|
||||
**dict(cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True)))
|
||||
cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True))
|
||||
|
||||
snmpEngine.transportDispatcher.runDispatcher()
|
||||
|
||||
|
|
|
@ -35,8 +35,8 @@ def getCmd(snmpEngine, authData, transportTarget, contextData,
|
|||
if varBinds:
|
||||
cmdgen.getCmd(snmpEngine, authData, transportTarget,
|
||||
contextData, *varBinds,
|
||||
**dict(cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True)))
|
||||
cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True))
|
||||
|
||||
snmpEngine.transportDispatcher.runDispatcher()
|
||||
|
||||
|
@ -67,8 +67,8 @@ def setCmd(snmpEngine, authData, transportTarget, contextData,
|
|||
while True:
|
||||
cmdgen.setCmd(snmpEngine, authData, transportTarget,
|
||||
contextData, *varBinds,
|
||||
**dict(cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True)))
|
||||
cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True))
|
||||
|
||||
snmpEngine.transportDispatcher.runDispatcher()
|
||||
|
||||
|
@ -107,8 +107,8 @@ def nextCmd(snmpEngine, authData, transportTarget, contextData,
|
|||
while True:
|
||||
cmdgen.nextCmd(snmpEngine, authData, transportTarget, contextData,
|
||||
*[(x[0], Null('')) for x in varBinds],
|
||||
**dict(cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True)))
|
||||
cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True))
|
||||
|
||||
snmpEngine.transportDispatcher.runDispatcher()
|
||||
|
||||
|
@ -185,8 +185,8 @@ def bulkCmd(snmpEngine, authData, transportTarget, contextData,
|
|||
cmdgen.bulkCmd(snmpEngine, authData, transportTarget, contextData,
|
||||
nonRepeaters, maxRepetitions,
|
||||
*[(x[0], Null('')) for x in varBinds],
|
||||
**dict(cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True)))
|
||||
cbFun=cbFun, cbCtx=cbCtx,
|
||||
lookupMib=options.get('lookupMib', True))
|
||||
|
||||
snmpEngine.transportDispatcher.runDispatcher()
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ class SnmpUSMSecurityModel(AbstractSecurityModel):
|
|||
|
||||
# New row
|
||||
mibInstrumController.writeVars(
|
||||
(usmUserEntry.name + (13,) + tblIdx2, 4), **dict(snmpEngine=snmpEngine)
|
||||
(usmUserEntry.name + (13,) + tblIdx2, 4), snmpEngine=snmpEngine
|
||||
)
|
||||
|
||||
# Set user&securityNames
|
||||
|
|
|
@ -58,7 +58,7 @@ else:
|
|||
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,
|
||||
**dict(lowcaseMatching=False))])
|
||||
lowcaseMatching=False)])
|
||||
|
||||
mibBuilder.setMibCompiler(
|
||||
compiler, kwargs.get('destination') or defaultDest
|
||||
|
|
7
setup.py
7
setup.py
|
@ -21,8 +21,6 @@ License :: OSI Approved :: BSD License
|
|||
Natural Language :: English
|
||||
Operating System :: OS Independent
|
||||
Programming Language :: Python :: 2
|
||||
Programming Language :: Python :: 2.4
|
||||
Programming Language :: Python :: 2.5
|
||||
Programming Language :: Python :: 2.6
|
||||
Programming Language :: Python :: 2.7
|
||||
Programming Language :: Python :: 3
|
||||
|
@ -53,8 +51,8 @@ def howto_install_setuptools():
|
|||
|
||||
|
||||
py_version = sys.version_info[:2]
|
||||
if py_version < (2, 4):
|
||||
print("ERROR: this package requires Python 2.4 or later!")
|
||||
if py_version < (2, 6):
|
||||
print("ERROR: this package requires Python 2.6 or later!")
|
||||
sys.exit(1)
|
||||
|
||||
requires = [ln.strip() for ln in open('requirements.txt').readlines()]
|
||||
|
@ -158,7 +156,6 @@ params.update({
|
|||
'pysnmp.hlapi.v3arch.asyncio',
|
||||
'pysnmp.hlapi.v3arch.asyncore',
|
||||
'pysnmp.hlapi.v3arch.asyncore.sync',
|
||||
'pysnmp.hlapi.v3arch.asyncore.sync.compat',
|
||||
'pysnmp.hlapi.v3arch.twisted',
|
||||
'pysnmp.proto',
|
||||
'pysnmp.proto.mpmod',
|
||||
|
|
Loading…
Reference in New Issue