mirror of
https://github.com/checktheroads/hyperglass
synced 2024-05-11 05:55:08 +00:00
add structured data configuration options & external RPKI validation
This commit is contained in:
@@ -23,6 +23,7 @@ from hyperglass.configuration.models.cache import Cache
|
||||
from hyperglass.configuration.models.logging import Logging
|
||||
from hyperglass.configuration.models.queries import Queries
|
||||
from hyperglass.configuration.models.messages import Messages
|
||||
from hyperglass.configuration.models.structured import Structured
|
||||
|
||||
|
||||
class Params(HyperglassModel):
|
||||
@@ -113,6 +114,7 @@ class Params(HyperglassModel):
|
||||
logging: Logging = Logging()
|
||||
messages: Messages = Messages()
|
||||
queries: Queries = Queries()
|
||||
structured: Structured = Structured()
|
||||
web: Web = Web()
|
||||
|
||||
class Config:
|
||||
|
||||
31
hyperglass/configuration/models/structured.py
Normal file
31
hyperglass/configuration/models/structured.py
Normal file
@@ -0,0 +1,31 @@
|
||||
"""Structured data configuration variables."""
|
||||
|
||||
# Standard Library
|
||||
from typing import List
|
||||
|
||||
# Third Party
|
||||
from pydantic import StrictInt, StrictStr, constr
|
||||
|
||||
# Project
|
||||
from hyperglass.models import HyperglassModel
|
||||
|
||||
|
||||
class StructuredCommunities(HyperglassModel):
|
||||
"""Control structured data response for BGP communties."""
|
||||
|
||||
mode: constr(regex=r"(permit|deny)") = "deny"
|
||||
items: List[StrictStr] = []
|
||||
|
||||
|
||||
class StructuredRpki(HyperglassModel):
|
||||
"""Control structured data response for RPKI state."""
|
||||
|
||||
mode: constr(regex=r"(router|external)") = "router"
|
||||
max_age: StrictInt = 24
|
||||
|
||||
|
||||
class Structured(HyperglassModel):
|
||||
"""Control structured data responses."""
|
||||
|
||||
communities: StructuredCommunities = StructuredCommunities()
|
||||
rpki: StructuredRpki = StructuredRpki()
|
||||
Reference in New Issue
Block a user