make extra_dhcp_opt vars public

The extra_dhcp_opt api-def variables VALID_BLANK_EXTRA_DHCP_OPTS and
DHCP_OPT_VALUE_MAX_LEN may need to be referenced by consumers; for
example during data processing [1]. While consumers can access these
values indirectly via the api-def's EXTRA_DHCP_OPT_KEY_SPECS, it's
a bit messy.

This patch makes those variables public allowing consumers to reference
them from a single simple location.

[1] https://github.com/openstack/neutron/blob/master/neutron/db/extradhcpopt_db.py#L32

Change-Id: I9f9898ba400f3786ef643bbcba744c035c77089f
This commit is contained in:
Boden R 2017-05-11 12:32:59 -06:00 committed by Manjeet Singh Bhatia
parent 449f079b33
commit 3f290dee6b
2 changed files with 10 additions and 5 deletions

View File

@ -17,16 +17,16 @@ from neutron_lib.api import converters
# Common definitions for maximum string field length
DHCP_OPT_NAME_MAX_LEN = 64
_VALID_BLANK_EXTRA_DHCP_OPTS = ('router', 'classless-static-route')
_DHCP_OPT_VALUE_MAX_LEN = 255
VALID_BLANK_EXTRA_DHCP_OPTS = ('router', 'classless-static-route')
DHCP_OPT_VALUE_MAX_LEN = 255
EXTRA_DHCP_OPT_KEY_SPECS = [
# key spec for opt_name in _VALID_BLANK_EXTRA_DHCP_OPTS
{'opt_name': {'type:values': _VALID_BLANK_EXTRA_DHCP_OPTS,
{'opt_name': {'type:values': VALID_BLANK_EXTRA_DHCP_OPTS,
'required': True},
'opt_value': {'type:string_or_none':
_DHCP_OPT_VALUE_MAX_LEN,
DHCP_OPT_VALUE_MAX_LEN,
'required': True},
'ip_version': {'convert_to': converters.convert_to_int,
'type:values': [4, 6],
@ -35,7 +35,7 @@ EXTRA_DHCP_OPT_KEY_SPECS = [
{'opt_name': {'type:not_empty_string': DHCP_OPT_NAME_MAX_LEN,
'required': True},
'opt_value': {'type:not_empty_string_or_none':
_DHCP_OPT_VALUE_MAX_LEN,
DHCP_OPT_VALUE_MAX_LEN,
'required': True},
'ip_version': {'convert_to': converters.convert_to_int,
'type:values': [4, 6],

View File

@ -0,0 +1,5 @@
---
features:
- The constants ``VALID_BLANK_EXTRA_DHCP_OPTS`` and ``DHCP_OPT_VALUE_MAX_LEN``
are now public in the ``neutron_lib.api.definitions.extra_dhcp_opt`` API
definition module.