Migration from Release 4.1 to Release 5.x

 

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

 

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:

Changes in Code Generation

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

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

 

 

Changes in HTTP

Changes to Be Made for Upgrading the Projects Developed in 4.1 Release ( 4.1 Model ) to 5.x Release (Multi-Protocol Agent)

 

note.jpg

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:

  1. 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.

  2. Load the AGENT-SAMPLE-MIB for which code is to be generated.

  3. Select the necessary options provided in the Settings menu of the Agent Compiler and generate code for the project.

  4. 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.

  5. Copy all C files and header files under the stubs directory of the old project to the directories specified in Point no.4.

  6. Do the following modifications to the c files and header files:

    1. 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)

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);

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;

}

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:

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;

}



Copyright © 2012, ZOHO Corp. All Rights Reserved.