Commit 5cf8cbc1 authored by Robert Ricci's avatar Robert Ricci
Browse files

Terrible hack.

Non-modular switches with two different types of interfaces give us
trouble under IOS because they appear to be on the same module, but
the duplicate card numbers. ie. Fastethernet0/1 and Gigabitethernet0/1
Hack around this by pretending the gigabit ports on such a switch are
on module 1, not module 0.

This works fine on the 29xx series, but probably won't work well for
anything else. The real solution is to move to iface instead of
card.port, or use a type.card.port triple.

In order to invoke this hack, you must put '-modhack' in the type for
the switch in the nodes table.
parent 6b843812
......@@ -110,10 +110,16 @@ sub new($$$;$) {
#
# We have to change our behavior depending on what OS the switch runs
#
$options->{'type'} =~ /^(\w+)(-ios)?$/;
$options->{'type'} =~ /^(\w+)(-modhack(-?))?(-ios)?$/;
$self->{SWITCHTYPE} = $1;
if ($2) {
$self->{NON_MODULAR_HACK} = 1;
} else {
$self->{NON_MODULAR_HACK} = 0;
}
if ($4) {
$self->{OSTYPE} = "IOS";
} else {
$self->{OSTYPE} = "CatOS";
......@@ -1548,8 +1554,22 @@ sub readifIndex($) {
foreach my $rowref (@$rows) {
my ($name,$iid,$descr) = @$rowref;
if ($descr =~ /(\d+)\/(\d+)$/) {
my $modport = "$1.$2";
if ($descr =~ /(\w*)(\d+)\/(\d+)$/) {
my $type = $1;
my $module = $2;
my $port = $3;
if ($self->{NON_MODULAR_HACK}) {
#
# Hack for non-modular switches with both 100Mbps and
# gigabit ports - consider gigabit ports to be on module 1
#
if (($module == 0) && ($type =~ /^gi/i)) {
$module = 1;
$self->debug("NON_MODULAR_HACK: Moving $descr to mod
$module");
}
}
my $modport = "$module.$port";
my $ifindex;
if (defined($iid) && ($iid ne "")) {
$ifindex = $iid;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment