Skip to content

Commit 5a83baf

Browse files
committed
use first destination port
1 parent 22b4433 commit 5a83baf

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

gv-neighbours.pl

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
use Storable;
66
use Data::Dump qw(dump);
77

8+
$|=1;
9+
810
my $gv = Storable::retrieve( '/tmp/gv.storable' );
11+
delete $gv->{'sw-core'}->{$_} foreach 7 .. 10; # remove sw-b101 lacp
912
warn "# gv = ",dump( $gv );
1013

1114
my @sw = qw( sw-core );
@@ -28,7 +31,12 @@
2831
warn "XX $sw";
2932
foreach my $port ( sort { $a <=> $b } keys %$s ) {
3033
my $to_sw = ( keys %{ $s->{$port} } )[0];
31-
my $to_port = ( keys %{ $s->{$port}->{$to_sw} } )[0];
34+
my @to_ports= keys %{ $s->{$port}->{$to_sw} } ;
35+
my $to_port = $to_ports[0];
36+
37+
if ( scalar @to_ports > 1 ) {
38+
warn "ERROR $sw $port -- $to_sw more than one destination port ",dump( @to_ports );
39+
}
3240

3341
next if $to_port eq 'no_port';
3442

@@ -38,6 +46,8 @@
3846

3947
print "$prefix $sw $port $to_sw $to_port\n";
4048

49+
next if $done_sw->{$to_sw};
50+
4151
if ( $to_sw =~ m/^sw-/ ) {
4252
push @prefix, "$prefix $sw $port $to_sw $to_port";
4353
push @sw, $to_sw;

0 commit comments

Comments
 (0)