[SNMP4J] SNMP v3 - with same user name on different devices is not working

Frank Fock fock at agentpp.com
Sat Apr 18 11:04:42 CEST 2015


Hi Senthil,

How do you get/determine the engine ID in your functions doGet1 parameter list?
It must be different for those two devices and it has to be their authoritative engine ID.

Best regards,
Frank



> On 17 Apr 2015, at 23:24, Senthil Murugan Ramalingam -X (seramali - UNISH CORPORATION at Cisco) <seramali at cisco.com> wrote:
> 
> Hi Frank,
> 
> I am trying to do SNMP v3  get request to 2 different devices with same
> user name , always 1 device get successful, other get time out. I referred
> earlier posts and tried all the solutions like localizing keys , nothing
> works. Can you pls help me how to fix this.
> 
> Here my USM portion of code
> 
> 
> private static USM usm;
> 
> 
> 
> static{
> 		SecurityProtocols securityProtocols = SecurityProtocols.getInstance();
> 	    securityProtocols.addPrivacyProtocol(new PrivAES128());
> 	    securityProtocols.addPrivacyProtocol(new
> PrivAES192With3DESKeyExtension());
> 	    securityProtocols.addPrivacyProtocol(new
> PrivAES256With3DESKeyExtension());
> 	    securityProtocols.addPrivacyProtocol(new PrivDES());
> 	    securityProtocols.addPrivacyProtocol(new Priv3DES());
> 
> 		 usm = new USM(securityProtocols, new
> OctetString(MPv3.createLocalEngineID()), 0);
> 		 SecurityModels.getInstance().addSecurityModel(usm);
> 
> }
> 
> 
> public static String doGet1(String targetAddr,String securityName, OID
> authenticationProtocol, String authenticationPassphrase,
> 		  OID privacyProtocol, String privacyPassphrase, String engineID, String
> oid,Logger logger){
> 	    
> 
> 	  try{
> 	        usm.addUser(new OctetString(securityName),new UsmUser(new
> OctetString(securityName),authenticationProtocol
> 	        		,authenticationPwd,privacyProtocol,privacyPwd));
> 	       
> //	        usm.addLocalizedUser(engineid, new OctetString(securityName),
> authenticationProtocol,
> SecurityProtocols.getInstance().passwordToKey(authenticationProtocol,
> authenticationPwd, engineid),
> //	        		privacyProtocol,
> SecurityProtocols.getInstance().passwordToKey(privacyProtocol,
> authenticationProtocol, privacyPwd, engineid));
> 
> //	        usm.addLocalizedUser(engineid, new OctetString(securityName),
> authenticationProtocol, authenticationPassphrase.getBytes(),
> //	        		privacyProtocol, privacyPassphrase.getBytes());
> 	        
> 
>  }
> 
> 
> 
> 
> 
> Thanks
> -Senthil
> 
> 




More information about the SNMP4J mailing list