netdisco / snmp-info

Other
35 stars 31 forks source link

C4000.pm -- setting speed/duplex #79

Closed netdisco-automation closed 7 years ago

netdisco-automation commented 18 years ago

updated C4000.pm to fix duplex/speed issues

Reported by: arcanez

Original Ticket: snmp-info/patches/10

netdisco-automation commented 18 years ago

Logged In: YES user_id=1368562

patch from C4000.pm in CVS to my C4000.pm, as requested by Max

Original comment by: arcanez

netdisco-automation commented 18 years ago

patch from C4000.pm in CVS to my C4000.pm, as requested by Max

Original comment by: arcanez

netdisco-automation commented 18 years ago

Logged In: YES user_id=109593

That looks like a completely different C4000.pm . Would you mind trying the one in CVS to see if its i_duplex and i_duplex_admin works?

Your i_speed_admin looks like it uses only mau functions, so might do better in MAU.pm. It might also do better to let the MIB do the heavy lifting, e.g., look for an OID like dot3MauType(.*)Base and then translate $1 into the desired return value - that gets rid of the need for a mapping table (which would have to be updated at the same time as the MIB does).

Original comment by: fenner

netdisco-automation commented 18 years ago

Logged In: YES user_id=1368562

revised my C4000.pm per fenner's suggestions.

i_duplex & i_duplex_admin did not work on a 4948.

Original comment by: arcanez

netdisco-automation commented 18 years ago

revised C4000.pm

Original comment by: arcanez

netdisco-automation commented 18 years ago

patch for EtherLike.pm to munge el_duplex

Original comment by: arcanez

netdisco-automation commented 18 years ago

Logged In: YES user_id=1368562

patch for EtherLike.pm to munge el_duplex (change fullDuplex to full, halfDuplex to half) for use with C4000.pm. I'd think el_duplex should be munged to read full/half/unknown anyway

Original comment by: arcanez

netdisco-automation commented 18 years ago

Logged In: YES user_id=109593

Just to make sure, did you use the MAU.pm from CVS too? Both sets of code are using ifMauDefaultType, so I'm a bit confused why one would work and the other wouldn't.

What's your sysDescr for these devices? Are they running IOS or CatOS? The code in CVS works on my 4503 and 4506, which are running e.g.

Cisco IOS Software, Catalyst 4500 L3 Switch Software (cat4500- ENTSERVICESK9-M), Version 12.2(25)SG, RELEASE SOFTWARE (fc2)

Perhaps 4000 and 4500 are more different than we thought.

Original comment by: fenner

netdisco-automation commented 18 years ago

Logged In: YES user_id=1368562

both running IOS. only CatOS we have are 5500's and the evil 4006.

4948: Cisco IOS Software, Catalyst 4000 L3 Switch Software (cat4000-I5K91S-M), Version 12.2(25)EWA2, RELEASE SOFTWARE (fc2)

4510R: Cisco IOS Software, Catalyst 4000 L3 Switch Software (cat4000-I5K91S-M), Version 12.2(25)EW, RELEASE SOFTWARE (fc1)

with the CVS MAU.pm & C4000.pm, I only get defined i_duplex (half/full, no unknown) and no i_speed_admin

maybe it's dependent on how the hashes are keyed.. I take for granted they're all keyed the same (interfaces, i_speed, i_speed_admin, i_duplex, i_duplex_admin)

Original comment by: arcanez

netdisco-automation commented 18 years ago

Original comment by: jeneric-placeholder

netdisco-automation commented 18 years ago

Logged In: YES user_id=109593

Justin,

I just noticed that I hadn't committed a change to C4000.pm that made it use MAU.pm for i_speed_admin. If you have developer's CVS access via ssh, could you update that way? (Right now viewcvs and anoncvs are pretty far behind).
Alternately, I could send you the bits to try. I'm pretty sure our code is both using the same OIDs so should be reporting the same info.

Original comment by: fenner

netdisco-automation commented 18 years ago

Logged In: YES user_id=109593

P.S., you're right that the indexes should be the same. Attached is the test script I've been using.

Original comment by: fenner

netdisco-automation commented 18 years ago

Script to test duplex/speed/admin + if_highspeed too

Original comment by: fenner

netdisco-automation commented 18 years ago

Logged In: YES user_id=1368562

after closer examination, it looks like your C4000.pm works fine on the 4507 and 4948 I tested it on. I just had to pull from developer CVS.

