Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'UdpTransportTarget' object has no attribute 'contextName' #424

Open
rohitsanthan opened this issue Jul 16, 2022 · 1 comment

Comments

@rohitsanthan
Copy link

rohitsanthan commented Jul 16, 2022

Hi, I am getting the error mentioned in the title when trying to run the below script. Could you please help with this?
g = getCmd(SnmpEngine(),
CommunityData("private"),
UsmUserData('private', authKey='authkey1', privKey='authkey1',
authProtocol=hlapi.usmHMACMD5AuthProtocol,
privProtocol=hlapi.usmAesCfb128Protocol),
UdpTransportTarget(('10.1.1.254', 161)),
ContextData(),
ObjectType(ObjectIdentity('1.3.6.1.4.1.9.9.23.1.3.1')))

@stsojithomas
Copy link

Your syntax for calling getCmd is incorrect. It seems you have mixed up Comm String along with UsmUserData which, by position, pushes UdpTransportTarget to that of ContextData parameter, and hence the error when it looks for contextName.

Please follow the correct usage for v3 and you will have it working.

Reference: https://pysnmp.readthedocs.io/en/latest/examples/hlapi/v3arch/asyncore/sync/manager/cmdgen/snmp-versions.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants