MIB-to-Java Generation

Overview
Many software developers are having difficulties understanding SNMP. Absolute majority of SNMP books, documentation and web resources are written by network IT professionals for network IT professionals. These resources are leaving unanswered basic questions asked by software developers.

Usually software developer facing a new task is trying to present a system as a set of components and their interaction. This approach is also reused to understand existing systems.

The main players in the SNMP world are:

  • Application. It could be any piece of software. Think about this software as an Operating System, device driver, database engine. In the FriendlySNMP context this is a Java Application. Network professionals very often refer it as a device, e.g. server, switch, router, printer, and so on. The term device reflects network origin and the area of the most intense use of the SNMP.
  • SNMP Agent. The application is SNMP enabled if it has embedded SNMP Agent. SNMP agent links application internal invariants to outside world using SNMP language. SNMP agent code is developed by third party companies and instantiated in the application. Example of SNMP agent is SNMP4J agent or FriendlySNMP agent. Each SNMP agent has unique IP address/port on the network.
  • MIB Browser. Complex application to monitor and manage multiple (counted thousands) SNMP enabled applications on the network. MIB browser has unique IP address/port on the network. There are many synonyms to the term MIB browser, e.g. SNMP manager.
  • MIB Files. Text files written in a special language to describe SNMP agent interface. These files act as IDL files familiar to software developers.
The picture below shows major SNMP components and their relationships (Java flavor).

Application is responsible to implement all MIB files functionality exposed in Java classes generated from MIB files. MIB files contain formal description of functionality exposed by the application. Written by developer using special language. MIB files are parsed and loaded by MIB Browser. Provide contract exposed by application and implemented by SNMP Agent.

Generator
Generator is a tool which takes MIB files as an input and compiles it into a Java class files. The generated Java files are included into the application project and registered with application SNMP agent.

The following picture depicts Java files generation specific to SNMP4J and FriendlySNMP agents.

The application must implement SNMP functionality declared in MIB files. Generally speaking generators are not required. However, generated Java files are very helpful because they provide formal Java interface to MIB files.

AgenPro is a generator paired to SNMP4J agent. It takes MIB files as an input and generates Java classes. These classes must be registered with SNMP4J agent.

FriendlyPro is a generator paired to FriendlySNMP agent. It takes Java classes generated by AgenPro as an input and generates Java classes which must be registered with FriendlySNMP agent. FriendlySNMP agent is a wrapper to SNMP4J agent and it is sufficient only to add AgenPro generated Java files to the application project. FriendlySNMP agent takes care to register them to underlying SNMP4J agent. FriendlyPro has extensive help with details how to use the tool and how to enable SNMP in a custom application.