Add peth_port_ifindex override for Junipers.

This commit is contained in:
Ryan Gasik
2018-10-06 20:53:06 -07:00
parent 770ab9c8ec
commit a82e8e32a0

View File

@@ -653,6 +653,27 @@ sub e_parent {
return \%e_parent;
}
sub peth_port_ifindex {
my $peth = shift;
my $partial = shift;
my $peth_port_ifindex = {};
my $i_descr = $peth->i_description();
# Juniper doesn't have a translator, but the ports follow a standardized layout.
# Only the power status from the first member in a virtual chassis is reported.
foreach my $i ( keys %$i_descr ) {
# Juniper's port numbering is PHYS-FPC/PIC/PORT, only looking at PIC 0
if ($i_descr->{$i} =~ m/^(fe|ge|xe|et)-([0-9]+)\/([0]+)\/([0-9]+)$/) {
# Juniper port numbering begins at 0, but for PowerEthernet it begins at 1
my $mod = $2+1;
my $port = $4+1;
$peth_port_ifindex->{"$mod.$port"} = $i;
}
}
return $peth_port_ifindex;
}
1;
__END__