Commit 7230df72 authored by Anil Mallapur's avatar Anil Mallapur

Fix to correctly represent the infiniband ports in Mellanox switch, now the...

Fix to correctly represent the infiniband ports in Mellanox switch, now the listportsfunction of snmpit_mellanox module is getting the port information for both the ethernet and infiniband ports, but an issue still exists in the snmpit_test.in module where in the port information has to be printed
parent 48d24007
......@@ -325,12 +325,15 @@ sub PortInstance2mlnx($$) {
sub ifindex2PortInstance($$) {
my ($self, $ifindex) = @_;
if (exists($self->{IFINDEX}{$ifindex})) {
$self->{IFINDEX}{$ifindex} =~ /^Eth(\d+)\/(\d+)$/;
if ($self->{IFINDEX}{$ifindex} =~ /^Eth(\d+)\/(\d+)$/){
return Port->LookupByStringForced(
Port->Tokens2TripleString($self->{NAME}, $1, $2));
} elsif (exists($self->{POIFINDEX}{$ifindex})) {
} elsif ($self->{IFINDEX}{$ifindex} =~ /SX\/(\d+)$/) {
return Port->LookupByStringForced(
Port->Tokens2TripleString($self->{NAME},1,$1));
}
} elsif (exists($self->{POIFINDEX}{$ifindex})) {
return Port->LookupByStringForced(
Port->Tokens2IfaceString($self->{NAME},
$self->{POIFINDEX}{$ifindex}));
......@@ -355,7 +358,6 @@ sub ifindex2mlnx($$) {
sub mlnx2PortInstance($$) {
my ($self, $mlnx) = @_;
return $self->ifindex2PortInstance($self->mlnx2ifindex($mlnx));
}
......@@ -388,6 +390,7 @@ sub convertPortFormat($$@) {
# We determine the type by sampling the first port given
#
my $sample = $ports[0];
if (!defined($sample)) {
warn "$id: Given a bad list of ports\n";
return undef;
......@@ -396,12 +399,11 @@ sub convertPortFormat($$@) {
my $input = undef;
if (Port->isPort($sample)) {
$input = $PORT_FORMAT_PORT;
} elsif ($sample =~ /^Eth/ || $sample =~ /^Po/) {
} elsif ($sample =~ /^Eth/ || $sample =~ /^Po/ || $sample =~ /SX/) {
$input = $PORT_FORMAT_MLNX;
} else {
$input = $PORT_FORMAT_IFINDEX;
}
#
# It's possible the ports are already in the right format
#
......
Markdown is supported
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