Here's a pseudo-SQL-style example for the second one:
SELECT adMX2820M13PrvSlotTable.adMX2820M13NetFuncServState.value FROM adMX2820M13PrvSlotTable WHERE adMX2820M13PrvSlotTable.adMX2820M13NetFuncServState.index_val[ +0] IN ( SELECT adGenPortSlotMapTable.adGenSlotAddress.index_val[0] FROM adGenPortSlotMapTable WHERE adGenPortSlotMapTable.adGenSlotAddress.value IN ( SELECT adMX2820M13StatDS3Table.adMX2820M13PrvCardPairID.index_ +val[0] FROM adMX2820M13StatDS3Table WHERE adMX2820M13StatDS3Table.adMX2820M13PrvCardPairID.value + !~ /not in use/i AND adMX2820M13StatDS3Table.adMX2820M13PrvCardPairID.value ! += '' ) )
This query string could be parsed and 'compiled' into a set of SNMP queries and then a set of lookup operations on the SNMP query results to return the specific data being requested.

So, the SNMP queries generated by parsing this would probably be something like this:
my $snmp1 = $sess->gettable( adMX2820M13StatDS3Table, columns => ['adMX2820M13PrvCardPairID',], ); my $snmp2 = $sess->gettable( adGenPortSlotMapTable, columns => ['adGenSlotAddress',], ); my $snmp3 = $sess->gettable( adMX2820M13PrvSlotTable, columns => ['adMX2820M13NetFuncServState',], ); # Code to correlate indices and values and such... # I could do this in larger, combined steps, or in a more # functional fashion, but I want this code to be as clear # and linear as possible # Inner-most sub-select: my $res1 = match_by_value( $snmp1, sub { $_ !~ /not in use/i } ); my $res2 = match_by_value( $snmp1, sub { $_ != '' } ); my $res3 = and( $res1, $res2 ); my $res4 = extract_index_val( 0, $res3 ); # Next sub-select: my $res5 = match_by_value( $snmp2, sub { $_ in( @$res4 ) } ); my $res6 = extract_index_val( 0, $res5 ); # Main select: my $res7 = match_by_value( $snmp3, sub { $_ in( @$res6 ) } ); my $res8 = extract_value( $res7 ); my $result = $res8
Somehow, it didn't come out as clear as I had hoped.

In reply to Re: RFC: Who wants to design a better SNMP API? by Hercynium
in thread RFC: Who wants to design a better SNMP API? by Hercynium

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.