From 76291c74adf1adf69ae96c74cf08e26e29277d58 Mon Sep 17 00:00:00 2001 From: Jed Reynolds Date: Fri, 2 Nov 2018 11:02:26 -0700 Subject: [PATCH] Fixes parsing ports --- lf_generic_ping.pl | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/lf_generic_ping.pl b/lf_generic_ping.pl index 8da75e6f..f8292e17 100755 --- a/lf_generic_ping.pl +++ b/lf_generic_ping.pl @@ -202,7 +202,8 @@ foreach my $line (@ports_lines) { } # careful about that comma after card! - ($card, $port, $type) = $line =~ m/^Shelf: 1, Card: (\d+), +Port: (\d+) +Type: (\w+) /; + # NO EID for Shelf: 1, Card: 1, Port: 2 Type: WIFI-Radio Alias: + ($card, $port, $type) = $line =~ m/^Shelf: 1, Card: (\d+),\s+Port: (\d+)\s+Type: (\w+)/; if ((defined $card) && ($card ne "") && (defined $port) && ($port ne "")) { $eid = "1.${card}.${port}"; my $rh_eid = { @@ -212,21 +213,32 @@ foreach my $line (@ports_lines) { dev => undef, }; $::eid_map{$eid} = $rh_eid; + #print "\nfound eid $eid\n"; } + #elsif ($line =~ /^Shelf/) { + # #print "NO EID for $line\n"; + #} + if (!(defined $eid) || ($eid eq "")) { + #print "NO EID for $line\n"; + next; + } ($mac, $dev) = $line =~ / MAC: ([0-9:a-fA-F]+)\s+DEV: (\S+)/; if ((defined $mac) && ($mac ne "")) { + #print "$eid MAC: $line\n"; $::eid_map{$eid}->{mac} = $mac; $::eid_map{$eid}->{dev} = $dev; } ($parent) = $line =~ / Parent.Peer: (\S+) /; if ((defined $parent) && ($parent ne "")) { + #print "$eid PARENT: $line\n"; $::eid_map{$eid}->{parent} = $parent; } ($ip) = $line =~ m/ IP: *([^ ]+) */; if ((defined $ip) && ($ip ne "")) { + #print "$eid IP: $line\n"; $::eid_map{$eid}->{ip} = $ip; } } # foreach