avoid error if juniper vlan not in bp_index

This commit is contained in:
Oliver Gorwits
2022-08-10 17:32:16 -04:00
parent e885efa921
commit dc3d1e0b46

View File

@@ -327,7 +327,14 @@ sub i_vlan_membership {
foreach my $vlan ( keys %$v_ports ) {
my @bp_indexes = split /,/, $v_ports->{$vlan};
push @{ $res->{ $bp_index->{$_} } }, $vlan for @bp_indexes;
foreach my $idx (@bp_indexes) {
if (!exists $bp_index->{$_}) {
print " VLAN $vlan has no bp_index mapping. Skipping.\n"
if $DEBUG;
next;
}
push @{ $res->{ $bp_index->{$_} } }, $vlan for @bp_indexes;
}
}
return $res;
}
@@ -353,7 +360,14 @@ sub i_vlan_membership_untagged {
foreach my $vlan ( keys %$v_ports ) {
my @bp_indexes = split /,/, $v_ports->{$vlan};
push @{ $res->{ $bp_index->{$_} } }, $vlan for @bp_indexes;
foreach my $idx (@bp_indexes) {
if (!exists $bp_index->{$_}) {
print " untagged VLAN $vlan has no bp_index mapping. Skipping.\n"
if $DEBUG;
next;
}
push @{ $res->{ $bp_index->{$_} } }, $vlan for @bp_indexes;
}
}
return $res;
}