sub translate_ifindex() {
my $ports_ini_dir = "/home/portal/bin/conf/snmp_set";
my (@range_files) =
( [ 204, 381, "snmp_ports_slot02.txt", ]
[ 22, 199, "snmp_ports_slot04.txt", ]
[ 513, 690, "snmp_ports_slot06.txt", ]
[ 823, 1000, "snmp_ports_slot08.txt", ]
[ 1067, 1244, "snmp_ports_slot10.txt", ]
[ 1311, 1488, "snmp_ports_slot12.txt", ]
[ 1555, 1732, "snmp_ports_slot14.txt", ]
[ 1799, 1976, "snmp_ports_slot16.txt", ]
[ 2043, 2220, "snmp_ports_slot18.txt", ]
[ 2287, 2464, "snmp_ports_slot20.txt", ] );
for ( my $t = 0 ; $t < @ifindex ; $t++ ) {
for my $range_file (@range_files) {
if ( $ifindex[$t] >= $$range_file[0]
&& $ifindex[$t] <= $$range_file[1] )
{
my $cfg = new Config::IniFiles(
-file => "$ports_ini_dir/$$range_file[2]" );
if ($cfg) {
push @msan_slot, $cfg->val( $ifindex[$t], "slot");
push @msan_port, $cfg->val( $ifindex[$t], "port");
}
else {
warn "Ooops($$range_file[2]): @Config::IniFiles::e
+rrors";
}
}
}
}
}
|