snmp4j

How to bind child object in table


I'm writing some device simulators using SNMP4J. i've got quite a few to do so wrote something to parse the mib and create some java classes and annotate the properties with the MIB info. I then wrote something to iterate through the fields and create some MOs using reflection.

My first was based on a fairly simple MIB that simply had a few nested objects and a table which is comprised of a type with simple types. I wrote a table model that wraps an array list.

My second mib has a table that has nested objects, e.g. each row has an object and those objects also have objects. I cant see how I can expose those to snmp4j, the table model getValue returns a Variable.

For example, the first one is easy just implement a table model that returns the indexed field in getValue

Table A[0]
  - height
  - width

The next one I don't know what to do for the instance of Object C

Table B[0]
  - height
  - width
  - Object C
      - someValue
      - someOtherValue

Solution

  • Have you checked your MIB for correct SMIv2 syntax yet? Nested tables as you illustrated in the example Table B are not supported by SMIv1 nor SMIv2.

    With SNMP and its Structure of Management Information (SMI), nested tables are realised by specifying two "flat" tables (instead of a single nested table) where the first and the second table share the same index columns but the second adds one or more additional index columns.

    To check your SNMP MIB for SMI conformance you can use the following free service: https://agentpp.com/services/mibcheck.html