Hi again -

I changed entry->lldpPortConfigPortNum = lldpPortConfigPortNum; to

entry->lldpPortConfigPortNum = lldpPortConfigPortNum + 1;

and now table still works and snmpget is working.  I will be testing the
other commands, but I guess this has solved my problem.  (or am I still
missing something?)

Also, as I add a row, am I supposed to set the valid bit to 1?

Kathy McLeod
Dept S82  CCB - SNMP
IBM Rochester, MN
(507) 253-4803
----- Forwarded by Kathy McLeod/Rochester/IBM on 03/18/2010 11:21 AM -----
                                                                           
             Kathy                                                         
             McLeod/Rochester/                                             
             IBM                                                        To 
                                       net-snmp-us...@lists.sourceforge.ne 
             03/18/2010 10:43          t                                   
             AM                                                         cc 
                                                                           
                                                                   Subject 
                                       not sure how to initialize          
                                       table_data                          
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           
                                                                           



Hi -

I took your advice and ran mib2c -c mib2c.table_data.conf
LLDP-MIB::lldpPortConfigTable.  The generated .h has this:

/*
 * column number definitions for table lldpPortConfigTable
 */
#define COLUMN_LLDPPORTCONFIGPORTNUM                       1
#define COLUMN_LLDPPORTCONFIGADMINSTATUS                2
#define COLUMN_LLDPPORTCONFIGNOTIFICATIONENABLE 3
#define COLUMN_LLDPPORTCONFIGTLVSTXENABLE               4

Note that the MIB defines the port number as the index, in the range of 1
to 4096.

My internal table that holds the data is this:

#define PORT_TAB_MAX_ENTRIES 4

typedef struct port_tab_entry_s {
   long  port_tab_portnum;
   long  port_tab_status;
   long  port_tab_notify;
   char  port_tab_tlvs;
} port_tab_entry_t;

extern port_tab_entry_t tempTable[PORT_TAB_MAX_ENTRIES];

Here is my code to copy my data to the table_data (for now I am testing
with fake data):

 /*
     * Initialise the contents of the table here
     */

    for(i=0; i<4; i++)
    {
       tempTable[i].port_tab_portnum = i+1;
       tempTable[i].port_tab_status  = (i+1) % 5; /* 1 thru 4 */
       tempTable[i].port_tab_notify  = i % 2;     /* true or false */
       tempTable[i].port_tab_tlvs    = BIT0 | i;

       lldpPortConfigTable_createEntry(table_data, i);
     }

snmptable works:
 snmptable -v 2c -c private localhost LLDP-MIB::lldpPortConfigTableSNMP
table: LLDP-MIB::lldpPortConfigTable

 lldpPortConfigAdminStatus lldpPortConfigNotificationEnable
lldpPortConfigTLVsTxEnable
                    txOnly                                0
"00 "
                    rxOnly                             true
"01 "
                   txAndRx                                0
"02 "
                  disabled                             true
"03 "

However when I do a get, the row numbers are from 0-3 (apparently) and the
top row is inaccessible (even though my port numbers (index) go from 1 -
4).
snmpget -v 2c -c private localhost LLDP-MIB::lldpPortConfigTable.1.2.1
LLDP-MIB::lldpPortConfigAdminStatus.1 = INTEGER: rxOnly(2)


When I change to lldpPortConfigTable_createEntry(table_data, i+1);
I get complete garbage:
 snmptable -v 2c -c private localhost LLDP-MIB::lldpPortConfigTableSNMP
table: LLDP-MIB::lldpPortConfigTable

 lldpPortConfigAdminStatus lldpPortConfigNotificationEnable
lldpPortConfigTLVsTxEnable
                         0                                0
"00 "
                         0                                0
"00 "
                         0                                0
"00 "
                1128482560                        539579726
"32 "

I wasn't sure what
netsnmp_table_helper_add_indexes(table_info, ASN_INTEGER, /* index:
lldpPortConfigPortNum */
                                     0);
does, so I changed the 0 to a 1.  Then snmptable works ok, but I was not
able to get anything from any of the columns.

Help.  Thanks.


Kathy McLeod


------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Net-snmp-users mailing list
Net-snmp-users@lists.sourceforge.net
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to