Skip to content
Snippets Groups Projects
Commit f67b24c7 authored by JORGE SASIAIN's avatar JORGE SASIAIN
Browse files

NAT-329: remove accidentally commited file

parent a87f48fe
No related branches found
No related tags found
No related merge requests found
Pipeline #84645 failed
from pydantic import BaseModel, validator, ModelField
from gso.utils.helpers import (
validate_country_code,
validate_ipv4_or_ipv6,
validate_site_fields_is_unique,
validate_site_name,
)
def common_ts_address_validator(cls, site_ts_address: str) -> str:
"""Validate that a terminal server address is valid."""
validate_ipv4_or_ipv6(site_ts_address)
return site_ts_address
def common_country_code_validator(cls, country_code: str) -> str:
"""Validate that the country code exists."""
validate_country_code(country_code)
return country_code
def common_unique_fields_validator(cls, value: str, field: ModelField) -> str | int:
"""Validate that the internal and :term:`BGP` community IDs are unique."""
return validate_site_fields_is_unique(field.name, value)
def common_site_name_validator(cls, site_name: str) -> str:
"""Validate the site name.
The site name must consist of three uppercase letters, followed by an optional single digit.
"""
validate_site_name(site_name)
return site_name
def validator_decorator(func):
def wrapper(cls, *args, **kwargs):
return validator(func.__name__, pre=True, allow_reuse=True)(*args, **kwargs)
return wrapper
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment