![]() |
This section will be helpful for users who are using SNMP Agents in the earlier versions of Agent Toolkit Java Edition and now wish to migrate to the latest release of the Toolkit. The document explains how to
Migrate from 4.2 to 5.1.0 release.
Migrate from 5.0 to 5.1.0 release.
Migrate from 5.1.0 to 6.0.0 release.
For easy migration, create a new Project with the 5.1.0 release product.
The source files for the new project will be generated under <Agent Toolkit Home>/snmpprojects/projectname/agent/src/myCompany/myPackage directory.
Remove all the generated files under this directory.
Move all your source files from your previous release directory to the specified directory.
Change the import statement as specified in "Package Structure Modified" section.
Then compile the Agent.
This will make your Agent work in 5.1 release.
Please note that relevant absolute path has to be specified in the Main file where you have agentDir = <Agent Toolkit Home>/snmpprojects/projectname/agent/bin";
The Package structure for certain imports have been modified and before generation the older imports have to be commented and new import statements have to be added. Package structure have been changed for the following import :
com.adventnet.common.agent.*; - This import has to be commented and the following has to be included com.adventnet.agent.utilities.common.*;
Code Generation Changes
The following table lists the details of code
generation that has to be implemented in 5.1 while migrating from 4.2.
|
Functions |
Current Implementation in 4.2 |
To be modified in 5.1.0 |
|
AgentSnmpGroup() method |
AgentSnmpGroup grp = new AgentSnmpGroup(); |
AgentSnmpGroup grp = new AgentSnmpGroup(this); |
|
acltable |
acl = new com.adventnet.snmp.snmp2.agent.
AclTableRequestHandler((SnmpAgent)this, |
aclTable = new com.adventnet.snmp.snmp2.agent. AclTable((SnmpAgent)this,"acl.txt","xml");
acl = new com.adventnet.snmp.snmp2.agent. AclTableRequestHandler((SnmpAgent)this, aclTable);
Also the following line should be added in variable declarations private com.adventnet.snmp.snmp2.agent.AclTable aclTable = null; |
|
vacltable |
super.setV1v2AccessControl(true); com.adventnet.snmp.snmp2.agent. VaclTableRequestHandler vacl = new com.adventnet.snmp.snmp2 .agent.VaclTableRequestHandler ((SnmpAgent)this, "conf", "vacl.txt", false); vacl.addRegistrationListener(hdlr); |
vaclTable = new com.adventnet.snmp.snmp2.agent. VaclTable((SnmpAgent)this,"vacl.txt","xml");
vacl = new com.adventnet.snmp.snmp2.agent. VaclTableRequestHandler((SnmpAgent)this, vaclTable);
Also the following line should be added in variable declarations private com.adventnet.snmp.snmp2.agent.VaclTable vaclTable = null; |
|
|
Note: The OCTET STRING is handled as java.lang.String in 4.2 whereas it is handled as byte[] in 5.1.0 release. |
If you have instrumented your implementation with the entry methods, then be aware that the name and argument are changed in the latest release. Some of the methods of 4.2 release modified in this 5.1 release are as follows:
The method in AclEntry and AclEntryInterface has been changed.
setAclAccess(int value); --> setAccess(Integer value);
Forwarding Entry Class
getManagerHost() --> getV1v2ManagerHost();
getManagerPort() --> getV1v2ManagerPort();
getRowStatus() --> getV1v2ManagerStatus();
setManagerHost(SnmpVar var) --> setV1v2ManagerHost(java.lang.String host);
setManagerPort(SnmpVar var) --> setV1v2ManagerPort(java.lang.Integer port);
setRowStatus(SnmpVar var) --> setV1v2ManagerStatus(java.lang.Integer status);
V3 Forwarding Entry Class
getManagerHost() --> getV3ManagerHost();
getManagerPort() --> getV3ManagerPort();
getRowStatus() --> getV3RowStatus();
setManagerHost(SnmpVar var) --> setV3ManagerHost(java.lang.String host);
setManagerPort(SnmpVar var) --> setV3ManagerPort(java.lang.Integer port);
setRowStatus(SnmpVar var) --> setV3RowStatus(java.lang.Integer status);
setV3ManagerUserContextName(SnmpVar var) --> setV3ManagerUserContextName(java.lang.String cname);
setV3ManagerUserName(SnmpVar var) --> setV3ManagerUserName(java.lang.String uname);
setV3ManagerUserSecModel(SnmpVar var) --> setV3ManagerUserSecModel(java.lang.Long smodel);
setV3SecurityLevel(SnmpVar var) --> setV3SecurityLevel(java.lang.Integer slevel);
Have a look at the deprecated methods : -
DynamicRegistrationWithCommunity, DynamicRegistrationWithInstance, & DynamicRegistration
createDynamicRegistrationEntry. (Please note that new methods with extra arguments are included in the same name)
DynamicRegistrationWithInstance
removeSubAgent(DynamicRegistrationEntry ent). (Please note that new methods with extra arguments are included in the same name).
SnmpAgent.
setDebug.
setDebugOn.
setDebugOff.
SnmpTrapService.
getTrapTableName
setTrapTableName
getTrapPathName
setTrapPathName
getV3TrapTableName
setV3TrapTableName
setPersistence
setFToVPersistence.
AclTableRequestHandler
setPersistence
setFToVPersistence
VaclTableRequestHandler.
setPersistence,
setFToVPersistence.
Agent Param Options
getCommunity
getWriteCommunity
Traps
CreateV3ForwardingEntry.
createForwardingEntry
getId() and setId(SnmpVar var) in Forwarding Entry
getId() and setId(SnmpVar var) in V3 Forwarding Entry
Usage of PropertyRegistraionListener is not recommended. (SingleAgent Bean option is completely deprecated)
All these methods will still work with 5.1.0 release of Agent Toolkit (Java Edition) tool as they have not been removed.
The Methods that are removed from the 5.1.0 release of Agent Toolkit (Java Edition) Which were already in the deprecated List of 4.2 Release)
1. DynamicRegistrationWithCommunity
Constructor
setV2Supported
setAgentRef
2. DynamicRegistrationWithInstance
setV2Supported
3. DynamicRegistration
setV2Supported
Constructor
4. AclTableRequestHandler
getFieldSepertator
5. Traps
createV3ForwardingEntry.
getId() and setId(SnmpVar var).
getId() and setId(SnmpVar var).
Need for the tool
In this 5.1.0 release of Agent Toolkit Java Edition a few extra columns have been added to the following tables to achieve complete functionality.
forwardingTable
v3forwardingTable
aProxyTable
communityBasedProxyTable
instanceBasedProxyTable
These tables earlier present in AGENT-SAMPLE-MIB are now available in AGENT-SNMP-CONFIG-MIB. The Tables have been renamed as
v1v2TrapForwardingTable
v3TrapForwardingTable
proxyTable
contextBasedProxyTable
instanceBasedProxyTable.
respectively. The file names that created for these tables have also been renamed as follows :
| Old Name |
New Name |
|---|---|
|
forwardingTable.txt/xml |
V1V2TrapForwardingTable.txt/xml |
|
v3forwardingTable.txt/xml |
V3TrapForwardingTable.txt/xml |
|
Subagent.txt/xml |
ProxyTable.txt/xml |
|
SubagentWithCommunity.txt/xml |
ProxyTable.txt/xml |
|
SubagentWithInstance.txt/xml |
ProxyTable.txt/xml |
If you are an user of the previous release you may have stored entries in these text files with the old columns. To make the new columns available in the old text files, this utility has to be used. The additional columns will be created with some default values.
How to run the tool
Go to <Agent Toolkit Home>/bin directory of 5.1.0 release.
To run the tool make use of SnmpMigrationTool.sh or SnmpMigrationTool.bat depending on the OS.
You will have to provide the following information once the utility is made to run.
Name of the Table to be converted.
Mode of the file (whether txt or xml).
File name for the existing Table.
File name to be created.
SnmpTrapAppender Method
This method has been modified in Release 5.1.0. To implement this feature in 5.1.0, please refer Sending Traps for Log Messages implemented using Log4j section in Sending Traps and Informs.
Other than this, there are no major changes involved while migrating from 5.0 to 5.1.0.
Migration from 5.1.0 to 6.0.0 Release
The following changes are involved while migrating from 5.1.0 to 6.0.0.
Modify your Package Structure
The package structure have been modified for certain imports. The following table depicts the changes in package structure in 6.0.0 compared to 5.1.0.
| Package Structure in 5.1.0 | Package Structure in 6.0.0 |
|---|---|
|
com.adventnet.agent.utilities.common |
com.adventnet.utilities.common (Common Utils) |
|
com.adventnet.agent.utilities.xml |
com.adventnet.utilities.xml.dom |
|
com.adventnet.agent.utilities.xml.XMLIntender |
com.adventnet.utilities.xml.indenter.XMLIntender |
|
com.adventnet.agent.logging |
com.adventnet.utilities.logging |
Before generating the agent, you need to ensure that the latest package structure is followed.
In 5.1.0 release, the java.util.TooManyListenersException class was used. This has to be changed to com.adventnet.utils.agent.RegistrationListenerException class in 6.0.0.
Changes in Configuration Files
V3TrapForwardingTable - new column 'v3ManagerHostType' added for IPv6 support.
v1v2TrapForwardingTable - new column 'v1v2ManagerHostType' added for IPv6 support.
UsmUserTable - two new columns added, UsmUserAuthKey and UsmUserPrivKey to provide persistence for AuthKey and PrivKey.
Backward compatibility is supported in the Agent Toolkit. So, if you
are a 5.1 user having an older version of xml files, you can keep the
6.0.0 jars in the classpath and run the agent. The columns will be
automatically added to the above-mentioned configuration files.
![]() |