-
Bug
-
Resolution: Unresolved
-
None
-
unspecified
-
None
-
Operating System: All
Platform: All
-
5650
The MibTable class assumes that Enums start from 0 which is is not always true and causes problems.
For example, in this leaf, the first value is 1:
> leaf ifAdminStatus {
> type enumeration {
> enum up
> enum down
{ value 2; }> enum testing
{ value 3; }> }
> [etc]
This is the relevant snippet from the MibTable class:
> } else if (Enum.class.isAssignableFrom(objectType)) {
> setObject = objectType.getEnumConstants()[variable.toInt()];
getEnumConstants returns an array like [up, down, testing], however variable.toInt() ranges from 1 to 3.
If ifAdminStatus is up, variable.toInt()=1 so:
[up, down, testing][1] => down
If ifAdminStatus is testing, you get [up, down, testing][3] which causes an exception:
>2016-04-04 12:17:47,386 | WARN | tp1045961511-266 | MibTable | 242 - org.opendaylight.snmp - 1.1.0.Beryllium | Populate Exception
>java.lang.ArrayIndexOutOfBoundsException: 3
> at org.opendaylight.snmp.plugin.internal.MibTable.parse(MibTable.java:179)
> at org.opendaylight.snmp.plugin.internal.MibTable.populate(MibTable.java:88)
The correct code should shift variable.toInt() accordingly to account for this. Right now I am working on fixing this.