File: make-cisco-products.pl

package info (click to toggle)
libsnmp-session-perl 1.14~git20221124T101957-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,104 kB
  • sloc: perl: 11,920; ansic: 25; makefile: 15
file content (21 lines) | stat: -rw-r--r-- 678 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/local/bin/perl -w
### Script to convert CISCO-PRODUCTS-MIB.my to a Perl variable
### definition for use in e.g. etna:/home/noc/bin/get-cisco-versions.
### Should be run from time to time when a new MIB arrives on
### ftp.cisco.com/pub/mibs/v2.
###
use strict;

my $source = "/home/leinen/snmp/mibs/cisco/v2/CISCO-PRODUCTS-MIB.my";

open (SRC, $source) || die "open $source: $!";
print "my %cisco_product_name = (\n";
while (<SRC>) {
    my ($product, $octet);
    next unless ($product, $octet)
	= /^(.*)\s+OBJECT\s+IDENTIFIER\s*::=\s*{\s*ciscoProducts\s*([0-9]+)\s*}/;
    print "  $octet => \"$product\",\n";
}
close (SRC) || warn "close $source: $!";
print ");\n";
1;