[SNMP4J] I: Code Generation
Frank Fock
fock at agentpp.com
Thu Sep 7 19:31:09 CEST 2006
Hi Ivan,
Please find my comments inline:
Rododendro Ivan wrote:
> Hi,
> I'm using the latest versions of SNMP4J Agent and SNMP4J, 1.0 and 1.7.5 respectevely.
>
> When generating agent code with Agenpro 2.5.1 and its templates, I got the two following errors when building java code:
>
> "The literal 4294967295 of type int is out of range" on generated code
>
OK, this 'error' should be avoided by the code generation.
However, it seems that the MIB contains an redundant
range restriction, since a Gauge32 cannot be less than
0 and greater than 4294967295. Change the MIB definition
(i.e. removing the SIZE restriction) and the generated code
will be OK.
> private void createTestLemfEntry() {
> MOColumn[] testLemfEntryColumns = new MOColumn[9];
> testLemfEntryColumns[idxIndex] =
> new MOMutableColumn(colIndex,
> SMIConstants.SYNTAX_GAUGE32,
> moFactory.createAccess(MOAccessImpl.ACCESSIBLE_FOR_READ_CREATE),
> null);
> ValueConstraint indexVC = new ConstraintsImpl();
> ((ConstraintsImpl)indexVC).add(new Constraint(0, 4294967295));
>
> And
>
> "The return type is incompatible with DefaultMOMutableRow2PC.getIndex()" on generated code
>
> public UnsignedInteger32 getIndex() {
> return (UnsignedInteger32) getValue(idxIndex);
> }
>
This is most likely caused by naming an object in the MIB "Index".
The recommended naming always includes an abbreviation of the
company that wrote the MIB as a prefix to avoid such name clashes.
Again, by changing the MIB definition, this name clash can be avoided.
Best regards,
Frank
> The generation code fram the same MIB with previous version of libraries and agenpro was correct.
>
> Thank you.
> Ivan
> _______________________________________________
> SNMP4J mailing list
> SNMP4J at agentpp.org
> http://lists.agentpp.org/mailman/listinfo/snmp4j
--
AGENT++
http://www.agentpp.com
http://www.mibexplorer.com
http://www.mibdesigner.com
More information about the SNMP4J
mailing list