[cricket-users] New listInterfaces is finally working for frame-relay. :)

From: Timothy Kennedy (sugarat@thunderhold.sugarat.net)
Date: Fri May 21 1999 - 00:27:49 PDT


From: Timothy Kennedy <sugarat@thunderhold.sugarat.net>

On Thu, 20 May 1999, Alan Lichty wrote:

> Ascend/Cascade ATM switches use a fixed VPI/VCI number as their MIB
> ifIndex in their counter tables and I had to hard code in the
> interface numbers instead of using the instance mapping tool. In this
> case, I have a template for inst as:
>
> inst = %InterfaceID%
>
> and hard code the entry per interface in the interfaces file:
>
> InterfaceID = "3.65579"
>
> I have a script that regularly rebuilds the interfaces file with new
> circuit updates every hour.

Your idea pushed me over the top, Alan. Thanks alot.
I finally got the listInterfaces script to build the interfaces file
properly, with two extra lines. One for the frame-relay host inst,
and one for the frame-relay-sub inst.

Here's a diff of the listInterfaces script I now use. Next post will have
a diff of my new Defaults file. These Diffs are versus the cricket-0.65
files.

---------8< cute here 8<----------

*** listInterfaces Wed Feb 24 12:54:51 1999
--- ../../cricket/util/listInterfaces Thu May 20 23:56:47 1999
***************
*** 47,50 ****
--- 47,53 ----
  
  my($ifDescr) = '.1.3.6.1.2.1.2.2.1.2';
+ my($host);
+ my($frInst);
+ my %hash;
  
  my($row);
***************
*** 52,55 ****
--- 55,61 ----
        my($oid, $value) = split(/:/, $row, 2);
        
+ my ($ifindex, $ifdescr) = split(/\:/, $row);
+ $hash{$ifdescr} = $ifindex;
+
        $oid =~ s/$ifDescr//;
  
***************
*** 57,60 ****
--- 63,67 ----
        my($connector) = snmpUtils::get($snmp,
"1.3.6.1.2.1.31.1.1.1.17.$oid");
        my($desc) = snmpUtils::get($snmp, "1.3.6.1.2.1.31.1.1.1.18.$oid");
+ my($type) = snmpUtils::get($snmp, ".1.3.6.1.2.1.2.2.1.3.$oid");
  
        # second fetched value is oper status -- use it to decide which
***************
*** 73,78 ****
                # frame relay link) need a special config.
  
! if (defined($connector) && $connector == 2) {
                        output("target-type", "sub-interface");
                }
                print "\n";
--- 80,99 ----
                # frame relay link) need a special config.
  
! if (defined($connector) && $connector == 2 && $type != 32)
{
                        output("target-type", "sub-interface");
+ }
+ elsif (defined($connector) && $connector == 2 && $type ==
32) {
+ my @parent = split(/\./, $ifdescr);
+ if($#parent == 1) {
+ $host = $parent[0];
+ $frInst = $parent[1];
+ }
+ elsif($#parent == 0) {
+ $host = $parent[0];
+ }
+ output("target-type", "frame-interface");
+ print "\thost-interface \t= \t$hash{$host}\n";
+ output("frame-interface", $frInst);
+
                }
                print "\n";

--------------8< cute here 8<------------

Tim Kennedy
sugarat@thunderhold.sugarat.net

Disclaimer: since this came from this me, not that ---> me,
it is persona mail, and in no way reflects any opinions or
policies of my employer, whom I won't mention here, just to
keep things clear of them. (new email policy at work)
Usual stuff about confidentiality and whatnot... intended
receivers, blah, blah, etc., etc.

------------------------------------------------------------------------
ONElist members are using Shared Files in great ways!
http://www.onelist.com
Are you? If not, see our homepage for details.



This archive was generated by hypermail 2b29 : Mon Mar 06 2000 - 19:00:49 PST