1
0
Fork 0
mirror of https://github.com/alice-lg/birdwatcher.git synced 2025-03-09 00:00:05 +01:00

Fixed a bug regarding timestamps in the protocols parser.

This commit is contained in:
Patrick Seeburger 2019-02-20 12:13:18 +01:00 committed by Benedikt Rudolph
parent 8585003413
commit c6e717bc61
3 changed files with 24 additions and 3 deletions

View file

@ -73,7 +73,7 @@ func init() {
regex.protocol.routeChanges = regexp.MustCompile(`(Import|Export) (updates|withdraws):\s+(\d+|---)\s+(\d+|---)\s+(\d+|---)\s+(\d+|---)\s+(\d+|---)\s*$`)
regex.routes.startDefinition = regexp.MustCompile(`^([0-9a-f\.\:\/]+)\s+via\s+([0-9a-f\.\:]+)\s+on\s+([\w\.]+)\s+\[([\w\.:]+)\s+([0-9\-\:\s]+)(?:\s+from\s+([0-9a-f\.\:\/]+)){0,1}\]\s+(?:(\*)\s+){0,1}\((\d+)(?:\/\d+){0,1}\).*`)
regex.protocol.short = regexp.MustCompile(`^(?:1002\-)?([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([0-9\-]+)\s+(.*?)\s*?$`)
regex.protocol.short = regexp.MustCompile(`^(?:1002\-)?([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([^\s]+)\s+([0-9\-]+\s+[0-9\:]+?|[0-9\-]+)\s+(.*?)\s*?$`)
regex.routes.second = regexp.MustCompile(`^\s+via\s+([0-9a-f\.\:]+)\s+on\s+([\w\.]+)\s+\[([\w\.:]+)\s+([0-9\-\:\s]+)(?:\s+from\s+([0-9a-f\.\:\/]+)){0,1}\]\s+(?:(\*)\s+){0,1}\((\d+)(?:\/\d+){0,1}\).*$`)
regex.routes.routeType = regexp.MustCompile(`^\s+Type:\s+(.*)\s*$`)
regex.routes.bgp = regexp.MustCompile(`^\s+BGP.(\w+):\s+(.+)\s*$`)

View file

@ -74,9 +74,9 @@ func TestParseProtocolShort(t *testing.T) {
log.Printf("%# v", pretty.Formatter(p))
protocols := p["protocols"].(Parsed)
if len(protocols) != 7 {
if len(protocols) != 27 {
//log.Printf("%# v", pretty.Formatter(protocols))
t.Fatalf("Expected 7 protocols, found: %v", len(protocols))
t.Fatalf("Expected 27 protocols, found: %v", len(protocols))
}
fmt.Println(protocols)

View file

@ -8,3 +8,24 @@ pp_0175_as15169 Pipe master up 2019-02-15 => t_0175_as15169
pb_0175_as15169 BGP t_0175_as15169 up 2019-02-15 Established
pp_0026_as20940 Pipe master up 2019-02-15 => t_0026_as20940
pb_0026_as20940 BGP t_0026_as20940 up 2019-02-15 Established
direct1 Direct master down 2019-02-19 16:17:59
kernel1 Kernel master down 2019-02-19 16:17:59
M42_pch_radb Pipe master up 2019-02-19 16:17:59 => T42_pch_radb
C42_pch_radb Pipe Collector up 2019-02-19 16:17:59 => T42_pch_radb
R194_42 BGP T42_pch_radb up 2019-02-19 16:29:00 Established
M3856_pch_radb Pipe master up 2019-02-19 16:17:59 => T3856_pch_radb
C3856_pch_radb Pipe Collector up 2019-02-19 16:17:59 => T3856_pch_radb
R195_42 BGP T3856_pch_radb up 2019-02-19 16:18:33 Established
M112_112_ripe Pipe master up 2019-02-19 16:17:59 => T112_112_ripe
C112_112_ripe Pipe Collector up 2019-02-19 16:17:59 => T112_112_ripe
R195_77 BGP T112_112_ripe up 2019-02-19 16:24:31 Established
M286_kpn_ripe Pipe master up 2019-02-19 16:17:59 => T286_kpn_ripe
C286_kpn_ripe Pipe Collector up 2019-02-19 16:17:59 => T286_kpn_ripe
R192_22 BGP T286_kpn_ripe up 2019-02-19 16:26:10 Established
M553_belwue_ripe Pipe master up 2019-02-19 16:17:59 => T553_belwue_ripe
C553_belwue_ripe Pipe Collector up 2019-02-19 16:17:59 => T553_belwue_ripe
R192_175 BGP T553_belwue_ripe up 2019-02-19 16:18:34 Established
R194_106 BGP T553_belwue_ripe up 2019-02-19 16:18:09 Established
R194_205 BGP T52866_iveloz_radb start 2019-02-20 12:06:01 Idle BGP Error: Bad peer AS
R_janus1 BGP T6695_bh_20 start 2019-02-19 16:17:59 Idle