2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-04-03 15:36:28 +00:00

Workaround switches that report ifindex in bridge

Some switches report ifindex instead of bridge index.

This is not compliant behavior.  However, we can detect
that every last mac was a dead end, and assume this is
the case to try to get better result.  This won't work
if there is overlap in interface and bridge indexes, so
in that case, the spec compliant behavior is assumed.
This commit is contained in:
Jarrod Johnson
2017-05-20 12:53:42 -04:00
parent 3213ceb972
commit 60871f7709

View File

@@ -772,7 +772,6 @@ sub refresh_switch {
xCAT::MsgUtils->message("S", "Error communicating with " . $session->{DestHost} . ": failed to get a valid response to BRIDGE-MIB request");
return;
}
# my $mactoindexmap = walkoid($session,'.1.3.6.1.2.1.17.4.3.1.2');
my $mactoindexmap = walkoid($session, '.1.3.6.1.2.1.17.7.1.2.2.1.2', silentfail => 1, verbose => $self->{show_verbose_info}, switch => $switch, callback => $self->{callback});
unless (defined($mactoindexmap)) { #if no qbridge defined, try bridge mib, probably cisco
@@ -783,6 +782,21 @@ sub refresh_switch {
xCAT::MsgUtils->message("S", "Error communicating with " . $session->{DestHost} . ": Unable to get MAC entries via either BRIDGE or Q-BRIDE MIB");
return;
}
my $bridgeifvalid = 0;
foreach (keys %$mactoindexmap) {
my $index = $mactoindexmap->{$_};
if (defined($bridgetoifmap->{$index})) {
$bridgeifvalid = 1;
last;
}
}
unless ($bridgeifvalid) {
# create a dummy bridgetoifmap to cover switches that thing it should go straight to ifindex
$bridgetoifmap = {};
foreach (keys %$namemap) {
$bridgetoifmap->{$_} = $_;
}
}
if (defined($self->{collect_mac_info})) {
my %index_to_mac = ();
foreach (keys %$mactoindexmap) {