I modified MAU.pm (i_duplex): $i_index{$iid} = 'half' if $duplex =~ /half/i; $i_index{$iid} = 'full' if $duplex =~ /full/i; $i_index{$iid} = 'auto' if $duplex =~ /auto/i; + $i_index{$iid} = 'unknown' if $duplex =~ /unknown/i;

Original comment by: arcanez

netdisco-automation commented 18 years ago

Logged In: YES user_id=1135238

Can we mark this as closed?

Original comment by: jeneric-placeholder

netdisco-automation commented 18 years ago

Original comment by: arcanez

netdisco-automation commented 18 years ago

Logged In: YES user_id=1368562

per jeneric

Original comment by: arcanez

netdisco-automation commented 18 years ago

Original comment by: arcanez

netdisco-automation commented 18 years ago

Original comment by: arcanez

netdisco-automation commented 18 years ago

Logged In: YES user_id=1368562

C4000.pm uses CiscoStack.pm to set duplex/speed, which errors out.

it looks like you have to set duplex/speed much the same that you get them. here is a hack that works, but needs fine tuning. Don't forget to set the auto negotiate to 1 or 2, depending on what you need (enabled, disabled) after you set the duplex/speed, the MAU method works fine. -- my %_mapping;

$_mapping{auto}{auto} = 'ccitt.0';

$_mapping{10}{auto} = 'dot3MauType10BaseTHD'; $_mapping{10}{half} = 'dot3MauType10BaseTHD'; $_mapping{10}{full} = 'dot3MauType10BaseTFD';

$_mapping{100}{auto} = 'dot3MauType100BaseTXFD'; $_mapping{100}{half} = 'dot3MauType100BaseTXHD'; $_mapping{100}{full} = 'dot3MauType100BaseTXFD';

$_mapping{1000}{auto} = 'dot3MauType1000BaseTFD'; $_mapping{1000}{half} = 'dot3MauType1000BaseTHD'; $_mapping{1000}{full} = 'dot3MauType1000BaseTFD';

sub set_i_duplex_admin { my ($c4000, $duplex, $iid) = @_;

my $speed_admin = $c4000->i_speed_admin(); my $speed = (split(/ /, $speed_admin->{$iid}))[0]; $speed = '1000' if $speed eq '1.0'; $duplex = lc($duplex);

return unless $_mapping{$speed}{$duplex};

my $oid = &SNMP::translateObj($_mapping{$speed}{$duplex});

$iid .= '.1'; return $c4000->set_mau_type_admin($oid, $iid); }

sub set_i_speed_admin { my ($c4000, $speed, $iid) = @_;

my $duplex_admin = $c4000->i_duplex_admin(); my $duplex = $duplex_admin->{$iid}; $speed = lc($speed);

return unless $_mapping{$speed}{$duplex};

my $oid = &SNMP::translateObj($_mapping{$speed}{$duplex});

$iid .= '.1'; return $c4000->set_mau_type_admin($oid, $iid); }

Original comment by: arcanez

netdisco-automation commented 18 years ago

Logged In: YES user_id=109593

Thanks for noticing. I'll ponder the MAU-MIB and see if we can come up with something that uses the MIB data somehow instead of needing _mapping.

Original comment by: fenner

netdisco-automation commented 18 years ago

Logged In: YES user_id=1135238

It appears there are two types of 4000's. Catalyst based and IOS based. Catalyst types should use the Catalyst class and CiscoStack.pm while IOS based should use the new C4000.pm and the MAU.pm (MAU MIB only supported on newer code). MAU.pm currently does not support sets while CiscoStack.pm has those changes already.

We need to modify the detection function for the classes to put 4000's in the correct class based on the software load.

Good reference on Cisco MIB support:

ftp://ftp-sj.cisco.com/pub/mibs/supportlists/cat4000/cat4000-supportlist.html

ftp://ftp-sj.cisco.com/pub/mibs/supportlists/wsc4000/wsc4000-supportlist.html

Original comment by: jeneric-placeholder

netdisco-automation commented 18 years ago

Logged In: YES user_id=1135238

After relooking at the detection, I think we just need to remove CiscoStack.pm from the inheritance chain on C4000.pm. It is an unsupported MIB on the IOS based 4000/4500. I'm assuming IOS based will always support (report) L3 while Catalyst based would only support L2.

Original comment by: jeneric-placeholder

netdisco-automation commented 17 years ago

Original comment by: arcanez