pybgpkitstream 0.1.9__py3-none-any.whl → 0.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pybgpkitstream/bgpstreamconfig.py +20 -2
- {pybgpkitstream-0.1.9.dist-info → pybgpkitstream-0.2.0.dist-info}/METADATA +1 -1
- {pybgpkitstream-0.1.9.dist-info → pybgpkitstream-0.2.0.dist-info}/RECORD +5 -5
- {pybgpkitstream-0.1.9.dist-info → pybgpkitstream-0.2.0.dist-info}/WHEEL +0 -0
- {pybgpkitstream-0.1.9.dist-info → pybgpkitstream-0.2.0.dist-info}/entry_points.txt +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import datetime
|
|
2
2
|
import importlib
|
|
3
3
|
import shutil
|
|
4
|
-
from pydantic import BaseModel, Field, DirectoryPath, field_validator
|
|
4
|
+
from pydantic import BaseModel, Field, DirectoryPath, field_validator, model_validator
|
|
5
5
|
from typing import Literal
|
|
6
6
|
from ipaddress import IPv4Address, IPv6Address
|
|
7
7
|
|
|
@@ -131,7 +131,7 @@ class PyBGPKITStreamConfig(BaseModel):
|
|
|
131
131
|
)
|
|
132
132
|
|
|
133
133
|
elif parser == "bgpkit":
|
|
134
|
-
if shutil.which("bgpkit") is None:
|
|
134
|
+
if shutil.which("bgpkit-parser") is None:
|
|
135
135
|
raise ValueError(
|
|
136
136
|
"bgpkit binary not found in PATH. "
|
|
137
137
|
"Install from: https://github.com/bgpkit/bgpkit-parser "
|
|
@@ -140,3 +140,21 @@ class PyBGPKITStreamConfig(BaseModel):
|
|
|
140
140
|
|
|
141
141
|
# Return the parser value if validation passes
|
|
142
142
|
return parser
|
|
143
|
+
|
|
144
|
+
@model_validator(mode='before')
|
|
145
|
+
@classmethod
|
|
146
|
+
def nest_bgpstream_params(cls, data: dict) -> dict:
|
|
147
|
+
"""Allow to define a flat config"""
|
|
148
|
+
# If the user already provided 'bgpstream_config', do nothing
|
|
149
|
+
if "bgpstream_config" in data:
|
|
150
|
+
return data
|
|
151
|
+
|
|
152
|
+
# Define which fields belong to the inner BGPStreamConfig
|
|
153
|
+
stream_fields = {"start_time", "end_time", "collectors", "data_types", "filters"}
|
|
154
|
+
|
|
155
|
+
# Extract those fields from the flat input
|
|
156
|
+
inner_data = {k: data.pop(k) for k in stream_fields if k in data}
|
|
157
|
+
|
|
158
|
+
# Nest them back into the dictionary
|
|
159
|
+
data["bgpstream_config"] = inner_data
|
|
160
|
+
return data
|
|
@@ -2,11 +2,11 @@ pybgpkitstream/__init__.py,sha256=OGWVhZdSvialNkIkQ1VBrmiyOcwkCA1D5IaLo7WQnPI,20
|
|
|
2
2
|
pybgpkitstream/bgpelement.py,sha256=7mXSUmWThhIbKy2JVsLchoteve0BshT3uH8cdbAe0Go,1176
|
|
3
3
|
pybgpkitstream/bgpkitstream.py,sha256=CKQv7dU-ooznuD1AjHKnZ6qRdPH1ZiOIEGtVNtU8PCY,15062
|
|
4
4
|
pybgpkitstream/bgpparser.py,sha256=aJcVCv_ydy3xQcH_BBxQE4hc7G1rLYqqNJAXCdnrasA,14689
|
|
5
|
-
pybgpkitstream/bgpstreamconfig.py,sha256=
|
|
5
|
+
pybgpkitstream/bgpstreamconfig.py,sha256=vIfEN475WDIZ7kGmi3dnj_1GIQE_r6qkDFETZmMvH5E,6199
|
|
6
6
|
pybgpkitstream/cli.py,sha256=E0E1hO0fzGhy1skBopRufdewsiSy_mA-J8Gf2WxBRxo,4214
|
|
7
7
|
pybgpkitstream/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
8
8
|
pybgpkitstream/utils.py,sha256=6FwEEpBtY_20BDlJPOPFmTYQGqw7fCBLjXmnd7gjBdQ,404
|
|
9
|
-
pybgpkitstream-0.
|
|
10
|
-
pybgpkitstream-0.
|
|
11
|
-
pybgpkitstream-0.
|
|
12
|
-
pybgpkitstream-0.
|
|
9
|
+
pybgpkitstream-0.2.0.dist-info/WHEEL,sha256=eh7sammvW2TypMMMGKgsM83HyA_3qQ5Lgg3ynoecH3M,79
|
|
10
|
+
pybgpkitstream-0.2.0.dist-info/entry_points.txt,sha256=aWhImGlXLtRKkfyJHudcbSp5K5As4ZGL8wXZC0y6q4o,60
|
|
11
|
+
pybgpkitstream-0.2.0.dist-info/METADATA,sha256=EBkydfiRKhgjAz4NotQqix2wX9uSHLK3iDQ_1oUSEqU,2953
|
|
12
|
+
pybgpkitstream-0.2.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|