From 906b1cb52f3d7a6406b726fcd9e3986f8c2b5dc0 Mon Sep 17 00:00:00 2001 From: Eric Miller <> Date: Wed, 30 Jul 2008 02:05:54 +0000 Subject: [PATCH] [ 2031292 ] HP POE support - port to ifIndex mapping (Jeroen van Ingen) --- Info/Layer2/HP.pm | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Info/Layer2/HP.pm b/Info/Layer2/HP.pm index a13a72c1..8a39536f 100644 --- a/Info/Layer2/HP.pm +++ b/Info/Layer2/HP.pm @@ -607,6 +607,26 @@ sub c_platform { return \%c_platform; } +# POWER-ETHERNET-MIB doesn't define a mapping of its +# "module"/"port" index to ifIndex. Different vendors +# do this in different ways. +# HP switches use the ifIndex as port index, so we can +# ignore the module information and map the index directly +# onto an ifIndex. +sub peth_port_ifindex { + my $peth = shift; + my $partial = shift; + + my $peth_port_status = $peth->peth_port_status($partial); + my $peth_port_ifindex; + + foreach my $i ( keys %$peth_port_status ) { + my ( $module, $port ) = split( /\./, $i ); + $peth_port_ifindex->{$i} = $port; + } + return $peth_port_ifindex; +} + 1; __END__ @@ -906,6 +926,11 @@ identifier (iid) Returns (C) for both key and value for 1600, 2424, 4000, and 8000 models since they seem to have problems with F +=item $hp->peth_port_ifindex() + +Returns reference to hash of power Ethernet port table entries map back to +interface index (c) + =back =head2 Topology information