The method SnmpServer.create_v3_tables() will set the error code internally.
If you are using SnmpRequestServer.create_v3_tables() or SnmpTarget.create_v3_tables(), you can use SnmpRequestServer.getErrorCode() or SnmpTarget.getErrorCode() respectively to get the error code constant.
These error code constants are defined in the class ErrorMessages.
Thanks,
Amarnath
Result is the value returned by create_v3_table. Error code = #:string, using the methods you mentioned.
* bad principal: result=-2 errorCode=46:usmStatsUnknownUserNames
* bad context: result=1 errorCode=-1:No Error code registered
* bad authProtocol (MDX5) : result=1 errorCode=-1:No Error code registered
* wrong authProtocol(SHA): result=-2 errorCode=48:usmStatsWrongDigests
* bad authPassword: result=-2 errorCode=48:usmStatsWrongDigests
* bad privPassword: result=1 errorCode=-1:No Error code registered
Most of the errors are not reported.
Hi,
The method SnmpServer.create_v3_tables() creates and adds USM user entries to USMUserTable.
As a part of adding users to the USMUserTable, it will perform Discovery and TimeSynchronization.
These processes do not use contextName, as there is no management information in this V3 handshake.
Also privPassword is not generally used in V3 handshake, and will not be validated, by default, in create_v3_tables().
As a part of create_v3_tables(), the userName of a NO_AUTH_NO_PRIV user or the privPassword of an AUTH_PRIV user can be validated using the method SnmpServer.validateUser(boolean) prior to calling create_v3_tables().
From the third case you stated, I understood that bad authProtocol(MDX5) means an authProtocol that is not supported by the SNMP API. In this case, default authProtocol will be set.
Any SNMP request timing out in case of bad privPassword could be an issue with the authoritative SNMP engine (agent in your case). The authoritative SNMP engine should report the non-authoritative SNMP engine with usmStatsDecryptionErrors OID in such case.
Hope this is clear.
Regards,
Amarnath
Corp