|
This section will be helpful for Agent Toolkit release 4.1 users who would like to migrate to Agent Tookit Release 5.x. There are no major changes in Agent API except that the new agent architecture now provides TL1 protocol support in addition to SNMP and HTTP. As specified in the Release features, the MibCompiler has been renamed as Agent Compiler with changes in the UI and support for TL1 code generation.
The links provided below gives you a detailed list of all the changes that have been made for each of the modules. It also provides a step-by-step procedure for upgrading your 4.1 projects to 5.x.
Changes in Agent Compiler User Interface
Changes in Code Generation
Changes in AGENT-CONFIG-MIB
Changes in HTTP
Upgrading projects developed in Release 4.1 (4.1 Model) to Release 5.x
Upgrading projects developed in Release 4.1 (4.0 Model) to Release 5.x
Changes in Agent Compiler User Interface
In release 4.2, the MibCompiler supported the 4.0 Model and 4.1 Model of code generation. In this release, the Agent Compiler supports the following models:
Standalone SNMP Agent (similar to 4.0 Model)
Standalone TL1 Agent (newly added)
Multi-Protocol Agent (similar to 4.1 Model with added support for TL1 protocol)
The get method generated in <AdventNet>/C-Agent/projects/<ProjectName>/agent/stubs/<mibmodule>+instru.c file has an additional argument "status". This is used to return the SNMP error.
In the older versions, the user cannot assign any error during get operation. It was handled in the Agent API. With this release, the user can specify the exact error in the get method using this status argument. For example, the get method of AdiskID of the AdiskTable is given below: U_CHAR *GetAdiskID(void *tableEntryPtr,INT32 *varValLen, U_CHAR *status)
Added one new method Get<Tablename>Entry in the <AdventNet>/C-Agent/projects/<ProjectName>/agent/stubs/<mibmodule>+hdlr.c file. This method is used to get an entry from the table. For example, the following method is generated to get an entry of the AdiskTable: U_CHAR GetAdiskTableEntry(U_CHAR***cols,INT32**colsLen, INT32 index)
The Update method generated in <AdventNet>/C-Agent/projects/<ProjectName>/agent/stubs/<mibmodule>+hdlr.c file has an additional argument "command ". Based on the value returned by the argument, the user can perform specific functions. For example, the Update method of AdiskTable is given below: CHAR UpdateAdiskTable(U_CHAR command)
The method CreateEntriesForApiTables() defined in AdventNet/C-Agent/projects/<ProjectName>/agent/stubs/submain.c file contains function calls to create the API Table entries. In release 4.1, the function calls to create the API Table entries were in different files as listed down in the table given below:
| API Table | FileName Directory in 4.1 Release |
|---|---|
|
Authentication Table
|
<AdventNet/C-Agent/projects/<ProjectName>/protocols/ snmp/src/ snmpauth.c |
|
Manager Table
|
<AdventNet/C-Agent/projects/ <ProjectName>/protocols/snmp/src/managerlist.c |
|
Proxy Table |
<AdventNet/C-Agent/projects/ <ProjectName>/protocols/snmp/src/proxytable.c |
|
USM User Table |
<AdventNet/C-Agent/projects/ <ProjectName>/protocols/snmp/src/snmpv3/security/usmtablehdlr.c |
|
VACM Context Table |
<AdventNet/C-Agent/projects/ <ProjectName>/protocols/snmp/src/snmpv3/acl/vacmcontexttable.c |
|
VACM Security To GroupTable |
<AdventNet/C-Agent/projects/ <ProjectName>/protocols/snmp/src/snmpv3/security/ vacmsecuritytogrouptable.c |
|
VACM Access Table |
<AdventNet/C-Agent/projects/ <ProjectName>/protocols/snmp/src/snmpv3/acl/ vacmaccesstablehdlr.c |
|
Vacm View Tree Family Table |
<AdventNet/C-Agent/projects/ <ProjectName>/protocols/snmp/src/snmpv3/acl/ vacmviewtreefamilyhdlr.c |
|
Trap Receiver Table |
<AdventNet/C-Agent/projects/ <ProjectName>/protocols/snmp/src/trapreceivertable.c |
If storage type in Database is enabled, the <ModuleName>+"dbs.c". is generated. This File contains methods for retrieving and updating a row from the database for a table. In the earlier versions, these methods were handled in the handler file itself. For example, the file aaplicationtabledbs.c will be generated if Database support is provided for the module aaplicationTable of the AGENT-SAMPLE-MIB. Please refer to Database file (MPA) or Database file (SSA) to know more about the methods generated.
Changes Made in AGENT-CONFIG-MIB
The starting OID of remote configuration tables defined in AGENT-CONFIG-MIB is changed as follows:
| Table Name | OID in Release 5.x | OID in Release 4.1 |
|---|---|---|
|
aclTable
|
.1.3.6.1.4.1.2162.10.1.2.1.6.1 |
.1.3.6.1.4.1.2162.10.1 |
|
v1v2TrapForwardingTable |
.1.3.6.1.4.1.2162.10.1.2.1.6.2 |
.1.3.6.1.4.1.2162.10.2 |
|
v3TrapForwardingTable |
.1.3.6.1.4.1.2162.10.1.2.1.6.3 |
.1.3.6.1.4.1.2162.10.3 |
|
Proxy Table |
.1.3.6.1.4.1.2162.10.1.2.1.6.4 |
.1.3.6.1.4.1.2162.10.4 |
|
trapReceiverTable |
.1.3.6.1.4.1.2162.10.1.2.1.6.5 |
.1.3.6.1.4.1.2162.10.5 |
For executing the exec tag, the name of the executable command in the Exec tag should be provided within quotes.
Changes to Be Made for Upgrading the Projects Developed in 4.1 Release ( 4.1 Model ) to 5.x Release (Multi-Protocol Agent)
|
|
Note: The projects created using Mibcompiler of 4.1 release cannot be used in the Agent Compiler of release 5.x. |
For example, if you have implemented agent for AGENT-SAMPLE-MIB in Release .1 (with 4.1 Model ) and you want to compile it in Release 5.x, follow these steps:
Create a new project in the Agent Compiler. Select the Multi-Protocol Agent as the Agent Type in the Agent Compiler with the required protocols enabled.
Load the AGENT-SAMPLE-MIB for which code is to be generated.
Select the necessary options provided in the Settings menu of the Agent Compiler and generate code for the project.
Delete all 'C' files and header files in <AdventNet>/C-Agent/<projects>/<ProjectName>/agent/stubs/agent-sample-mib/src and <AdventNet>/C-Agent/<projects>/<ProjectName>/agent/stubs/agent-sample mib/include.
Copy all C files and header files under the stubs directory of the old project to the directories specified in Point no.4.
Do the following modifications to the c files and header files:
Since additional argument "status" is added to the get method in release 5.x, it has to be reflected in the get methods generated in 4.1 release for each mibmodule in the <modulename>+instru.c file. For example, modify the GetAdiskID() generated in adisktableinstru.c file as follows.
In 4.1
U_CHAR *GetAdiskID(void *tableEntryPtr, INT32 *varValLen)
to be modified as
U_CHAR *GetAdiskID(void *tableEntryPtr, INT32 *varValLen, U_CHAR *status)
The function prototype of the get methods defined in the header file for each mibmodule should be modified. For example, modify the GetAdiskID() in adisktable.h in the ./include directory as follows:
In 4.1
ADISKTABLE_PUBLIC U_CHAR *GetAdiskID(void *tableEntryPtr, INT32 *varValLen);
to be modified as
ADISKTABLE_PUBLIC U_CHAR *GetAdiskID(void *tableEntryPtr, INT32 *varValLen, U_CHAR *status);
Since the Update method generated in /<mibmodule>+hdlr.c file has an additional argument "command " in release 5.1, it has to be reflected in the Update method generated for the 4.1 release. For example, the Update() method of AdiskTable in adisktablehdlr.c file should be modified as :
In 4.1 void UpdateAdiskTable() to be modified as CHAR UpdateAdiskTable(U_CHAR command)
Similarly, the function prototype of the Update methods defined in the header file for each mibmodule should be modified. For example, modify the UpdateAdiskTable() in adisktable.h in the ./include directory as follows: In 4.1 ADISKTABLE_PUBLIC void UpdateAdiskTable(); to be modified as ADISKTABLE_PUBLIC CHAR UpdateAdiskTable(U_CHAR command);
In <MibName>+traps.c file generated in ./stubs/src directory, add the following macro above the CreateNotification() function declaration #include "config.h".
In release 5.1, the broadcast notification function is defined under the macro #ifdef Deprecated_4_1. Hence add the following macro in the ./<projectname>/agent/source/system/include/config.h file #define DEPRECATED_4_1.
Row status validation in 5.x is modified. Hence, for tables having RowStatus column defined in release 4.1, the Set method generated for the RowStatus column in the <TableName>+hdlr.c file should be modified. In this example, in aaplicationUserTable of the AGENT-SAMPLE-MIB, aaplicationUserTableStatus is the row status column. The Set method
SetAaplictionUserTableStatus() generated in aaplicationUserTableinstru.c should be modified as shown below:
|
U_CHAR *SetAaplictionUserTableStatus(void *tableEntryPtr, U_CHAR *varVal, INT32 *varValLen, U_CHAR *status) { .... ........... ........... value = (* ((INT32*)(varVal))); retVal = SUCCESS; if(*status == VALIDATE) { retVal = IsValidRowStatus(presentState, (U_CHAR)value, status); if(retVal == FAILURE) { DEBUGMSG1("Wrong value for RowStatus Column !!!\n"); return NULL; } } else { retVal = UpdateRowStatus(presentState, (U_CHAR)value, status); aaplicationUserTableEntryPtr->aaplictionUserTableStatus = retVal; /* Please provide your code to instrument this OID here */ ..... ....... .......... ...................
*varValLen = Sizeof(aaplicationUserTableEntryPtr->aaplictionUserTableStatus); return (U_CHAR *)&aaplicationUserTableEntryPtr->aaplictionUserTableStatus; } |
After doing the above modifications, compile the project in 5.0 Release.
Start and test the agent.
Changes to Be Made for Upgrading the Projects Developed in 4.1 Release ( 4.0 Model ) to 5.x Release (Standalone SNMP Agent)
For example, you have implemented agent for AGENT-SAMPLE-MIB in Release 4.1 (with 4.0 Model ) and you want to compile it in Release 5.x:
Create a new project in the Agent Compiler. Select the Standalone SNMP Agent as the Agent Type in the Agent Compiler.
Load the AGENT-SAMPLE-MIB for which code is to be generated.
Select the necessary options provided in the Settings menu of the Agent Compiler and generate code for the project.
Delete all 'C' files and header files generated under the stubs directory of the 5.x project. (i.e.) <AdventNet>/C-Agent/<projects>/<ProjectName>/agent/stubs/agent-sample-mib/src <AdventNet>/C-Agent/<projects>/<ProjectName>/agent/stubs/agent-sample-mib/include
Copy all C files and header files under the stubs directory of the old project to the directories specified in Point no.4.
Do the following modifications to the c files and header files:
In 4.0 Model, the Treecell method generated in ./<mibmodule>+hdlr.c file will contain the first argument "0". Since this argument is removed in 5.1, the necessary changes have to be made in all the handler files generated. For example, the treeCell function generated in agentsystemhdlr.c file in 4.0 Model is given below:
|
treeCell gv_agentSystemCell = {0, "AGENT-SAMPLE-MIB:AgentSystem", SNMP_VERSION_2c, gv_agentSystemOid, AGENTSYSTEM_OID_LEN, NOT_TABLE, gv_agentSystemSubIdList, AGENTSYSTEM_SUBID_LEN, gv_agentSystemSubIdListAccess, gv_agentSystemSubIdListDataTypes, 0,AgentSystemProcessRequests, AgentSystemProcessReadReq, AgentSystemProcessWriteReq, UpdateAgentSystem, NULL, NULL}; |
In the above function, remove the first argument "0" and save the file. This modification should be made in all the handler files of the project.
Since the Update method generated in /<mibmodule>+hdlr.c file has an additional argument "command " in release 5.1, it has to be reflected in the Update method generated for the 4.1 release. For example, the Update() method of AdiskTable in adisktablehdlr.c file should be modified as :
In 4.1 void UpdateAdiskTable() to be modified as CHAR UpdateAdiskTable(U_CHAR command).
The above modification should be made in all the handler files generated for the project.
Modify the file name <mibname>+traps.c with the actual Mib name as specified under the ./stubs directory. For example, the trap file agentsamplemibtraps.c to be changed as agent-sample-mibtraps.c. The function SendTrapMessage() called in SendV1TrapOf<TrapName>() in <mibname>+traps.c file should be modified. For example, in agentsamplemibtraps.c file, do the following modification to the SendTrapMessage() function which is called in SendV2TrapOfscalarNotifications() and SendV2TrapOftableNotifications():
In 4.1 SendTrapMessage(trapPdu) to be modified as SendTrapMessage(trapPdu,&gv_trapVector,&gv_informVector);
Row status validation in 5.x is modified. Hence, for tables having RowStatus column defined in release 4.1, the Set method generated for the RowStatus column in the <TableName>+hdlr.c file should be modified. In this example, in aaplicationUserTable of the AGENT-SAMPLE-MIB, aaplicationUserTableStatus is the row status column. The Set method SetAaplictionUserTableStatus() generated in aaplicationUserTableinstru.c should be modified as shown below:
|
U_CHAR *SetAaplictionUserTableStatus(void *tableEntryPtr, U_CHAR *varVal, INT32 *varValLen, U_CHAR *status) { .... ........... ........... value = (* ((INT32*)(varVal))); retVal = SUCCESS; if(*status == VALIDATE) { retVal = IsValidRowStatus(presentState, (U_CHAR)value, status); if(retVal == FAILURE) { DEBUGMSG1("Wrong value for RowStatus Column !!!\n"); return NULL; } } else { retVal = UpdateRowStatus(presentState, (U_CHAR)value, status); aaplicationUserTableEntryPtr->aaplictionUserTableStatus = retVal; /* Please provide your code to instrument this OID here */ ..... ....... .......... ................... *varValLen = Sizeof(aaplicationUserTableEntryPtr->aaplictionUserTableStatus); return (U_CHAR *)&aaplicationUserTableEntryPtr->aaplictionUserTableStatus; } |
After doing the above modifications, compile the project in Agent Compiler of 5.x Release.
Start and test the agent by selecting Tools->MibBrowser.
|