* Carrier object implementation #909 * API keys: disabling of user account by a PeeringDB admin does not disable access via a User API key. Also no disable mech, only revoke. #1140 * Ops: django needs lightweight healthcheck route that confirms database connectivity #1284 * Ops: various indexes are needed #1285 * API requests with invalid Authentication headers should notify users in some way. #1220 * Allow user to change account username #1130 * UX to remove carriers from facilities more inline the other similar UX * more UX fixes for removing carriers from facilities * Cache hints are needed for optimal CDN use #970 * fixes Commandline tool "Run command" button gone #1278 * RIR status gets deleted when changes are made to the network #1279 * Improve MTU field #658 * CSRF cookie not set error from email confirmation view #1296 * expose CSP_CONNECT_SRC * fix confirm email path checking in session middleware * Ops: Emails to OPERATIONS_EMAIL need to be rate-limited #1282 * add website field to carrier ux * website field on carrier optional with org fallback * linting * add *.google-analytics.com to CSP_CONNECT_SRC * poetry relock * fix issues with confirm-email reverse during session creation validation * fix tests * fix tests * pin django-peeringdb to support_202211 * linting * django ratelimit to <4 * regen docs * fix automated net stats to only include networks with status `ok` #1283 * linting * poetry lock Co-authored-by: Matt Griswold <[email protected]>
2.6 KiB
Generated from validators.py on 2023-01-17 22:33:48.360745
peeringdb_server.validators
peeringdb model / field validators
Functions
validate_address_space
def validate_address_space(prefix)
Validate an ip prefix according to peeringdb specs.
Arguments: - prefix: ipaddress.IPv4Network or an ipaddress.IPv6Network
Raises: - ValidationError on failed validation
validate_api_rate
def validate_api_rate(value)
Validates a number/time-unit format used to determine rate limits
e.g., 10/second or 100/minute
Will raise a ValidationError on failure
Arguments:
- value(
str)
Returns:
- validated value (
str)
validate_bool
def validate_bool(value)
Validates a boolean value
This can be passed a string for True or False or an integer as 1, 0 as well
to convert and return a boolean value
Will raise ValidationError on failure.
Arguments:
- value (
str|int|bool)
Returns:
- validated value (
bool)
validate_irr_as_set
def validate_irr_as_set(value)
Validate irr as-set string.
- the as-set/rs-set name has to conform to RFC 2622 (5.1 and 5.2)
- the source may be specified by AS-SET@SOURCE or SOURCE::AS-SET
- multiple values must be separated by either comma, space or comma followed by space
Arguments:
- value: irr as-set string
Returns:
- str: validated irr as-set string
validate_phonenumber
def validate_phonenumber(phonenumber, country=None)
Validate a phonenumber to E.164
Arguments: - phonenumber (str)
Raises: - ValidationError if phone number isn't valid E.164 and cannot be made E.164 valid
Returns: - str: validated phonenumber
validate_prefix
def validate_prefix(prefix)
Validate ip prefix.
Arguments: - prefix: ipaddress.IPv4Network or an ipaddress.IPv6Network
Raises: - ValidationError on failed validation
Returns: - ipaddress.ip_network instance
validate_prefix_overlap
def validate_prefix_overlap(prefix)
Validate that a prefix does not overlap with another prefix on an already existing ixlan.
Arguments: - prefix: ipaddress.IPv4Network or an ipaddress.IPv6Network
Raises: - ValidationError on failed validation
validate_zipcode
def validate_zipcode(zipcode, country)
Validate a zipcode for a country. If a country has zipcodes, a zipcode is required. If a country does not have zipcodes, it's not required.
Arguments: - zipcode (can be Str or None at this point) - country (two-letter country-code provided in data) Raises: - ValidationError if Zipcode is missing from a country WITH zipcodes Returns: - str: zipcode