In the python module pysnmp there is a function named cmdGen.nextCmd with the following definition
nextCmd(authData,
transportTarget,
*varNames, # <------- point of interest
lookupNames=False,
lookupValues=False,
lexicographicMode=False,
ignoreNonIncreasingOid=False,
maxRows=0)
I can call this function this way:
errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd(
cmdgen.CommunityData('public'),
cmdgen.UdpTransportTarget(('192.168.0.1', 161)),
'1.3.6.1.4.1.14988.1.1.1.2.1.3', # strength
'1.3.6.1.4.1.14988.1.1.1.2.1.4', # tx-bytes
'1.3.6.1.4.1.14988.1.1.1.2.1.5', # rx-bytes
lookupValues=False
)
apparently the oid's (strength, tx-bytes, rx-bytes) are passed to the nextCmd function via the *varNames parameter.
I'm trying to archive something along these lines:
oids = ( # dynamically generated
'1.3.6.1.4.1.14988.1.1.1.2.1.3', # strength
'1.3.6.1.4.1.14988.1.1.1.2.1.4', # tx-bytes
'1.3.6.1.4.1.14988.1.1.1.2.1.5' # rx-bytes
)
errorIndication, errorStatus, errorIndex, varBindTable = cmdGen.nextCmd(
cmdgen.CommunityData('public'),
cmdgen.UdpTransportTarget(('192.168.0.1', 161)),
oids, # these are the oid's
lookupValues=False
)
but it does yield a
AttributeError: 'tuple' object has no attribute 'split'
How can bundle the oid's into a variable and pass them to the nextCmd? I'm extracting the oid's from a dict, so I don't want to hard-code them.