avoid error if juniper vlan not in bp_index

This commit is contained in:
Oliver Gorwits
2022-08-11 04:57:42 +01:00
parent dc3d1e0b46
commit d5f68ca4e7

View File

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