I am facing problems with a non-conformant SNMP agent: its IF-MIB::ifTable contains rows with ifIndex >= 2^31. The ifIndex has (according to the MIB) syntax Integer32 (1..2^31-1), however, this agent is quite a big device from Huawei (a GPON OLT) and I will hardly ever make them to comply with the MIB.
I'd like to collect statistics even from these interfaces, but current OpenNMS code fails when collectd tries to traverse the ifTable: "String -100663296 could not be converted to a SnmpObjId. It has a negative for subId 0" @ org.opennms.netmgt.snmp.SnmpObjId.convertStringToInts(SnmpObjId.java:121).
There are 2 problems:
a) the caller passes string containing negative value,
b) SnmpObjId will not work with OID parts >= 2^31 anyway (uses Java 32-bit signed int)
The b) might be already considered a bug: the numbers in OID are unsigned 32-bit ints (see RFC2578, SMIv2, section 3.5).
I will try to fix both problems. What should be the right way to support 32-bit unsigned ints in current Java? Do we already depend on Java 8, which introduces unsigned ops in Integer class? Or do I have to use longs?