Open def-bs opened 5 years ago
Hi, if you go to the Device Ports page for device ip252.31 and select port 22, and enable the Neighbor Device column, what is shown there?
Also in the return, what is shown on the ip252.36 device for port C22 and port 70?
Thanks
on ip252.31 I get this:
On ip252.36 (this one is correct)
@def-bs thanks! OK so this is a consequence of the recent fix where Netdisco was overlaying two links.
Here you asymmetric connection definitions. Netdisco has to pick one to use in the map and it picks the "wrong" one, I guess. But the map is not really at fault.. the underlying data is incorrect somehow.
So I suspect that the device model of ip252.31 is returning the wrong data to netdisco. What's interesting is that there is a port "70" on ip252.36, though (otherwise a broken topology symbol would show, I think).
If you do something like:
netdisco-do show -d ip252.31 -e c_port -D
we could see the data returned by the SNMP::Info class for the device. This is the list of "neighbor ports" it has cached from LLDP/CDP/etc beacons received.
[32270] 2019-06-11 07:03:34 info App::Netdisco version 2.042010 loaded.
[32270] 2019-06-11 07:03:35 info show: [10.23.252.31]/c_port started at Tue Jun 11 09:03:35 2019
[32270] 2019-06-11 07:03:35 debug show: running with timeout 600s
[32270] 2019-06-11 07:03:35 debug => running workers for phase: check
[32270] 2019-06-11 07:03:35 debug -> run worker check/base/0
[32270] 2019-06-11 07:03:35 debug Show is able to run
[32270] 2019-06-11 07:03:35 debug => running workers for phase: main
[32270] 2019-06-11 07:03:35 debug -> run worker main/base/100
[32270] 2019-06-11 07:03:35 debug snmp reader cache warm: [10.23.252.31]
[32270] 2019-06-11 07:03:35 debug [10.23.252.31:161] try_connect with ver: 2, class: SNMP::Info::Layer2::HP, comm:
OK looks like a problem with the HP class in SNMP::Info, you can see the duplicate port "22.1" and "0.22.1" (latter is the correct data).
it seems c_port returns all known topo data, i guess in this somehow causes confusion since the first part seems to be based on ifdescr and the second part on ifindex.
strange thing however is that the port column contains "C22" in that screenshot, which might be part of the issue. at least that broke topo on lenovo devices.
what does c_if return for both devices?
after looking into this a bit more i created netdisco/netdisco#608 , #344 & #345 with my understanding of underlying issues (or api confusion). all input/preferences/remarks appreciated.
for reference, this is what one of our snmp::info gurus said:
[15:38.07] <*buffextras> niekniek!~niekniek@164-205-145-85.ftth.glasoperator.nl joined
[15:55.42] <JvI_home> oliver: re c_port, IMHO the hash keys should be treated as internal identifiers only, ie as a row identfier to tie columns together.
[15:57.13] <JvI_home> They are not guaranteed to match up with any other index, such as interface index (aka ifIndex or iid)
[16:00.06] <JvI_home> (as I'm sure you know, but I want to point it out because it makes SNMP::Info development a lot harder if external callers are starting to treat table indexes as
having meaning)
(edited script, a bit to much copy/paste made remote info print "ip" instead of actual attribute, data returned however was correct)
ofcourse it doesn't help that the example in snmp::info synopsis (https://metacpan.org/pod/SNMP::Info#SYNOPSIS) makes things even less clear.
i had a first stab at trying to make things more clear:
#!/usr/bin/env perl
use SNMP::Info;
my $info = new SNMP::Info(
AutoSpecify => 1,
Debug => 1,
DestHost => 'device',
Community => 'public',
Version => 2
) or die "Can't connect to device.\n";
my $err = $info->error();
die "SNMP Community or Version probably wrong connecting to device. $err\n" if defined $err;
my $name = $info->name();
my $class = $info->class();
print "SNMP::Info is using this device class : $class\n";
my $topo = $info->has_topo();
unless (defined $topo) { exit(); }
my $interfaces = $info->interfaces();
# not all topology protocols support every function, check the manual for info on that:
# https://metacpan.org/pod/SNMP::Info#Topology-Information
my $c_if = $info->c_if(undef, $topo);
my $c_ip = $info->c_ip(undef, $topo);
my $c_port = $info->c_port(undef, $topo);
my $c_id = $info->c_id(undef, $topo);
my $c_platform = $info->c_platform(undef, $topo);
# devices can run multiple topo protos at the same time on the same interface, SNMP::Info
# will show all relations, which means some interfaces can return multiple results.
my %seencount;
foreach my $topo_id (sort (keys %$c_if)) {
print "topology identifier: $topo_id\n";
my $iid = $c_if->{$topo_id};
unless (exists $seencount{$iid}) {$seencount{$iid} = 0};
$seencount{$iid}++;
print " local info\n";
print " iid: $iid (seen $seencount{$iid} times)\n";
print " port: $interfaces->{$iid}\n";
my $r_ip = $c_ip->{$topo_id};
my $r_port = $c_port->{$topo_id};
my $r_id = $c_id->{$topo_id};
my $r_platform = $c_platform->{$topo_id};
print " remote info\n";
if (defined $r_ip) {print " ip: $r_ip\n"};
if (defined $r_port) {print " port: $r_port\n"};
if (defined $r_id) {print " id: $r_id\n"};
if (defined $r_platform) {print " platform: $r_platform\n"};
}
it could be done better with a nested hash like this perhaps, but the above code is easy to understand.
now for a device running both cdp and lldp, which has neighbors speaking either no topology protocol, lldp, or lldp+cdp you get output like this:
topology identifier: 0.1.4
local info
iid: 1 (seen 1 times)
port: fa1
remote info
ip: 10.40.254.248
ip: mgmt0
ip: 6c:b2:ae:91:25:0c
topology identifier: 0.12.5
local info
iid: 12 (seen 1 times)
port: fa12
remote info
ip: 10.40.254.249
ip: mgmt0
ip: 6c:b2:ae:91:22:be
topology identifier: 0.24.3
local info
iid: 24 (seen 1 times) <-----
port: fa24
remote info
ip: 10.40.254.111
ip: Gi1/1/3
ip: 44:d3:ca:bb:4a:00
topology identifier: 1.8
local info
iid: 1 (seen 2 times)
port: fa1
remote info
ip: 10.40.254.248
ip: mgmt0
ip: d10-n9k1.aquafin.be(FDO21392TG5)
topology identifier: 12.9
local info
iid: 12 (seen 2 times)
port: fa12
remote info
ip: 10.40.254.249
ip: mgmt0
ip: d10-n9k2.aquafin.be(FDO21392TFD)
topology identifier: 19.7
local info
iid: 19 (seen 1 times)
port: fa19
remote info
ip: 10.40.254.102
ip: e0M
ip: netapp-cl2-01
topology identifier: 24.4
local info
iid: 24 (seen 2 times) <------
port: fa24
remote info
ip: 10.40.254.111
ip: GigabitEthernet1/1/3
ip: D10-ACCESS-01.aquafin.be
also, #252 in an attempt to make cdp handle mac addresses that are embedded in a string field, cdp_port() now munges all 6 character port names to mac addresses.
is the name/descr/alias of your port 6 characters long by any chance?
I don't fully port.csv.zip
understand your question - "is the name/descr/alias of your port 6 characters long by any chance?"
Here is the data from port table in DB.
did something change in your setup since the file you linked shows netdisco 2.42.08 instead of .10 ?
Expected Behavior
I expect that when i move the cursor on the link between two devices, the correct port is shown.
Current Behavior
I am getting a wrong port on the map, a device is shown as connected on port 70, instead the correct one is C22.
Your Environment
App::Netdisco 2.42.10 SNMP::Info 3.68 DB Schema 58 PostgreSQL 9.6.13 Perl 5.24.1
Device information
SNMP::Info::_global uptime : DISMAN-EVENT-MIB::sysUpTimeInstance : .1.3.6.1.2.1.1.3.0 SNMP::Info::_global layers : SNMPv2-MIB::sysServices.0 : .1.3.6.1.2.1.1.7.0 SNMP::Info::_global description : SNMPv2-MIB::sysDescr.0 : .1.3.6.1.2.1.1.1.0 SNMP::Info::_global id : SNMPv2-MIB::sysObjectID.0 : .1.3.6.1.2.1.1.2.0 SNMP::Info 3.68 SNMP::Info::device_type() layers:01001010 id:11 sysDescr:"HP J4887A ProCurve Switch 4104GL, revision G.07.117, ROM G.05.02 (/sw/code/build/gamo(m03))" SNMP::Info 3.68 SNMP::Info::device_type() layers:01001010 id:11 sysDescr:"HP J4887A ProCurve Switch 4104GL, revision G.07.117, ROM G.05.02 (/sw/code/build/gamo(m03))" SNMP::Info::specify() - Changed Class to SNMP::Info::Layer2::HP. SNMP::Info::_validate_autoload_method(_data_printer) Unable to resolve method.