1
0
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:
checktheroads
2020-06-06 01:22:14 -07:00
parent 40b957ee21
commit 4b92b670c9
6 changed files with 137 additions and 8 deletions

View File

@@ -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:

View 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()