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.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 ! += '' ) )
Somehow, it didn't come out as clear as I had hoped.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
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |