snmp related question, getnext of empty table accesses the key of next table

MEENA SELVAM <>
Tue Aug 16 21:39:41 CEST 2005


Hi,

I have few tables in snmp module, and when I issue a
get_next using a mib browser for an empty table, since
endOfTable is returned, it continues to look for the
next available instance of the next variable/table.

This is  according to (conforming to ) the
documentation given below from
www.erlang.se/doc/doc-5.0.1/lib/snmp-3.2.1/doc/
under instrumentation functions section.

=====================================================
3.1.6 GetNext Operation 

The GetNext Operation operation should only be defined
for tables since the agent can find the next instance
of plain variables in the MIB and call the
instrumentation with the get operation. 

table_access(get_next, RowIndex, Cols [, ExtraArg1,
...])

 

Cols is a list of integers, all greater than or equal
to zero. This indicates that the instrumentation
should find the next accessible instance. This
function returns the tuple {NextOid, NextValue}, or
endOfTable. NextOid should be the lexicographically
next accessible instance of a managed object in the
table. It should be a list of integers, where the
first integer is the column, and the rest of the list
is the indices for the next row. If endOfTable is
returned, the agent continues to search for the next
instance among the other variables and tables. 

RowIndex may be an empty list, an incompletely
specified row index, or the index for an unspecified
row.
======================================================

But, in finding the next instance the program tries to
access the key ie Colno corresponding to key is part
of this search.

In my case, the get_next of the switch table works
fine
normally but in the normal case, the keys are
inaccessible, and hence getnext (even as part of walk)
specifies columns 3-7 and never 1 and 2

The error I get is:


** User error: Invalid return value {'EXIT',{{badma
tch,{aborted,{function_clause,[{oam_snmp_snas,get_switch_table,[1,{'1','1'}]},{o
am_snmp_table,nselect_cols,6},{reg,'-transaction/3-fun-0-',3},{reg,'-transaction
/3-fun-1-',1},{mnesia_tm,apply_fun,3},{mnesia_tm,execute_transaction,5},{oam_snm
p_snas,snasSwitchDetailTable,3},{snmpa_agent,get_next_values_all_rows,6}]}}},[{o
am_snmp_snas,snasSwitchDetailTable,3},{snmpa_agent,get_next_values_all_rows,6},{
snmpa_agent,get_next_table,4},{snmpa_agent,next_loop_varbinds,5},{snmpa_agent,pr
ocess_pdu,4},{snmpa_agent,handle_pdu,7},{snmpa_agent,handle_info,2},{gen_server,
handle_msg,6}]}} from
{oam_snmp_snas,snasSwitchDetailTable,[]} (get_next)

my get_switch_table is the access function which is
defined below: The first parameter is col no.

get_switch_table(?snasSwitchIp, {XId, SId}) ->
       
        {value, SwitchIp} =
reg:value_t(?SwitchIp(XId,SId)),
      
      tuple_to_list(SwitchIp);

the problem is due to the col value 1 (first parameter
of the following function call). This is confirmed
because, just typing at erlang shell as follows:

oam_snmp_snas:get_switch_table(1,{'1','1'}).

gives the following error,

=ERROR REPORT==== 16-Aug-2005::10:25:42 ===
                                           Error in
process <0.1043.0> on node '
' with exit value:
{function_clause,[{oam_snmp_snas,get_switch_t
able,[1,{'1','1'}]},{erl_eval,do_apply,5},{shell,exprs,6},{shell,eval_loop,3}]}

                                                      
                        *
* exited:
{function_clause,[{oam_snmp_snas,get_switch_table,[1,{'1','1'}]},
                             {erl_eval,do_apply,5},
                             {shell,exprs,6},
                             {shell,eval_loop,3}]} **

whereas oam_snmp_snas:get_switch_table(3,{'1','1'}).
does not give error(produces proper output)


My doubt is: why does the next searched instance is
the key(col 1), instead of column 3.

Also is it possible to suppress searching beyond for
next available instance if endOfTable is encountered.


meena


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 



More information about the erlang-questions mailing list