2
0
mirror of https://github.com/xcat2/xcat-core.git synced 2026-01-10 18:32:35 +00:00

Fix Cumulus support of breakout ports

The code before was way too picky and complex, when it could
have been simple and forgiving.
This commit is contained in:
Jarrod Johnson
2020-07-10 08:21:26 -04:00
parent 89f3770e7c
commit d450d982d7

View File

@@ -733,30 +733,12 @@ sub refresh_switch {
}
}else{
foreach (@res){
if($_ =~ m/^([0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}) dev swp([0-9]+) vlan ([0-9]+) .*/){
if($_ =~ m/^([0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}:[0-9a-z]{2}) dev (swp[^ ]+) vlan ([0-9]+) .*/){
$mymac=$1;
$myport=$2;
$myport=sprintf("%d",$myport);
my $macport=$2;
my $macvlan=$3;
#try all the possible port number formats
#e.g, "5","swp5","05","swp05"
unless(exists $self->{switches}->{$switch}->{$myport}){
if(exists $self->{switches}->{$switch}->{"swp".$myport}){
$myport="swp".$myport;
}else{
$myport=sprintf("%02d",$myport);
unless(exists $self->{switches}->{$switch}->{$myport}){
if(exists $self->{switches}->{$switch}->{"swp".$myport}){
$myport="swp".$myport;
}else{
$myport="";
}
}
}
}
if($myport){
if($output){
printf $output "$mymac|%s\n", $self->{switches}->{$switch}->{$myport};