Commit e5d9b3be authored by Kirk Webb's avatar Kirk Webb

Pack of fixes for snmpit_force10 portchannel support (squash).

parent e05758e4
...@@ -212,14 +212,14 @@ sub new($$$;$) { ...@@ -212,14 +212,14 @@ sub new($$$;$) {
# #
# Bomb out if the session could not be established # Bomb out if the session could not be established
# #
warn "ERROR: Unable to connect via SNMP to $self->{NAME}\n"; warn "ERROR: Unable to connect via SNMP to $self->{NAME}\n";
return undef; return undef;
} }
# Grab our expect object (Ugh... Why Force10, why?) # Grab our expect object (Ugh... Why Force10, why?)
# This does not immediately connect to the switch. # This does not immediately connect to the switch.
if (exists($options{"username"}) && exists($options{"password"})) { if (exists($options->{"username"}) && exists($options->{"password"})) {
my $swcreds = $options{"username"} . ":" . $options{"password"}; my $swcreds = $options->{"username"} . ":" . $options->{"password"};
$self->{EXP_OBJ} = force10_expect->new($self->{NAME},$debugLevel, $self->{EXP_OBJ} = force10_expect->new($self->{NAME},$debugLevel,
$swcreds); $swcreds);
if (!$self->{EXP_OBJ}) { if (!$self->{EXP_OBJ}) {
...@@ -1717,18 +1717,24 @@ sub getChannelIfIndex($@) { ...@@ -1717,18 +1717,24 @@ sub getChannelIfIndex($@) {
$self->debug("$id: entering ".join(",",@ports)."\n"); $self->debug("$id: entering ".join(",",@ports)."\n");
return undef return undef
if (! @ifIndexes); if (! @modports);
$self->debug("$id: ".join(",",@modports)."\n"); $self->debug("$id: ".join(",",@modports)."\n");
my ($rows) = snmpitBulkwalkFatal($self->{SESS},[$OID_AGGPLIST]); my ($rows) = snmpitBulkwalkWarn($self->{SESS},[$OID_AGGPLIST]);
# Try to find the input ports in the membership lists of the port # Try to find the input ports in the membership lists of the port
# channels on this switch. Stop and return the first match found. # channels on this switch. Stop and return the first match found.
if ($rows) { if ($rows) {
RESULTS: foreach my $result (@{$rows}) { RESULTS: foreach my $result (@{$rows}) {
my ($name,$channelid,$members) = @{$result}; my ($oid,$channelid,$members) = @{$result};
$self->debug("$id: got $name, $channelid, members $members\n",2); $self->debug("$id: got $oid, $channelid, members $members\n",2);
# Apparently the iid (channelid) is not filled in when
# walking this OID tree. Check for a null iid, and substitute
# the last component of the returned OID if necessary.
if (!$channelid) {
$channelid = substr($oid, rindex($oid,'.') + 1);
}
# Chop up membership list into individual members. The stupid # Chop up membership list into individual members. The stupid
# thing is returned as a string that looks like this: # thing is returned as a string that looks like this:
# "Fo 0/52 Fo 0/56 ...". So, we must hop over the port type # "Fo 0/52 Fo 0/56 ...". So, we must hop over the port type
...@@ -1738,7 +1744,7 @@ sub getChannelIfIndex($@) { ...@@ -1738,7 +1744,7 @@ sub getChannelIfIndex($@) {
my $membmodport = join(".", split(/\//, $elements[$i+1])); my $membmodport = join(".", split(/\//, $elements[$i+1]));
foreach my $modport (@modports) { foreach my $modport (@modports) {
if ($modport eq $membmodport && if ($modport eq $membmodport &&
exists{$self->{POIFINDEX}{"Po$channelid"}}) { exists($self->{POIFINDEX}{"Po$channelid"})) {
$ifindex = $self->{POIFINDEX}{"Po$channelid"}; $ifindex = $self->{POIFINDEX}{"Po$channelid"};
last RESULTS; last RESULTS;
} }
...@@ -1751,7 +1757,7 @@ sub getChannelIfIndex($@) { ...@@ -1751,7 +1757,7 @@ sub getChannelIfIndex($@) {
# passed in, just return the ifindex for that port (single wire trunks). # passed in, just return the ifindex for that port (single wire trunks).
if (!$ifindex && scalar(@ports) == 1) { if (!$ifindex && scalar(@ports) == 1) {
if (exists($self->{IFINDEX}{$ports[0]})) { if (exists($self->{IFINDEX}{$ports[0]})) {
$ifindex = $self->{IFINDEX}{$port[0]}; $ifindex = $self->{IFINDEX}{$ports[0]};
} }
} }
...@@ -1779,7 +1785,7 @@ sub setChannelVlan($$$;$) { ...@@ -1779,7 +1785,7 @@ sub setChannelVlan($$$;$) {
my $isconfig = 1; my $isconfig = 1;
my $vlifname = "vlan$vlanid"; my $vlifname = "vlan$vlanid";
my ($res, $out) = $self->{EXP_OBJ}->doCLICmd($cmd, $isconfig, $vlifname); my ($res, $out) = $self->{EXP_OBJ}->doCLICmd($cmd, $isconfig, $vlifname);
if (!$res) { if ($res) {
warn "$id: Error adding vlan to channel: $out\n"; warn "$id: Error adding vlan to channel: $out\n";
} }
return $res; return $res;
...@@ -1801,7 +1807,7 @@ sub setVlansOnTrunk($$$$) { ...@@ -1801,7 +1807,7 @@ sub setVlansOnTrunk($$$$) {
$self->debug("$id: entering, modport: $modport, value: $value, vlans: ".join(",",@vlan_numbers)."\n"); $self->debug("$id: entering, modport: $modport, value: $value, vlans: ".join(",",@vlan_numbers)."\n");
my ($ifindex) = $self->convertPortFormat(PORT_FORMAT_IFINDEX, $modport); my ($ifindex) = $self->convertPortFormat($PORT_FORMAT_IFINDEX, $modport);
if (!$ifindex) { if (!$ifindex) {
warn "$id: WARNING: Could not get ifindex for port $modport\n"; warn "$id: WARNING: Could not get ifindex for port $modport\n";
return 0; return 0;
......
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