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

164 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
af7cf95968
Merge branch 'main' into computroniks/bug/#311-fix-field-validation 2025-09-27 20:58:59 -04:00
Chumy
8f690adb5c Fix bug: Directives will be error on deserialize rules and field with None type 2025-09-25 23:17:21 -04:00
Jason Hall
cf137bd7e8
format and lint 2025-06-14 21:44:20 -04:00
Jelson Stoelben Rodrigues
23522da754 fix: ensure query_target is transformed after validation
Transformation must occur after validation, or else the transformation will possibly make the validation fail
2025-06-09 21:37:14 -04:00
Chris Wiggins
51c7f9eef6 feat: Add FRR structured output for BGP Routes 2025-06-09 21:12:18 -04:00
Mattie Nickson
b7e268bf18
Fixed API docs rendering
The use of `strip_whitespace` in `Field` for the query validation model caused the automatic generation of the API docs to fail with `ValueError: `schema_extra` declares key `strip_whitespace` which does not exist in `Schema` object`. By switching from `Field` to `Annotated` with `StringConstraints`, this avoids this issue allowing API docs to be correctly rendered.

Signed-off-by: Mattie Nickson <mnickson@sidingsmedia.com>
2025-06-06 10:08:59 +01:00
Mattie Nickson
6d132e27b4
Fixed validation of no condition rules
Previously, when processing rules with no condition, an extra RuleWithPattern rule was also added to the rule list causing a validation error. This has been corrected.

Signed-off-by: Mattie Nickson <mnickson@sidingsmedia.com>
2025-06-04 17:59:49 +01:00
Mattie Nickson
d653461b5d
Fix field validation for device config.
Some of the field validator methods for device config used `values` as a dictionary (presumably from an old version of pydantic). This is now passed as a `ValidationInfo` object by pydantic, which caused issues when code attempted to access it. The affected methods have been updated to fix the issue.

Fix #311

Signed-off-by: Mattie Nickson <mnickson@sidingsmedia.com>
2025-06-04 13:33:28 +01:00
cooperwinser
c369af439d Removed Union import 2025-05-17 23:34:15 +10:00
cooperwinser
7135ec3c9c Fix: allow integer values in extCommunityListRaw field for Arista BGP parsing 2024-12-09 12:08:25 +11:00
cooperwinser
2ed949a7a4 Fix: allow integer values in extCommunityListRaw field for Arista BGP parsing 2024-12-09 11:53:19 +11:00
thatmattlove
f340e65082 fix BGP route validation 2024-06-30 23:33:06 -04:00
thatmattlove
08fd310b44 fix issue where pattern rules failed validation 2024-06-16 17:12:54 -04:00
thatmattlove
6d06b9809d (possibly) fix log width issue 2024-06-16 16:59:22 -04:00
thatmattlove
aab4ada723 add support for any DoH provider; closes #254; closes #256 2024-06-01 15:25:41 -04:00
thatmattlove
bfcae89bf0 fix prepending of HYPERGLASS_APP_PATH to values; closes #253 2024-06-01 15:08:59 -04:00
thatmattlove
4b6e6cba70 fix config value overwrite; closes #249 2024-05-31 22:24:41 -04:00
thatmattlove
15ff03806a properly format menu content with configuration parameters 2024-05-28 14:42:45 -04:00
thatmattlove
ee5a418264 fix import sorting 2024-05-27 16:25:47 -04:00
thatmattlove
594d2e90f8 fix container file handling 2024-05-27 16:08:50 -04:00
thatmattlove
e84cc4ac00 remove deprecated pydantic constr usage 2024-05-27 14:41:04 -04:00
thatmattlove
7c398fdf4f remove params.docs.mode field; fix params.docs.path default value 2024-04-02 00:08:06 -04:00
thatmattlove
e6b6ab5812 remove test function 2024-04-01 23:45:56 -04:00
thatmattlove
d2f734ba1c logging overhaul 2024-04-01 23:42:07 -04:00
thatmattlove
d2e1486b5a initial migration to litestar 2024-03-26 23:59:42 -04:00
thatmattlove
e7e8b9b881 update docs 2024-03-25 00:01:16 -04:00
thatmattlove
19bdfe74d0 fix PeeringDB link rendering 2024-03-24 16:50:31 -04:00
thatmattlove
5d39ff054f fix ip validation rule when querying an IPv6 target 2024-03-19 23:27:38 -04:00
thatmattlove
a8476f2ea9 fix import sorting 2024-03-17 16:04:41 -04:00
thatmattlove
74827c02b9 fix unused import 2024-03-17 16:04:00 -04:00
thatmattlove
d706ff1959 fix test fixtures 2024-03-17 15:59:34 -04:00
thatmattlove
77c0a31256 upgrade major dependencies 2024-03-16 23:17:54 -04:00
thatmattlove
20ae02e2e5 fix & clean up api response models 2024-03-03 00:21:08 -05:00
thatmattlove
99ec07d055 fix issues causing test failure 2024-03-01 23:19:08 -05:00
thatmattlove
cd6bf7a162 tooling overhaul 2024-02-27 17:44:19 -05:00
thatmattlove
446853e4a9 countless updates I mostly don't remember. 2023-04-13 23:05:05 -04:00
thatmattlove
a15fe52061 fix typo 2022-12-30 23:40:14 -05:00
thatmattlove
7fd35f5d6f fix device_type selection for linux platforms 2022-12-26 16:23:56 -05:00
thatmattlove
c8c13eea27 migrate legacy builtin commands to directives 2022-12-26 10:57:30 -05:00
thatmattlove
43faa0f8e4 fix zip error 2022-12-24 18:21:25 -05:00
thatmattlove
9c9a8469a4 replace flake8 with ruff for linting, refactor issues 2022-12-24 17:53:05 -05:00
thatmattlove
4dfe5749ae fix import sorting 2022-12-19 16:58:12 -05:00
thatmattlove
f37eb9abf7 add v2 docs, minor refactoring 2022-12-19 14:57:20 -05:00
thatmattlove
fc3ba3a8be clean up unused parameters and start work on 2.0.0 docs 2022-12-12 18:52:39 -05:00
thatmattlove
60429ebbc1 commit previous changes and dep updates 2022-12-11 17:30:20 -05:00
thatmattlove
9300105d9f #142: Start multiple query target implementation 2021-12-23 00:00:35 -07:00
thatmattlove
dfca1a5bc1 Move isort configuration to pyproject.toml 2021-12-22 22:22:01 -07:00
thatmattlove
c479a2f2b4 Add info support back to directives 2021-12-18 19:38:13 -07:00