[SNMP4J] SNMP4J newbie (3)

Marco.Bresciani at alcatel.it Marco.Bresciani at alcatel.it
Thu Dec 15 11:51:06 CET 2005


Here I am again... this time is not a compile problem but "simply" a 
logical one.
  I'm creating the init method I've explained before then I'll have to 
implement all the get/set Object, get/set/create/delete Row, get/set 
Table, and some more internal type-converter methods I've inherited from 
the current configuration and class signatures. :-(

Which are the information I need to completely prepare a working SNMP 
environment? I mean... The user will use my class (named "Converter") in 
this way:

Converter.init(some parameters);     // somewhere in the code

then it will use Converter.setObject(some parameters); somewhere in the 
code or Converter.getRowt(some parameters); or any other method as well 
and so on.
  To prepare such a class I would have to instantiate a SNMPv3 environment 
by specifying its URL with: targetURL = GenericAddress.parse(address + ":" 
+ pIPAddress + "/" + pPort); where address could be "tcp" or "udp". Then 
the transport level: transport = new DefaultTcpTransportMapping(); or 
transport = new DefaultUdpTransportMapping(); with the related SNMP 
activation: snmp = new Snmp(transport). I also need a SNMPv3 message 
processor like that: processor = 
(MPv3)snmp.getMessageProcessingModel(MessageProcessingModel.MPv3); and the 
USM:

        userModel = new USM(SecurityProtocols.getInstance(), new 
OctetString(processor.createLocalEngineID()), 0);

with its security protocols: 
SecurityProtocols.getInstance().addDefaultProtocols(); and 
SecurityModels.getInstance().addSecurityModel(userModel);. Finally, the 
transport.listen(); would engage the SNMP connection... right? Then I have 
to prepare a user target: device = new UserTarget(); adding its security 
levels: device.setSecurityLevel(SecurityLevel.AUTH_PRIV); and a user 
management:

        user = new UsmUser(new OctetString(pUserName),
                           new OID("AUTENTHICATION_PROTOCOL"),
                           new OctetString(pPassword),
                           (OID) null,
                           (OctetString) null);

added to the SNMP: snmp.getUSM().addUser(device.getSecurityName(), user);

BUT I have some questions:

 - what about the target URL?! targetURL = GenericAddress.parse(address + 
":" + pIPAddress + "/" + pPort); where and how I have to use it to say 
"connect to this address"?

 - message processor and USM seem detached from Snmp instance. How can I 
manage them?

 - the security model defined by the USM is related to Snmp instance too?

 - please clarify me the difference between security name/password and 
privacy name/password. Also, what about protocols OID? Are they related to 
my device MIB?

Thank you in advance for any help anyone could give me... and sorry for my 
bad written English and my "newbie-ness".

Dott. Ing. Marco Bresciani

-- 
Alcatel - WTD R&D SW Lab. [Stage]
Via Trento, 30
20059 Vimercate (Mi) Italia
Phone: +39.039.686.5546

E-Mail: Marco.Bresciani at Alcatel.It



More information about the SNMP4J mailing list