netdisco / snmp-info

Other
39 stars 32 forks source link

snmp::info:ciscoagg returns unusable mappings on cisco c3750x stacked. #295

Closed inphobia closed 5 years ago

inphobia commented 5 years ago

snmp::info::ciscoagg returns unusable mappings for cisco c3750x stacks running ios 15.0(2)SE6.

i suspect it's due to bp_index missing the needed mappings.

snmp::info class used for this device is snmp::info::layer3::c6500

Expected Behavior

according to snmp::info::ciscoagg:

agg_ports
Returns a HASH reference mapping from slave to master port for each member of a port bundle on the device. Keys are ifIndex of the slave ports, Values are ifIndex of the corresponding master ports.

expected is to get ifindex keys back.

Current Behavior

at least for the device i tested on, the keys returned are bp_index id's, not ifindex. but bp_index() is missing mappings for the returned keys.

Possible Solution

using dot3adAggPortSelectedAggID seems to be a solution for this device. based off agg_ports_pagp in snmp::info::ciscoagg:

sub agg_ports_lag {
  my $dev = shift;

  my $mapping = {};
  my $group = $dev->dot3adAggPortSelectedAggID;
  for my $slave (keys %$group) {
    my $master = $group->{$slave};
    next if($master == 0 || $slave == $master);

    $mapping->{$slave} = $master;
  }

  return $mapping;
}

i'm not sure where to best change or try to catch this. snmp::info::ciscoagg is used by a lot of classes, many of which i don't have access to for testing, so things might break. on the other hand, snmp::info::ciscoagg->agg_ports says it should return ifindex keys which it is currently not doing.

