From 08b2f50ac7fcfc8e9a6ab690f4ec251bb68d8071 Mon Sep 17 00:00:00 2001 From: Bill Fenner Date: Fri, 11 Oct 2013 11:22:20 -0700 Subject: [PATCH] On EOS, the LLDP port ID is a dot1d port. Don't bother trying the reverse-mapping through ifAlias trick, since ifAlias is of course non-unique, if the user configures the same description for multiple ports (e.g., "open port"). --- Info/Layer3/Arista.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/Info/Layer3/Arista.pm b/Info/Layer3/Arista.pm index 80cb1107..d9202d3b 100644 --- a/Info/Layer3/Arista.pm +++ b/Info/Layer3/Arista.pm @@ -120,6 +120,27 @@ sub fw_port { return $arista->qb_fw_port($partial); } +# The LLDP MIB leaves it up in the air what the index means. +# On EOS, it's a dot1d port. +sub lldp_if { + my $arista = shift; + my $partial = shift; + + # We pick a column that someone else is likely to want, + # so that the cache means that hopefully this doesn't + # cause any more SNMP transactions in total. + my $desc = $arista->lldp_rem_desc($partial) || {}; + my $bp_index = $arista->bp_index() || {}; + + my $lldp_if = {}; + foreach my $key ( keys %$desc ) { + my @aOID = split( '\.', $key ); + my $port = $aOID[1]; + $lldp_if->{$key} = $bp_index->{$port}; + } + return $lldp_if; +} + 1; __END__