snmpwalk implementation

Shiv Shankar Singh <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <E5FB6B3940ECF24D906CB6430212E2E85AD830FE@GUREXMB01.ASIAN.AD.ARICENT.COM>
Dear Sir,
I have implemented netsnmp sub-agent and would like to test snmpwalk command.

Please can you suggest me that what I need to enhance in my mib file for testing snmpwalk command.

When I do snmpwalk from snmp manager it calls my sub-agent but always sends column as 3 while I have implemented code for column 1.
And I want the data of column 1 by doing snmpwalk as I am hard-coding column 1 with a array of char.

Does I need to fill back the next index in response for snmp namager or manager itself increment the index and send the getnext for snmpwalk?

Now I am using tabular object., can I test snmpwalk by using scalar objects?

I am using the following command for snmpwalk:
rio:/root/shiv/snmp> snmpgetnext -v2c -c demopublic -M /usr/share/snmp/mibs/ -m ALL localhost ARICENT-SHIV::mmeLocalDataTable.0


Please find the code snipped below:

void
initialize_table_mmeLocalDataTable(void)
{
    static oid      mmeLocalDataTable_oid[] =
        { 1, 3, 6, 1, 4, 1, 29601, 11, 2, 1, 1 };
    size_t          mmeLocalDataTable_oid_len =
        OID_LENGTH(mmeLocalDataTable_oid);
    netsnmp_handler_registration *reg;
    netsnmp_iterator_info *iinfo;
    netsnmp_table_registration_info *table_info;

    reg =
        netsnmp_create_handler_registration("mmeLocalDataTable",
                                            mmeLocalDataTable_handler,
                                            mmeLocalDataTable_oid,
                                            mmeLocalDataTable_oid_len,
                                            HANDLER_CAN_RWRITE);

}

struct mmeLocalDataTable_entry {
    /*
     * Index values
     */
    u_long          instanceId1;

    /*
     * Column values
     */
    char            UE[100];
    char            old_UE;
    u_long          old_instanceId1;
    long            mmeLocalDataTableRowStatus;

    /*
     * Illustrate using a simple linked list
     */
    int             valid;
    struct mmeLocalDataTable_entry *next;
};




    case MODE_GET:
        for (request = requests; request; request = request->next) {
           /* table_entry = (struct mmeLocalDataTable_entry *)
                netsnmp_extract_iterator_context(request);*/

            table_info = netsnmp_extract_table_info(request);
  // memset(&imsi_object_rsp, 0, sizeof(imsi_object_rsp))



            switch (table_info->colnum) {
            case COLUMN_UE:
               /*( if (!table_entry) {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }*/
    for(count = 0;count<100;count++)
    UE[count] = 'a';

                snmp_set_var_typed_value(request->requestvb, ASN_OCTET_STR,
                                         (char *)UE,
                                         sizeof(UE));
                break;
            case COLUMN_INSTANCEID1:
                if (!table_entry) {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_value(request->requestvb, ASN_UNSIGNED,
                                         table_entry->instanceId1,
                                         sizeof(table_entry->instanceId1));
                break;
            case COLUMN_MMELOCALDATATABLEROWSTATUS:
                if (!table_entry) {
                    netsnmp_set_request_error(reqinfo, request,
                                              SNMP_NOSUCHINSTANCE);
                    continue;
                }
                snmp_set_var_typed_value(request->requestvb, ASN_INTEGER,
                                         table_entry->
                                         mmeLocalDataTableRowStatus,
                                         sizeof(table_entry->
                                                mmeLocalDataTableRowStatus));
                break;
            default:
                netsnmp_set_request_error(reqinfo, request,
                                          SNMP_NOSUCHOBJECT);
                break;
            }
        }
        break;

Please correct me wherever I am wrong and verify whether my approach is right or not, please suggest me if you feel any other better approach
for testing snmpwalk command.

Thanks & Regards,
Shiv



________________________________
"DISCLAIMER: This message is proprietary to Aricent and is intended solely for the use of the individual to whom it is addressed. It may contain privileged or confidential information and should not be circulated or used for any purpose other than for what it is intended. If you have received this message in error, please notify the originator immediately. If you are not the intended recipient, you are notified that you are strictly prohibited from using, copying, altering, or disclosing the contents of this message. Aricent accepts no responsibility for loss or damage arising from the use of the information transmitted by this email including damage from virus."

------------------------------------------------------------------------------

_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.