Subnet segment_id writable extension
To enable the possibility to migrate a non-routed network to a routed network allow updating the segment_id of a subnet. Change-Id: Iffda823a149a1143f46ee9a05e9640b34bf42c51 Partial-Bug: #1692490
This commit is contained in:
parent
cf3fb5ffb2
commit
9059d0d709
|
@ -67,6 +67,7 @@ from neutron_lib.api.definitions import servicetype
|
|||
from neutron_lib.api.definitions import sorting
|
||||
from neutron_lib.api.definitions import subnet
|
||||
from neutron_lib.api.definitions import subnet_onboard
|
||||
from neutron_lib.api.definitions import subnet_segmentid_writable
|
||||
from neutron_lib.api.definitions import subnetpool
|
||||
from neutron_lib.api.definitions import trunk
|
||||
from neutron_lib.api.definitions import trunk_details
|
||||
|
@ -131,6 +132,7 @@ _ALL_API_DEFINITIONS = {
|
|||
sorting,
|
||||
subnet,
|
||||
subnet_onboard,
|
||||
subnet_segmentid_writable,
|
||||
subnetpool,
|
||||
trunk,
|
||||
trunk_details,
|
||||
|
|
|
@ -110,6 +110,7 @@ KNOWN_EXTENSIONS = (
|
|||
'router',
|
||||
'router_availability_zone',
|
||||
'security-group',
|
||||
'segment',
|
||||
'service-type',
|
||||
'sorting',
|
||||
'standard-attr-description',
|
||||
|
@ -117,6 +118,7 @@ KNOWN_EXTENSIONS = (
|
|||
'standard-attr-timestamp',
|
||||
'subnet_allocation',
|
||||
'subnet_onboard',
|
||||
'subnet-segmentid-writable',
|
||||
'tag',
|
||||
'trunk',
|
||||
'trunk-details',
|
||||
|
|
|
@ -0,0 +1,80 @@
|
|||
# All rights reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import segment
|
||||
from neutron_lib.api.definitions import subnet
|
||||
|
||||
|
||||
# The alias of the extension.
|
||||
ALIAS = 'subnet-segmentid-writable'
|
||||
|
||||
# The label to lookup the plugin in the plugin directory. It can match the
|
||||
# alias, as required.
|
||||
LABEL = ALIAS
|
||||
|
||||
# Whether or not this extension is simply signaling behavior to the user
|
||||
# or it actively modifies the attribute map.
|
||||
IS_SHIM_EXTENSION = False
|
||||
|
||||
# Whether the extension is marking the adoption of standardattr model for
|
||||
# legacy resources, or introducing new standardattr attributes. False or
|
||||
# None if the standardattr model is adopted since the introduction of
|
||||
# resource extension.
|
||||
# If this is True, the alias for the extension should be prefixed with
|
||||
# 'standard-attr-'.
|
||||
IS_STANDARD_ATTR_EXTENSION = False
|
||||
|
||||
# The name of the extension.
|
||||
NAME = 'Subnet SegmentID (writable)'
|
||||
|
||||
# A prefix for API resources. An empty prefix means that the API is going
|
||||
# to be exposed at the v2/ level as any other core resource.
|
||||
API_PREFIX = ''
|
||||
|
||||
# The description of the extension.
|
||||
DESCRIPTION = (
|
||||
"Provides a writable segment_id attribute for a subnet resource.")
|
||||
|
||||
# A timestamp of when the extension was introduced.
|
||||
UPDATED_TIMESTAMP = "2018-03-12T00:00:00-00:00"
|
||||
|
||||
|
||||
RESOURCE_ATTRIBUTE_MAP = {
|
||||
subnet.COLLECTION_NAME: {
|
||||
segment.SEGMENT_ID: {'allow_post': True, 'allow_put': True,
|
||||
'default': None,
|
||||
'validate': {'type:uuid_or_none': None},
|
||||
'is_visible': True}
|
||||
}
|
||||
}
|
||||
|
||||
# The subresource attribute map for the extension. It adds child resources
|
||||
# to main extension's resource. The subresource map must have a parent and
|
||||
# a parameters entry. If an extension does not need such a map, None can
|
||||
# be specified (mandatory).
|
||||
SUB_RESOURCE_ATTRIBUTE_MAP = {}
|
||||
|
||||
# The action map: it associates verbs with methods to be performed on
|
||||
# the API resource.
|
||||
ACTION_MAP = {}
|
||||
|
||||
# The action status.
|
||||
ACTION_STATUS = {
|
||||
}
|
||||
|
||||
# The list of required extensions.
|
||||
REQUIRED_EXTENSIONS = [segment.ALIAS]
|
||||
|
||||
# The list of optional extensions.
|
||||
OPTIONAL_EXTENSIONS = []
|
|
@ -0,0 +1,20 @@
|
|||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron_lib.api.definitions import segment
|
||||
from neutron_lib.api.definitions import subnet_segmentid_writable
|
||||
from neutron_lib.tests.unit.api.definitions import base
|
||||
|
||||
|
||||
class SubnetSegmentIDDefinitionTestCase(base.DefinitionBaseTestCase):
|
||||
extension_module = subnet_segmentid_writable
|
||||
extension_attributes = (segment.SEGMENT_ID,)
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
features:
|
||||
- |
|
||||
Make ``segment_id`` of subnet resource writable. Enables the possibility to
|
||||
migrate a non-routed network to a routed network.
|
Loading…
Reference in New Issue