Steps to Reproduce (for bugs)

  1. show agg_ports:
    netdisco-do show -d 10.40.254.12 -e agg_ports
    [31362] 2019-01-12 02:10:32  info App::Netdisco version 2.040002 loaded.
    [31362] 2019-01-12 02:10:33  info show: [10.40.254.12]/agg_ports started at Sat Jan 12 03:10:33 2019
    \ {
    53    5001,
    109   5001
    }
  2. the info in step 1 comes from snmp::info::IEEE802dot3ad, where it tries to map to bp_index(). but bp_index has no mappings for these ports (notice how 53 & 109 are missing).
    netdisco-do show -d 10.40.254.12 -e bp_index
    [31883] 2019-01-12 02:12:49  info App::Netdisco version 2.040002 loaded.
    [31883] 2019-01-12 02:12:49  info show: [10.40.254.12]/bp_index started at Sat Jan 12 03:12:49 2019
    \ {
    44    10144,
    49    10301,
    50    10302,
    51    10303,
    52    10304,
    54    10402,
    61    10605,
    105   10801,
    106   10802,
    107   10803,
    108   10804,
    110   10902,
    120   11108,
    122   11110,
    161   11301,
    162   11302,
    163   11303,
    164   11304,
    165   11401,
    166   11402,
    217   11801,
    218   11802,
    219   11803,
    220   11804,
    221   11901,
    222   11902,
    512   5001
    }

    according to cisco: (https://www.cisco.com/c/en/us/support/docs/ip/simple-network-management-protocol-snmp/40700-snmp-ifIndex40700.html) bp_index needs to be mapped to a vlan using a community@vlan-id construct. i found no combination that would return a mapping for 53 & 109. the config of the physical interfaces looks like:

    interface TenGigabitEthernet1/1/1
    switchport trunk encapsulation dot1q
    switchport trunk allowed vlan 1,8,101,110-113,120,252,254,451,452,455,460,810
    switchport mode trunk
    switchport nonegotiate
    srr-queue bandwidth share 1 30 35 5
    priority-queue out
    mls qos trust dscp
    auto qos trust dscp
    channel-group 1 mode active
    end

that of the portchannel interface:

interface Port-channel1
 switchport trunk encapsulation dot1q
 switchport trunk allowed vlan 1,8,101,110-113,120,252,254,451,452,455,460,810
 switchport mode trunk
 switchport nonegotiate
end

it could be that not returing dot1dBasePortIfIndex (==bp_index) for portchannel members is a cisco bug, but i found no reference to it.

  1. notice that id's returned in step 1 are not present in ifindex (snipped a bit of output)

    netdisco-do show -d 10.40.254.12 -e i_index
    [32067] 2019-01-12 02:28:08  info App::Netdisco version 2.040002 loaded.
    [32067] 2019-01-12 02:28:08  info show: [10.40.254.12]/i_index started at Sat Jan 12 03:28:08 2019
    \ {
    1       1,
    254     254,
    5001    5001,
    5179    5179,
    5180    5180,
    5181    5181,
    ...
    10303   10303,
    10304   10304,
    10401   10401,
    10402   10402,
    10601   10601,
    ...
    10804   10804,
    10901   10901,
    10902   10902,
    11101   11101,
    ...
    11901   11901,
    11902   11902,
    14501   14501,
    14502   14502
    }
  2. since https://github.com/netdisco/netdisco/blob/master/lib/App/Netdisco/Worker/Plugin/Discover/Properties.pm#L239 can't map the interfaces no portchannel members are shown for this class of devices.

Your Environment

inphobia commented 5 years ago

bonus: this also makes my cisco nexuses return correct info. without the diff port members are all over the place, even mapping portchannels as members of other port channels.

device: nexus 9332pq nx-os 7.0(3)I7(5) class: SNMP::Info::Layer3::Nexus

without the diff:

netdisco-do show -d 10.40.72.252 -e agg_ports
[756] 2019-01-12 02:41:28  info App::Netdisco version 2.040002 loaded.
[756] 2019-01-12 02:41:28  info show: [10.40.72.252]/agg_ports started at Sat Jan 12 03:41:28 2019
\ {
    5           369098776,
    7           369098776,
    11          369098776,
    12          369098776,
    19          369098776,
...
    6252        369098776,
    6259        369098776,
    6260        369098776,
    6267        369098776,
    369098763   369098776,
    369098811   369098776,
    369098812   369098776,
    436215296   369098802,
    436216320   369098802,
    436218368   369098758,
    436222464   369098792
}

a lot of this output has been snipped, but to give you an idea:

netdisco-do show -d 10.40.72.252 -e agg_ports 2>&1 | wc -l
1330

yup, 1330 lines!

with the diff: netdisco-do show -d 10.40.72.252 -e agg_ports

[1197] 2019-01-12 02:47:04  info App::Netdisco version 2.040002 loaded.
[1197] 2019-01-12 02:47:05  info show: [10.40.72.252]/agg_ports started at Sat Jan 12 03:47:05 2019
\ {
    436209664   369098802,
    436210176   369098802,
    436210688   369098758,
    436212224   369098792,
    436212736   369098811,
    436213248   369098812,
    436214272   369098803,
    436214784   369098763,
    436217856   369102843,
    436218368   369102843,
    436220928   369102847,
    436221440   369102847
}
[1197] 2019-01-12 02:47:05  info show: finished at Sat Jan 12 03:47:05 2019
[1197] 2019-01-12 02:47:05  info show: status done: Showed agg_ports response from 10.40.72.252

while the info returned now is correct, it is however not yet complete. portchannel members on fabric extenders are not yet shown.

update: the portchannels i'm missing are either not using lacp, are not in sync, or are the fabric extender uplinks. while the portchannel interface show up in dot3adAggIndex, they have no members in dot3adAggPortSelectedAggID. as such they will not be shown.

inphobia commented 5 years ago

tagging @JeroenvIS we had discussed this problem before. he had also seen it on nexus 5596s, but there it seems to work if no descriptions are given to an interface.

inphobia commented 5 years ago

cisco-lag-mib might have the parts needed to fill the last gaps, i'll investigate later.

inphobia commented 5 years ago

296 now fixes most of my issues; but needs a lot more testing.

inphobia commented 5 years ago

works for me & noone else complained (or reported anything at all 😈 )