Move network segment range types to lib constants

Move NETWORK_SEGMENT_RANGE_TYPE_LIST from api-def to
neutron_lib.constants and renamed to NETWORK_SEGMENT_RANGE_TYPES so
that the constant can be used elsewhere.

Co-authored-by: Allain Legacy <Allain.legacy@windriver.com>

Partially-implements: blueprint network-segment-range-management
Change-Id: I6d49faf9eef9087d6ae5c3722f0b9a2a3f980c63
This commit is contained in:
Kailun Qin 2019-01-17 06:24:57 +08:00
parent 4e1bc16c2f
commit 42efcef626
3 changed files with 11 additions and 6 deletions

View File

@ -35,11 +35,6 @@ RESOURCE_NAME = 'network_segment_range'
# The plural for the resource.
COLLECTION_NAME = 'network_segment_ranges'
NETWORK_SEGMENT_RANGE_TYPE_LIST = [constants.TYPE_VLAN,
constants.TYPE_VXLAN,
constants.TYPE_GRE,
constants.TYPE_GENEVE]
# Min ID for VLAN, VXLAN, GRE and GENEVE all equal to 1; Max ID for them are
# 4094, 2 ** 24 - 1, 2 ** 32 - 1 and 2 ** 24 - 1 respectively.
# Take the largest range: [MIN_GRE_ID, MAX_GRE_ID] as the limit for validation.
@ -82,7 +77,8 @@ RESOURCE_ATTRIBUTE_MAP = {
'network_type': {'allow_post': True,
'allow_put': False,
'validate': {
'type:values': NETWORK_SEGMENT_RANGE_TYPE_LIST},
'type:values':
constants.NETWORK_SEGMENT_RANGE_TYPES},
'default': constants.ATTR_NOT_SPECIFIED,
'is_filter': True,
'is_visible': True},

View File

@ -289,6 +289,9 @@ TYPE_VXLAN = 'vxlan'
TYPE_VLAN = 'vlan'
TYPE_NONE = 'none'
# List of supported network segment range types
NETWORK_SEGMENT_RANGE_TYPES = [TYPE_VLAN, TYPE_VXLAN, TYPE_GRE, TYPE_GENEVE]
# Values for network_type
# For VLAN Network

View File

@ -0,0 +1,6 @@
---
other:
- |
The ``neutron_lib.api.definitions.network_segment_range.NETWORK_SEGMENT_RANGE_TYPE_LIST``
constant was moved to ``neutron_lib.constants`` and renamed to
``NETWORK_SEGMENT_RANGE_TYPES`` so that it can be used elsewhere.