From 3f290dee6bf9462594c6935179484f544b34a17c Mon Sep 17 00:00:00 2001 From: Boden R Date: Thu, 11 May 2017 12:32:59 -0600 Subject: [PATCH] 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 --- neutron_lib/api/definitions/extra_dhcp_opt.py | 10 +++++----- .../extra-dhcp-opt-public-vars-ec4e1c2dcac43d69.yaml | 5 +++++ 2 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/extra-dhcp-opt-public-vars-ec4e1c2dcac43d69.yaml diff --git a/neutron_lib/api/definitions/extra_dhcp_opt.py b/neutron_lib/api/definitions/extra_dhcp_opt.py index 95d2e4978..0e4fa9224 100644 --- a/neutron_lib/api/definitions/extra_dhcp_opt.py +++ b/neutron_lib/api/definitions/extra_dhcp_opt.py @@ -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], diff --git a/releasenotes/notes/extra-dhcp-opt-public-vars-ec4e1c2dcac43d69.yaml b/releasenotes/notes/extra-dhcp-opt-public-vars-ec4e1c2dcac43d69.yaml new file mode 100644 index 000000000..5eef55e78 --- /dev/null +++ b/releasenotes/notes/extra-dhcp-opt-public-vars-ec4e1c2dcac43d69.yaml @@ -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.