neutron_lib.api.validators.dns.
validate_dns_domain
(data, max_len=255)¶Validate DNS domain.
Parameters: |
|
---|---|
Returns: | None if data is valid, otherwise a human readable message indicating why validation failed. |
neutron_lib.api.validators.dns.
validate_dns_name
(data, max_len=255)¶Validate DNS name.
This method validates dns name and also needs to have dns_domain in config because this may call a method which uses the config.
Parameters: |
|
---|---|
Returns: | None if data is valid, otherwise a human readable message indicating why validation failed. |
neutron_lib.api.validators.dns.
validate_fip_dns_name
(data, max_len=255)¶Validate DNS name for floating IP.
Parameters: |
|
---|---|
Returns: | None if data is valid, otherwise a human readable message indicating why validation failed. |
neutron_lib.api.validators.
add_validator
(validation_type, validator)¶Dynamically add a validator.
This can be used by clients to add their own, private validators, rather than directly modifying the data structure. The clients can NOT modify existing validators.
neutron_lib.api.validators.
get_validator
(validation_type, default=None)¶Get a registered validator by type.
Parameters: |
|
---|---|
Returns: | The validator if registered, otherwise the default value. |
neutron_lib.api.validators.
is_attr_set
(attribute)¶Determine if an attribute value is set.
Parameters: | attribute – The attribute value to check. |
---|---|
Returns: | False if the attribute value is None or ATTR_NOT_SPECIFIED, otherwise True. |
neutron_lib.api.validators.
validate_any_key_specs_or_none
(data, key_specs=None)¶Validate each dict in a list matches at least 1 key_spec.
Parameters: |
|
---|---|
Returns: | None. |
Raises: | InvalidInput – If any of the dicts in data do not match at least 1 of the key_specs given. |
neutron_lib.api.validators.
validate_boolean
(data, valid_values=None)¶Validate data is a python bool compatible object.
Parameters: |
|
---|---|
Returns: | None if the value can be converted to a bool, otherwise a human readable message indicating why data is invalid. |
neutron_lib.api.validators.
validate_dict
(data, key_specs=None)¶Validate data is a dict optionally containing a specific set of keys.
Parameters: |
|
---|---|
Returns: | None if data is a dict and (optionally) contains only key_specs. Otherwise a human readable message is returned indicating why data is not valid. |
neutron_lib.api.validators.
validate_dict_or_empty
(data, key_specs=None)¶Validate data is {} or a dict containing a specific set of keys.
Parameters: |
|
---|---|
Returns: | None if data is {} or a dict (optionally) containing only key_specs. Otherwise a human readable message is returned indicating why data is not valid. |
neutron_lib.api.validators.
validate_dict_or_nodata
(data, key_specs=None)¶Validate no data or a dict containing a specific set of keys.
Parameters: |
|
---|---|
Returns: | None if no data/empty dict or a dict and (optionally) contains all key_specs. Otherwise a human readable message is returned indicating why data is not valid. |
neutron_lib.api.validators.
validate_dict_or_none
(data, key_specs=None)¶Validate data is None or a dict containing a specific set of keys.
Parameters: |
|
---|---|
Returns: | None if data is None or a dict that (optionally) contains all key_specs. Otherwise a human readable message is returned indicating why data is not valid. |
neutron_lib.api.validators.
validate_fixed_ips
(data, valid_values=None)¶Validate data is a list of fixed IP dicts.
In addition this function validates the ip_address and subnet_id if present in each fixed IP dict.
Parameters: |
|
---|---|
Returns: | None if data is a valid list of fixed IP dicts. Otherwise a human readable message is returned indicating why validation failed. |
neutron_lib.api.validators.
validate_hostroutes
(data, valid_values=None)¶Validate a list of unique host route dicts.
Parameters: |
|
---|---|
Returns: | None if data is a valid list of unique host route dicts, otherwise a human readable message indicating why validation failed. |
neutron_lib.api.validators.
validate_integer
(data, valid_values=None)¶This function validates if the data is an integer.
It checks both number or string provided to validate it’s an integer and returns a message with the error if it’s not
Parameters: |
|
---|---|
Returns: | None if data is an integer, otherwise a human readable message indicating why validation failed.. |
neutron_lib.api.validators.
validate_ip_address
(data, valid_values=None)¶Validate data is an IP address.
Parameters: |
|
---|---|
Returns: | None if data is an IP address, otherwise a human readable message indicating why data isn’t an IP address. |
neutron_lib.api.validators.
validate_ip_address_or_none
(data, valid_values=None)¶Validate data is an IP address or None.
Parameters: |
|
---|---|
Returns: | None if data is None or a valid IP address, otherwise a human readable message indicating why the data is invalid. |
neutron_lib.api.validators.
validate_ip_or_subnet_or_none
(data, valid_values=None)¶Validate data is an IP address, a valid IP subnet string, or None.
Parameters: |
|
---|---|
Returns: | None if data is None or a valid IP address or a valid IP subnet, otherwise a human readable message indicating why the data is neither an IP address nor IP subnet. |
neutron_lib.api.validators.
validate_ip_pools
(data, valid_values=None)¶Validate that start and end IP addresses are present.
In addition to this the IP addresses will also be validated.
Parameters: |
|
---|---|
Returns: | None if data is a valid list of IP pools, otherwise a message indicating why the data is invalid. |
neutron_lib.api.validators.
validate_list_of_regex_or_none
(data, valid_values=None)¶Validate data is None or a list of items matching regex.
Parameters: |
|
---|---|
Returns: | None if data is None or contains matches for valid_values, otherwise a human readable message as to why data is invalid. |
neutron_lib.api.validators.
validate_list_of_unique_strings
(data, max_len=None)¶Validate data is a list of unique strings.
Parameters: |
|
---|---|
Returns: | None if the data is a list of non-empty/non-blank strings, otherwise a human readable message indicating why validation failed. |
neutron_lib.api.validators.
validate_mac_address
(data, valid_values=None)¶Validate data is a MAC address.
Parameters: |
|
---|---|
Returns: | None if the data is a valid MAC address, otherwise a human readable message as to why validation failed. |
neutron_lib.api.validators.
validate_mac_address_or_none
(data, valid_values=None)¶Validate data is a MAC address if the data isn’t None.
Parameters: |
|
---|---|
Returns: | None if the data is None or a valid MAC address, otherwise a human readable message indicating why validation failed. |
neutron_lib.api.validators.
validate_nameservers
(data, valid_values=None)¶Validate a list of unique IP addresses.
Parameters: |
|
---|---|
Returns: | None if data is a list of valid IP addresses, otherwise a human readable message is returned indicating why validation failed. |
neutron_lib.api.validators.
validate_no_whitespace
(data)¶Validates that input has no whitespace.
Parameters: | data – The data to validate. Must be a python string type suitable for searching via regex. |
---|---|
Returns: | The data itself. |
Raises: | InvalidInput – If the data contains whitespace. |
neutron_lib.api.validators.
validate_non_negative
(data, valid_values=None)¶Validate data is a positive int.
Parameters: |
|
---|---|
Returns: | None if data is an int and is positive, otherwise a human readable message as to why data is invalid. |
neutron_lib.api.validators.
validate_not_empty_string
(data, max_len=None)¶Validate data is a non-empty/non-blank string.
Parameters: |
|
---|---|
Returns: | None if the data is non-empty/non-blank, otherwise a human readable string message indicating why validation failed. |
neutron_lib.api.validators.
validate_not_empty_string_or_none
(data, max_len=None)¶Validate data is a non-empty string or None.
Parameters: |
|
---|---|
Returns: | None if the data string is not None and is not an empty string, otherwise a human readable message as to why the string data is invalid. |
neutron_lib.api.validators.
validate_port_range_or_none
(data, valid_values=None)¶Validate data is a range of TCP/UDP port numbers
Parameters: |
|
---|---|
Returns: | None if data is an int between 0 and 65535, or two ints between 0 and 65535 with a colon between them, otherwise a human readable message as to why data is invalid. |
neutron_lib.api.validators.
validate_range
(data, valid_values=None)¶Check that integer value is within a range provided.
Test is inclusive. Allows either limit to be ignored, to allow checking ranges where only the lower or upper limit matter. It is expected that the limits provided are valid integers or the value None.
Parameters: |
|
---|---|
Returns: | None if the data is a valid int in the given range, otherwise a human readable message as to why validation failed. |
neutron_lib.api.validators.
validate_range_or_none
(data, valid_values=None)¶Check that the provided value is none or a ranged integer
neutron_lib.api.validators.
validate_regex
(data, valid_values=None)¶Validate data is matched against a regex.
Parameters: |
|
---|---|
Returns: | None if data contains matches for valid_values, otherwise a human readable message as to why data is invalid. |
neutron_lib.api.validators.
validate_regex_or_none
(data, valid_values=None)¶Validate data is None or matched against a regex.
Parameters: |
|
---|---|
Returns: | None if data is None or contains matches for valid_values, otherwise a human readable message as to why data is invalid. |
neutron_lib.api.validators.
validate_string
(data, max_len=None)¶Validate data is a string object optionally capping it length.
Parameters: |
|
---|---|
Returns: | None if the data is a valid string type and (optionally) within the given max_len. Otherwise a human readable message indicating why the data is invalid. |
neutron_lib.api.validators.
validate_string_or_none
(data, max_len=None)¶Validate data is a string or None.
Parameters: |
|
---|---|
Returns: | None if the data is None or a valid string, otherwise a human readable message indicating why validation failed. |
neutron_lib.api.validators.
validate_subnet
(data, valid_values=None)¶Validate data is an IP network subnet string.
Parameters: |
|
---|---|
Returns: | None if data is valid IP network address. Otherwise a human readable message as to why data is invalid. |
neutron_lib.api.validators.
validate_subnet_list
(data, valid_values=None)¶Validate data is a list of subnet dicts.
Parameters: |
|
---|---|
Returns: | None if data is a valid list of subnet dicts, otherwise a human readable message as to why the data is invalid. |
neutron_lib.api.validators.
validate_subnet_or_none
(data, valid_values=None)¶Validate data is a valid subnet address string or None.
Parameters: |
|
---|---|
Returns: | None if data is None or a valid subnet, otherwise a human readable message as to why data is invalid. |
neutron_lib.api.validators.
validate_subnetpool_id
(data, valid_values=None)¶Validate data is valid subnet pool ID.
Parameters: |
|
---|---|
Returns: | None if data is a valid subnet pool ID, otherwise a human readable message as to why it’s invalid. |
neutron_lib.api.validators.
validate_subnetpool_id_or_none
(data, valid_values=None)¶Validate data is valid subnet pool ID or None.
Parameters: |
|
---|---|
Returns: | None if data is a valid subnet pool ID or None, otherwise a human readable message as to why it’s invalid. |
neutron_lib.api.validators.
validate_subports
(data, valid_values=None)¶Validate data is a list of subnet port dicts.
Parameters: |
|
---|---|
Returns: | None if data is a list of subport dicts each with a unique valid port_id, segmentation_id and segmentation_type. Otherwise a human readable message is returned indicating why the data is invalid. |
neutron_lib.api.validators.
validate_uuid
(data, valid_values=None)¶Validate data is UUID like.
Parameters: |
|
---|---|
Returns: | None if data is UUID like in form, otherwise a human readable message indicating why data is invalid. |
neutron_lib.api.validators.
validate_uuid_list
(data, valid_values=None)¶Validate data is a list of UUID like values.
Parameters: |
|
---|---|
Returns: | None if data is an iterable that contains valid UUID values, otherwise a message is returned indicating why validation failed. |
neutron_lib.api.validators.
validate_uuid_or_none
(data, valid_values=None)¶Validate data is UUID like or None.
Parameters: |
|
---|---|
Returns: | None if data is UUID like in form or None, otherwise a human readable message indicating why data is invalid. |
neutron_lib.api.validators.
validate_values
(data, valid_values=None, valid_values_display=None)¶Validate that the provided ‘data’ is within ‘valid_values’.
Parameters: |
|
---|---|
Returns: | The message to return if data not in valid_values. |
Raises: | TypeError if the values for ‘data’ or ‘valid_values’ are not compatible for comparison or doesn’t have __contains__. If TypeError is raised this is considered a programming error and the inputs (data) and (valid_values) must be checked so this is never raised on validation. |
Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.