1
0
Fork 1
mirror of https://github.com/thatmattlove/hyperglass.git synced 2026-04-17 21:38:27 +00:00
Commit graph

11 commits

Author SHA1 Message Date
Tan Siewert
79d235c2ff
frr: return AS0 if AS_PATH length is zero
Local prefixes usually do not have an AS_PATH:
```
vtysh -c "show bgp ipv4 unicast 10.10.10.10 json" | jq '.paths[].aspath'
{
  "string": "Local",
  "segments": [],
  "length": 0
}
```

Set AS0 as a temporary solution when AS_PATH length is zero. This
avoids parser failures for local prefixes, though ideally we should
use the device's actual ASN (see TODO in code).

Signed-off-by: Tan Siewert <tan@siewert.io>
2025-10-04 21:35:30 +02:00
Tan Siewert
32873934cf
frr: set default values for optional next-hop fields
The metric and used fields might not be returned, causing the parser to
fail if they are not present. The absence was observed in FRR 10.4.1
with a multipath IPv6 route that has two next-hops (one GUA, one LL):
```
$ vtysh -c "show bgp ipv6 unicast 2003::/19 json" | jq '.paths[].nexthops'
[
  {
    "ip": "2a0d:2146:bdff:120::1",
    "afi": "ipv6",
    "scope": "global",
    "linkLocalOnly": false,
    "length": 32,
    "metric": 0,
    "accessible": true
  },
  {
    "ip": "fe80::3e61:408:1e3e:cff0",
    "afi": "ipv6",
    "scope": "link-local",
    "length": 32,
    "accessible": true,
    "used": true
  }
]
[
  {
    "ip": "2a0d:2146:bdff:120::1",
    "afi": "ipv6",
    "scope": "global",
    "linkLocalOnly": false,
    "length": 32,
    "metric": 0,
    "accessible": true
  },
  {
    "ip": "fe80::3e61:408:1e3e:cff0",
    "afi": "ipv6",
    "scope": "link-local",
    "length": 32,
    "accessible": true,
    "used": true
  }
]
```

Tested: Query a prefix with multiple next-hops where the metric or used
attributes are missing on one of them.

Signed-off-by: Tan Siewert <tan@siewert.io>
2025-10-04 21:35:27 +02:00
Jason Hall
cf137bd7e8
format and lint 2025-06-14 21:44:20 -04:00
Chris Wiggins
51c7f9eef6 feat: Add FRR structured output for BGP Routes 2025-06-09 21:12:18 -04:00
thatmattlove
d2f734ba1c logging overhaul 2024-04-01 23:42:07 -04:00
thatmattlove
a8476f2ea9 fix import sorting 2024-03-17 16:04:41 -04:00
thatmattlove
77c0a31256 upgrade major dependencies 2024-03-16 23:17:54 -04:00
thatmattlove
c049569cab Update black 2021-12-06 17:12:30 -07:00
thatmattlove
98201c1752 Update standard structured data models 2021-09-13 02:35:52 -07:00
thatmattlove
52ebf4663c Update code formatting - line length 2021-09-12 15:09:24 -07:00
checktheroads
59e767e501 clean up data models [skip ci] 2020-12-13 01:48:35 -07:00
Renamed from hyperglass/parsing/models/frr.py (Browse further)